Abstract
Thestaking precompiled contract acts as a bridge to enable the Stable SDK’s x/staking module functionality to be used in an EVM environment.
Contents
Concepts
Inx/staking module in Stable SDK, bond denom must be registered during chain initialization for staking. Validator and delegator only can use bond denom staking token. In staking precompiled contract, additional checks are made to ensure that the validator or delegator is a caller.
Configuration
Contract address and gas cost is predefined.Contract Address
Methods
createValidator
A validator is created. The validator must be created with an initial delegation from the operator. For potential delegators, validator should offer their information and plan for commission rate. Delegator can choose validator to delegate their own tokens by disclosed information with natural regulation from market mechanism.CreateValidator is emitted when the validator is successfully registered.
Inputs
Description is a struct with the following fields:
CommissionRates is a struct with the following fields:
rate should be set to an appropriate value acceptable to the market.
- If validator’s commission rate is higher, delegator’s profit is lower.
- If validator’s commission rate is lower, validator’s profit is lower and it makes operation difficult.
maxRate can make delegator concern about unexpected high commission rate by validator, maxRate should be set carefully. maxChangeRate is unchangeable when initialized.
Outputs
editValidator
Validator updates its information. Validator only can update information except unchangeable fields such asmaxRate and maxChangeRate in CommissionRates struct.
EditValidator is emitted when the validator is successfully updated.
Inputs
Outputs
delegate
Delegator sets the amount of token to be delegated to the validator.Delegate is emitted when the delegation is successfully done.
Inputs
Outputs
Events
newShares indicates the ownership ratio of the delegator. The shares calculated may vary depending on the time even though the same amount of tokens are delegated.
undelegate
Delegator withdraws the amount of token delegated to the validator.Unbond is emitted when the undelegation is successfully done.
Inputs
Outputs
redelegate
Delegator redelegates the amount of token delegated to the validator to another validator.Redelegate is emitted when the redelegate is successfully done.
Inputs
Outputs
delegation
Returns the delegation information between a delegator and a validator. If there is no delegation found, theshares and balance will be 0.
Inputs
Outputs
Coin is a struct with the following fields:
unbondingDelegation
Returns the unbonding delegation information between a delegator and a validator. If there is no unbonding delegation found, emptyUnbondingDelegationOutput will be returned.
Inputs
Outputs
UnbondingDelegationOutput is a struct with the following fields:
UnbondingDelegationEntry is a struct with the following fields:
validator
Returns the validator information. If there is no validator found, emptyValidatorOutput will be returned.
Inputs
Outputs
Validator is a struct with the following fields:
validators
Returns all validators matched with the status. If there is no validator found, emptyValidatorsOutput will be returned.
Status, declared in x/staking module, can be one of the following:
- 0 : “BOND_STATUS_UNSPECIFIED”, unspecified status
- 1 : “BOND_STATUS_UNBONDING”, validator is unbonding
- 2 : “BOND_STATUS_UNBONDED”, validator is unbonded
- 3 : “BOND_STATUS_BONDED”, validator is bonded
Inputs
PageReq is a struct with the following fields:
Outputs
PageResp is a struct with the following fields:
redelegation
Returns the redelegation information of delegator, source validator and destination validator. If there is no redelegation found, emptyRedelegationOutput will be returned.
Inputs
Outputs
RedelegationOutput is a struct with the following fields:
RedelegationEntry is a struct with the following fields:
redelegations
Returns all redelegations of delegator, source validator and destination validator. If there is no redelegation found, emptyRedelegationResponse and PageResp will be returned.

