Documentation ¶
Index ¶
- func EmitAcknowledgementEvent(ctx sdk.Context, data types.NonFungibleTokenPacketData, ...)
- 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) ClassHash(c context.Context, req *types.QueryClassHashRequest) (*types.QueryClassHashResponse, error)
- func (k Keeper) ClassPathFromHash(ctx sdk.Context, classID string) (string, error)
- func (k Keeper) ClassTrace(c context.Context, req *types.QueryClassTraceRequest) (*types.QueryClassTraceResponse, error)
- func (k Keeper) ClassTraces(c context.Context, req *types.QueryClassTracesRequest) (*types.QueryClassTracesResponse, error)
- func (k Keeper) EscrowAddress(c context.Context, req *types.QueryEscrowAddressRequest) (*types.QueryEscrowAddressResponse, error)
- func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
- func (k Keeper) GetAllClassTraces(ctx sdk.Context) types.Traces
- func (k Keeper) GetClassTrace(ctx sdk.Context, classTraceHash tmbytes.HexBytes) (types.ClassTrace, 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) GetSendEnabled(ctx sdk.Context) bool
- func (k Keeper) HasClassTrace(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) IterateClassTraces(ctx sdk.Context, cb func(denomTrace types.ClassTrace) bool)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MustMarshalClassTrace(classTrace types.ClassTrace) []byte
- func (k Keeper) MustUnmarshalClassTrace(bz []byte) types.ClassTrace
- 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, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
- func (k Keeper) SendTransfer(ctx sdk.Context, sourcePort, sourceChannel, classID string, tokenIDs []string, ...) (uint64, error)
- func (k Keeper) SetClassTrace(ctx sdk.Context, denomTrace types.ClassTrace)
- func (k Keeper) SetEscrowAddress(ctx sdk.Context, portID, channelID string)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPort(ctx sdk.Context, portID string)
- func (k Keeper) Transfer(goCtx context.Context, msg *types.MsgTransfer) (*types.MsgTransferResponse, error)
- func (k Keeper) UnmarshalClassTrace(bz []byte) (types.ClassTrace, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmitAcknowledgementEvent ¶
func EmitAcknowledgementEvent(ctx sdk.Context, data types.NonFungibleTokenPacketData, ack exported.Acknowledgement, err error)
EmitAcknowledgementEvent emits an event signalling a successful or failed acknowledgement and including the error details if any.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper defines the IBC non fungible transfer keeper
func NewKeeper ¶
func NewKeeper( cdc codec.Codec, key storetypes.StoreKey, paramSpace paramtypes.Subspace, ics4Wrapper types.ICS4Wrapper, channelKeeper types.ChannelKeeper, portKeeper types.PortKeeper, authKeeper types.AccountKeeper, nftKeeper types.NFTKeeper, scopedKeeper capabilitykeeper.ScopedKeeper, ) Keeper
NewKeeper creates a new IBC nft-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 nft-transfer module that can claim a capability that IBC module passes to it
func (Keeper) ClassHash ¶
func (k Keeper) ClassHash(c context.Context, req *types.QueryClassHashRequest) (*types.QueryClassHashResponse, error)
ClassHash implements the Query/ClassHash gRPC method
func (Keeper) ClassPathFromHash ¶
ClassPathFromHash returns the full class path prefix from an ibc classId with a hash component.
func (Keeper) ClassTrace ¶
func (k Keeper) ClassTrace(c context.Context, req *types.QueryClassTraceRequest) (*types.QueryClassTraceResponse, error)
ClassTrace implements the Query/ClassTrace gRPC method
func (Keeper) ClassTraces ¶
func (k Keeper) ClassTraces(c context.Context, req *types.QueryClassTracesRequest) (*types.QueryClassTracesResponse, error)
ClassTraces implements the Query/ClassTraces gRPC method
func (Keeper) EscrowAddress ¶
func (k Keeper) EscrowAddress(c context.Context, req *types.QueryEscrowAddressRequest) (*types.QueryEscrowAddressResponse, error)
EscrowAddress implements the EscrowAddress gRPC method
func (Keeper) ExportGenesis ¶
func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState
ExportGenesis exports ibc nft-transfer module's portID and class trace info into its genesis state.
func (Keeper) GetAllClassTraces ¶
GetAllClassTraces returns the trace information for all the class.
func (Keeper) GetClassTrace ¶
func (k Keeper) GetClassTrace(ctx sdk.Context, classTraceHash tmbytes.HexBytes) (types.ClassTrace, bool)
GetClassTrace retrieves the full identifiers trace and base classId 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) HasClassTrace ¶
HasClassTrace 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 nft-transfer state and binds to PortID.
func (Keeper) IterateClassTraces ¶
IterateClassTraces iterates over the class traces in the store and performs a callback function.
func (Keeper) MustMarshalClassTrace ¶
func (k Keeper) MustMarshalClassTrace(classTrace types.ClassTrace) []byte
MustMarshalClassTrace attempts to decode and return an ClassTrace object from raw encoded bytes. It panics on error.
func (Keeper) MustUnmarshalClassTrace ¶
func (k Keeper) MustUnmarshalClassTrace(bz []byte) types.ClassTrace
MustUnmarshalClassTrace attempts to decode and return an ClassTrace object from raw encoded bytes. It panics on error.
func (Keeper) OnAcknowledgementPacket ¶
func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, packet channeltypes.Packet, data types.NonFungibleTokenPacketData, 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.NonFungibleTokenPacketData) 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.NonFungibleTokenPacketData) 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, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error)
Params implements the Params gRPC method
func (Keeper) SendTransfer ¶
func (k Keeper) SendTransfer( ctx sdk.Context, sourcePort, sourceChannel, classID string, tokenIDs []string, sender sdk.AccAddress, receiver string, timeoutHeight clienttypes.Height, timeoutTimestamp uint64, memo string, ) (uint64, error)
SendTransfer handles nft-transfer sending logic. A sending chain may be acting as a source or sink zone.
when a chain is sending tokens across a port and channel which are not equal to the last prefixed port and channel pair, it is acting as a source zone. when tokens are sent from a source zone, the destination port and channel will be prefixed onto the classId (once the tokens are received) adding another hop to the tokens record.
when a chain is sending tokens across a port and channel which are equal to the last prefixed port and channel pair, it is acting as a sink zone. when tokens are sent from a sink zone, the last prefixed port and channel pair on the classId is removed (once the tokens are received), undoing the last hop in the tokens record.
For example, assume these steps of transfer occur: A -> B -> C -> A -> C -> B -> A
| sender chain | receiver chain | | :-----: | -------------------------: | :------------: | :------------: | -------------------------: | :-----: | | chain | classID | (port,channel) | (port,channel) | classID | chain | | A | nftClass | (p1,c1) | (p2,c2) | p2/c2/nftClass | B | | B | p2/c2/nftClass | (p3,c3) | (p4,c4) | p4/c4/p2/c2/nftClass | C | | C | p4/c4/p2/c2/nftClass | (p5,c5) | (p6,c6) | p6/c6/p4/c4/p2/c2/nftClass | A | | A | p6/c6/p4/c4/p2/c2/nftClass | (p6,c6) | (p5,c5) | p4/c4/p2/c2/nftClass | C | | C | p4/c4/p2/c2/nftClass | (p4,c4) | (p3,c3) | p2/c2/nftClass | B | | B | p2/c2/nftClass | (p2,c2) | (p1,c1) | nftClass | A |
func (Keeper) SetClassTrace ¶
func (k Keeper) SetClassTrace(ctx sdk.Context, denomTrace types.ClassTrace)
SetClassTrace sets a new {trace hash -> class trace} pair to the store.
func (Keeper) SetEscrowAddress ¶
SetEscrowAddress attempts to save a account to auth module
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) UnmarshalClassTrace ¶
func (k Keeper) UnmarshalClassTrace(bz []byte) (types.ClassTrace, error)
UnmarshalClassTrace attempts to decode and return an ClassTrace object from raw encoded bytes.