distribution

package
v0.5.0-rc.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2025 License: Apache-2.0 Imports: 18 Imported by: 12

README

Distribution Precompile

Address

0x0000000000000000000000000000000000000801

Description

The Distribution precompile provides an EVM interface to the Cosmos SDK x/distribution module, enabling smart contracts to interact with staking rewards, validator commissions, and the community pool. It supports both reward queries and distribution operations including claiming, withdrawing, and funding.

Interface

Transaction Methods
setWithdrawAddress
function setWithdrawAddress(
    address delegator,
    string memory withdrawerAddress
) external returns (bool);

Sets the address authorized to withdraw rewards for a delegator.

Parameters:

  • delegator: The delegator address setting the withdraw address
  • withdrawerAddress: The address that will be authorized to withdraw rewards

Authorization: Caller must be the delegator

Gas Cost: 2000 + (30 × input data size in bytes)

withdrawDelegatorRewards
function withdrawDelegatorRewards(
    address delegator,
    string memory validator
) external returns (Coin[] memory);

Withdraws pending rewards from a specific validator.

Parameters:

  • delegator: The delegator withdrawing rewards
  • validator: The validator address to withdraw from

Returns:

  • Array of Coin structs representing withdrawn amounts

Authorization: Caller must be the delegator

Gas Cost: 2000 + (30 × input data size in bytes)

withdrawValidatorCommission
function withdrawValidatorCommission(
    string memory validator
) external returns (Coin[] memory);

Withdraws accumulated commission for a validator.

Parameters:

  • validator: The validator address withdrawing commission

Returns:

  • Array of Coin structs representing withdrawn commission

Authorization: Caller must be the validator

Gas Cost: 2000 + (30 × input data size in bytes)

claimRewards
function claimRewards(
    address delegator,
    uint32 maxRetrieve
) external returns (bool);

Claims rewards from all validators at once (custom batch operation).

Parameters:

  • delegator: The delegator claiming rewards
  • maxRetrieve: Maximum number of validators to claim from

Authorization: Caller must be the delegator

Gas Cost: 2000 + (30 × input data size in bytes)

fundCommunityPool
function fundCommunityPool(
    address depositor,
    Coin[] memory coins
) external returns (bool);

Deposits tokens into the community pool.

Parameters:

  • depositor: The address funding the pool
  • coins: Array of coins to deposit

Authorization: Caller must be the depositor

Gas Cost: 2000 + (30 × input data size in bytes)

depositValidatorRewardsPool
function depositValidatorRewardsPool(
    string memory validator,
    Coin[] memory coins
) external returns (bool);

Deposits tokens into a validator's rewards pool.

Parameters:

  • validator: The validator whose pool receives the deposit
  • coins: Array of coins to deposit

Gas Cost: 2000 + (30 × input data size in bytes)

Query Methods
delegationTotalRewards
function delegationTotalRewards(
    address delegator
) external view returns (
    DelegatorTotal[] memory,
    DecCoin[] memory
);

Returns total rewards across all validators for a delegator.

Parameters:

  • delegator: The delegator address

Returns:

  • Array of DelegatorTotal structs (per-validator rewards)
  • Array of DecCoin structs (total rewards sum)

Gas Cost: 1000 + (3 × input data size in bytes)

delegationRewards
function delegationRewards(
    address delegator,
    string memory validator
) external view returns (DecCoin[] memory);

Returns rewards for a specific delegator-validator pair.

Parameters:

  • delegator: The delegator address
  • validator: The validator address

Returns:

  • Array of DecCoin structs representing rewards

Gas Cost: 1000 + (3 × input data size in bytes)

delegatorValidators
function delegatorValidators(
    address delegator
) external view returns (string[] memory);

Lists all validators from which a delegator can claim rewards.

Parameters:

  • delegator: The delegator address

Returns:

  • Array of validator addresses

Gas Cost: 1000 + (3 × input data size in bytes)

delegatorWithdrawAddress
function delegatorWithdrawAddress(
    address delegator
) external view returns (string memory);

Returns the configured withdraw address for a delegator.

