Skip to main content

Abstract

The distribution precompiled contract acts as a bridge to enable the Stable SDK’s x/distribution module functionality to be used in an EVM environment.

Contents

  1. Concepts
  2. Configuration
  3. Methods
  4. Events

Concepts

In distribution precompiled contract, additional checks are made to ensure that the delegator or depositor is a caller.

Configuration

Contract address and gas cost is predefined.

Contract Address

Methods

setWithdrawAddress

Sets the address to receive the reward for the token delegated by the delegator to the validator. Sometimes, when the delegator is self-delegated, the validator address is used as the delegator. SetWithdrawAddress is emitted when the withdrawer address is successfully set.

Inputs

Outputs

withdrawDelegatorRewards

Withdraws the reward to be received by the delegator from the validator. All types of tokens that validator rewards to delegator is withdrawn in a single transaction. WithdrawDelegatorRewards is emitted when the reward is successfully withdrawn.

Inputs

Outputs

Coin is a struct with the following fields:

withdrawValidatorCommission

Withdraws the commission of the validator. All types of tokens that validator receives as commission is withdrawn in a single transaction. WithdrawValidatorCommission is emitted when the commission is successfully withdrawn.

Inputs

Outputs

validatorDistributionInfo

Returns the distribution information representing the reward the validator will receive. Validator can delegate tokens to himself at his own address to acts as a delegator called self-bonded.

Inputs

Outputs

ValidatorDistributionInfo is a struct with the following fields: DecCoin is a struct with the following fields:

validatorOutstandingRewards

Returns the outstanding rewards of the validator. Outstanding rewards indicates total amount of rewards consists of commission and self-bonded rewards of validator and total rewards of delegators. If there is a validator A and delegators B, C, and D delegate to A, Outstanding rewards of validator is the sum of commission and self-bonded rewards of A + rewards of B, C, and D.

Inputs

Outputs

validatorCommission

Returns the commission of the validator. This method is used to retrieve the commission of the validator before calling withdrawValidatorCommission method.

Inputs

Outputs

validatorSlashes

Returns the history of slashes of the validator between the starting height and ending height. Slashing is the fines imposed when a validator behaves maliciously or violates network rules such as double signing, misbehavior, or not following the chain rules.

Inputs

PageReq is a struct with the following fields:

Outputs

ValidatorSlashEvent is a struct with the following fields: Dec is a struct with the following fields: PageResp is a struct with the following fields:

delegationRewards

Returns the rewards that delegator receives from the validator.

Inputs

Outputs

delegationTotalRewards

Returns the total rewards that delegator receives from all validators.

Inputs

Outputs

DelegationDelegatorReward is a struct with the following fields:

delegatorValidators

Returns the validators that delegator is bonded to.

Inputs

Outputs

delegatorWithdrawAddress

Returns the address to receive the reward of delegation set by setWithdrawAddress method.

Inputs

Outputs

Events

SetWithdrawAddress

WithdrawDelegatorRewards

WithdrawValidatorCommission