ValidatorShare Contract

What you should know about ValidatorShare Contract?

What is ValidatorShare Contract?

The ValidatorShare contract is the core of the delegation mechanism of Bitkub Chain. All delegation-related actions that users can interact with can be executed through this contract. In this contract, it's possible to delegate, undelegate, and claim your reward.

A ValidatorShare contract is created when a node validator is staked with the ValidatorShareFactory contract by the StakeManager contract. It is not intended to hold any funds through its own capabilities. The ValidatorShare contract can be replaced as it is merely an implementation, with the data and funds located in other contracts.

Functions

including the following function:

Delegate

delegate() payable
  • payable - Native KUB required.

This method requires native KUB to be sent as a value along with the transaction that calls this method.

This function can only be called when the delegation flag in the ValidatorShare contract is set to true.

Upon delegation, a KAP20 token of the ValidatorShare contract will be minted in the same amount as the delegated amount to the sender. The KAP20 token is the proof of ownership of the sender’s shares in the contract. It can be transferred and has the same standard functionality as other KAP20 tokens.

When this function is called, the ValidatorShare contract’s states will be updated, and the pending reward of the sender will be sent to the sender. The sender's final total delegated amount (original delegated amount plus newly delegated amount) must be more than or equal to the minimum delegated amount. The funds will be sent to the StakeManagerVault contract.

Undelegate

undelegate(uint256 claimAmount)
  • claimAmount - The amount of native KUB in wei unit that will be retrieved from the ValidatorShare contract.

Upon calling this function, the ValidatorShare contract’s states will be updated, and the pending reward of the sender will be sent to the sender.

The maximum value of the claimAmount argument is the balance of the sender's KAP20 ownership token, and it cannot be 0.

In the case where the final total delegated amount (the balance of the sender's ownership token as deduced by the claimAmount argument) is less than the minimum delegated amount, the value of the claimAmount argument will be adjusted to the sender's ownership token balance, meaning all shares of the sender will be undelegated. The ownership token will be burnt (removed from existence, and the total supply decreased) according to the claimAmount argument, which may have been adjusted. The funds will be sent from the StakeManagerVault contract to the sender.

ClaimRewards

claimRewards()
  • claimRewards- Upon calling this function, the ValidatorShare contract’s states will be updated, and the pending reward of the sender will be sent to the sender.

Last updated