The operations related to the delegator’s stake voting can also be performed by calling the "ValidatorShare" and "StakeManagerProxy" contracts. Most operations call the "ValidatorShare" contract. Only the transfer vote calls the "StakeManagerProxy" contract.
Each validator has a corresponding "ValidatorShare" contract and can access the validator[validatorId].contractAddress of StakeManagerProxy to get the ValidatorShare contract address corresponding to a certain validator. The following is an introduction to the contract functions corresponding to voting-related operations.
Stake a certain amount of BTT and vote for the validator corresponding to the ValidatorShare
- Contract Method：
ValidatorShare:buyVoucher(uint256 _amount, uint256 _minSharesToMint)
_amount：amount of Voting
_minSharesToMint：The minimum acceptable number of share coins, the BTT voted by the delegator for the validator will be converted into share coins to represent the user's share of the total votes for the validator. The delegator can query the number of shares he owns through the balanceOf method of the validator's ValidatorShare contract.
The delegator calls the withdrawRewards method of the validator's ValidatorShare contract to withdraw the reward. After the execution is successful, the reward immediately reaches the delegator's account.
- Parameter： N/A
Vote the BTT voting rewards that have been earned but yet withdrawn for the validator again to get more voting rewards.
- Parameter： N/A
"Transfer Votes" is to transfer some or all of the votes to another validator.
StakeManagerProxy:migrateDelegation(uint256 fromValidatorId, uint256 toValidatorId, uint256 amount)
uint256 fromValidatorId：original validator id
uint256 toValidatorId：new validator id
uint256 amount：amount of BTT transferred
- Votes can only be transferred to those whose validatorID is larger than 7.
- Transfer Votes will trigger reward claiming action automatically
Cancel the vote. After canceling the vote, the staked BTT needs to go through a lock-up period of 80 checkpoints (about 40 hours) before it can be withdrawn.
ValidatorShare:sellVoucher_new:(uint256 claimAmount, uint256 maximumSharesToBurn)
claimAmount：The amount of BTT that has been canceled for voting; the total amount of BTT voted by the delegator for the validator can be obtained through the ValidatorShare:getTotalStake method.
maximumSharesToBurn：The maximum number of shares that can be burned; the number of shares owned by the delegator can be obtained through the ValidatorShare:balanceOf method.
- Note Canceling the votes can be done continuously with a minimal interval of 1 checkpoint.
To withdraw the staked BTT, this method can only be called after a lock-up period of 80 checkpoints after the vote is canceled.
uint256 unbondNonce：the nonce corresponding to
Cancel Votes， withdraw the BTT of the nonce time of
Cancel Votes. The total number of votes canceled by the delegator can be queried through the ValidatorShare:unbondNonces method.