ibctransfer

package
v0.9.14 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecConvForIncomingCoins

func ExecConvForIncomingCoins(
	ctx sdk.Context,
	incomingCoins sdk.Coin,
	finalCoins sdk.Coin,
	bankKeeper sdktransfertypes.BankKeeper,
	packet channeltypes.Packet,
	data sdktransfertypes.FungibleTokenPacketData,
) error

func ExecConvForRefundCoins

func ExecConvForRefundCoins(
	ctx sdk.Context,
	incomingCoins sdk.Coin,
	finalCoins sdk.Coin,
	bankKeeper sdktransfertypes.BankKeeper,
	packet channeltypes.Packet,
	data sdktransfertypes.FungibleTokenPacketData,
) error

func GetConvForIncomingCoins

func GetConvForIncomingCoins(
	ctx sdk.Context,
	whitelistKeeper tokenregistrytypes.Keeper,
	packet channeltypes.Packet,
	data sdktransfertypes.FungibleTokenPacketData,
) (sdk.Coin, sdk.Coin)

GetConvForIncomingCoins returns 1) the coins that are being received via IBC, which need to be deducted from that denom when converting to final denom, and 2) the coins that need to be added to the final denom.

func GetConvForRefundCoins

func GetConvForRefundCoins(
	ctx sdk.Context,
	whitelistKeeper tokenregistrytypes.Keeper,
	packet channeltypes.Packet,
	data sdktransfertypes.FungibleTokenPacketData,
) (sdk.Coin, sdk.Coin)

GetConvForRefundCoins returns 1) the coins that are being received via IBC, which need to be deducted from that denom when converting to final denom, and 2) the coins that need to be added to the final denom.

func IncreasePrecision

func IncreasePrecision(dec sdk.Dec, po int64) sdk.Dec

func IsRecvPacketAllowed

func IsRecvPacketAllowed(ctx sdk.Context, whitelistKeeper tokenregistrytypes.Keeper,
	packet channeltypes.Packet, data transfertypes.FungibleTokenPacketData) bool

func IsRecvPacketReturning

func IsRecvPacketReturning(packet channeltypes.Packet, data transfertypes.FungibleTokenPacketData) bool

IsRecvPacketReturning() indicates if a token is returning to sifchain, i.e the sender is not the source of the token.

func IsWhitelisted

func IsWhitelisted(ctx sdk.Context, whitelistKeeper tokenregistrytypes.Keeper, denom string) bool

func OnAcknowledgementMaybeConvert

func OnAcknowledgementMaybeConvert(
	ctx sdk.Context,
	sdkTransferKeeper sctransfertypes.SDKTransferKeeper,
	whitelistKeeper tokenregistrytypes.Keeper,
	bankKeeper sdktransfertypes.BankKeeper,
	packet channeltypes.Packet,
	acknowledgement []byte,
) (*sdk.Result, error)

OnAcknowledgementMaybeConvert() runs on acknowledgement from receiving chain, of an outgoing send. I.e: Receiving ack from recipient chain of our send. Case A: Recipient acknowledges our send, do nothing. Case B: Recipient acknowledges error of our send, refund sender their coins.

func OnRecvPacketEnforceWhitelist

func OnRecvPacketEnforceWhitelist(
	ctx sdk.Context,
	sdkTransferKeeper sctransfertypes.SDKTransferKeeper,
	whitelistKeeper tokenregistrytypes.Keeper,
	bankKeeper transfertypes.BankKeeper,
	packet channeltypes.Packet,
) (*sdk.Result, []byte, error)

func OnRecvPacketMaybeConvert

func OnRecvPacketMaybeConvert(
	ctx sdk.Context,
	sdkTransferKeeper sctransfertypes.SDKTransferKeeper,
	whitelistKeeper tokenregistrytypes.Keeper,
	bankKeeper transfertypes.BankKeeper,
	packet channeltypes.Packet,
) (*sdk.Result, []byte, error)

OnRecvPacketMaybeConvert will receive a transfer (after whitelisting is checked), and if the receive was successful, it will be converted into the unit_denom of the denom minted by the IBC transfer module.

func OnTimeoutMaybeConvert

func OnTimeoutMaybeConvert(
	ctx sdk.Context,
	sdkTransferKeeper sctransfertypes.SDKTransferKeeper,
	whitelistKeeper tokenregistrytypes.Keeper,
	bankKeeper transfertypes.BankKeeper,
	packet channeltypes.Packet,
) (*sdk.Result, error)

OnTimeoutPacket() refunds the sender since the original packet sent was never received and has been timed out.

sdkkeeper.refundPacketToken will unescrow and send back the tokens back to sender if the sending chain was the source chain. Otherwise, the sent tokens were burnt in the original send so new tokens are minted and sent to the sending address.

OnTimeoutMaybeConvert() potentially does a conversion from the denom that was sent out, back to the original unit_denom.

func ShouldConvertIncomingCoins

func ShouldConvertIncomingCoins(
	ctx sdk.Context,
	whitelistKeeper tokenregistrytypes.Keeper,
	packet channeltypes.Packet,
	data sdktransfertypes.FungibleTokenPacketData,
) bool

ShouldConvertIncomingCoins() is called after the SDK has accepted incoming coins, or after the coins have "come back in" when a send is refunded.

func ShouldConvertRefundCoins

func ShouldConvertRefundCoins(
	ctx sdk.Context,
	whitelistKeeper tokenregistrytypes.Keeper,
	packet channeltypes.Packet,
	data sdktransfertypes.FungibleTokenPacketData,
) bool

Types

type AppModule

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

AppModule implements an application module for the ibctransfer module.

func NewAppModule

func NewAppModule(sdkTransferKeeper sdktransferkeeper.Keeper, whitelistKeeper tokenregistrytypes.Keeper, bankKeeper bankkeeper.Keeper, cdc codec.BinaryMarshaler) AppModule

func (AppModule) BeginBlock

func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock)

BeginBlock returns the begin blocker for the dispensation module.

func (AppModule) EndBlock

func (am AppModule) EndBlock(ctx sdk.Context, req abci.RequestEndBlock) []abci.ValidatorUpdate

EndBlock returns the end blocker for the dispensation module. It returns no validator updates.

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context, codec codec.JSONMarshaler) json.RawMessage

ExportGenesis returns the exported genesis state as raw bytes for the dispensation module.

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx sdk.Context, codec codec.JSONMarshaler, data json.RawMessage) []abci.ValidatorUpdate

InitGenesis performs genesis initialization for the dispensation module. It returns no validator updates

func (AppModule) LegacyQuerierHandler

func (am AppModule) LegacyQuerierHandler(amino *codec.LegacyAmino) sdk.Querier

IBC does not support a legacy querier

func (AppModule) Name

func (am AppModule) Name() string

Name returns the dispensation module's name.

func (AppModule) OnAcknowledgementPacket

func (am AppModule) OnAcknowledgementPacket(ctx sdk.Context, packet types.Packet, acknowledgement []byte) (*sdk.Result, error)

func (AppModule) OnChanCloseConfirm

func (am AppModule) OnChanCloseConfirm(ctx sdk.Context, portID, channelID string) error

func (AppModule) OnChanCloseInit

func (am AppModule) OnChanCloseInit(ctx sdk.Context, portID, channelID string) error

func (AppModule) OnChanOpenAck

func (am AppModule) OnChanOpenAck(ctx sdk.Context, portID, channelID string, counterpartyVersion string) error

func (AppModule) OnChanOpenConfirm

func (am AppModule) OnChanOpenConfirm(ctx sdk.Context, portID, channelID string) error

func (AppModule) OnChanOpenInit

func (am AppModule) OnChanOpenInit(ctx sdk.Context, order types.Order, connectionHops []string, portID string, channelID string, channelCap *capabilitytypes.Capability, counterparty types.Counterparty, version string) error

func (AppModule) OnChanOpenTry

func (am AppModule) OnChanOpenTry(ctx sdk.Context, order types.Order, connectionHops []string, portID, channelID string, channelCap *capabilitytypes.Capability, counterparty types.Counterparty, version, counterpartyVersion string) error

func (AppModule) OnRecvPacket

func (am AppModule) OnRecvPacket(ctx sdk.Context, packet types.Packet) (*sdk.Result, []byte, error)

func (AppModule) OnTimeoutPacket

func (am AppModule) OnTimeoutPacket(ctx sdk.Context, packet types.Packet) (*sdk.Result, error)

func (AppModule) QuerierRoute

func (am AppModule) QuerierRoute() string

QuerierRoute returns the dispensation module's querier route name.

func (AppModule) RegisterInvariants

func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry)

RegisterInvariants registers the dispensation module invariants.

func (AppModule) RegisterServices

func (am AppModule) RegisterServices(cfg module.Configurator)

func (AppModule) Route

func (am AppModule) Route() sdk.Route

Route returns the message routing key for the dispensation module.

type AppModuleBasic

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

AppModuleBasic defines the basic application module.

func (AppModuleBasic) DefaultGenesis

func (am AppModuleBasic) DefaultGenesis(cdc codec.JSONMarshaler) json.RawMessage

DefaultGenesis returns default genesis state as raw bytes for the module.

func (AppModuleBasic) GetQueryCmd

func (am AppModuleBasic) GetQueryCmd() *cobra.Command

GetQueryCmd returns no root query command for the module.

func (AppModuleBasic) GetTxCmd

func (am AppModuleBasic) GetTxCmd() *cobra.Command

GetTxCmd returns the root tx command for the module.

func (AppModuleBasic) Name

func (am AppModuleBasic) Name() string

func (AppModuleBasic) RegisterGRPCGatewayRoutes

func (am AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux)

func (AppModuleBasic) RegisterInterfaces

func (am AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry)

RegisterInterfaces registers the module's interface types

func (AppModuleBasic) RegisterLegacyAminoCodec

func (am AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

func (AppModuleBasic) RegisterRESTRoutes

func (am AppModuleBasic) RegisterRESTRoutes(ctx client.Context, rtr *mux.Router)

RegisterRESTRoutes registers the REST routes for the module.

func (AppModuleBasic) ValidateGenesis

func (am AppModuleBasic) ValidateGenesis(cdc codec.JSONMarshaler, config client.TxEncodingConfig, bz json.RawMessage) error

ValidateGenesis performs genesis state validation for the module.

Directories

Path Synopsis
mocks
Package scibctransfermocks is a generated GoMock package.
Package scibctransfermocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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