keeper

package
v3.0.3 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers the claims module invariants

Types

type Hooks

type Hooks struct {
	// contains filtered or unexported fields
}

Hooks wrapper struct for the claim keeper

func (Hooks) AfterDelegationModified

func (h Hooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (Hooks) AfterProposalActive

func (h Hooks) AfterProposalActive(ctx sdk.Context, proposalID uint64)

func (Hooks) AfterProposalDeposit

func (h Hooks) AfterProposalDeposit(ctx sdk.Context, proposalID uint64, depositorAddr sdk.AccAddress)

func (Hooks) AfterProposalFailedMinDeposit

func (h Hooks) AfterProposalFailedMinDeposit(ctx sdk.Context, proposalID uint64)

governance hooks

func (Hooks) AfterProposalInactive

func (h Hooks) AfterProposalInactive(ctx sdk.Context, proposalID uint64)

func (Hooks) AfterProposalSubmission

func (h Hooks) AfterProposalSubmission(ctx sdk.Context, proposalID uint64)

func (Hooks) AfterProposalVote

func (h Hooks) AfterProposalVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress)

func (Hooks) AfterProposalVotingPeriodEnded

func (h Hooks) AfterProposalVotingPeriodEnded(ctx sdk.Context, proposalID uint64)

func (Hooks) AfterValidatorBeginUnbonding

