keeper

package
v0.0.0-...-dec079c Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2022 License: Apache-2.0 Imports: 17 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 bep3 MsgServer interface for the provided Keeper.

func NewQuerier

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

NewQuerier is the module level router for state queries

func NewQueryServerImpl

func NewQueryServerImpl(k Keeper) types.QueryServer

NewQueryServerImpl creates a new server for handling gRPC queries.

Types

type Keeper

type Keeper struct {
	Maccs map[string]bool
	// contains filtered or unexported fields
}

Keeper of the bep3 store

func NewKeeper

func NewKeeper(cdc codec.Codec, key sdk.StoreKey, sk types.BankKeeper, ak types.AccountKeeper,
	paramstore paramtypes.Subspace, maccs map[string]bool,
) Keeper

NewKeeper creates a bep3 keeper

func (Keeper) ClaimAtomicSwap

func (k Keeper) ClaimAtomicSwap(ctx sdk.Context, from sdk.AccAddress, swapID []byte, randomNumber []byte) error

ClaimAtomicSwap validates a claim attempt, and if successful, sends the escrowed amount and closes the AtomicSwap.

func (Keeper) CreateAtomicSwap

func (k Keeper) CreateAtomicSwap(ctx sdk.Context, randomNumberHash []byte, timestamp int64, heightSpan uint64,
	sender, recipient sdk.AccAddress, senderOtherChain, recipientOtherChain string,
	amount sdk.Coins, crossChain bool,
) error

CreateAtomicSwap creates a new atomic swap.

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) DeleteClosedAtomicSwapsFromLongtermStorage

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

DeleteClosedAtomicSwapsFromLongtermStorage removes swaps one week after completion.

func (Keeper) GetAllAssetSupplies

func (k Keeper) GetAllAssetSupplies(ctx sdk.Context) (supplies types.AssetSupplies)

GetAllAssetSupplies returns all asset supplies from the store

func (Keeper) GetAllAtomicSwaps

func (k Keeper) GetAllAtomicSwaps(ctx sdk.Context) (atomicSwaps types.AtomicSwaps)

GetAllAtomicSwaps returns all AtomicSwaps 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) GetAssetByCoinID

func (k Keeper) GetAssetByCoinID(ctx sdk.Context, coinID int64) (types.AssetParam, bool)

GetAssetByCoinID returns an asset by its denom

func (Keeper) GetAssetSupply

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

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

func (Keeper) GetAssets

func (k Keeper) GetAssets(ctx sdk.Context) (types.AssetParams, bool)

GetAssets returns a list containing all supported assets

func (Keeper) GetAtomicSwap

func (k Keeper) GetAtomicSwap(ctx sdk.Context, swapID []byte) (types.AtomicSwap, bool)

GetAtomicSwap gets an AtomicSwap from the store.

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) 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) (params types.Params)

GetParams returns the total set of bep3 parameters.

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) 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) InsertIntoByBlockIndex

func (k Keeper) InsertIntoByBlockIndex(ctx sdk.Context, atomicSwap types.AtomicSwap)

InsertIntoByBlockIndex adds a swap ID and expiration time into the byBlock index.

func (Keeper) InsertIntoLongtermStorage

func (k Keeper) InsertIntoLongtermStorage(ctx sdk.Context, atomicSwap types.AtomicSwap)

InsertIntoLongtermStorage adds a swap ID and deletion time into the longterm storage index. Completed swaps are stored for 1 week.

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) IterateAtomicSwaps

func (k Keeper) IterateAtomicSwaps(ctx sdk.Context, cb func(atomicSwap types.AtomicSwap) (stop bool))

IterateAtomicSwaps provides an iterator over all stored AtomicSwaps. For each AtomicSwap, cb will be called. If cb returns true, the iterator will close and stop.

func (Keeper) IterateAtomicSwapsByBlock

func (k Keeper) IterateAtomicSwapsByBlock(ctx sdk.Context, inclusiveCutoffTime uint64, cb func(swapID []byte) (stop bool))

IterateAtomicSwapsByBlock provides an iterator over AtomicSwaps ordered by AtomicSwap expiration block For each AtomicSwap cb will be called. If cb returns true the iterator will close and stop.

func (Keeper) IterateAtomicSwapsLongtermStorage

func (k Keeper) IterateAtomicSwapsLongtermStorage(ctx sdk.Context, inclusiveCutoffTime uint64,
	cb func(swapID []byte) (stop bool),
)

IterateAtomicSwapsLongtermStorage provides an iterator over AtomicSwaps ordered by deletion height. For each AtomicSwap cb will be called. If cb returns true the iterator will close and stop.

func (Keeper) Logger

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

Logger returns a module-specific logger.

func (Keeper) RefundAtomicSwap

func (k Keeper) RefundAtomicSwap(ctx sdk.Context, from sdk.AccAddress, swapID []byte) error

RefundAtomicSwap refunds an AtomicSwap, sending assets to the original sender and closing the AtomicSwap.

func (Keeper) RemoveAtomicSwap

func (k Keeper) RemoveAtomicSwap(ctx sdk.Context, swapID []byte)

RemoveAtomicSwap removes an AtomicSwap from the AtomicSwapKeyPrefix.

func (Keeper) RemoveFromByBlockIndex

func (k Keeper) RemoveFromByBlockIndex(ctx sdk.Context, atomicSwap types.AtomicSwap)

RemoveFromByBlockIndex removes an AtomicSwap from the byBlock index.

func (Keeper) RemoveFromLongtermStorage

func (k Keeper) RemoveFromLongtermStorage(ctx sdk.Context, atomicSwap types.AtomicSwap)

RemoveFromLongtermStorage removes a swap from the into the longterm storage index

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) SetAtomicSwap

func (k Keeper) SetAtomicSwap(ctx sdk.Context, atomicSwap types.AtomicSwap)

SetAtomicSwap puts the AtomicSwap into the store, and updates any indexes.

func (Keeper) SetParams

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

SetParams sets the bep3 parameters to the param space.

func (Keeper) SetPreviousBlockTime

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

SetPreviousBlockTime set the time of the previous block

func (Keeper) UpdateExpiredAtomicSwaps

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

UpdateExpiredAtomicSwaps finds all AtomicSwaps that are past (or at) their ending times and expires them.

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