Documentation
¶
Index ¶
- Constants
- type Keeper
- func (k Keeper) ClassPathFromHash(ctx sdk.Context, class string) (string, error)
- func (q Keeper) ClassTrace(c context.Context, req *types.QueryClassTraceRequest) (*types.QueryClassTraceResponse, error)
- func (q Keeper) ClassTraces(c context.Context, req *types.QueryClassTracesRequest) (*types.QueryClassTracesResponse, error)
- func (k Keeper) GetClassTrace(ctx sdk.Context, classTraceHash tmbytes.HexBytes) (types.ClassTrace, bool)
- func (k Keeper) GetMtTransferModuleAddr(name string) sdk.AccAddress
- func (k Keeper) HasClassTrace(ctx sdk.Context, classTraceHash tmbytes.HexBytes) bool
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MtTransfer(goCtx context.Context, msg *types.MsgMtTransfer) (*types.MsgMtTransferResponse, error)
- func (k Keeper) MustMarshalClassTrace(classTrace types.ClassTrace) []byte
- func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, data types.MultiTokenPacketData, ...) error
- func (k Keeper) OnRecvPacket(ctx sdk.Context, packet packetType.Packet, data types.MultiTokenPacketData) error
- func (k Keeper) SendMtTransfer(ctx sdk.Context, class, id string, sender sdk.AccAddress, receiver string, ...) error
- func (k Keeper) SetClassTrace(ctx sdk.Context, classTrace types.ClassTrace)
- func (k Keeper) UnmarshalClassTrace(bz []byte) (types.ClassTrace, error)
Constants ¶
const ( CLASSPREFIX = "tibc-" CLASSPATHPREFIX = "mt" DELIMITER = "/" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.BinaryCodec, key storetypes.StoreKey, ak types.AccountKeeper, mk types.MtKeeper, pk types.PacketKeeper, ck types.ClientKeeper, ) Keeper
NewKeeper creates a new TIBC transfer Keeper instance
func (Keeper) ClassPathFromHash ¶
ClassPathFromHash returns the full class path prefix from an ibc class with a hash component.
func (Keeper) ClassTrace ¶
func (q Keeper) ClassTrace(c context.Context, req *types.QueryClassTraceRequest) (*types.QueryClassTraceResponse, error)
ClassTrace implements the Query/ClassTrace gRPC method
func (Keeper) ClassTraces ¶
func (q Keeper) ClassTraces(c context.Context, req *types.QueryClassTracesRequest) (*types.QueryClassTracesResponse, error)
ClassTraces implements the Query/ClassTraces gRPC method
func (Keeper) GetClassTrace ¶
func (k Keeper) GetClassTrace( ctx sdk.Context, classTraceHash tmbytes.HexBytes, ) (types.ClassTrace, bool)
GetClassTrace retreives the full identifiers trace and base class from the store.
func (Keeper) GetMtTransferModuleAddr ¶
func (k Keeper) GetMtTransferModuleAddr(name string) sdk.AccAddress
GetMtTransferModuleAddr returns the mt transfer module addr
func (Keeper) HasClassTrace ¶
HasClassTrace checks if a the key with the given class trace hash exists on the store.
func (Keeper) MtTransfer ¶
func (k Keeper) MtTransfer(goCtx context.Context, msg *types.MsgMtTransfer) (*types.MsgMtTransferResponse, error)
func (Keeper) MustMarshalClassTrace ¶
func (k Keeper) MustMarshalClassTrace(classTrace types.ClassTrace) []byte
MustMarshalClassTrace attempts to encode an ClassTrace object and returns the raw encoded bytes. It panics on error.
func (Keeper) OnAcknowledgementPacket ¶
func (k Keeper) OnAcknowledgementPacket(ctx sdk.Context, data types.MultiTokenPacketData, ack packetType.Acknowledgement) error
func (Keeper) OnRecvPacket ¶
func (k Keeper) OnRecvPacket(ctx sdk.Context, packet packetType.Packet, data types.MultiTokenPacketData) error
OnRecvPacket A->B->C away_from_source == true
B receive packet from A : class -> mt/A/B/class c receive packet from B : mt/A/B/class -> mt/A/B/C/class
C->B->A away_from_source == flase
B receive packet from C : mt/A/B/C/class -> mt/A/B/class A receive packet from B : mt/A/B/class -> class
func (Keeper) SendMtTransfer ¶
func (k Keeper) SendMtTransfer( ctx sdk.Context, class, id string, sender sdk.AccAddress, receiver string, destChain string, relayChain string, destContract string, amount uint64, ) error
SendMtTransfer is a wrapper function for sending a mt transfer packet.
The function determines whether the mt is sent from the source chain or sent back to the source chain from other chains. If awayFromOrigin is true, the mt is sent from the source chain to other chains. If awayFromOrigin is false, the mt is sent from other chains to the source chain.
The function will lock the mt and send a packet if awayFromOrigin is true. If awayFromOrigin is false, the function will burn the mt.
The function will return an error if the mt class is invalid, the mt is invalid, the sender is invalid, or the packet fails to send.
func (Keeper) SetClassTrace ¶
func (k Keeper) SetClassTrace(ctx sdk.Context, classTrace types.ClassTrace)
SetClassTrace sets a new {trace hash -> class trace} pair to the store.
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.