keeper

package
v0.32.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMigrationHandler added in v0.13.0

func GetMigrationHandler(k Keeper) func(ctx sdk.Context) error

GetMigrationHandler returns the handler that performs in-place store migrations

func NewMsgServerImpl

func NewMsgServerImpl(k types.Nexus, snapshotter types.Snapshotter, slashing types.SlashingKeeper, staking types.StakingKeeper, axelarnet types.AxelarnetKeeper) types.MsgServiceServer

NewMsgServerImpl returns an implementation of the nexus MsgServiceServer interface for the provided Keeper.

Types

type Keeper

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

Keeper represents a nexus keeper

func NewKeeper

func NewKeeper(cdc codec.BinaryCodec, storeKey sdk.StoreKey, paramSpace params.Subspace) Keeper

NewKeeper returns a new nexus keeper

func (Keeper) ActivateChain

func (k Keeper) ActivateChain(ctx sdk.Context, chain exported.Chain)

ActivateChain activates the given chain

func (Keeper) AddChainMaintainer

func (k Keeper) AddChainMaintainer(ctx sdk.Context, chain exported.Chain, address sdk.ValAddress) error

AddChainMaintainer adds the given address to be one of the given chain's maintainers

func (Keeper) AddTransferFee added in v0.17.0

func (k Keeper) AddTransferFee(ctx sdk.Context, coin sdk.Coin)

AddTransferFee adds transfer fee

func (Keeper) ArchivePendingTransfer

func (k Keeper) ArchivePendingTransfer(ctx sdk.Context, transfer exported.CrossChainTransfer)

ArchivePendingTransfer marks the transfer for the given recipient as concluded and archived

func (Keeper) ComputeTransferFee added in v0.15.0

func (k Keeper) ComputeTransferFee(ctx sdk.Context, sourceChain exported.Chain, destinationChain exported.Chain, asset sdk.Coin) (sdk.Coin, error)

ComputeTransferFee computes the fee for a cross-chain transfer. If fee_info is not set for an asset on a chain, default of zero is used

transfer_fee = min(total_max_fee, max(total_min_fee, (total_fee_rate) * amount))

INVARIANT: source_chain.min_fee + destination_chain.min_fee <= transfer_fee <= source_chain.max_fee + destination_chain.max_fee

func (Keeper) DeactivateChain added in v0.12.0

func (k Keeper) DeactivateChain(ctx sdk.Context, chain exported.Chain)

DeactivateChain deactivates the given chain

func (Keeper) DeleteMessage added in v0.32.0

func (k Keeper) DeleteMessage(ctx sdk.Context, id string)

DeleteMessage deletes the general message with associated ID, and also deletes the message ID from the approved messages store

func (Keeper) EnqueueForTransfer

func (k Keeper) EnqueueForTransfer(ctx sdk.Context, sender exported.CrossChainAddress, asset sdk.Coin) (exported.TransferID, error)

EnqueueForTransfer enqueues an asset transfer for the given deposit address

func (Keeper) EnqueueTransfer added in v0.17.0

func (k Keeper) EnqueueTransfer(ctx sdk.Context, senderChain exported.Chain, recipient exported.CrossChainAddress, asset sdk.Coin) (exported.TransferID, error)

EnqueueTransfer enqueues an asset transfer to the given recipient address

func (Keeper) ExportGenesis added in v0.9.0

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

ExportGenesis returns the reward module's genesis state.

func (Keeper) GenerateMessageID added in v0.32.0

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

GenerateMessageID generates a unique general message ID

func (Keeper) GetChain

func (k Keeper) GetChain(ctx sdk.Context, chainName exported.ChainName) (chain exported.Chain, ok bool)

GetChain retrieves the specification for a supported blockchain

func (Keeper) GetChainByNativeAsset added in v0.14.0

func (k Keeper) GetChainByNativeAsset(ctx sdk.Context, asset string) (chain exported.Chain, ok bool)

GetChainByNativeAsset gets a chain by the native asset

func (Keeper) GetChainMaintainerState added in v0.25.0

func (k Keeper) GetChainMaintainerState(ctx sdk.Context, chain exported.Chain, address sdk.ValAddress) (exported.MaintainerState, bool)

GetChainMaintainerState returns the maintainer state of the given chain and address

func (Keeper) GetChainMaintainerStates added in v0.18.0

