keeper

package
v1.7.4 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the HTLC MsgServer interface for the provided Keeper.

func NewQuerier

func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier

NewQuerier creates a new HTLC Querier instance

func ParamKeyTable

func ParamKeyTable() paramstypes.KeyTable

ParamKeyTable for htlc module

Types

type Keeper

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

Keeper defines the HTLC keeper

func NewKeeper

func NewKeeper(
	cdc codec.Codec,
	key storetypes.StoreKey,
	paramSpace paramstypes.Subspace,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
	blockedAddrs map[string]bool,
) Keeper

NewKeeper creates a new HTLC Keeper instance

func (Keeper) AddHTLCToExpiredQueue

func (k Keeper) AddHTLCToExpiredQueue(ctx sdk.Context, expirationHeight uint64, id tmbytes.HexBytes)

AddHTLCToExpiredQueue adds the specified HTLC to the expiration queue

func (Keeper) AssetParams

func (k Keeper) AssetParams(ctx sdk.Context) (res []types.AssetParam)

MaxRequestTimeout returns the maximum request timeout

func (Keeper) ClaimHTLC

func (k Keeper) ClaimHTLC(
	ctx sdk.Context,
	id tmbytes.HexBytes,
	secret tmbytes.HexBytes,
) (
	string,
	bool,
	types.SwapDirection,
	error,
)

ClaimHTLC claims the specified HTLC with the given secret

func (Keeper) CreateHTLC

func (k Keeper) CreateHTLC(
	ctx sdk.Context,
	sender sdk.AccAddress,
	to sdk.AccAddress,
	receiverOnOtherChain string,
	senderOnOtherChain string,
	amount sdk.Coins,
	hashLock tmbytes.HexBytes,
	timestamp uint64,
	timeLock uint64,
	transfer bool,
) (
	id tmbytes.HexBytes,
	err error,
)

CreateHTLC creates an HTLC

func (Keeper) CreateNewAssetSupply

func (k Keeper) CreateNewAssetSupply(ctx sdk.Context, denom string) types.AssetSupply

CreateNewAssetSupply creates a new AssetSupply in the store for the input denom

func (Keeper) DecrementCurrentAssetSupply

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

DecrementCurrentAssetSupply decrement an asset's supply by the coin

func (Keeper) DecrementIncomingAssetSupply

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

DecrementIncomingAssetSupply decrements an asset's incoming supply

func (Keeper) DecrementOutgoingAssetSupply

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

DecrementOutgoingAssetSupply decrements an asset's outgoing supply

func (Keeper) DeleteHTLCFromExpiredQueue

func (k Keeper) DeleteHTLCFromExpiredQueue(ctx sdk.Context, expirationHeight uint64, id tmbytes.HexBytes)

DeleteHTLCFromExpiredQueue removes the specified HTLC from the expiration queue

func (Keeper) EnsureModuleAccountPermissions

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

EnsureModuleAccountPermissions syncs the bep3 module account's permissions with those in the supply keeper.

func (Keeper) GetAllAssetSupplies

func (k Keeper) GetAllAssetSupplies(ctx sdk.Context) (supplies []types.AssetSupply)

GetAllAssetSupplies returns all asset supplies from the store

func (Keeper) GetAsset

func (k Keeper) GetAsset(ctx sdk.Context, denom string) (types.AssetParam, error)

GetAsset returns the asset param associated with the input denom

func (Keeper) GetAssetSupply

func (k Keeper) GetAssetSupply(ctx sdk.Context, denom string) (assetSupply types.AssetSupply, found bool)

GetAssetSupply gets an asset's current supply from the store.

func (Keeper) GetAssets

func (k Keeper) GetAssets(ctx sdk.Context) ([]types.AssetParam, bool)

GetAssets returns a list containing all supported assets

func (Keeper) GetAuthorizedAddresses

func (k Keeper) GetAuthorizedAddresses(ctx sdk.Context) []sdk.AccAddress

GetAuthorizedAddresses returns a list of addresses that have special authorization within this module, eg all the deputies.

func (Keeper) GetDeputyAddress

func (k Keeper) GetDeputyAddress(ctx sdk.Context, denom string) (sdk.AccAddress, error)

GetDeputyAddress returns the deputy address for the input denom

func (Keeper) GetFixedFee

func (k Keeper) GetFixedFee(ctx sdk.Context, denom string) (sdk.Int, error)

GetFixedFee returns the fixed fee for incoming swaps

func (Keeper) GetHTLC

func (k Keeper) GetHTLC(ctx sdk.Context, id tmbytes.HexBytes) (htlc types.HTLC, found bool)