Parameters:

  • delegator: The delegator address

Returns:

  • The withdraw address

Gas Cost: 1000 + (3 × input data size in bytes)

communityPool
function communityPool() external view returns (DecCoin[] memory);

Returns the current balance of the community pool.

Returns:

  • Array of DecCoin structs representing pool balance

Gas Cost: 1000 + (3 × input data size in bytes)

validatorCommission
function validatorCommission(
    string memory validator
) external view returns (DecCoin[] memory);

Returns accumulated commission for a validator.

Parameters:

  • validator: The validator address

Returns:

  • Array of DecCoin structs representing commission

Gas Cost: 1000 + (3 × input data size in bytes)

validatorDistributionInfo
function validatorDistributionInfo(
    string memory validator
) external view returns (DistInfo memory);

Returns comprehensive distribution information for a validator.

Parameters:

  • validator: The validator address

Returns:

  • DistInfo struct containing commission and self-delegation rewards

Gas Cost: 1000 + (3 × input data size in bytes)

validatorOutstandingRewards
function validatorOutstandingRewards(
    string memory validator
) external view returns (DecCoin[] memory);

Returns outstanding (undistributed) rewards for a validator.

Parameters:

  • validator: The validator address

Returns:

  • Array of DecCoin structs representing outstanding rewards

Gas Cost: 1000 + (3 × input data size in bytes)

validatorSlashes
function validatorSlashes(
    string memory validator,
    uint64 startingHeight,
    uint64 endingHeight,
    PageRequest memory pageRequest
) external view returns (
    ValidatorSlashEvent[] memory,
    PageResponse memory
);

Returns slashing events for a validator within a height range.

Parameters:

  • validator: The validator address
  • startingHeight: Start of the query range
  • endingHeight: End of the query range
  • pageRequest: Pagination parameters

Returns:

  • Array of ValidatorSlashEvent structs
  • PageResponse with pagination information

Gas Cost: 1000 + (3 × input data size in bytes)

Data Structures
struct Coin {
    string denom;
    uint256 amount;
}

struct DecCoin {
    string denom;
    uint256 amount;
    uint8 precision;
}

struct DelegatorTotal {
    string validatorAddress;
    DecCoin[] rewards;
}

struct DistInfo {
    string operatorAddress;
    DecCoin[] commission;
    DecCoin[] selfBondRewards;
}

struct ValidatorSlashEvent {
    uint64 validatorPeriod;
    Fraction fraction;
}

struct Fraction {
    uint256 numerator;
    uint256 denominator;
}

Message Type Constants

string constant MSG_SET_WITHDRAWER_ADDRESS = "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress"
string constant MSG_WITHDRAW_DELEGATOR_REWARD = "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward"
string constant MSG_WITHDRAW_VALIDATOR_COMMISSION = "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission"

Implementation Details

Authorization

All transaction methods enforce that the caller matches the relevant account (delegator or validator) to prevent unauthorized operations.

Balance Tracking

The precompile tracks native token balance changes during transaction execution to accurately return transfer amounts.

Event Emission

Each transaction emits corresponding events for on-chain tracking and indexing.

Address Format Support

The precompile accepts both hex and bech32 address formats, automatically converting as needed for Cosmos SDK compatibility.

Documentation

Index

Constants

