Documentation ¶
Index ¶
- type Keeper
- func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool
- func (k Keeper) BindPort(ctx sdk.Context, portID string) error
- func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error
- func (k Keeper) DenomHash(c context.Context, req *types.QueryDenomHashRequest) (*types.QueryDenomHashResponse, error)
- func (k Keeper) DenomPathFromHash(ctx sdk.Context, denom string) (string, error)
- func (k Keeper) DenomTrace(c context.Context, req *types.QueryDenomTraceRequest) (*types.QueryDenomTraceResponse, error)
- func (k Keeper) DenomTraces(c context.Context, req *types.QueryDenomTracesRequest) (*types.QueryDenomTracesResponse, error)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetAllDenomTraces(ctx sdk.Context) types.Traces
- func (k Keeper) GetDenomTrace(ctx sdk.Context, denomTraceHash tmbytes.HexBytes) (types.DenomTrace, bool)
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetPort(ctx sdk.Context) string
- func (k Keeper) GetReceiveEnabled(ctx sdk.Context) bool
- func (k Keeper) GetRouter() *types.Router
- func (k Keeper) GetSendEnabled(ctx sdk.Context) bool
- func (k Keeper) GetTransferAccount(ctx sdk.Context) authtypes.ModuleAccountI
- func (k Keeper) HasDenomTrace(ctx sdk.Context, denomTraceHash tmbytes.HexBytes) bool
- func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState)
- func (k Keeper) IsBound(ctx sdk.Context, portID string) bool
- func (k Keeper) IterateDenomTraces(ctx sdk.Context, cb func(denomTrace types.DenomTrace) bool)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MarshalDenomTrace(denomTrace types.DenomTrace) ([]byte, error)
- func (k Keeper) MustMarshalDenomTrace(denomTrace types.DenomTrace) []byte
- func (k Keeper) MustUnmarshalDenomTrace(bz []byte) types.DenomTrace
- func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, ...) error
- func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, ...) error
- func (k Keeper) OnTimeoutPacket(ctx sdk.Context, packet channeltypes.Packet, ...) error
- func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) SendTransfer(ctx sdk.Context, sourcePort, sourceChannel string, token sdk.Coin, ...) error
- func (k Keeper) SetDenomTrace(ctx sdk.Context, denomTrace types.DenomTrace)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPort(ctx sdk.Context, portID string)
- func (k *Keeper) SetRefundHook(hook types.RefundHook)
- func (k *Keeper) SetRouter(rtr *types.Router)
- func (k Keeper) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error)
- func (k Keeper) UnmarshalDenomTrace(bz []byte) (types.DenomTrace, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Keeper ¶
type Keeper struct { Router *types.Router RefundHook types.RefundHook // contains filtered or unexported fields }
Keeper defines the IBC fungible transfer keeper
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, key sdk.StoreKey, paramSpace paramtypes.Subspace, ics4Wrapper types.ICS4Wrapper, channelKeeper types.ChannelKeeper, portKeeper types.PortKeeper, authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, scopedKeeper capabilitykeeper.ScopedKeeper, ) 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 ¶
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 ¶
func (k Keeper) DenomHash(c context.Context, req *types.QueryDenomHashRequest) (*types.QueryDenomHashResponse, error)
DenomHash implements the Query/DenomHash gRPC method
func (Keeper) DenomPathFromHash ¶
DenomPathFromHash returns the full denomination path prefix from an ibc denom with a hash component.
func (Keeper) DenomTrace ¶
func (k Keeper) DenomTrace(c context.Context, req *types.QueryDenomTraceRequest) (*types.QueryDenomTraceResponse, error)
DenomTrace implements the Query/DenomTrace gRPC method
func (Keeper) DenomTraces ¶
func (k Keeper) DenomTraces(c context.Context, req *types.QueryDenomTracesRequest) (*types.QueryDenomTracesResponse, error)
DenomTraces implements the Query/DenomTraces 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 ¶
GetAllDenomTraces returns the trace information for all the denominations.
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) GetReceiveEnabled ¶
GetReceiveEnabled retrieves the receive enabled boolean from the paramstore
func (Keeper) GetSendEnabled ¶
GetSendEnabled retrieves the send enabled boolean from the paramstore
func (Keeper) GetTransferAccount ¶
func (k Keeper) GetTransferAccount(ctx sdk.Context) authtypes.ModuleAccountI
GetTransferAccount returns the ICS20 - transfers ModuleAccount
func (Keeper) HasDenomTrace ¶
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 ¶
IterateDenomTraces iterates over the denomination traces in the store and performs a callback function.
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 ¶
func (k Keeper) Params(c 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 sdk.Coin, sender sdk.AccAddress, receiver string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, router string, fee sdk.Coin, ) 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) 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) SetRefundHook ¶
func (k *Keeper) SetRefundHook(hook types.RefundHook)
func (*Keeper) SetRouter ¶
SetRouter sets the Router in IBC Transfer Keeper and seals it. The method panics if there is an existing router that's already sealed.
func (Keeper) Transfer ¶
func (k Keeper) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error)
Transfer defines a 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.