keeper

package
v8.3.0 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: MIT Imports: 27 Imported by: 174

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 ort 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) DenomHash

DenomHash implements the Query/DenomHash gRPC method

func (Keeper) DenomPathFromHash

func (k Keeper) DenomPathFromHash(ctx sdk.Context, denom string) (string, error)

DenomPathFromHash returns the full denomination path prefix from an ibc denom with a hash component.

func (Keeper) DenomTrace

DenomTrace implements the Query/DenomTrace gRPC method

func (Keeper) DenomTraces

DenomTraces implements the Query/DenomTraces 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) GetAllDenomTraces

func (k Keeper) GetAllDenomTraces(ctx sdk.Context) types.Traces

GetAllDenomTraces returns the trace information for 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) GetDenomTrace

func (k Keeper) GetDenomTrace(ctx sdk.Context, denomTraceHash tmbytes.HexBytes) (types.DenomTrace, bool)

GetDenomTrace retreives the full identifiers trace and base denomination from the store.

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) HasDenomTrace

func (k Keeper) HasDenomTrace(ctx sdk.Context, denomTraceHash tmbytes.HexBytes) bool

HasDenomTrace checks if a the key with the given denomination trace 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) IterateDenomTraces

func (k Keeper) IterateDenomTraces(ctx sdk.Context, cb func(denomTrace types.DenomTrace) bool)

IterateDenomTraces iterates over the denomination traces 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) MarshalDenomTrace

func (k Keeper) MarshalDenomTrace(denomTrace types.DenomTrace) ([]byte, error)

MarshalDenomTrace attempts to encode an DenomTrace object and returns the raw encoded bytes.

func (Keeper) MustMarshalDenomTrace

func (k Keeper) MustMarshalDenomTrace(denomTrace types.DenomTrace) []byte

MustMarshalDenomTrace attempts to encode an DenomTrace object and returns the raw encoded bytes. It panics on error.

func (Keeper) MustUnmarshalDenomTrace

func (k Keeper) MustUnmarshalDenomTrace(bz []byte) types.DenomTrace

MustUnmarshalDenomTrace attempts to decode and return an DenomTrace object from raw encoded bytes. It panics on error.

func (Keeper) OnAcknowledgementPacket

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

OnAcknowledgementPacket responds to the the success or failure of a packet acknowledgement written on the receiving chain. If the acknowledgement was a success then nothing occurs. If the acknowledgement failed, then the sender is refunded their tokens using the refundPacketToken function.

func (Keeper) OnRecvPacket

func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data types.FungibleTokenPacketData) 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.

func (Keeper) OnTimeoutPacket

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

OnTimeoutPacket refunds the sender since the original packet sent was never received and has been timed out.

func (Keeper) Params

Params implements the Query/Params gRPC method

func (Keeper) SetDenomTrace

func (k Keeper) SetDenomTrace(ctx sdk.Context, denomTrace types.DenomTrace)

SetDenomTrace sets a new {trace hash -> denom trace} pair to the store.

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) UnmarshalDenomTrace

func (k Keeper) UnmarshalDenomTrace(bz []byte) (types.DenomTrace, error)

UnmarshalDenomTrace attempts to decode and return an DenomTrace object from raw encoded bytes.

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) 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.

func (Migrator) MigrateTraces

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

MigrateTraces migrates the DenomTraces to the correct format, accounting for slashes in the BaseDenom.

Jump to

Keyboard shortcuts

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