keeper

package
v3.0.0-rc2 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2025 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreatePricesMap

func CreatePricesMap(prices []feedstypes.Price) map[string]feedstypes.Price

CreatePricesMap creates a map of prices with signal ID as the key

func ExportGenesis

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

ExportGenesis returns the module's exported genesis

func GenerateNewPrices

func GenerateNewPrices(
	signalDeviations []types.SignalDeviation,
	latestPricesMap map[string]feedstypes.Price,
	feedsPricesMap map[string]feedstypes.Price,
	timestamp int64,
	sendAll bool,
) []feedstypes.Price

GenerateNewPrices generates new prices based on the current prices and signal deviations.

func InitGenesis

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

InitGenesis initializes the module's state from a provided genesis state.

func IsOutOfGasError

func IsOutOfGasError(err any) (bool, string)

IsOutOfGasError checks if the error object is an out of gas or gas overflow error type

func IsValidPortID

func IsValidPortID(portID string) bool

IsValidPortID checks if a given port ID is valid. It ensures that the port ID starts with the predefined prefix (portIDPrefix).

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the x/tunnel MsgServer interface.

func NewQueryServer

func NewQueryServer(k Keeper) types.QueryServer

func PortIDForTunnel

func PortIDForTunnel(tunnelID uint64) string

PortIDForTunnel generates a unique port ID for a given tunnel ID. It concatenates a predefined prefix (portIDPrefix) with the tunnel ID.

Types

type Keeper

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

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	key storetypes.StoreKey,
	authKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	feedsKeeper types.FeedsKeeper,
	bandtssKeeper types.BandtssKeeper,
	channelKeeper types.ChannelKeeper,
	ics4Wrapper types.ICS4Wrapper,
	portKeeper types.PortKeeper,
	scopedKeeper types.ScopedKeeper,
	authority string,
) Keeper

NewKeeper creates a new tunnel Keeper instance

func (Keeper) ActivateTunnel

func (k Keeper) ActivateTunnel(ctx sdk.Context, tunnelID uint64) error

ActivateTunnel activates a tunnel

func (Keeper) AddTunnel

func (k Keeper) AddTunnel(
	ctx sdk.Context,
	route types.RouteI,
	signalDeviations []types.SignalDeviation,
	interval uint64,
	creator sdk.AccAddress,
) (*types.Tunnel, error)

AddTunnel adds a new tunnel

func (Keeper) AuthenticateCapability

func (k Keeper) AuthenticateCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) bool

AuthenticateCapability wraps the scopedKeeper's AuthenticateCapability function

func (Keeper) ClaimCapability

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

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

func (Keeper) CreatePacket

func (k Keeper) CreatePacket(
	ctx sdk.Context,
	tunnelID uint64,
	prices []feedstypes.Price,
) (types.Packet, error)

CreatePacket creates a new packet of the given tunnel. Creating a packet charges the base packet fee to the tunnel's fee payer.

func (Keeper) DeactivateTunnel

func (k Keeper) DeactivateTunnel(ctx sdk.Context, tunnelID uint64) error

DeactivateTunnel deactivates a tunnel

func (Keeper) DeductBasePacketFee

func (k Keeper) DeductBasePacketFee(ctx sdk.Context, feePayer sdk.AccAddress) error

DeductBasePacketFee deducts the base packet fee from the fee payer of the packet

func (Keeper) DeleteActiveTunnelID

func (k Keeper) DeleteActiveTunnelID(ctx sdk.Context, tunnelID uint64)

DeleteActiveTunnelID deletes the active tunnel ID from the store

func (Keeper) DeleteDeposit

func (k Keeper) DeleteDeposit(ctx sdk.Context, tunnelID uint64, depositorAddr sdk.AccAddress)

DeleteDeposit deletes a deposit from the store

func (Keeper) DepositToTunnel

func (k Keeper) DepositToTunnel(
	ctx sdk.Context,
	tunnelID uint64,
	depositor sdk.AccAddress,
	depositAmount sdk.Coins,
) error

DepositToTunnel deposits to a tunnel

func (Keeper) GenerateTunnelAccount

func (k Keeper) GenerateTunnelAccount(ctx sdk.Context, key string) (sdk.AccAddress, error)

GenerateTunnelAccount generates a new tunnel account for the given key

func (Keeper) GetActiveTunnelIDs

func (k Keeper) GetActiveTunnelIDs(ctx sdk.Context) []uint64

GetActiveTunnelIDs retrieves the active tunnel IDs from the store

func (Keeper) GetAllDeposits

func (k Keeper) GetAllDeposits(ctx sdk.Context) []types.Deposit

GetAllDeposits returns all deposits in the store

func (Keeper) GetAllLatestPrices

func (k Keeper) GetAllLatestPrices(ctx sdk.Context) []types.LatestPrices

GetAllLatestPrices gets all the latest prices from the store

func (Keeper) GetAuthority

func (k Keeper) GetAuthority() string

GetAuthority returns the x/tunnel module's authority.

func (Keeper) GetDeposit

func (k Keeper) GetDeposit(
	ctx sdk.Context,
	tunnelID uint64,
	depositorAddr sdk.AccAddress,
) (deposit types.Deposit, found bool)

GetDeposit retrieves a deposit by its tunnel ID and depositor address

