Viction Staking Governance
Masternodes and Voters' funds are locked and governed in the Viction Validator smart contract:
Smart Contract Code: Viction Validator
Smart Contract ABI: TomoValidatorAbi.json
Viction Validator Smart Contract Interface:
// apply a new masternode candidate
function propose(address _candidate) external payable;
// Deposit to stake/vote for a candidate
function vote(address _candidate) external payable;
// Unstake/unvote for a candidate
function unvote(address _candidate, uint256 _cap) public;
// Resign a candidate
function resign(address _candidate) public;
// Withdraw after unvote, resign
function withdraw(uint256 _blockNumber, uint _index) public;
function getCandidates() public view returns(address[]);
function getCandidateCap(address _candidate) public view returns(uint256);
function getCandidateOwner(address _candidate) public view returns(address);
function getVoterCap(address _candidate, address _voter) public view returns(uint256);
function getVoters(address _candidate) public view returns(address[]);
function isCandidate(address _candidate) public view returns(bool);
function getWithdrawBlockNumbers() public view returns(uint256[]);
function getWithdrawCap(uint256 _blockNumber) public view returns(uint256);Viction provides RPC APIs that can be used with Web3 library to directly call the functions in the smart contract.
You can follow the steps below to interact with the smart contract by using Web3 library and NodeJS.
Init Web3 Provider
At the first step, you need init Web3 provider by connecting Viction Fullnode RPC endpoint.
For testnet/mainnet details, you can get network information here
Unlock Wallet
Unlock the wallet must be done before staking on the nodes
Example
Init Web3 Viction Validator Contract
Note: you can get TomoValidatorAbi.json here
Propose/Apply a Candidate
Masternode owners need to have at least 50,000 VIC to apply to become a Masternode Candidate. Make sure to have > 50,000 VIC in the Masternode owner wallet in order to deposit it into the smart contract and pay the related transaction fee.
Apply to become a Masternode Candidate by calling propose function from the smart contract
Example
Refer to Staking Viction script
Stake/Vote for a Candidate
Stake at least 100 VIC for a node by calling vote function from the smart contract.
Example
Stake 500 VIC to a node.
Unstake/Unvote a Candidate
You can unstake by calling unvote function from the smart contract
Resign a Candidate
Withdraw VIC
You need to wait for 96 epochs (to unvote), 30 days (to resign) to unlock your staked VIC
Example
Get list Withdrawals
We need to call getWithdrawBlockNumbers and getWithdrawCap functions from TomoValidator smart contract to get the data
Example
Get list Candidates
You can get list Candidates from RPC endpoint:
Last updated