GetHTLC retrieves the specified HTLC

func (Keeper) GetHTLCAccount

func (k Keeper) GetHTLCAccount(ctx sdk.Context) authtypes.ModuleAccountI

GetHTLCAccount returns the HTLC module account

func (Keeper) GetMaxBlockLock

func (k Keeper) GetMaxBlockLock(ctx sdk.Context, denom string) (uint64, error)

GetMaxBlockLock returns the maximum block lock

func (Keeper) GetMaxSwapAmount

func (k Keeper) GetMaxSwapAmount(ctx sdk.Context, denom string) (sdk.Int, error)

GetMaxSwapAmount returns the maximum swap amount

func (Keeper) GetMinBlockLock

func (k Keeper) GetMinBlockLock(ctx sdk.Context, denom string) (uint64, error)

GetMinBlockLock returns the minimum block lock

func (Keeper) GetMinSwapAmount

func (k Keeper) GetMinSwapAmount(ctx sdk.Context, denom string) (sdk.Int, error)

GetMinSwapAmount returns the minimum swap amount

func (Keeper) GetParams

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

GetParams gets all parameteras as types.Params

func (Keeper) GetPreviousBlockTime

func (k Keeper) GetPreviousBlockTime(ctx sdk.Context) (blockTime time.Time, found bool)

GetPreviousBlockTime get the blocktime for the previous block

func (Keeper) GetSupplyLimit

func (k Keeper) GetSupplyLimit(ctx sdk.Context, denom string) (types.SupplyLimit, error)

GetSupplyLimit returns the supply limit for the input denom

func (Keeper) HTLC

func (Keeper) HasHTLC

func (k Keeper) HasHTLC(ctx sdk.Context, id tmbytes.HexBytes) bool

HasHTLC checks if the given HTLC exists

func (Keeper) IncrementCurrentAssetSupply

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

IncrementCurrentAssetSupply increments an asset's supply by the coin

func (Keeper) IncrementIncomingAssetSupply

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

IncrementIncomingAssetSupply increments an asset's incoming supply

func (Keeper) IncrementOutgoingAssetSupply

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

IncrementOutgoingAssetSupply increments an asset's outgoing supply

func (Keeper) IterateAssetSupplies

func (k Keeper) IterateAssetSupplies(
	ctx sdk.Context,
	cb func(supply types.AssetSupply) (stop bool),
)

IterateAssetSupplies provides an iterator over all stored AssetSupplies.

func (Keeper) IterateHTLCExpiredQueueByHeight

func (k Keeper) IterateHTLCExpiredQueueByHeight(
	ctx sdk.Context, height uint64,
	op func(id tmbytes.HexBytes, h types.HTLC) (stop bool),
)

IterateHTLCExpiredQueueByHeight iterates through the HTLC expiration queue by the specified height

func (Keeper) IterateHTLCs

func (k Keeper) IterateHTLCs(
	ctx sdk.Context,
	op func(id tmbytes.HexBytes, h types.HTLC) (stop bool),
)

IterateHTLCs iterates through the HTLCs

func (Keeper) Logger

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

Logger returns a module-specific logger

func (Keeper) Params

func (Keeper) RefundHTLC

func (k Keeper) RefundHTLC(ctx sdk.Context, h types.HTLC, id tmbytes.HexBytes) error

RefundHTLC refunds the specified HTLC

func (Keeper) SetAsset

func (k Keeper) SetAsset(ctx sdk.Context, asset types.AssetParam)

SetAsset sets an asset in the params

func (Keeper) SetAssetSupply

func (k Keeper) SetAssetSupply(ctx sdk.Context, supply types.AssetSupply, denom string)

SetAssetSupply updates an asset's supply

func (Keeper) SetHTLC

func (k Keeper) SetHTLC(ctx sdk.Context, htlc types.HTLC, id tmbytes.HexBytes)

SetHTLC sets the given HTLC

func (Keeper) SetParams

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

SetParams sets the params to the store

func (Keeper) SetPreviousBlockTime

func (k Keeper) SetPreviousBlockTime(ctx sdk.Context, blockTime time.Time)

SetPreviousBlockTime set the time of the previous block

func (Keeper) UpdateTimeBasedSupplyLimits

func (k Keeper) UpdateTimeBasedSupplyLimits(ctx sdk.Context)

UpdateTimeBasedSupplyLimits updates the time based supply for each asset, resetting it if the current time window has elapsed.

func (Keeper) ValidateLiveAsset

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

ValidateLiveAsset checks if an asset is both supported and active

Jump to

Keyboard shortcuts

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