func (Keeper) GetDeposits

func (k Keeper) GetDeposits(ctx sdk.Context, tunnelID uint64) []types.Deposit

GetDeposits retrieves all deposits for the tunnel

func (Keeper) GetLatestPrices

func (k Keeper) GetLatestPrices(ctx sdk.Context, tunnelID uint64) (types.LatestPrices, error)

GetLatestPrices gets the latest prices from the store

func (Keeper) GetModuleBalance

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

GetModuleBalance returns the balance of the tunnel ModuleAccount

func (Keeper) GetPacket

func (k Keeper) GetPacket(ctx sdk.Context, tunnelID uint64, sequence uint64) (types.Packet, error)

GetPacket retrieves a packet by its tunnel ID and packet ID

func (Keeper) GetParams

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

GetParams returns the current x/tunnel module parameters.

func (Keeper) GetTotalFees

func (k Keeper) GetTotalFees(ctx sdk.Context) types.TotalFees

GetTotalFees retrieves the total fees from the store

func (Keeper) GetTunnel

func (k Keeper) GetTunnel(ctx sdk.Context, tunnelID uint64) (types.Tunnel, error)

GetTunnel retrieves a tunnel by its ID

func (Keeper) GetTunnelAccount

func (k Keeper) GetTunnelAccount(ctx sdk.Context) sdk.ModuleAccountI

GetTunnelAccount returns the tunnel ModuleAccount

func (Keeper) GetTunnelCount

func (k Keeper) GetTunnelCount(ctx sdk.Context) uint64

GetTunnelCount returns the current number of all tunnels ever existed

func (Keeper) GetTunnels

func (k Keeper) GetTunnels(ctx sdk.Context) []types.Tunnel

GetTunnels returns all tunnels

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) MustGetTunnel

func (k Keeper) MustGetTunnel(ctx sdk.Context, tunnelID uint64) types.Tunnel

MustGetTunnel retrieves a tunnel by its ID. Panics if the tunnel does not exist.

func (Keeper) ProduceActiveTunnelPackets

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

ProduceActiveTunnelPackets generates packets and sends packets to the destination route for all active tunnels

func (Keeper) ProducePacket

func (k Keeper) ProducePacket(
	ctx sdk.Context,
	tunnelID uint64,
	feedsPricesMap map[string]feedstypes.Price,
) error

ProducePacket generates a packet and sends it to the destination route

func (Keeper) SendIBCPacket

func (k Keeper) SendIBCPacket(
	ctx sdk.Context,
	route *types.IBCRoute,
	packet types.Packet,
	interval uint64,
) (types.PacketReceiptI, error)

SendIBCPacket sends IBC packet

func (Keeper) SendPacket

func (k Keeper) SendPacket(ctx sdk.Context, packet types.Packet) (err error)

SendPacket sends a packet to the destination route

func (Keeper) SendTSSPacket

func (k Keeper) SendTSSPacket(
	ctx sdk.Context,
	route *types.TSSRoute,
	packet types.Packet,
	feePayer sdk.AccAddress,
) (receipt types.PacketReceiptI, err error)

SendTSSPacket sends TSS packet

func (Keeper) SetActiveTunnelID

func (k Keeper) SetActiveTunnelID(ctx sdk.Context, tunnelID uint64)

SetActiveTunnelID sets the active tunnel ID in the store

func (Keeper) SetDeposit

func (k Keeper) SetDeposit(ctx sdk.Context, deposit types.Deposit)

SetDeposit sets a deposit in the store

func (Keeper) SetLatestPrices

func (k Keeper) SetLatestPrices(ctx sdk.Context, latestPrices types.LatestPrices)

SetLatestPrices sets the latest prices in the store

func (Keeper) SetModuleAccount

func (k Keeper) SetModuleAccount(ctx sdk.Context, acc sdk.ModuleAccountI)

SetModuleAccount sets a module account in the account keeper.

func (Keeper) SetPacket

func (k Keeper) SetPacket(ctx sdk.Context, packet types.Packet)

SetPacket sets a packet in the store

func (Keeper) SetParams

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

SetParams sets the x/tunnel module parameters.

func (Keeper) SetTotalFees

func (k Keeper) SetTotalFees(ctx sdk.Context, totalFee types.TotalFees)

SetTotalFees sets the total fees in the store

func (Keeper) SetTunnel

func (k Keeper) SetTunnel(ctx sdk.Context, tunnel types.Tunnel)

SetTunnel sets a tunnel in the store

func (Keeper) SetTunnelCount

func (k Keeper) SetTunnelCount(ctx sdk.Context, count uint64)

SetTunnelCount sets the tunnel count in the store

func (Keeper) UpdateSignalsAndInterval

func (k Keeper) UpdateSignalsAndInterval(
	ctx sdk.Context,
	tunnelID uint64,
	signalDeviations []types.SignalDeviation,
	interval uint64,
) error

UpdateSignalsAndInterval edits a tunnel and reset latest signal price interval.

func (Keeper) WithdrawFromTunnel

func (k Keeper) WithdrawFromTunnel(
	ctx sdk.Context,
	tunnelID uint64,
	amount sdk.Coins,
	withdrawer sdk.AccAddress,
) error

WithdrawFromTunnel withdraws a deposit from a tunnel

Jump to

Keyboard shortcuts

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