Staking Precompiled
Address: 0x0000000000000000000000000000000000001003
Interface: IStaking
ABI: IStaking
Introduction
use staking precompiled contract to call some functions of the staking module, such as: delegate, undelegate, withdraw, etc.
Method
delegate
delegate token to validator, get shares and reward
delegate to different validators, the shares obtained are essentially different and cannot be added
msg.value
: payable method, the amount of the token to be delegated_val
: the validator address_shares
: the shares of the delegate token_reward
: the reward of the delegate
only can delegate origin token, must be input msg.value
only delegate validator who has participated in block generation, delegate again, will get reward
delegate event
delegator
: the delegator addressvalidator
: the validator address to be delegatedamount
: the amount of the token to be delegatedshares
: the shares of the delegate token
undelegate
undelegate token from validator, get token, reward, and completion time
_val
: the validator address to be undelegated_shares
: the shares to undelegate_amount
: the amount of the shares undelegated_reward
: the reward of undelegated_completionTime
: the completion time of undelegated
undelegate event
sender
: the sender addressvalidator
: the validator address to be undelegatedshares
: the shares to undelegateamount
: the amount of the shares undelegatedcompletionTime
: the completion time of undelegated
redelegate
redelegate token from validator to other validator, get shares and reward
_valSrc
: the validator address to be redelegated_valDst
: the validator address to be redelegated to_shares
: the shares to redelegate_amount
: the amount of the shares redelegated_reward
: the reward of redelegated_completionTime
: the completion time of redelegated
redelegate event
sender
: the sender addressvalSrc
: the validator address to be redelegatedvalDst
: the validator address to be redelegated toshares
: the shares to redelegateamount
: the amount of the shares redelegatedcompletionTime
: the completion time of redelegated
withdraw
withdraw delegate reward
_val
: the validator address to be withdraw_reward
: reward amount
withdraw event
withdrawer
: the withdraw addressvalidator
: the validator address to be withdrawreward
: reward amount
approveShares
approve transferFrom shares amount
_val
: the validator address to be approved_spender
: the spender address_shares
: the shares amount to be approved_result
: the result of approve
approveShares event
owner
: the shares owner addressspender
: the spender addressvalidator
: the validator address to be approvedshares
: the shares amount to be approved
transferShares
transfer shares to other address
_val
: the validator address to be transfer_to
: the receiver address_shares
: the shares amount to be transfer_token
: the token amount of transfer shares_reward
: the reward amount of to address when transfer shares
transferShares event
from
: the shares owner addressto
: the receiver addressvalidator
: the validator address to be transfershares
: the shares amount to be transfertoken
: the token amount of transfer shares
transferFromShares
transfer shares with approval
transfer shares from other address, need to approve first
_val
: the validator address to be transfer_from
: the shares owner address_to
: the receiver address_shares
: the shares amount to be transfer_token
: the token amount of transfer shares_reward
: the reward amount of to address when transfer shares
transferFromShares event(same as transferShares)
from
: the shares owner addressto
: the receiver addressvalidator
: the validator address to be transfershares
: the shares amount to be transfertoken
: the token amount of transfer shares
delegation
query delegation
_val
: the validator address to be query_del
: the delegator address to be query_shares
: the shares of the delegator in the validator_delegateAmount
: the amount of the delegator in the validator
delegationRewards
query delegation rewards
_val
: the validator address to be query_del
: the delegator address to be query_reward
: the reward of the delegator in the validator
allowanceShares
query allowance shares
_val
: the validator address to be query_owner
: the owner address to be query_spender
: the spender address to be query_shares
: the allowance shares in the validator
Last updated