Documentation ¶
Index ¶
- Constants
- func NewDelegationRewardsRequest(args []interface{}) (*distributiontypes.QueryDelegationRewardsRequest, error)
- func NewDelegationTotalRewardsRequest(args []interface{}) (*distributiontypes.QueryDelegationTotalRewardsRequest, error)
- func NewDelegatorValidatorsRequest(args []interface{}) (*distributiontypes.QueryDelegatorValidatorsRequest, error)
- func NewDelegatorWithdrawAddressRequest(args []interface{}) (*distributiontypes.QueryDelegatorWithdrawAddressRequest, error)
- func NewMsgSetWithdrawAddress(args []interface{}) (*distributiontypes.MsgSetWithdrawAddress, common.Address, error)
- func NewMsgWithdrawDelegatorReward(args []interface{}) (*distributiontypes.MsgWithdrawDelegatorReward, common.Address, error)
- func NewMsgWithdrawValidatorCommission(args []interface{}) (*distributiontypes.MsgWithdrawValidatorCommission, common.Address, error)
- func NewValidatorCommissionRequest(args []interface{}) (*distributiontypes.QueryValidatorCommissionRequest, error)
- func NewValidatorDistributionInfoRequest(args []interface{}) (*distributiontypes.QueryValidatorDistributionInfoRequest, error)
- func NewValidatorOutstandingRewardsRequest(args []interface{}) (*distributiontypes.QueryValidatorOutstandingRewardsRequest, error)
- func NewValidatorSlashesRequest(method *abi.Method, args []interface{}) (*distributiontypes.QueryValidatorSlashesRequest, error)
- type DelegationDelegatorReward
- type DelegationTotalRewardsOutput
- type EventClaimRewards
- type EventSetWithdrawAddress
- type EventWithdrawDelegatorRewards
- type EventWithdrawValidatorRewards
- type Precompile
- func (p Precompile) Address() common.Address
- func (p Precompile) ClaimRewards(ctx sdk.Context, origin common.Address, contract *vm.Contract, ...) ([]byte, error)
- func (p Precompile) DelegationRewards(ctx sdk.Context, _ *vm.Contract, method *abi.Method, args []interface{}) ([]byte, error)
- func (p Precompile) DelegationTotalRewards(ctx sdk.Context, _ *vm.Contract, method *abi.Method, args []interface{}) ([]byte, error)
- func (p Precompile) DelegatorValidators(ctx sdk.Context, _ *vm.Contract, method *abi.Method, args []interface{}) ([]byte, error)
- func (p Precompile) DelegatorWithdrawAddress(ctx sdk.Context, _ *vm.Contract, method *abi.Method, args []interface{}) ([]byte, error)
- func (p Precompile) EmitClaimRewardsEvent(ctx sdk.Context, stateDB vm.StateDB, delegatorAddress common.Address, ...) error
- func (p Precompile) EmitSetWithdrawAddressEvent(ctx sdk.Context, stateDB vm.StateDB, caller common.Address, ...) error
- func (p Precompile) EmitWithdrawDelegatorRewardsEvent(ctx sdk.Context, stateDB vm.StateDB, delegatorAddress common.Address, ...) error
- func (p Precompile) EmitWithdrawValidatorCommissionEvent(ctx sdk.Context, stateDB vm.StateDB, validatorAddress string, coins sdk.Coins) error
- func (Precompile) IsTransaction(methodName string) bool
- func (p Precompile) RequiredGas(input []byte) uint64
- func (p Precompile) Run(evm *vm.EVM, contract *vm.Contract, readOnly bool) (bz []byte, err error)
- func (p Precompile) SetWithdrawAddress(ctx sdk.Context, origin common.Address, contract *vm.Contract, ...) ([]byte, error)
- func (p Precompile) ValidatorCommission(ctx sdk.Context, _ *vm.Contract, method *abi.Method, args []interface{}) ([]byte, error)
- func (p Precompile) ValidatorDistributionInfo(ctx sdk.Context, _ *vm.Contract, method *abi.Method, args []interface{}) ([]byte, error)
- func (p Precompile) ValidatorOutstandingRewards(ctx sdk.Context, _ *vm.Contract, method *abi.Method, args []interface{}) ([]byte, error)
- func (p Precompile) ValidatorSlashes(ctx sdk.Context, _ *vm.Contract, method *abi.Method, args []interface{}) ([]byte, error)
- func (p Precompile) WithdrawDelegatorRewards(ctx sdk.Context, origin common.Address, contract *vm.Contract, ...) ([]byte, error)
- func (p Precompile) WithdrawValidatorCommission(ctx sdk.Context, origin common.Address, contract *vm.Contract, ...) ([]byte, error)
- type ValidatorDistributionInfo
- type ValidatorDistributionInfoOutput
- type ValidatorSlashEvent
- type ValidatorSlashesInput
- type ValidatorSlashesOutput
Constants ¶
const ( // ErrSetWithdrawAddrAuth is raised when no authorization to set the withdraw address exists. ErrSetWithdrawAddrAuth = "set withdrawer address authorization for address %s does not exist" // ErrWithdrawDelRewardsAuth is raised when no authorization to withdraw delegation rewards exists. ErrWithdrawDelRewardsAuth = "withdraw delegation rewards authorization for address %s does not exist" // ErrWithdrawValCommissionAuth is raised when no authorization to withdraw validator commission exists. ErrWithdrawValCommissionAuth = "withdraw validator commission authorization for address %s does not exist" // 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" )
const ( // EventTypeSetWithdrawAddress defines the event type for the distribution SetWithdrawAddressMethod transaction. EventTypeSetWithdrawAddress = "SetWithdrawerAddress" // EventTypeWithdrawDelegatorRewards defines the event type for the distribution WithdrawDelegatorRewardsMethod transaction. EventTypeWithdrawDelegatorRewards = "WithdrawDelegatorRewards" // EventTypeWithdrawValidatorCommission defines the event type for the distribution WithdrawValidatorCommissionMethod transaction. EventTypeWithdrawValidatorCommission = "WithdrawValidatorCommission" // EventTypeClaimRewards defines the event type for the distribution ClaimRewardsMethod transaction. EventTypeClaimRewards = "ClaimRewards" )
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" )
const ( // SetWithdrawAddressMethod defines the ABI method name for the distribution // SetWithdrawAddress transaction. SetWithdrawAddressMethod = "setWithdrawAddress" // WithdrawDelegatorRewardsMethod defines the ABI method name for the distribution // WithdrawDelegatorRewards transaction. WithdrawDelegatorRewardsMethod = "withdrawDelegatorRewards" // WithdrawValidatorCommissionMethod defines the ABI method name for the distribution // WithdrawValidatorCommission transaction. WithdrawValidatorCommissionMethod = "withdrawValidatorCommission" // ClaimRewardsMethod defines the ABI method name for the custom ClaimRewards transaction ClaimRewardsMethod = "claimRewards" )
Variables ¶
This section is empty.
Functions ¶
func NewDelegationRewardsRequest ¶
func NewDelegationRewardsRequest(args []interface{}) (*distributiontypes.QueryDelegationRewardsRequest, error)
NewDelegationRewardsRequest creates a new QueryDelegationRewardsRequest instance and does sanity checks on the provided arguments.
func NewDelegationTotalRewardsRequest ¶
func NewDelegationTotalRewardsRequest(args []interface{}) (*distributiontypes.QueryDelegationTotalRewardsRequest, error)
NewDelegationTotalRewardsRequest creates a new QueryDelegationTotalRewardsRequest instance and does sanity checks on the provided arguments.
func NewDelegatorValidatorsRequest ¶
func NewDelegatorValidatorsRequest(args []interface{}) (*distributiontypes.QueryDelegatorValidatorsRequest, error)
NewDelegatorValidatorsRequest creates a new QueryDelegatorValidatorsRequest instance and does sanity checks on the provided arguments.
func NewDelegatorWithdrawAddressRequest ¶
func NewDelegatorWithdrawAddressRequest(args []interface{}) (*distributiontypes.QueryDelegatorWithdrawAddressRequest, error)
NewDelegatorWithdrawAddressRequest creates a new QueryDelegatorWithdrawAddressRequest instance and does sanity checks on the provided arguments.
func NewMsgSetWithdrawAddress ¶
func NewMsgSetWithdrawAddress(args []interface{}) (*distributiontypes.MsgSetWithdrawAddress, common.Address, error)
NewMsgSetWithdrawAddress creates a new MsgSetWithdrawAddress instance.
func NewMsgWithdrawDelegatorReward ¶
func NewMsgWithdrawDelegatorReward(args []interface{}) (*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 DelegationDelegatorReward ¶
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 ¶
func (dtr *DelegationTotalRewardsOutput) FromResponse(res *distributiontypes.QueryDelegationTotalRewardsResponse) *DelegationTotalRewardsOutput
FromResponse populates the DelegationTotalRewardsOutput from a QueryDelegationTotalRewardsResponse.
type EventClaimRewards ¶
EventClaimRewards defines the event data for the ClaimRewards transaction.
type EventSetWithdrawAddress ¶
EventSetWithdrawAddress defines the event data for the SetWithdrawAddress transaction.
type EventWithdrawDelegatorRewards ¶
type EventWithdrawDelegatorRewards struct { DelegatorAddress common.Address ValidatorAddress common.Address Amount *big.Int }
EventWithdrawDelegatorRewards defines the event data for the WithdrawDelegatorRewards transaction.
type EventWithdrawValidatorRewards ¶
EventWithdrawValidatorRewards defines the event data for the WithdrawValidatorRewards transaction.
type Precompile ¶
type Precompile struct { cmn.Precompile // contains filtered or unexported fields }
Precompile defines the precompiled contract for distribution.
func NewPrecompile ¶
func NewPrecompile( distributionKeeper distributionkeeper.Keeper, stakingKeeper stakingkeeper.Keeper, authzKeeper authzkeeper.Keeper, ) (*Precompile, error)
NewPrecompile creates a new distribution Precompile instance as a PrecompiledContract interface.
func (Precompile) Address ¶
func (p Precompile) Address() common.Address
Address defines the address of the distribution compile contract. address: 0x0000000000000000000000000000000000000801
func (Precompile) ClaimRewards ¶
func (p Precompile) ClaimRewards( ctx sdk.Context, origin common.Address, 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) 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) 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) 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) EmitWithdrawDelegatorRewardsEvent ¶
func (p Precompile) EmitWithdrawDelegatorRewardsEvent(ctx sdk.Context, stateDB vm.StateDB, delegatorAddress common.Address, validatorAddress string, coins sdk.Coins) error
EmitWithdrawDelegatorRewardsEvent creates a new event emitted on a WithdrawDelegatorRewards 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) IsTransaction ¶
func (Precompile) IsTransaction(methodName string) bool
IsTransaction checks if the given method name corresponds to a transaction or query.
Available distribution transactions are:
- ClaimRewards
- SetWithdrawAddress
- WithdrawDelegatorRewards
- WithdrawValidatorCommission
func (Precompile) RequiredGas ¶
func (p Precompile) RequiredGas(input []byte) uint64
RequiredGas calculates the precompiled contract's base gas rate.
func (Precompile) Run ¶
Run executes the precompiled contract distribution methods defined in the ABI.
func (Precompile) SetWithdrawAddress ¶
func (p Precompile) SetWithdrawAddress( ctx sdk.Context, origin common.Address, 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) WithdrawDelegatorRewards ¶
func (p Precompile) WithdrawDelegatorRewards( ctx sdk.Context, origin common.Address, contract *vm.Contract, stateDB vm.StateDB, method *abi.Method, args []interface{}, ) ([]byte, error)
WithdrawDelegatorRewards withdraws the rewards of a delegator from a single validator.
func (Precompile) WithdrawValidatorCommission ¶
func (p Precompile) WithdrawValidatorCommission( ctx sdk.Context, origin common.Address, 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 ¶
func (o *ValidatorDistributionInfoOutput) FromResponse(res *distributiontypes.QueryValidatorDistributionInfoResponse) ValidatorDistributionInfoOutput
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 ¶
func (vs *ValidatorSlashesOutput) FromResponse(res *distributiontypes.QueryValidatorSlashesResponse) *ValidatorSlashesOutput
FromResponse populates the ValidatorSlashesOutput from a QueryValidatorSlashesResponse.