func (k Keeper) GetChainMaintainerStates(ctx sdk.Context, chain exported.Chain) []exported.MaintainerState

GetChainMaintainerStates returns the maintainer states of the given chain

func (Keeper) GetChainMaintainers

func (k Keeper) GetChainMaintainers(ctx sdk.Context, chain exported.Chain) []sdk.ValAddress

GetChainMaintainers returns the maintainers of the given chain

func (Keeper) GetChains

func (k Keeper) GetChains(ctx sdk.Context) (chains []exported.Chain)

GetChains retrieves the specification for all supported blockchains

func (Keeper) GetFeeInfo added in v0.15.0

func (k Keeper) GetFeeInfo(ctx sdk.Context, chain exported.Chain, asset string) exported.FeeInfo

GetFeeInfo retrieves the fee info for an asset on a chain, and returns zero fees if it doesn't exist

func (Keeper) GetMessage added in v0.32.0

func (k Keeper) GetMessage(ctx sdk.Context, id string) (m exported.GeneralMessage, found bool)

GetMessage returns the general message by ID

func (Keeper) GetParams

func (k Keeper) GetParams(ctx sdk.Context) types.Params

GetParams gets the nexus module's parameters

func (Keeper) GetRecipient

func (k Keeper) GetRecipient(ctx sdk.Context, depositAddress exported.CrossChainAddress) (exported.CrossChainAddress, bool)

GetRecipient retrieves the cross chain recipient associated to the specified sender

func (Keeper) GetRouter added in v0.9.0

func (k Keeper) GetRouter() types.Router

GetRouter returns the nexus router. If no router was set, it returns a (sealed) router with no handlers

func (Keeper) GetSentMessages added in v0.32.0

func (k Keeper) GetSentMessages(ctx sdk.Context, chain exported.ChainName, limit int64) []exported.GeneralMessage

GetSentMessages returns up to limit sent messages where chain is the destination chain

func (Keeper) GetTransferFees added in v0.11.1

func (k Keeper) GetTransferFees(ctx sdk.Context) sdk.Coins

GetTransferFees returns the accumulated transfer fees

func (Keeper) GetTransfersForChain

func (k Keeper) GetTransfersForChain(ctx sdk.Context, chain exported.Chain, state exported.TransferState) (transfers []exported.CrossChainTransfer)

GetTransfersForChain returns the current set of transfers with the given state for the given chain

func (Keeper) GetTransfersForChainPaginated added in v0.13.1

func (k Keeper) GetTransfersForChainPaginated(ctx sdk.Context, chain exported.Chain, state exported.TransferState, pageRequest *query.PageRequest) ([]exported.CrossChainTransfer, *query.PageResponse, error)

GetTransfersForChainPaginated returns the current set of transfers with the given state for the given chain with the given pagination properties

func (Keeper) InitGenesis added in v0.9.0

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

InitGenesis initializes the reward module's state from a given genesis state.

func (Keeper) IsAssetRegistered

func (k Keeper) IsAssetRegistered(ctx sdk.Context, chain exported.Chain, denom string) bool

IsAssetRegistered returns true if the specified asset is supported by the given chain

func (Keeper) IsChainActivated

func (k Keeper) IsChainActivated(ctx sdk.Context, chain exported.Chain) bool

IsChainActivated returns true if the given chain is activated; false otherwise

func (Keeper) IsChainMaintainer

func (k Keeper) IsChainMaintainer(ctx sdk.Context, chain exported.Chain, address sdk.ValAddress) bool

IsChainMaintainer returns true if the given address is one of the given chain's maintainers; false otherwise

func (Keeper) LinkAddresses

func (k Keeper) LinkAddresses(ctx sdk.Context, depositAddress exported.CrossChainAddress, recipientAddress exported.CrossChainAddress) error

LinkAddresses links a sender address to a cross-chain recipient address

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) RateLimitTransfer added in v0.27.0

func (k Keeper) RateLimitTransfer(ctx sdk.Context, chain exported.ChainName, asset sdk.Coin, direction exported.TransferDirection) error

RateLimitTransfer applies a rate limit to transfers, and returns an error if the rate limit is exceeded

func (Keeper) RegisterAsset

func (k Keeper) RegisterAsset(ctx sdk.Context, chain exported.Chain, asset exported.Asset, limit sdk.Uint, window time.Duration) error

