Distribution

The Distribution.sol interface is designed to serve as a bridge between Solidity contracts on the Ethereum blockchain and the distribution module (x/distribution) within the Cosmos SDK blockchain ecosystem. This interface abstracts the interaction with the Cosmos SDK distribution module, enabling Ethereum-based contracts to communicate with and utilize functionalities provided by the distribution module without requiring intricate knowledge of its internal implementation details.

Transactions (Functions)

a. setWithdrawAddress

function setWithdrawAddress(
    address delegatorAddress,
    string memory withdrawerAddress
) external returns (bool succes
  • Purpose: Allows changing the address capable of withdrawing rewards for a given delegator.

  • Parameters:

    • delegatorAddress: The address of the delegator.

    • withdrawerAddress: The address that will have the capability to withdraw rewards for the specified delegator.

    • Returns: bool success: Indicates the success of the operation.

b. withdrawDelegatorRewards

function withdrawDelegatorRewards(
    address delegatorAddress,
    string memory validatorAddress
)
external
returns (
    Coin[] calldata amount
);
  • Purpose: Withdraws the rewards of a delegator from a specific validator.

  • Parameters:

    • delegatorAddress: The address of the delegator.

    • validatorAddress: The address of the validator from which rewards are being withdrawn.

    • Returns: Coin[] calldata amount: The amount of Coin withdrawn.

c. withdrawValidatorCommission

function withdrawValidatorCommission(
    string memory validatorAddress
)
external
returns (
    Coin[] calldata amount
);
  • Purpose: Withdraws the rewards commission of a validator.

  • Parameters:

    • validatorAddress: The address of the validator. Returns: Coin[] calldata

    • amount: The amount of Coin withdrawn.

2. Queries (View Functions)

a. Validator Information Queries:

function validatorDistributionInfo(
    string memory validatorAddress
)
external
view
returns (
    ValidatorDistributionInfo calldata distributionInfo
);
  • validatorDistributionInfo: Queries validator commission and self-delegation rewards for a validator.

function validatorOutstandingRewards(
    string memory validatorAddress
)
external
view
returns (
    DecCoin[] calldata rewards
);
  • validatorOutstandingRewards: Queries outstanding rewards of a validator address.

function validatorCommission(
    string memory validatorAddress
)
external
view
returns (
    DecCoin[] calldata commission
);
  • validatorCommission: Queries accumulated commission for a validator.

function validatorSlashes(
    string memory validatorAddress,
    uint64 startingHeight,
    uint64 endingHeight
)
external
view
returns (
    ValidatorSlashEvent[] calldata slashes,
    PageResponse calldata pageResponse
);
  • validatorSlashes: Queries slashing events for a validator within a specified height interval.

b. Delegation Reward Queries:

function delegationRewards(
    address delegatorAddress,
    string memory validatorAddress
)
external
view
returns (
    DecCoin[] calldata rewards
);
  • delegationRewards: Queries the total rewards accrued by a delegation from a specific address to a given validator.

function delegationTotalRewards(
    address delegatorAddress
)
external
view
returns (
    DelegationDelegatorReward[] calldata rewards,
    DecCoin[] calldata total
);
  • delegationTotalRewards: Queries the total rewards accrued by each validator that a given address has delegated to.

function delegatorValidators(
    address delegatorAddress
) external view returns (string[] calldata validators);
  • delegatorValidators: Queries all validators that a given address has delegated to.

function delegatorWithdrawAddress(
    address delegatorAddress
) external view returns (string memory withdrawAddress);
  • delegatorWithdrawAddress: Queries the address capable of withdrawing rewards for a given delegator.

3. Events

event SetWithdrawerAddress(
    address indexed caller,
    string withdrawerAddress
);
  • SetWithdrawerAddress: Emitted when a new withdrawer address is being set.

event WithdrawDelegatorRewards(
    address indexed delegatorAddress,
    string indexed validatorAddress,
    uint256 amount
);
  • WithdrawDelegatorRewards: Emitted when rewards from a delegation are withdrawn.

event WithdrawValidatorCommission(
    string indexed validatorAddress,
    uint256 commission
);
  • WithdrawValidatorCommission: Emitted when validator commissions are being withdrawn.

Last updated