View Source
const (
	// ErrDifferentValidator is raised when the origin address is not the same as the validator address.
	ErrDifferentValidator = "origin address %s is not the same as validator address %s"
	// ErrInvalidAmount is raised when the given sdk coins amount is invalid
	ErrInvalidAmount = "invalid amount %s"
)
View Source
const (
	// EventTypeSetWithdrawAddress defines the event type for the distribution SetWithdrawAddressMethod transaction.
	EventTypeSetWithdrawAddress = "SetWithdrawerAddress"
	// EventTypeWithdrawDelegatorReward defines the event type for the distribution WithdrawDelegatorRewardMethod transaction.
	EventTypeWithdrawDelegatorReward = "WithdrawDelegatorReward"
	// EventTypeWithdrawValidatorCommission defines the event type for the distribution WithdrawValidatorCommissionMethod transaction.
	EventTypeWithdrawValidatorCommission = "WithdrawValidatorCommission"
	// EventTypeFundCommunityPool defines the event type for the distribution FundCommunityPoolMethod transaction.
	EventTypeFundCommunityPool = "FundCommunityPool"
	// EventTypeClaimRewards defines the event type for the distribution ClaimRewardsMethod transaction.
	EventTypeClaimRewards = "ClaimRewards"
	// EventTypeDepositValidatorRewardsPool defines the event type for the distribution DepositValidatorRewardsPoolMethod transaction.
	EventTypeDepositValidatorRewardsPool = "DepositValidatorRewardsPool"
)
View Source
const (
	// ValidatorDistributionInfoMethod defines the ABI method name for the
	// ValidatorDistributionInfo query.
	ValidatorDistributionInfoMethod = "validatorDistributionInfo"
	// ValidatorOutstandingRewardsMethod defines the ABI method name for the
	// ValidatorOutstandingRewards query.
	ValidatorOutstandingRewardsMethod = "validatorOutstandingRewards"
	// ValidatorCommissionMethod defines the ABI method name for the
	// ValidatorCommission query.
	ValidatorCommissionMethod = "validatorCommission"
	// ValidatorSlashesMethod defines the ABI method name for the
	// ValidatorSlashes query.
	ValidatorSlashesMethod = "validatorSlashes"
	// DelegationRewardsMethod defines the ABI method name for the
	// DelegationRewards query.
	DelegationRewardsMethod = "delegationRewards"
	// DelegationTotalRewardsMethod defines the ABI method name for the
	// DelegationTotalRewards query.
	DelegationTotalRewardsMethod = "delegationTotalRewards"
	// DelegatorValidatorsMethod defines the ABI method name for the
	// DelegatorValidators query.
	DelegatorValidatorsMethod = "delegatorValidators"
	// DelegatorWithdrawAddressMethod defines the ABI method name for the
	// DelegatorWithdrawAddress query.
	DelegatorWithdrawAddressMethod = "delegatorWithdrawAddress"
	// CommunityPoolMethod defines the ABI method name for the
	// CommunityPool query.
	CommunityPoolMethod = "communityPool"
)
View Source
const (
	// SetWithdrawAddressMethod defines the ABI method name for the distribution
	// SetWithdrawAddress transaction.
	SetWithdrawAddressMethod = "setWithdrawAddress"
	// WithdrawDelegatorRewardMethod defines the ABI method name for the distribution
	// WithdrawDelegatorReward transaction.
	WithdrawDelegatorRewardMethod = "withdrawDelegatorRewards"
	// WithdrawValidatorCommissionMethod defines the ABI method name for the distribution
	// WithdrawValidatorCommission transaction.
	WithdrawValidatorCommissionMethod = "withdrawValidatorCommission"
	// FundCommunityPoolMethod defines the ABI method name for the fundCommunityPool transaction
	FundCommunityPoolMethod = "fundCommunityPool"
	// ClaimRewardsMethod defines the ABI method name for the custom ClaimRewards transaction
	ClaimRewardsMethod = "claimRewards"
	// DepositValidatorRewardsPoolMethod defines the ABI method name for the distribution
	// DepositValidatorRewardsPool transaction
	DepositValidatorRewardsPoolMethod = "depositValidatorRewardsPool"
)

Variables

View Source
var (
	ABI abi.ABI
)

Functions

func NewCommunityPoolRequest added in v0.3.0

func NewCommunityPoolRequest(args []interface{}) (*distributiontypes.QueryCommunityPoolRequest, error)

NewCommunityPoolRequest creates a new QueryCommunityPoolRequest instance and does sanity checks on the provided arguments.

func NewDelegationRewardsRequest

func NewDelegationRewardsRequest(args []interface{}, addrCdc address.Codec) (*distributiontypes.QueryDelegationRewardsRequest, error)

NewDelegationRewardsRequest creates a new QueryDelegationRewardsRequest instance and does sanity checks on the provided arguments.