func (h Hooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

func (Hooks) AfterValidatorBonded

func (h Hooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

func (Hooks) AfterValidatorCreated

func (h Hooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress)

staking hooks

func (Hooks) AfterValidatorRemoved

func (h Hooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress)

func (Hooks) BeforeDelegationCreated

func (h Hooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (Hooks) BeforeDelegationRemoved

func (h Hooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (Hooks) BeforeDelegationSharesModified

func (h Hooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

func (Hooks) BeforeValidatorModified

func (h Hooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress)

func (Hooks) BeforeValidatorSlashed

func (h Hooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec)

func (Hooks) PostTxProcessing

func (h Hooks) PostTxProcessing(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error

evm hook

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper struct

func NewKeeper

NewKeeper returns keeper

func (Keeper) AfterDelegationModified

func (k Keeper) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress)

AfterDelegationModified is called after a delegation is modified. Once a user delegates their EVMOS tokens to a validator, the claimable amount for the user's claims record delegation action is claimed and transferred to the user address.

func (Keeper) AfterEVMStateTransition

func (k Keeper) AfterEVMStateTransition(ctx sdk.Context, msg core.Message, receipt *ethtypes.Receipt) error

AfterEVMStateTransition implements the ethermint evm PostTxProcessing hook. After a EVM state transition is successfully processed, the claimable amount for the users's claims record evm action is claimed and transferred to the user address.

func (Keeper) AfterProposalVote

func (k Keeper) AfterProposalVote(ctx sdk.Context, proposalID uint64, voterAddr sdk.AccAddress)

AfterProposalVote is called after a vote on a proposal is cast. Once the vote is successfully included, the claimable amount for the user's claims record vote action is claimed and the transferred to the user address.

func (Keeper) ClaimCoinsForAction

func (k Keeper) ClaimCoinsForAction(
	ctx sdk.Context,
	addr sdk.AccAddress,
	claimsRecord types.ClaimsRecord,
	action types.Action,
	params types.Params,
) (sdk.Int, error)

ClaimCoinsForAction removes the claimable amount entry from a claims record and transfers it to the user's account

func (Keeper) ClaimableAmountForAction

func (k Keeper) ClaimableAmountForAction(
	ctx sdk.Context,
	claimsRecord types.ClaimsRecord,
	action types.Action,
	params types.Params,
) (claimableCoins, remainder sdk.Int)

ClaimableAmountForAction returns claimable amount for a specific action done by an address

func (Keeper) ClaimsInvariant

func (k Keeper) ClaimsInvariant() sdk.Invariant

ClaimsInvariant checks that the total amount of all unclaimed coins held in claims records is equal to the escrowed balance held in the claims module account

func (Keeper) ClaimsRecord

ClaimsRecord returns the initial claimable amount per user and the claims per action. Claimable amount per action will be 0 if claiming is disabled, before the start time, or after end time.

func (Keeper) ClaimsRecords

ClaimsRecords returns all claims records

func (Keeper) ClawbackEmptyAccounts

func (k Keeper) ClawbackEmptyAccounts(ctx sdk.Context, claimsDenom string)

ClawbackEmptyAccounts performs the clawback of all allocated tokens from airdrop recipient accounts with a sequence number of 0 (i.e the account hasn't performed a single tx during the claim window). Once the account is clawbacked, the claims record is deleted from state.

func (Keeper) ClawbackEscrowedTokens

func (k Keeper) ClawbackEscrowedTokens(ctx sdk.Context) error

ClawbackEscrowedTokens transfers all the escrowed airdrop tokens on the ModuleAccount to the community pool

func (Keeper) DeleteClaimsRecord

func (k Keeper) DeleteClaimsRecord(ctx sdk.Context, addr sdk.AccAddress)

DeleteClaimsRecord deletes a claims record from the store

func (Keeper) EndAirdrop

func (k Keeper) EndAirdrop(ctx sdk.Context, params types.Params) error

EndAirdrop transfers the unclaimed tokens from the airdrop to the community pool, removes all claims records from state and disables the claims.

func (Keeper) EndBlocker

func (k Keeper) EndBlocker(ctx sdk.Context)

EndBlocker checks if the airdrop claiming period has ended in order to process the clawback of unclaimed tokens

func (Keeper) GetClaimableAmountForAction

func (k Keeper) GetClaimableAmountForAction(
	ctx sdk.Context,
	claimsRecord types.ClaimsRecord,
	action types.Action,
	params types.Params,
) (claimableCoins, remainder sdk.Int)

GetClaimableAmountForAction returns claimable amount for a specific action done by an address returns zero if airdrop didn't start, isn't enabled or has finished

func (Keeper) GetClaimsRecord

func (k Keeper) GetClaimsRecord(ctx sdk.Context, addr sdk.AccAddress) (types.ClaimsRecord, bool)

GetClaimsRecord returns the claims record for a specific address

func (Keeper) GetClaimsRecords

func (k Keeper) GetClaimsRecords(ctx sdk.Context) []types.ClaimsRecordAddress

GetClaimsRecords get claims record instances for genesis export

func (Keeper) GetModuleAccount

func (k Keeper) GetModuleAccount(ctx sdk.Context) authtypes.ModuleAccountI

GetModuleAccount returns the module account for the claim module

func (Keeper) GetModuleAccountAddress

func (k Keeper) GetModuleAccountAddress() sdk.AccAddress

GetModuleAccountAddress gets the airdrop coin balance of module account

func (Keeper) GetModuleAccountBalances

func (k Keeper) GetModuleAccountBalances(ctx sdk.Context) sdk.Coins

GetModuleAccountBalances gets the balances of module account that escrows the airdrop tokens

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)

GetParams returns the total set of claim parameters.

func (Keeper) HasClaimsRecord

func (k Keeper) HasClaimsRecord(ctx sdk.Context, addr sdk.AccAddress) bool

HasClaimsRecord returns if the claims record is found in the store a given address

func (Keeper) Hooks

func (k Keeper) Hooks() Hooks

Return the wrapper struct

func (Keeper) IterateClaimsRecords

func (k Keeper) IterateClaimsRecords(ctx sdk.Context, handlerFn func(addr sdk.AccAddress, cr types.ClaimsRecord) (stop bool))

IterateClaimsRecords iterates over all claims records and performs a callback.

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns logger

func (Keeper) MergeClaimsRecords

func (k Keeper) MergeClaimsRecords(
	ctx sdk.Context,
	recipient sdk.AccAddress,
	senderClaimsRecord,
	recipientClaimsRecord types.ClaimsRecord,
	params types.Params,
) (mergedRecord types.ClaimsRecord, err error)

This method additionally:

  • Always claims the IBC action, assuming both record haven't claimed it.
  • Marks an action as claimed for the new instance by performing an XOR operation between the 2 provided records: `merged completed action = sender completed action XOR recipient completed action`

func (Keeper) OnAcknowledgementPacket

func (k Keeper) OnAcknowledgementPacket(
	ctx sdk.Context,
	packet channeltypes.Packet,
	acknowledgement []byte,
) error

OnAcknowledgementPacket performs an IBC send callback. Once a user submits an IBC transfer to a recipient in the destination chain and the transfer acknowledgement package is received, the claimable amount for the senders's claims record `ActionIBCTransfer` is claimed and transferred to the sender address. The function performs a no-op if claims are disabled globally, acknowledgment failed, or if the sender has no claims record.

func (Keeper) OnRecvPacket

OnRecvPacket performs an IBC receive callback. Once a user receives an IBC transfer from a counterparty chain and the transfer is successful, the claimable amount for the receiver's claims record `ActionIBCTransfer` is claimed and transferred to the receivers address. Additionally, if the sender address is a Cosmos Hub or Osmosis address with an airdrop allocation, the claims record is merged with the recipient's claims record. The function performs a no-op if claims are disabled globally or if the sender has no claims record.

func (Keeper) Params

Params returns the params of the claim module

func (Keeper) SendPacket

func (k Keeper) SendPacket(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet exported.PacketI) error

SendPacket implements the ICS4Wrapper interface from the transfer module. It calls the underlying SendPacket function directly to move down the middleware stack. Without SendPacket, this module would be skipped, when sending packages from the transferKeeper to core IBC.

func (Keeper) SetClaimsRecord

func (k Keeper) SetClaimsRecord(ctx sdk.Context, addr sdk.AccAddress, claimsRecord types.ClaimsRecord)

SetClaimsRecord sets a claims record for an address in store

func (*Keeper) SetICS4Wrapper

func (k *Keeper) SetICS4Wrapper(ics4Wrapper porttypes.ICS4Wrapper)

SetICS4Wrapper sets the ICS4 wrapper to the keeper. It panics if already set

func (Keeper) SetParams

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

SetParams sets the claim parameters to the param space.

func (Keeper) TotalUnclaimed

TotalUnclaimed returns the total amount unclaimed from the airdrop

func (Keeper) WriteAcknowledgement

func (k Keeper) WriteAcknowledgement(ctx sdk.Context, channelCap *capabilitytypes.Capability, packet exported.PacketI, ack exported.Acknowledgement) error

WriteAcknowledgement implements the ICS4Wrapper interface from the transfer module. It calls the underlying WriteAcknowledgement function directly to move down the middleware stack.

type Migrator

type Migrator struct {
	// contains filtered or unexported fields
}

Migrator is a struct for handling in-place store migrations.

func NewMigrator

func NewMigrator(keeper Keeper) Migrator

NewMigrator returns a new Migrator.

func (Migrator) Migrate1to2

func (m Migrator) Migrate1to2(ctx sdk.Context) error

Migrate1to2 migrates from consensus version 1 to 2.

Jump to

Keyboard shortcuts

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