keeper

package
v8.8.8 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllInvariants

func AllInvariants(k *Keeper) sdk.Invariant

AllInvariants runs all invariants of the transfer module.

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k *Keeper)

RegisterInvariants registers all transfer invariants

func TotalEscrowPerDenomInvariants

func TotalEscrowPerDenomInvariants(k *Keeper) sdk.Invariant

TotalEscrowPerDenomInvariants checks that the total amount escrowed for each denom is not smaller than the amount stored in the state entry.

Types

type Keeper

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

Keeper defines the IBC fungible transfer keeper

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	key storetypes.StoreKey,
	legacySubspace types.ParamSubspace,
	ics4Wrapper porttypes.ICS4Wrapper,
	channelKeeper types.ChannelKeeper,
	portKeeper types.PortKeeper,
	authKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	scopedKeeper exported.ScopedKeeper,
	authority string,
) Keeper

NewKeeper creates a new IBC transfer Keeper instance

func (Keeper) AuthenticateCapability

func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool

AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function

func (Keeper) BindPort

func (k Keeper) BindPort(ctx sdk.Context, portID string) error

BindPort defines a wrapper function for the port Keeper's function in order to expose it to module's InitGenesis function

func (Keeper) ClaimCapability

func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error

ClaimCapability allows the transfer module that can claim a capability that IBC module passes to it

func (Keeper) Denom

Denom implements the Query/Denom gRPC method

func (Keeper) DenomHash

DenomHash implements the Query/DenomHash gRPC method

func (Keeper) Denoms

Denoms implements the Query/Denoms gRPC method

func (Keeper) EscrowAddress

EscrowAddress implements the EscrowAddress gRPC method

func (Keeper) ExportGenesis

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

ExportGenesis exports ibc-transfer module's portID and denom trace info into its genesis state.

func (Keeper) GetAllDenoms

func (k Keeper) GetAllDenoms(ctx sdk.Context) types.Denoms

GetAllDenoms returns all the denominations.

func (Keeper) GetAllTotalEscrowed

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

GetAllTotalEscrowed returns the escrow information for all the denominations.

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the transfer module's authority.

func (Keeper) GetDenom

func (k Keeper) GetDenom(ctx sdk.Context, denomHash cmtbytes.HexBytes) (types.Denom, bool)

GetDenom retrieves the denom from store given the hash of the denom.

func (Keeper) GetICS4Wrapper

func (k Keeper) GetICS4Wrapper() porttypes.ICS4Wrapper

GetICS4Wrapper returns the ICS4Wrapper.

func (Keeper) GetParams

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

GetParams returns the current transfer module parameters.

func (Keeper) GetPort

func (k Keeper) GetPort(ctx sdk.Context) string

GetPort returns the portID for the transfer module. Used in ExportGenesis

func (Keeper) GetTotalEscrowForDenom

func (k Keeper) GetTotalEscrowForDenom(ctx sdk.Context, denom string) sdk.Coin

GetTotalEscrowForDenom gets the total amount of source chain tokens that are in escrow, keyed by the denomination.

NOTE: if there is no value stored in state for the provided denom then a new Coin is returned for the denom with an initial value of zero. This accommodates callers to simply call `Add()` on the returned Coin as an empty Coin literal (e.g. sdk.Coin{}) will trigger a panic due to the absence of a denom.

func (Keeper) HasDenom

func (k Keeper) HasDenom(ctx sdk.Context, denomHash cmtbytes.HexBytes) bool

HasDenom checks if a the key with the given denomination hash exists on the store.

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState)

InitGenesis initializes the ibc-transfer state and binds to PortID.

func (Keeper) IterateDenoms

func (k Keeper) IterateDenoms(ctx sdk.Context, cb func(denom types.Denom) bool)

IterateDenoms iterates over the denominations in the store and performs a callback function.

func (Keeper) IterateTokensInEscrow