func NewDelegationTotalRewardsRequest

func NewDelegationTotalRewardsRequest(args []interface{}, addrCdc address.Codec) (*distributiontypes.QueryDelegationTotalRewardsRequest, error)

NewDelegationTotalRewardsRequest creates a new QueryDelegationTotalRewardsRequest instance and does sanity checks on the provided arguments.

func NewDelegatorValidatorsRequest

func NewDelegatorValidatorsRequest(args []interface{}, addrCdc address.Codec) (*distributiontypes.QueryDelegatorValidatorsRequest, error)

NewDelegatorValidatorsRequest creates a new QueryDelegatorValidatorsRequest instance and does sanity checks on the provided arguments.

func NewDelegatorWithdrawAddressRequest

func NewDelegatorWithdrawAddressRequest(args []interface{}, addrCdc address.Codec) (*distributiontypes.QueryDelegatorWithdrawAddressRequest, error)

NewDelegatorWithdrawAddressRequest creates a new QueryDelegatorWithdrawAddressRequest instance and does sanity checks on the provided arguments.

func NewMsgDepositValidatorRewardsPool added in v0.3.0

func NewMsgDepositValidatorRewardsPool(args []interface{}, addrCdc address.Codec) (*distributiontypes.MsgDepositValidatorRewardsPool, common.Address, error)

NewMsgDepositValidatorRewardsPool creates a new MsgDepositValidatorRewardsPool message.

func NewMsgFundCommunityPool

func NewMsgFundCommunityPool(args []interface{}, addrCdc address.Codec) (*distributiontypes.MsgFundCommunityPool, common.Address, error)

NewMsgFundCommunityPool creates a new NewMsgFundCommunityPool message.

func NewMsgSetWithdrawAddress

func NewMsgSetWithdrawAddress(args []interface{}, addrCdc address.Codec) (*distributiontypes.MsgSetWithdrawAddress, common.Address, error)

NewMsgSetWithdrawAddress creates a new MsgSetWithdrawAddress instance.

func NewMsgWithdrawDelegatorReward

func NewMsgWithdrawDelegatorReward(args []interface{}, addrCdc address.Codec) (*distributiontypes.MsgWithdrawDelegatorReward, common.Address, error)

NewMsgWithdrawDelegatorReward creates a new MsgWithdrawDelegatorReward instance.

func NewMsgWithdrawValidatorCommission

func NewMsgWithdrawValidatorCommission(args []interface{}) (*distributiontypes.MsgWithdrawValidatorCommission, common.Address, error)

NewMsgWithdrawValidatorCommission creates a new MsgWithdrawValidatorCommission message.

func NewValidatorCommissionRequest

func NewValidatorCommissionRequest(args []interface{}) (*distributiontypes.QueryValidatorCommissionRequest, error)

NewValidatorCommissionRequest creates a new QueryValidatorCommissionRequest instance and does sanity checks on the provided arguments.

func NewValidatorDistributionInfoRequest

func NewValidatorDistributionInfoRequest(args []interface{}) (*distributiontypes.QueryValidatorDistributionInfoRequest, error)

NewValidatorDistributionInfoRequest creates a new QueryValidatorDistributionInfoRequest instance and does sanity checks on the provided arguments.

func NewValidatorOutstandingRewardsRequest

func NewValidatorOutstandingRewardsRequest(args []interface{}) (*distributiontypes.QueryValidatorOutstandingRewardsRequest, error)

NewValidatorOutstandingRewardsRequest creates a new QueryValidatorOutstandingRewardsRequest instance and does sanity checks on the provided arguments.

func NewValidatorSlashesRequest

func NewValidatorSlashesRequest(method *abi.Method, args []interface{}) (*distributiontypes.QueryValidatorSlashesRequest, error)

NewValidatorSlashesRequest creates a new QueryValidatorSlashesRequest instance and does sanity checks on the provided arguments.

Types

type CommunityPoolOutput added in v0.3.0

type CommunityPoolOutput struct {
	Pool []cmn.DecCoin
}

CommunityPoolOutput is a struct to represent the key information from a CommunityPool response.

