keeper

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2021 License: Apache-2.0 Imports: 18 Imported by: 32

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl added in v1.2.0

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 added in v1.4.0

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.Marshaler,
	key sdk.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 added in v1.4.0

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

MaxRequestTimeout returns the maximum request timeout

func (Keeper) AssetSupplies added in v1.4.0

func (Keeper) AssetSupply added in v1.4.0

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 added in v1.4.0

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 added in v1.4.0

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

DecrementCurrentAssetSupply decrement an asset's supply by the coin

func (Keeper) DecrementIncomingAssetSupply added in v1.4.0

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

DecrementIncomingAssetSupply decrements an asset's incoming supply

func (Keeper) DecrementOutgoingAssetSupply added in v1.4.0

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 added in v1.4.0

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 added in v1.4.0

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

GetAllAssetSupplies returns all asset supplies from the store

func (Keeper) GetAsset added in v1.4.0

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 added in v1.4.0

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 added in v1.4.0

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

GetAssets returns a list containing all supported assets

func (Keeper) GetAuthorizedAddresses added in v1.4.0

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 added in v1.4.0

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

GetDeputyAddress returns the deputy address for the input denom

func (Keeper) GetFixedFee added in v1.4.0

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 added in v1.4.0

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

GetMaxBlockLock returns the maximum block lock

func (Keeper) GetMaxSwapAmount added in v1.4.0

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

GetMaxSwapAmount returns the maximum swap amount

func (Keeper) GetMinBlockLock added in v1.4.0

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

GetMinBlockLock returns the minimum block lock

func (Keeper) GetMinSwapAmount added in v1.4.0

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

GetMinSwapAmount returns the minimum swap amount

func (Keeper) GetParams added in v1.4.0

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

GetParams gets all parameteras as types.Params

func (Keeper) GetPreviousBlockTime added in v1.4.0

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

GetPreviousBlockTime get the blocktime for the previous block

func (Keeper) GetSupplyLimit added in v1.4.0

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 added in v1.4.0

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

IncrementCurrentAssetSupply increments an asset's supply by the coin

func (Keeper) IncrementIncomingAssetSupply added in v1.4.0

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

IncrementIncomingAssetSupply increments an asset's incoming supply

func (Keeper) IncrementOutgoingAssetSupply added in v1.4.0

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

IncrementOutgoingAssetSupply increments an asset's outgoing supply

func (Keeper) IterateAssetSupplies added in v1.4.0

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 added in v1.4.0

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 added in v1.4.0

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

SetAsset sets an asset in the params

func (Keeper) SetAssetSupply added in v1.4.0

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 added in v1.4.0

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

SetParams sets the params to the store

func (Keeper) SetPreviousBlockTime added in v1.4.0

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

SetPreviousBlockTime set the time of the previous block

func (Keeper) UpdateTimeBasedSupplyLimits added in v1.4.0

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 added in v1.4.0

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