keeper

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2024 License: GPL-3.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CmpPubKeyToEVMAddress added in v0.12.0

func CmpPubKeyToEVMAddress(cmpPubKey []byte) (common.Address, error)

func CmpPubKeyToUncmpPubkey added in v0.12.0

func CmpPubKeyToUncmpPubkey(compressedPubKeyBytes []byte) ([]byte, error)

func IPTokenToBondCoin

func IPTokenToBondCoin(amount *big.Int) (sdk.Coin, sdk.Coins)

IPTokenToBondCoin converts the IP amount into a $STAKE coin. TODO: At this point, it is 1-to1, but this might change in the future. TODO: parameterized bondDenom.

func Logger

func Logger(ctx sdk.Context) log.Logger

func UncmpPubKeyToCmpPubKey added in v0.12.0

func UncmpPubKeyToCmpPubKey(uncmpPubKey []byte) ([]byte, error)

Types

type Keeper

type Keeper struct {
	WithdrawalQueue          addcollections.Queue[types.Withdrawal]
	RewardWithdrawalQueue    addcollections.Queue[types.Withdrawal]
	DelegatorWithdrawAddress collections.Map[string, string]
	DelegatorRewardAddress   collections.Map[string, string]
	DelegatorOperatorAddress collections.Map[string, string]
	// contains filtered or unexported fields
}

Keeper of the x/evmstaking store.

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeService store.KVStoreService,
	ak types.AccountKeeper,
	bk types.BankKeeper,
	slk types.SlashingKeeper,
	stk types.StakingKeeper,
	dk types.DistributionKeeper,
	authority string,
	ethCl ethclient.Client,
	validatorAddressCodec addresscodec.Codec,
) *Keeper

NewKeeper creates a new evmstaking Keeper instance.

func (Keeper) AddRewardWithdrawalToQueue added in v0.12.0

func (k Keeper) AddRewardWithdrawalToQueue(ctx context.Context, withdrawal types.Withdrawal) error

AddRewardWithdrawalToQueue inserts a reward withdrawal into the queue.

func (Keeper) AddWithdrawalToQueue

func (k Keeper) AddWithdrawalToQueue(ctx context.Context, withdrawal types.Withdrawal) error

AddWithdrawalToQueue inserts a withdrawal into the queue.

func (Keeper) DequeueEligibleRewardWithdrawals added in v0.12.0

func (k Keeper) DequeueEligibleRewardWithdrawals(ctx context.Context, maxDequeue uint32) (withdrawals etypes.Withdrawals, err error)

func (Keeper) DequeueEligibleWithdrawals

func (k Keeper) DequeueEligibleWithdrawals(ctx context.Context, maxDequeue uint32) (withdrawals etypes.Withdrawals, err error)

func (*Keeper) EndBlock

func (k *Keeper) EndBlock(ctx context.Context) (abci.ValidatorUpdates, error)

Query staking module's UnbondingDelegation (UBD Queue) to get the matured unbonding delegations. Then, insert the matured unbonding delegations into the withdrawal queue. TODO: check if unbonded delegations in staking module must be distinguished based on source of generation, CL or EL.

func (Keeper) EnqueueRewardWithdrawal added in v0.13.0

func (k Keeper) EnqueueRewardWithdrawal(ctx context.Context, delAddrBech32, valAddrBech32 string, claimedReward uint64) error

EnqueueRewardWithdrawal enqueues the reward withdrawal to mint reward IP token on EL side.

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis returns a GenesisState for a given context and keeper.

func (Keeper) GetAllWithdrawals

func (k Keeper) GetAllWithdrawals(ctx context.Context) (withdrawals []types.Withdrawal, err error)

GetAllWithdrawals gets the set of all withdrawals with no limits.

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the x/evmstaking module's authority.

func (Keeper) GetMatureUnbondedDelegations

func (k Keeper) GetMatureUnbondedDelegations(ctx context.Context) (matureUnbonds []stypes.DVPair, err error)

Modified from https://github.com/cosmos/cosmos-sdk/blob/v0.50.7/x/staking/keeper/delegation.go#L521

func (Keeper) GetOldValidatorSweepIndex added in v0.10.0

func (k Keeper) GetOldValidatorSweepIndex(ctx context.Context) (nextValIndex uint64, err error)

func (Keeper) GetParams

func (k Keeper) GetParams(ctx context.Context) (params types.Params, err error)

func (Keeper) GetValidatorSweepIndex added in v0.10.0

func (k Keeper) GetValidatorSweepIndex(ctx context.Context) (types.ValidatorSweepIndex, error)

func (Keeper) GetWithdrawalQueue

GetWithdrawalQueue returns the withdrawal queue in pagination. TODO: GetWithdrawalQueue tests.

func (Keeper) GetWithdrawals

func (k Keeper) GetWithdrawals(ctx context.Context, maxRetrieve uint32) (withdrawals []types.Withdrawal, err error)

GetWithdrawals returns at max the requested amount of withdrawals.

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx context.Context, gs *types.GenesisState) error

func (*Keeper) IsSingularity added in v0.12.0

func (k *Keeper) IsSingularity(ctx context.Context) (bool, error)

func (Keeper) MaxSweepPerBlock

func (k Keeper) MaxSweepPerBlock(ctx context.Context) (uint32, error)

func (Keeper) MaxWithdrawalPerBlock