RegisterAsset indicates that the specified asset is supported by the given chain

func (Keeper) RegisterFee added in v0.15.0

func (k Keeper) RegisterFee(ctx sdk.Context, chain exported.Chain, feeInfo exported.FeeInfo) error

RegisterFee registers the fee info for an asset on a chain

func (Keeper) RemoveChainMaintainer

func (k Keeper) RemoveChainMaintainer(ctx sdk.Context, chain exported.Chain, address sdk.ValAddress) error

RemoveChainMaintainer removes the given address from the given chain's maintainers

func (Keeper) SetChain

func (k Keeper) SetChain(ctx sdk.Context, chain exported.Chain)

SetChain sets the specification for a supported chain

func (Keeper) SetChainMaintainerState added in v0.25.0

func (k Keeper) SetChainMaintainerState(ctx sdk.Context, maintainerState exported.MaintainerState) error

SetChainMaintainerState sets the given chain's maintainer state

func (Keeper) SetMessageExecuted added in v0.32.0

func (k Keeper) SetMessageExecuted(ctx sdk.Context, id string) error

SetMessageExecuted sets the general message as executed

func (Keeper) SetMessageFailed added in v0.32.0

func (k Keeper) SetMessageFailed(ctx sdk.Context, id string) error

SetMessageFailed sets the general message as failed

func (Keeper) SetMessageSent added in v0.32.0

func (k Keeper) SetMessageSent(ctx sdk.Context, id string) error

SetMessageSent sets the general message as sent

func (Keeper) SetNewMessage added in v0.31.0

func (k Keeper) SetNewMessage(ctx sdk.Context, m exported.GeneralMessage) error

SetNewMessage sets the given general message. If the messages is approved, adds the message ID to approved messages store

func (Keeper) SetParams

func (k Keeper) SetParams(ctx sdk.Context, p types.Params)

SetParams sets the nexus module's parameters

func (Keeper) SetRateLimit added in v0.27.0

func (k Keeper) SetRateLimit(ctx sdk.Context, chainName exported.ChainName, limit sdk.Coin, window time.Duration) error

SetRateLimit sets a rate limit for the given chain and asset. If max uint256 is provided as a limit, it's treated as a rate limit being infinite/not being set.

func (*Keeper) SetRouter added in v0.9.0

func (k *Keeper) SetRouter(router types.Router)

SetRouter sets the nexus router. It will panic if called more than once

func (Keeper) SubTransferFee added in v0.11.1

func (k Keeper) SubTransferFee(ctx sdk.Context, coin sdk.Coin)

SubTransferFee subtracts coin from transfer fee

func (Keeper) ValidateAddress added in v0.32.0

func (k Keeper) ValidateAddress(ctx sdk.Context, address exported.CrossChainAddress) error

ValidateAddress validates the given cross chain address

type Querier added in v0.18.0

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

Querier implements the grpc queries for the nexus module

func NewGRPCQuerier added in v0.18.0

func NewGRPCQuerier(k Keeper, a types.AxelarnetKeeper) Querier

NewGRPCQuerier creates a new nexus Querier

func (Querier) Assets added in v0.18.0

Assets returns the registered assets of a chain

func (Querier) ChainMaintainers added in v0.26.3

ChainMaintainers returns the chain maintainers for a given chain

func (Querier) ChainState added in v0.18.0

ChainState returns the chain state in the network

func (Querier) Chains added in v0.18.0

Chains returns the chains registered on the network

func (Querier) ChainsByAsset added in v0.18.0

ChainsByAsset returns all chains that an asset is registered on

func (Querier) FeeInfo added in v0.18.0

FeeInfo returns the fee info for an asset on a specific chain

func (Querier) LatestDepositAddress added in v0.18.0

LatestDepositAddress returns the deposit address for the provided recipient

func (Querier) Message added in v0.32.0

Message queries the general message for a given message ID

func (Querier) RecipientAddress added in v0.19.4

RecipientAddress returns the recipient address for a given deposit address

func (Querier) TransferFee added in v0.18.0

TransferFee returns the transfer fee for a cross chain transfer

func (Querier) TransferRateLimit added in v0.27.0

TransferRateLimit queries the transfer rate limit for a given chain and asset

func (Querier) TransfersForChain added in v0.18.0

TransfersForChain returns the transfers for a given chain

Jump to

Keyboard shortcuts

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