keeper

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2020 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultPacketTimeoutHeight is the default packet timeout height relative
	// to the current block height. The timeout is disabled when set to 0.
	DefaultPacketTimeoutHeight = 1000 // NOTE: in blocks

	// DefaultPacketTimeoutTimestamp is the default packet timeout timestamp relative
	// to the current block timestamp. The timeout is disabled when set to 0.
	DefaultPacketTimeoutTimestamp = 0 // NOTE: in nanoseconds
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

Keeper defines the IBC transfer keeper

func NewKeeper

func NewKeeper(
	cdc codec.Marshaler, key sdk.StoreKey,
	channelKeeper types.ChannelKeeper, portKeeper types.PortKeeper,
	authKeeper types.AccountKeeper, bankKeeper types.BankKeeper, scopedKeeper capability.ScopedKeeper,
) Keeper

NewKeeper creates a new IBC transfer Keeper instance

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

func (k Keeper) ChanCloseInit(ctx sdk.Context, portID, channelID string) error

ChanCloseInit defines a wrapper function for the channel Keeper's function in order to expose it to the ICS20 trasfer handler.

func (Keeper) ClaimCapability

func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capability.Capability, name string) error

ClaimCapability allows the transfer module that can claim a capability that IBC module passes to it

func (Keeper) GetPort

func (k Keeper) GetPort(ctx sdk.Context) string

GetPort returns the portID for the transfer module. Used in ExportGenesis

func (Keeper) GetTransferAccount

func (k Keeper) GetTransferAccount(ctx sdk.Context) authexported.ModuleAccountI

GetTransferAccount returns the ICS20 - transfers ModuleAccount

func (Keeper) IsBound

func (k Keeper) IsBound(ctx sdk.Context, portID string) bool

IsBound checks if the transfer module is already bound to the desired port

func (Keeper) Logger

func (k Keeper) Logger(ctx sdk.Context) log.Logger

Logger returns a module-specific logger.

func (Keeper) OnRecvPacket

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

func (Keeper) OnTimeoutPacket

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

func (Keeper) PacketExecuted

func (k Keeper) PacketExecuted(ctx sdk.Context, packet channelexported.PacketI, acknowledgement []byte) error

PacketExecuted defines a wrapper function for the channel Keeper's function in order to expose it to the ICS20 transfer handler. Keeper retreives channel capability and passes it into channel keeper for authentication

func (Keeper) SendTransfer

func (k Keeper) SendTransfer(
	ctx sdk.Context,
	sourcePort,
	sourceChannel string,
	destHeight uint64,
	amount sdk.Coins,
	sender sdk.AccAddress,
	receiver string,
) error

SendTransfer handles transfer sending logic. There are 2 possible cases:

1. Sender chain is the source chain of the coins (i.e where they were minted): the coins are transferred to an escrow address (i.e locked) on the sender chain and then transferred to the destination chain (i.e not the source chain) via a packet with the corresponding fungible token data.

2. Coins are not native from the sender chain (i.e tokens sent where transferred over through IBC already): the coins are burned and then a packet is sent to the source chain of the tokens.

Jump to

Keyboard shortcuts

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