func (*CommunityPoolOutput) FromResponse added in v0.3.0

FromResponse populates the CommunityPoolOutput from a QueryCommunityPoolResponse.

func (*CommunityPoolOutput) Pack added in v0.3.0

func (cp *CommunityPoolOutput) Pack(args abi.Arguments) ([]byte, error)

Pack packs a given slice of abi arguments into a byte array.

type DelegationDelegatorReward

type DelegationDelegatorReward struct {
	ValidatorAddress string
	Reward           []cmn.DecCoin
}

DelegationDelegatorReward is a struct to represent the key information from a query for the rewards of a delegation to a given validator.

type DelegationTotalRewardsOutput

type DelegationTotalRewardsOutput struct {
	Rewards []DelegationDelegatorReward
	Total   []cmn.DecCoin
}

DelegationTotalRewardsOutput is a struct to represent the key information from a DelegationTotalRewards response.

func (*DelegationTotalRewardsOutput) FromResponse

FromResponse populates the DelegationTotalRewardsOutput from a QueryDelegationTotalRewardsResponse.

func (*DelegationTotalRewardsOutput) Pack

func (dtr *DelegationTotalRewardsOutput) Pack(args abi.Arguments) ([]byte, error)

Pack packs a given slice of abi arguments into a byte array.

type EventClaimRewards

type EventClaimRewards struct {
	DelegatorAddress common.Address
	Amount           *big.Int
}

EventClaimRewards defines the event data for the ClaimRewards transaction.

type EventDepositValidatorRewardsPool added in v0.3.0

type EventDepositValidatorRewardsPool struct {
	Depositor        common.Address
	ValidatorAddress common.Address
	Denom            string
	Amount           *big.Int
}

EventDepositValidatorRewardsPool defines the event data for the DepositValidatorRewardsPool transaction.

type EventFundCommunityPool

type EventFundCommunityPool struct {
	Depositor common.Address
	Denom     string
	Amount    *big.Int
}

EventFundCommunityPool defines the event data for the FundCommunityPool transaction.

type EventSetWithdrawAddress

type EventSetWithdrawAddress struct {
	Caller            common.Address
	WithdrawerAddress string
}

EventSetWithdrawAddress defines the event data for the SetWithdrawAddress transaction.

type EventWithdrawDelegatorReward added in v0.3.0

type EventWithdrawDelegatorReward struct {
	DelegatorAddress common.Address
	ValidatorAddress common.Address
	Amount           *big.Int
}

EventWithdrawDelegatorReward defines the event data for the WithdrawDelegatorReward transaction.

type EventWithdrawValidatorRewards

type EventWithdrawValidatorRewards struct {
	ValidatorAddress common.Hash
	Commission       *big.Int
}

EventWithdrawValidatorRewards defines the event data for the WithdrawValidatorRewards transaction.

type Precompile

type Precompile struct {
	cmn.Precompile

	abi.ABI
	// contains filtered or unexported fields
}

Precompile defines the precompiled contract for distribution.

func NewPrecompile

func NewPrecompile(
	distributionKeeper cmn.DistributionKeeper,
	distributionMsgServer distributiontypes.MsgServer,
	distributionQuerier distributiontypes.QueryServer,
	stakingKeeper cmn.StakingKeeper,
	bankKeeper cmn.BankKeeper,
	addrCdc address.Codec,
) *Precompile

NewPrecompile creates a new distribution Precompile instance as a PrecompiledContract interface.

func (*Precompile) ClaimRewards

