Documentation
¶
Index ¶
- type Keeper
- func (k Keeper) Denom(goCtx context.Context, req *types.QueryDenomRequest) (*types.QueryDenomResponse, error)
- func (k Keeper) DenomHash(goCtx context.Context, req *types.QueryDenomHashRequest) (*types.QueryDenomHashResponse, error)
- func (k Keeper) Denoms(ctx context.Context, req *types.QueryDenomsRequest) (*types.QueryDenomsResponse, error)
- func (k Keeper) EscrowAddress(goCtx context.Context, req *types.QueryEscrowAddressRequest) (*types.QueryEscrowAddressResponse, error)
- func (k Keeper) EscrowCoin(ctx sdk.Context, sender, escrowAddress sdk.AccAddress, coin sdk.Coin) error
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetAllDenoms(ctx sdk.Context) types.Denoms
- func (k Keeper) GetAllTotalEscrowed(ctx sdk.Context) sdk.Coins
- func (k Keeper) GetAuthority() string
- func (k Keeper) GetDenom(ctx sdk.Context, denomHash cmtbytes.HexBytes) (types.Denom, bool)
- func (k Keeper) GetICS4Wrapper() porttypes.ICS4Wrapper
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetPort(ctx sdk.Context) string
- func (k Keeper) GetTotalEscrowForDenom(ctx sdk.Context, denom string) sdk.Coin
- func (k Keeper) HasDenom(ctx sdk.Context, denomHash cmtbytes.HexBytes) bool
- func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState)
- func (k Keeper) IsBlockedAddr(addr sdk.AccAddress) bool
- func (k Keeper) IterateDenoms(ctx sdk.Context, cb func(denom types.Denom) bool)
- func (k Keeper) IterateTokensInEscrow(ctx sdk.Context, storeprefix []byte, cb func(denomEscrow sdk.Coin) bool)
- func (Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, sourcePort string, sourceChannel string, ...) error
- func (k Keeper) OnRecvPacket(ctx sdk.Context, data types.FungibleTokenPacketDataV2, sourcePort string, ...) error
- func (k Keeper) OnTimeoutPacket(ctx sdk.Context, sourcePort string, sourceChannel string, ...) error
- func (k Keeper) Params(goCtx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) SendTransfer(ctx sdk.Context, sourcePort, sourceChannel string, token types.Token, ...) error
- func (k Keeper) SetDenom(ctx sdk.Context, denom types.Denom)
- func (k Keeper) SetDenomMetadata(ctx sdk.Context, denom types.Denom)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPort(ctx sdk.Context, portID string)
- func (k Keeper) SetTotalEscrowForDenom(ctx sdk.Context, coin sdk.Coin)
- func (k Keeper) TokenFromCoin(ctx sdk.Context, coin sdk.Coin) (types.Token, error)
- func (k Keeper) TotalEscrowForDenom(goCtx context.Context, req *types.QueryTotalEscrowForDenomRequest) (*types.QueryTotalEscrowForDenomResponse, error)
- func (k Keeper) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error)
- func (k Keeper) UnescrowCoin(ctx sdk.Context, escrowAddress, receiver sdk.AccAddress, coin sdk.Coin) error
- func (k Keeper) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error)
- func (k *Keeper) WithICS4Wrapper(wrapper porttypes.ICS4Wrapper)
- type Migrator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Keeper ¶
type Keeper struct { AuthKeeper types.AccountKeeper BankKeeper types.BankKeeper // contains filtered or unexported fields }
Keeper defines the IBC fungible transfer keeper
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, storeService corestore.KVStoreService, legacySubspace types.ParamSubspace, ics4Wrapper porttypes.ICS4Wrapper, channelKeeper types.ChannelKeeper, authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, authority string, ) Keeper
NewKeeper creates a new IBC transfer Keeper instance
func (Keeper) Denom ¶
func (k Keeper) Denom(goCtx context.Context, req *types.QueryDenomRequest) (*types.QueryDenomResponse, error)
Denom implements the Query/Denom gRPC method
func (Keeper) DenomHash ¶
func (k Keeper) DenomHash(goCtx context.Context, req *types.QueryDenomHashRequest) (*types.QueryDenomHashResponse, error)
DenomHash implements the Query/DenomHash gRPC method
func (Keeper) Denoms ¶
func (k Keeper) Denoms(ctx context.Context, req *types.QueryDenomsRequest) (*types.QueryDenomsResponse, error)
Denoms implements the Query/Denoms gRPC method
func (Keeper) EscrowAddress ¶
func (k Keeper) EscrowAddress(goCtx context.Context, req *types.QueryEscrowAddressRequest) (*types.QueryEscrowAddressResponse, error)
EscrowAddress implements the EscrowAddress gRPC method
func (Keeper) EscrowCoin ¶
func (k Keeper) EscrowCoin(ctx sdk.Context, sender, escrowAddress sdk.AccAddress, coin sdk.Coin) error
EscrowCoin will send the given coin from the provided sender to the escrow address. It will also update the total escrowed amount by adding the escrowed coin's amount to the current total escrow.
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 ¶
GetAllDenoms returns all the denominations.
func (Keeper) GetAllTotalEscrowed ¶
GetAllTotalEscrowed returns the escrow information for all the denominations.
func (Keeper) GetAuthority ¶
GetAuthority returns the transfer module's authority.
func (Keeper) GetICS4Wrapper ¶
func (k Keeper) GetICS4Wrapper() porttypes.ICS4Wrapper
GetICS4Wrapper returns the ICS4Wrapper.
func (Keeper) GetTotalEscrowForDenom ¶
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 ¶
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) IsBlockedAddr ¶
func (k Keeper) IsBlockedAddr(addr sdk.AccAddress) bool
IsBlockedAddr checks if the given address is allowed to send or receive tokens. The module account is always allowed to send and receive tokens.
func (Keeper) IterateDenoms ¶
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) OnAcknowledgementPacket ¶
func (k Keeper) OnAcknowledgementPacket( ctx sdk.Context, sourcePort string, sourceChannel string, data types.FungibleTokenPacketDataV2, ack channeltypes.Acknowledgement, ) error
OnAcknowledgementPacket responds to the success or failure of a packet acknowledgment written on the receiving chain.
If the acknowledgement was a success then nothing occurs. Otherwise, if the acknowledgement failed, then the sender is refunded their tokens.
func (Keeper) OnRecvPacket ¶
func (k Keeper) OnRecvPacket( ctx sdk.Context, data types.FungibleTokenPacketDataV2, sourcePort string, sourceChannel string, destPort string, destChannel string, ) 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, sourcePort string, sourceChannel string, data types.FungibleTokenPacketDataV2, ) error
OnTimeoutPacket processes a transfer packet timeout by refunding the tokens to the sender
func (Keeper) Params ¶
func (k Keeper) Params(goCtx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params implements the Query/Params gRPC method
func (Keeper) SendTransfer ¶
func (k Keeper) SendTransfer( ctx sdk.Context, sourcePort, sourceChannel string, token types.Token, sender sdk.AccAddress, ) error
SendTransfer handles transfer sending logic. There are 2 possible cases:
1. Sender chain is acting as the source zone. The coins are transferred to an escrow address (i.e locked) on the sender chain and then transferred to the receiving chain through IBC TAO logic. It is expected that the receiving chain will mint vouchers to the receiving address.
2. Sender chain is acting as the sink zone. The coins (vouchers) are burned on the sender chain and then transferred to the receiving chain though IBC TAO logic. It is expected that the receiving chain, which had previously sent the original denomination, will unescrow the fungible token and send it to the receiving address.
Another way of thinking of source and sink zones is through the token's timeline. Each send to any chain other than the one it was previously received from is a movement forwards in the token's timeline. This causes trace to be added to the token's history and the destination port and destination channel to be prefixed to the denomination. In these instances the sender chain is acting as the source zone. When the token is sent back to the chain it previously received from, the prefix is removed. This is a backwards movement in the token's timeline and the sender chain is acting as the sink zone.
Example: These steps of transfer occur: A -> B -> C -> A -> C -> B -> A
1. A -> B : sender chain is source zone. Denom upon receiving: 'B/denom' 2. B -> C : sender chain is source zone. Denom upon receiving: 'C/B/denom' 3. C -> A : sender chain is source zone. Denom upon receiving: 'A/C/B/denom' 4. A -> C : sender chain is sink zone. Denom upon receiving: 'C/B/denom' 5. C -> B : sender chain is sink zone. Denom upon receiving: 'B/denom' 6. B -> A : sender chain is sink zone. Denom upon receiving: 'denom'
func (Keeper) SetDenom ¶
SetDenom sets a new {denom hash -> denom } pair to the store. This allows for reverse lookup of the denom given the hash.
func (Keeper) SetDenomMetadata ¶
SetDenomMetadata sets an IBC token's denomination metadata
func (Keeper) SetTotalEscrowForDenom ¶
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) TokenFromCoin ¶
tokenFromCoin constructs an IBC token given an SDK coin.
func (Keeper) TotalEscrowForDenom ¶
func (k Keeper) TotalEscrowForDenom(goCtx context.Context, req *types.QueryTotalEscrowForDenomRequest) (*types.QueryTotalEscrowForDenomResponse, error)
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) UnescrowCoin ¶
func (k Keeper) UnescrowCoin(ctx sdk.Context, escrowAddress, receiver sdk.AccAddress, coin sdk.Coin) error
UnescrowCoin will send the given coin from the escrow address to the provided receiver. It will also update the total escrow by deducting the unescrowed coin's amount from the current total escrow.
func (Keeper) UpdateParams ¶
func (k Keeper) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error)
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 (Migrator) MigrateDenomMetadata ¶
MigrateDenomMetadata sets token metadata for all the IBC denom traces
func (Migrator) MigrateDenomTraceToDenom ¶
MigrateDenomTraceToDenom migrates storage from using DenomTrace to Denom.
func (Migrator) MigrateParams ¶
MigrateParams migrates the transfer module's parameters from the x/params to self store.