func (k Keeper) IterateTokensInEscrow(ctx sdk.Context, storeprefix []byte, cb func(denomEscrow sdk.Coin) bool)

IterateTokensInEscrow iterates over the denomination escrows in the store and performs a callback function. Denominations for which an invalid value (i.e. not integer) is stored, will be skipped.

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) OnAcknowledgementPacket

func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, data types.FungibleTokenPacketDataV2, ack channeltypes.Acknowledgement) error

OnAcknowledgementPacket responds to the success or failure of a packet acknowledgment written on the receiving chain.

If no forwarding occurs and the acknowledgement was a success then nothing occurs. Otherwise, if the acknowledgement failed, then the sender is refunded their tokens.

If forwarding is used and the acknowledgement was a success, a successful acknowledgement is written for the forwarded packet. Otherwise, if the acknowledgement failed, after refunding the sender, the tokens of the forwarded packet that were received are in turn either refunded or burned.

func (Keeper) OnRecvPacket

func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data types.FungibleTokenPacketDataV2) error

OnRecvPacket processes a cross chain fungible token transfer.

If the sender chain is the source of minted tokens then vouchers will be minted and sent to the receiving address. Otherwise if the sender chain is sending back tokens this chain originally transferred to it, the tokens are unescrowed and sent to the receiving address.

In the case of packet forwarding, the packet is sent on the next hop as specified in the packet's ForwardingPacketData.

func (Keeper) OnTimeoutPacket

func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, data types.FungibleTokenPacketDataV2) error

OnTimeoutPacket processes a transfer packet timeout.

If no forwarding occurs, it refunds the tokens to the sender.

If forwarding is used and the chain acted as a middle hop on a multihop transfer, after refunding the tokens to the sender, the tokens of the forwarded packet that were received are in turn either refunded or burned.

func (Keeper) Params

Params implements the Query/Params gRPC method

func (Keeper) SetDenom

func (k Keeper) SetDenom(ctx sdk.Context, denom types.Denom)

SetDenom sets a new {denom hash -> denom } pair to the store. This allows for reverse lookup of the denom given the hash.

func (Keeper) SetParams

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

SetParams sets the transfer module parameters.

func (Keeper) SetPort

func (k Keeper) SetPort(ctx sdk.Context, portID string)

SetPort sets the portID for the transfer module. Used in InitGenesis

func (Keeper) SetTotalEscrowForDenom

func (k Keeper) SetTotalEscrowForDenom(ctx sdk.Context, coin sdk.Coin)

SetTotalEscrowForDenom stores the total amount of source chain tokens that are in escrow. Amount is stored in state if and only if it is not equal to zero. The function will panic if the amount is negative.

func (Keeper) TotalEscrowForDenom

TotalEscrowForDenom implements the TotalEscrowForDenom gRPC method.

func (Keeper) Transfer

func (k Keeper) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error)

Transfer defines an rpc handler method for MsgTransfer.

func (Keeper) UpdateParams

UpdateParams defines an rpc handler method for MsgUpdateParams. Updates the ibc-transfer module's parameters.

func (*Keeper) WithICS4Wrapper

func (k *Keeper) WithICS4Wrapper(wrapper porttypes.ICS4Wrapper)

WithICS4Wrapper sets the ICS4Wrapper. This function may be used after the keepers creation to set the middleware which is above this module in the IBC application 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) MigrateDenomMetadata

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

MigrateDenomMetadata sets token metadata for all the IBC denom traces

func (Migrator) MigrateDenomTraceToDenom

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

MigrateDenomTraceToDenom migrates storage from using DenomTrace to Denom.

func (Migrator) MigrateParams

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

MigrateParams migrates the transfer module's parameters from the x/params to self store.

func (Migrator) MigrateTotalEscrowForDenom

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

MigrateTotalEscrowForDenom migrates the total amount of source chain tokens in escrow.

Jump to

Keyboard shortcuts

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