func (k Keeper) MaxWithdrawalPerBlock(ctx context.Context) (uint32, error)

func (Keeper) MinPartialWithdrawalAmount

func (k Keeper) MinPartialWithdrawalAmount(ctx context.Context) (uint64, error)

func (Keeper) Params

func (Keeper) ParseCreateValidatorLog

func (k Keeper) ParseCreateValidatorLog(ethlog ethtypes.Log) (*bindings.IPTokenStakingCreateValidator, error)

func (Keeper) ParseDepositLog

func (k Keeper) ParseDepositLog(ethlog ethtypes.Log) (*bindings.IPTokenStakingDeposit, error)

func (Keeper) ParseRedelegateLog

func (k Keeper) ParseRedelegateLog(ethLog ethtypes.Log) (*bindings.IPTokenStakingRedelegate, error)

func (Keeper) ParseUnjailLog

func (k Keeper) ParseUnjailLog(ethlog ethtypes.Log) (*bindings.IPTokenStakingUnjail, error)

func (Keeper) ParseWithdrawLog

func (k Keeper) ParseWithdrawLog(ethlog ethtypes.Log) (*bindings.IPTokenStakingWithdraw, error)

func (Keeper) PeekEligibleRewardWithdrawals added in v0.12.0

func (k Keeper) PeekEligibleRewardWithdrawals(ctx context.Context, maxPeek uint32) (withdrawals etypes.Withdrawals, err error)

func (Keeper) PeekEligibleWithdrawals

func (k Keeper) PeekEligibleWithdrawals(ctx context.Context, maxPeek uint32) (withdrawals etypes.Withdrawals, err error)

func (Keeper) ProcessAddOperator added in v0.12.0

func (k Keeper) ProcessAddOperator(ctx context.Context, ev *bindings.IPTokenStakingAddOperator) (err error)

func (Keeper) ProcessCreateValidator

func (k Keeper) ProcessCreateValidator(ctx context.Context, ev *bindings.IPTokenStakingCreateValidator) (err error)

func (Keeper) ProcessDeposit

func (k Keeper) ProcessDeposit(ctx context.Context, ev *bindings.IPTokenStakingDeposit) (err error)

func (Keeper) ProcessEligibleRewardWithdrawal added in v0.13.0

func (k Keeper) ProcessEligibleRewardWithdrawal(ctx context.Context, delegation stypes.Delegation, validator stypes.Validator, minRewardWithdrawalAmount uint64) error

ProcessEligibleRewardWithdrawal processes the reward withdrawal of delegation.

func (Keeper) ProcessRedelegate

func (k Keeper) ProcessRedelegate(ctx context.Context, ev *bindings.IPTokenStakingRedelegate) (err error)

func (Keeper) ProcessRemoveOperator added in v0.12.0

func (k Keeper) ProcessRemoveOperator(ctx context.Context, ev *bindings.IPTokenStakingRemoveOperator) (err error)

func (Keeper) ProcessRewardWithdrawals added in v0.12.0

func (k Keeper) ProcessRewardWithdrawals(ctx context.Context) error

func (Keeper) ProcessSetRewardAddress added in v0.12.0

func (k Keeper) ProcessSetRewardAddress(ctx context.Context, ev *bindings.IPTokenStakingSetRewardAddress) (err error)

func (Keeper) ProcessSetWithdrawalAddress

func (k Keeper) ProcessSetWithdrawalAddress(ctx context.Context, ev *bindings.IPTokenStakingSetWithdrawalAddress) (err error)

func (Keeper) ProcessStakingEvents

func (k Keeper) ProcessStakingEvents(ctx context.Context, height uint64, logs []*evmenginetypes.EVMEvent) error

func (Keeper) ProcessUbiWithdrawal added in v0.12.0

func (k Keeper) ProcessUbiWithdrawal(ctx context.Context) error

func (Keeper) ProcessUnbondingWithdrawals added in v0.12.0

func (k Keeper) ProcessUnbondingWithdrawals(ctx context.Context, unbondedEntries []stypes.UnbondedEntry) error

func (Keeper) ProcessUnjail

func (k Keeper) ProcessUnjail(ctx context.Context, ev *bindings.IPTokenStakingUnjail) (err error)

func (Keeper) ProcessUpdateValidatorCommission added in v0.12.0

func (k Keeper) ProcessUpdateValidatorCommission(ctx context.Context, ev *bindings.IPTokenStakingUpdateValidatorCommssion) (err error)

func (Keeper) ProcessWithdraw

func (k Keeper) ProcessWithdraw(ctx context.Context, ev *bindings.IPTokenStakingWithdraw) (err error)

func (Keeper) SetParams

func (k Keeper) SetParams(ctx context.Context, params types.Params) error

This method performs no validation of the parameters.

func (Keeper) SetValidatorSweepIndex added in v0.10.0

func (k Keeper) SetValidatorSweepIndex(ctx context.Context, validatorSweepIndex types.ValidatorSweepIndex) error

func (Keeper) ValidateGenesis

func (k Keeper) ValidateGenesis(gs *types.GenesisState) error

func (Keeper) ValidatorAddressCodec

func (k Keeper) ValidatorAddressCodec() addresscodec.Codec

ValidatorAddressCodec returns the app validator address codec.

Jump to

Keyboard shortcuts

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