func (p *Precompile) ClaimRewards(
	ctx sdk.Context,
	contract *vm.Contract,
	stateDB vm.StateDB,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

ClaimRewards claims the rewards accumulated by a delegator from multiple or all validators.

func (Precompile) CommunityPool added in v0.3.0

func (p Precompile) CommunityPool(
	ctx sdk.Context,
	_ *vm.Contract,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

CommunityPool returns the community pool coins.

func (Precompile) DelegationRewards

func (p Precompile) DelegationRewards(
	ctx sdk.Context,
	_ *vm.Contract,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

DelegationRewards returns the total rewards accrued by a delegation.

func (Precompile) DelegationTotalRewards

func (p Precompile) DelegationTotalRewards(
	ctx sdk.Context,
	_ *vm.Contract,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

DelegationTotalRewards returns the total rewards accrued by a delegation.

func (Precompile) DelegatorValidators

func (p Precompile) DelegatorValidators(
	ctx sdk.Context,
	_ *vm.Contract,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

DelegatorValidators returns the validators a delegator is bonded to.

func (Precompile) DelegatorWithdrawAddress

func (p Precompile) DelegatorWithdrawAddress(
	ctx sdk.Context,
	_ *vm.Contract,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

DelegatorWithdrawAddress returns the withdraw address for a delegator.

func (*Precompile) DepositValidatorRewardsPool added in v0.3.0

func (p *Precompile) DepositValidatorRewardsPool(
	ctx sdk.Context,
	contract *vm.Contract,
	stateDB vm.StateDB,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

DepositValidatorRewardsPool deposits rewards into the validator rewards pool for a specific validator.

func (Precompile) EmitClaimRewardsEvent

func (p Precompile) EmitClaimRewardsEvent(ctx sdk.Context, stateDB vm.StateDB, delegatorAddress common.Address, totalCoins sdk.Coins) error

EmitClaimRewardsEvent creates a new event emitted on a ClaimRewards transaction.

func (Precompile) EmitDepositValidatorRewardsPoolEvent added in v0.3.0

func (p Precompile) EmitDepositValidatorRewardsPoolEvent(ctx sdk.Context, stateDB vm.StateDB, depositor common.Address, validatorAddress string, coins sdk.Coins) error

EmitDepositValidatorRewardsPoolEvent creates a new event emitted on a DepositValidatorRewardsPool transaction.

func (Precompile) EmitFundCommunityPoolEvent

func (p Precompile) EmitFundCommunityPoolEvent(ctx sdk.Context, stateDB vm.StateDB, depositor common.Address, coins sdk.Coins) error

EmitFundCommunityPoolEvent creates a new event emitted per Coin on a FundCommunityPool transaction.

func (Precompile) EmitSetWithdrawAddressEvent

func (p Precompile) EmitSetWithdrawAddressEvent(ctx sdk.Context, stateDB vm.StateDB, caller common.Address, withdrawerAddress string) error

EmitSetWithdrawAddressEvent creates a new event emitted on a SetWithdrawAddressMethod transaction.

func (Precompile) EmitWithdrawDelegatorRewardEvent added in v0.3.0

func (p Precompile) EmitWithdrawDelegatorRewardEvent(ctx sdk.Context, stateDB vm.StateDB, delegatorAddress common.Address, validatorAddress string, coins sdk.Coins) error

EmitWithdrawDelegatorRewardEvent creates a new event emitted on a WithdrawDelegatorReward transaction.

func (Precompile) EmitWithdrawValidatorCommissionEvent

func (p Precompile) EmitWithdrawValidatorCommissionEvent(ctx sdk.Context, stateDB vm.StateDB, validatorAddress string, coins sdk.Coins) error

EmitWithdrawValidatorCommissionEvent creates a new event emitted on a WithdrawValidatorCommission transaction.

func (Precompile) Execute added in v0.5.0

func (p Precompile) Execute(ctx sdk.Context, stateDB vm.StateDB, contract *vm.Contract, readOnly bool) ([]byte, error)

func (*Precompile) FundCommunityPool

func (p *Precompile) FundCommunityPool(
	ctx sdk.Context,
	contract *vm.Contract,
	stateDB vm.StateDB,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

FundCommunityPool directly fund the community pool

func (Precompile) IsTransaction

func (Precompile) IsTransaction(method *abi.Method) bool

IsTransaction checks if the given method name corresponds to a transaction or query.

Available distribution transactions are:

  • ClaimRewards
  • SetWithdrawAddress
  • WithdrawDelegatorReward
  • WithdrawValidatorCommission
  • FundCommunityPool
  • DepositValidatorRewardsPool

func (Precompile) RequiredGas

func (p Precompile) RequiredGas(input []byte) uint64

RequiredGas calculates the precompiled contract's base gas rate.

func (Precompile) Run

func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readonly bool) ([]byte, error)

func (Precompile) SetWithdrawAddress

func (p Precompile) SetWithdrawAddress(
	ctx sdk.Context,
	contract *vm.Contract,
	stateDB vm.StateDB,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

SetWithdrawAddress sets the withdrawal address for a delegator (or validator self-delegation).

func (Precompile) ValidatorCommission

func (p Precompile) ValidatorCommission(
	ctx sdk.Context,
	_ *vm.Contract,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

ValidatorCommission returns the commission for a validator.

func (Precompile) ValidatorDistributionInfo

func (p Precompile) ValidatorDistributionInfo(
	ctx sdk.Context,
	_ *vm.Contract,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

ValidatorDistributionInfo returns the distribution info for a validator.

func (Precompile) ValidatorOutstandingRewards

func (p Precompile) ValidatorOutstandingRewards(
	ctx sdk.Context,
	_ *vm.Contract,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

ValidatorOutstandingRewards returns the outstanding rewards for a validator.

func (Precompile) ValidatorSlashes

func (p Precompile) ValidatorSlashes(
	ctx sdk.Context,
	_ *vm.Contract,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

ValidatorSlashes returns the slashes for a validator.

func (*Precompile) WithdrawDelegatorReward added in v0.3.0

func (p *Precompile) WithdrawDelegatorReward(
	ctx sdk.Context,
	contract *vm.Contract,
	stateDB vm.StateDB,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

WithdrawDelegatorReward withdraws the rewards of a delegator from a single validator.

func (*Precompile) WithdrawValidatorCommission

func (p *Precompile) WithdrawValidatorCommission(
	ctx sdk.Context,
	contract *vm.Contract,
	stateDB vm.StateDB,
	method *abi.Method,
	args []interface{},
) ([]byte, error)

WithdrawValidatorCommission withdraws the rewards of a validator.

type ValidatorDistributionInfo

type ValidatorDistributionInfo struct {
	OperatorAddress string        `abi:"operatorAddress"`
	SelfBondRewards []cmn.DecCoin `abi:"selfBondRewards"`
	Commission      []cmn.DecCoin `abi:"commission"`
}

ValidatorDistributionInfo is a struct to represent the key information from a ValidatorDistributionInfoResponse.

type ValidatorDistributionInfoOutput

type ValidatorDistributionInfoOutput struct {
	DistributionInfo ValidatorDistributionInfo `abi:"distributionInfo"`
}

ValidatorDistributionInfoOutput is a wrapper for ValidatorDistributionInfo to return in the response.

func (*ValidatorDistributionInfoOutput) FromResponse

FromResponse converts a response to a ValidatorDistributionInfo.

type ValidatorSlashEvent

type ValidatorSlashEvent struct {
	ValidatorPeriod uint64  `abi:"validatorPeriod"`
	Fraction        cmn.Dec `abi:"fraction"`
}

ValidatorSlashEvent is a struct to represent the key information from a ValidatorSlashEvent response.

type ValidatorSlashesInput

type ValidatorSlashesInput struct {
	ValidatorAddress string
	StartingHeight   uint64
	EndingHeight     uint64
	PageRequest      query.PageRequest
}

ValidatorSlashesInput is a struct to represent the key information to perform a ValidatorSlashes query.

type ValidatorSlashesOutput

type ValidatorSlashesOutput struct {
	Slashes      []ValidatorSlashEvent
	PageResponse query.PageResponse
}

ValidatorSlashesOutput is a struct to represent the key information from a ValidatorSlashes response.

func (*ValidatorSlashesOutput) FromResponse

FromResponse populates the ValidatorSlashesOutput from a QueryValidatorSlashesResponse.

func (*ValidatorSlashesOutput) Pack

func (vs *ValidatorSlashesOutput) Pack(args abi.Arguments) ([]byte, error)

Pack packs a given slice of abi arguments into a byte array.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL