keeper

package
v7.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: MIT Imports: 18 Imported by: 103

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmitDistributeFeeEvent

func EmitDistributeFeeEvent(ctx sdk.Context, receiver string, fee sdk.Coins)

EmitDistributeFeeEvent emits an event containing a distribution fee and receiver address

func EmitIncentivizedPacketEvent

func EmitIncentivizedPacketEvent(ctx sdk.Context, packetID channeltypes.PacketId, packetFees types.PacketFees)

EmitIncentivizedPacketEvent emits an event containing information on the total amount of fees incentivizing a specific packet. It should be emitted on every fee escrowed for the given packetID.

func EmitRegisterCounterpartyPayeeEvent

func EmitRegisterCounterpartyPayeeEvent(ctx sdk.Context, relayer, counterpartyPayee, channelID string)

EmitRegisterCounterpartyPayeeEvent emits an event containing information of a registered counterparty payee for a relayer on a particular channel

func EmitRegisterPayeeEvent

func EmitRegisterPayeeEvent(ctx sdk.Context, relayer, payee, channelID string)

EmitRegisterPayeeEvent emits an event containing information of a registered payee for a relayer on a particular channel

Types

type Keeper

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

Keeper defines the IBC fungible transfer keeper

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec, key storetypes.StoreKey,
	ics4Wrapper porttypes.ICS4Wrapper, channelKeeper types.ChannelKeeper,
	portKeeper types.PortKeeper, authKeeper types.AccountKeeper, bankKeeper types.BankKeeper,
) Keeper

NewKeeper creates a new 29-fee Keeper instance

func (Keeper) BindPort

func (k Keeper) BindPort(ctx sdk.Context, portID string) *capabilitytypes.Capability

BindPort defines a wrapper function for the port Keeper's function in order to expose it to module's InitGenesis function

func (Keeper) CounterpartyPayee

CounterpartyPayee implements the Query/CounterpartyPayee gRPC method and returns the registered counterparty payee address for forward relaying

func (Keeper) DeleteFeeEnabled

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

DeleteFeeEnabled deletes the fee enabled flag for a given portID and channelID

func (Keeper) DeleteFeesInEscrow

func (k Keeper) DeleteFeesInEscrow(ctx sdk.Context, packetID channeltypes.PacketId)

DeleteFeesInEscrow deletes the fee associated with the given packetID

func (Keeper) DeleteForwardRelayerAddress

func (k Keeper) DeleteForwardRelayerAddress(ctx sdk.Context, packetID channeltypes.PacketId)

Deletes the forwardRelayerAddr associated with the packetID

func (Keeper) DistributePacketFeesOnAcknowledgement

func (k Keeper) DistributePacketFeesOnAcknowledgement(ctx sdk.Context, forwardRelayer string, reverseRelayer sdk.AccAddress, packetFees []types.PacketFee, packetID channeltypes.PacketId)

DistributePacketFeesOnAcknowledgement pays all the acknowledgement & receive fees for a given packetID while refunding the timeout fees to the refund account.

func (Keeper) DistributePacketFeesOnTimeout

func (k Keeper) DistributePacketFeesOnTimeout(ctx sdk.Context, timeoutRelayer sdk.AccAddress, packetFees []types.PacketFee, packetID channeltypes.PacketId)

DistributePacketsFeesOnTimeout pays all the timeout fees for a given packetID while refunding the acknowledgement & receive fees to the refund account.

func (Keeper) EscrowAccountHasBalance

func (k Keeper) EscrowAccountHasBalance(ctx sdk.Context, coins sdk.Coins) bool

EscrowAccountHasBalance verifies if the escrow account has the provided fee.

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis returns the fee middleware application exported genesis

func (Keeper) FeeEnabledChannel

FeeEnabledChannel implements the Query/FeeEnabledChannel gRPC method and returns true if the provided port and channel identifiers belong to a fee enabled channel

func (Keeper) FeeEnabledChannels

FeeEnabledChannels implements the Query/FeeEnabledChannels gRPC method and returns a list of fee enabled channels

func (Keeper) GetAllCounterpartyPayees

func (k Keeper) GetAllCounterpartyPayees(ctx sdk.Context) []types.RegisteredCounterpartyPayee

GetAllCounterpartyPayees returns all registered counterparty payee addresses

func (Keeper) GetAllFeeEnabledChannels

func (k Keeper) GetAllFeeEnabledChannels(ctx sdk.Context) []types.FeeEnabledChannel

GetAllFeeEnabledChannels returns a list of all ics29 enabled channels containing portID & channelID that are stored in state

func (Keeper) GetAllForwardRelayerAddresses

func (k Keeper) GetAllForwardRelayerAddresses(ctx sdk.Context) []types.ForwardRelayerAddress

GetAllForwardRelayerAddresses returns all forward relayer addresses stored for async acknowledgements

func (Keeper) GetAllIdentifiedPacketFees

func (k Keeper) GetAllIdentifiedPacketFees(ctx sdk.Context) []types.IdentifiedPacketFees

GetAllIdentifiedPacketFees returns a list of all IdentifiedPacketFees that are stored in state

func (Keeper) GetAllPayees

func (k Keeper) GetAllPayees(ctx sdk.Context) []types.RegisteredPayee

GetAllPayees returns all registered payees addresses

func (Keeper) GetAppVersion

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

GetAppVersion returns the underlying application version.

func (Keeper) GetChannel

func (k Keeper) GetChannel(ctx sdk.Context, portID, channelID string) (channeltypes.Channel, bool)

GetChannel wraps IBC ChannelKeeper's GetChannel function

func (Keeper) GetCounterpartyPayeeAddress

func (k Keeper) GetCounterpartyPayeeAddress(ctx sdk.Context, address, channelID string) (string, bool)

GetCounterpartyPayeeAddress gets the counterparty payee address given a destination relayer address

func (Keeper) GetFeeModuleAddress

func (k Keeper) GetFeeModuleAddress() sdk.AccAddress

GetFeeModuleAddress returns the ICS29 Fee ModuleAccount address

func (Keeper) GetFeesInEscrow

func (k Keeper) GetFeesInEscrow(ctx sdk.Context, packetID channeltypes.PacketId) (types.PacketFees, bool)

GetFeesInEscrow returns all escrowed packet fees for a given packetID

func (Keeper) GetIdentifiedPacketFeesForChannel

func (k Keeper) GetIdentifiedPacketFeesForChannel(ctx sdk.Context, portID, channelID string) []types.IdentifiedPacketFees

GetIdentifiedPacketFeesForChannel returns all the currently escrowed fees on a given channel.

func (Keeper) GetNextSequenceSend

func (k Keeper) GetNextSequenceSend(ctx sdk.Context, portID, channelID string) (uint64, bool)

GetNextSequenceSend wraps IBC ChannelKeeper's GetNextSequenceSend function

func (Keeper) GetPacketCommitment

func (k Keeper) GetPacketCommitment(ctx sdk.Context, portID, channelID string, sequence uint64) []byte

GetPacketCommitment wraps IBC ChannelKeeper's GetPacketCommitment function

func (Keeper) GetPayeeAddress

func (k Keeper) GetPayeeAddress(ctx sdk.Context, relayerAddr, channelID string) (string, bool)

GetPayeeAddress retrieves the fee payee address stored in state given the provided channel identifier and relayer address

func (Keeper) GetRelayerAddressForAsyncAck

func (k Keeper) GetRelayerAddressForAsyncAck(ctx sdk.Context, packetID channeltypes.PacketId) (string, bool)

GetRelayerAddressForAsyncAck gets forward relayer address for a particular packet

func (Keeper) HasFeesInEscrow

func (k Keeper) HasFeesInEscrow(ctx sdk.Context, packetID channeltypes.PacketId) bool

HasFeesInEscrow returns true if packet fees exist for the provided packetID

func (Keeper) IncentivizedPacket

IncentivizedPacket implements the Query/IncentivizedPacket gRPC method

func (Keeper) IncentivizedPackets

IncentivizedPackets implements the Query/IncentivizedPackets gRPC method

func (Keeper) IncentivizedPacketsForChannel

IncentivizedPacketsForChannel implements the Query/IncentivizedPacketsForChannel gRPC method

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, state types.GenesisState)

InitGenesis initializes the fee middleware application state from a provided genesis state

func (Keeper) IsFeeEnabled

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

IsFeeEnabled returns whether fee handling logic should be run for the given port. It will check the fee enabled flag for the given port and channel identifiers

func (Keeper) IsLocked

func (k Keeper) IsLocked(ctx sdk.Context) bool

IsLocked indicates if the fee module is locked Please see ADR 004 for more information.

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MustMarshalFees

func (k Keeper) MustMarshalFees(fees types.PacketFees) []byte

MustMarshalFees attempts to encode a Fee object and returns the raw encoded bytes. It panics on error.

func (Keeper) MustUnmarshalFees

func (k Keeper) MustUnmarshalFees(bz []byte) types.PacketFees

MustUnmarshalFees attempts to decode and return a Fee object from raw encoded bytes. It panics on error.

func (Keeper) PayPacketFee

PayPacketFee defines a rpc handler method for MsgPayPacketFee PayPacketFee is an open callback that may be called by any module/user that wishes to escrow funds in order to relay the packet with the next sequence

func (Keeper) PayPacketFeeAsync

PayPacketFee defines a rpc handler method for MsgPayPacketFee PayPacketFee is an open callback that may be called by any module/user that wishes to escrow funds in order to incentivize the relaying of a known packet. Only packets which have been sent and have not gone through the packet life cycle may be incentivized.

func (Keeper) Payee

Payee implements the Query/Payee gRPC method and returns the registered payee address to which packet fees are paid out

func (Keeper) RefundFeesOnChannelClosure

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

RefundFeesOnChannelClosure will refund all fees associated with the given port and channel identifiers. If the escrow account runs out of balance then fee module will become locked as this implies the presence of a severe bug. When the fee module is locked, no fee distributions will be performed. Please see ADR 004 for more information.

func (Keeper) RegisterCounterpartyPayee

RegisterCounterpartyPayee defines a rpc handler method for MsgRegisterCounterpartyPayee RegisterCounterpartyPayee is called by the relayer on each channelEnd and allows them to specify the counterparty payee address before relaying. This ensures they will be properly compensated for forward relaying since the destination chain must include the registered counterparty payee address in the acknowledgement. This function may be called more than once by a relayer, in which case, the latest counterparty payee address is always used.

func (Keeper) RegisterPayee

RegisterPayee defines a rpc handler method for MsgRegisterPayee RegisterPayee is called by the relayer on each channelEnd and allows them to set an optional payee to which reverse and timeout relayer packet fees will be paid out. The payee should be registered on the source chain from which packets originate as this is where fee distribution takes place. This function may be called more than once by a relayer, in which case, the latest payee is always used.

func (Keeper) SendPacket

func (k Keeper) SendPacket(
	ctx sdk.Context,
	chanCap *capabilitytypes.Capability,
	sourcePort string,
	sourceChannel string,
	timeoutHeight clienttypes.Height,
	timeoutTimestamp uint64,
	data []byte,
) (uint64, error)

SendPacket wraps the ICS4Wrapper SendPacket function

func (Keeper) SetCounterpartyPayeeAddress

func (k Keeper) SetCounterpartyPayeeAddress(ctx sdk.Context, address, counterpartyAddress, channelID string)

SetCounterpartyPayeeAddress maps the destination chain counterparty payee address to the source relayer address The receiving chain must store the mapping from: address -> counterpartyPayeeAddress for the given channel

func (Keeper) SetFeeEnabled

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

SetFeeEnabled sets a flag to determine if fee handling logic should run for the given channel identified by channel and port identifiers.

func (Keeper) SetFeesInEscrow

func (k Keeper) SetFeesInEscrow(ctx sdk.Context, packetID channeltypes.PacketId, fees types.PacketFees)

SetFeesInEscrow sets the given packet fees in escrow keyed by the packetID

func (Keeper) SetPayeeAddress

func (k Keeper) SetPayeeAddress(ctx sdk.Context, relayerAddr, payeeAddr, channelID string)

SetPayeeAddress stores the fee payee address in state keyed by the provided channel identifier and relayer address

func (Keeper) SetRelayerAddressForAsyncAck

func (k Keeper) SetRelayerAddressForAsyncAck(ctx sdk.Context, packetID channeltypes.PacketId, address string)

SetRelayerAddressForAsyncAck sets the forward relayer address during OnRecvPacket in case of async acknowledgement

func (Keeper) TotalAckFees

TotalAckFees implements the Query/TotalAckFees gRPC method

func (Keeper) TotalRecvFees

TotalRecvFees implements the Query/TotalRecvFees gRPC method

func (Keeper) TotalTimeoutFees

TotalTimeoutFees implements the Query/TotalTimeoutFees gRPC method

func (*Keeper) WithICS4Wrapper added in v7.3.0

func (k *Keeper) WithICS4Wrapper(wrapper porttypes.ICS4Wrapper)

WithICS4Wrapper sets the ICS4Wrapper. This function may be used after the keepers creation to set the middleware which is above this module in the IBC application stack.

func (Keeper) WriteAcknowledgement

func (k Keeper) WriteAcknowledgement(ctx sdk.Context, chanCap *capabilitytypes.Capability, packet ibcexported.PacketI, acknowledgement ibcexported.Acknowledgement) error

WriteAcknowledgement wraps IBC ChannelKeeper's WriteAcknowledgement function ICS29 WriteAcknowledgement is used for asynchronous acknowledgements

Jump to

Keyboard shortcuts

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