Documentation ¶
Index ¶
- func NewMsgServerImpl(keeper bep3Keeper) types.MsgServer
- func NewQuerier(keeper Keeper) sdk.Querier
- type Keeper
- func (k Keeper) AssetSupplies(c context.Context, req *types.QueryAssetSuppliesRequest) (*types.QueryAssetSuppliesResponse, error)
- func (k Keeper) AssetSupply(c context.Context, req *types.QueryAssetSupplyRequest) (*types.QueryAssetSupplyResponse, error)
- func (k Keeper) ClaimAtomicSwapState(ctx sdk.Context, from sdk.AccAddress, swapID []byte, randomNumber []byte) (*sdk.Result, error)
- func (k Keeper) CreateAtomicSwapState(ctx sdk.Context, randomNumberHash []byte, timestamp, swapTimeSpanMin int64, ...) (*sdk.Result, error)
- func (k Keeper) CreateNewAssetSupply(ctx sdk.Context, denom string) types.AssetSupply
- func (k Keeper) DecrementCurrentAssetSupply(ctx sdk.Context, coin sdk.Coin) error
- func (k Keeper) DecrementIncomingAssetSupply(ctx sdk.Context, coin sdk.Coin) error
- func (k Keeper) DecrementOutgoingAssetSupply(ctx sdk.Context, coin sdk.Coin) error
- func (k Keeper) DeleteClosedAtomicSwapsFromLongtermStorage(ctx sdk.Context)
- func (k Keeper) EnsureModuleAccountPermissions(ctx sdk.Context) error
- func (k Keeper) GetAllAssetSupplies(ctx sdk.Context) (supplies types.AssetSupplies)
- func (k Keeper) GetAllAtomicSwaps(ctx sdk.Context) (atomicSwaps types.AtomicSwaps)
- func (k Keeper) GetAsset(ctx sdk.Context, denom string) (types.AssetParam, error)
- func (k Keeper) GetAssetByCoinID(ctx sdk.Context, coinID int64) (types.AssetParam, bool)
- func (k Keeper) GetAssetSupply(ctx sdk.Context, denom string) (types.AssetSupply, bool)
- func (k Keeper) GetAssets(ctx sdk.Context) (types.AssetParams, bool)
- func (k Keeper) GetAtomicSwap(ctx sdk.Context, swapID []byte) (types.AtomicSwap, bool)
- func (k Keeper) GetDeputyAddress(ctx sdk.Context, denom string) (sdk.AccAddress, error)
- func (k Keeper) GetFixedFee(ctx sdk.Context, denom string) (sdk.Int, error)
- func (k Keeper) GetMaxSwapAmount(ctx sdk.Context, denom string) (sdk.Int, error)
- func (k Keeper) GetMinSwapAmount(ctx sdk.Context, denom string) (sdk.Int, error)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPreviousBlockTime(ctx sdk.Context) (blockTime time.Time, found bool)
- func (k Keeper) GetSupplyLimit(ctx sdk.Context, denom string) (types.SupplyLimit, error)
- func (k Keeper) GetSwapTime(ctx sdk.Context, denom string) (int64, error)
- func (k Keeper) GetTimeSpanMin(ctx sdk.Context, denom string) (int64, error)
- func (k Keeper) IncrementCurrentAssetSupply(ctx sdk.Context, coin sdk.Coin) error
- func (k Keeper) IncrementIncomingAssetSupply(ctx sdk.Context, coin sdk.Coin) error
- func (k Keeper) IncrementOutgoingAssetSupply(ctx sdk.Context, coin sdk.Coin) error
- func (k Keeper) InsertIntoByTimestamp(ctx sdk.Context, atomicSwap types.AtomicSwap)
- func (k Keeper) InsertIntoLongtermStorage(ctx sdk.Context, atomicSwap types.AtomicSwap)
- func (k Keeper) IterateAssetSupplies(ctx sdk.Context, cb func(supply types.AssetSupply) (stop bool))
- func (k Keeper) IterateAtomicSwaps(ctx sdk.Context, cb func(atomicSwap types.AtomicSwap) (stop bool))
- func (k Keeper) IterateAtomicSwapsByBlock(ctx sdk.Context, inclusiveCutoffTime int64, cb func(swapID []byte) (stop bool))
- func (k Keeper) IterateAtomicSwapsLongtermStorage(ctx sdk.Context, inclusiveCutoffTime uint64, ...)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) RefundAtomicSwapState(ctx sdk.Context, from sdk.AccAddress, swapID []byte) (*sdk.Result, error)
- func (k Keeper) RemoveAtomicSwap(ctx sdk.Context, swapID []byte)
- func (k Keeper) RemoveFromByTimestamp(ctx sdk.Context, atomicSwap types.AtomicSwap)
- func (k Keeper) RemoveFromLongtermStorage(ctx sdk.Context, atomicSwap types.AtomicSwap)
- func (k Keeper) SetAsset(ctx sdk.Context, asset types.AssetParam)
- func (k Keeper) SetAssetSupply(ctx sdk.Context, supply types.AssetSupply, denom string)
- func (k Keeper) SetAtomicSwap(ctx sdk.Context, atomicSwap types.AtomicSwap)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPreviousBlockTime(ctx sdk.Context, blockTime time.Time)
- func (k Keeper) Swap(c context.Context, req *types.QuerySwapRequest) (*types.QuerySwapResponse, error)
- func (k Keeper) Swaps(c context.Context, req *types.QuerySwapsRequest) (*types.QuerySwapsResponse, error)
- func (k Keeper) UpdateExpiredAtomicSwaps(ctx sdk.Context)
- func (k Keeper) UpdateTimeBasedSupplyLimits(ctx sdk.Context)
- func (k Keeper) ValidateLiveAsset(ctx sdk.Context, coin sdk.Coin) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶ added in v0.3.0
func NewQuerier ¶
NewQuerier is the module level router for state queries
Types ¶
type Keeper ¶
Keeper of the bep3 store
func NewKeeper ¶
func NewKeeper(cdc codec.BinaryMarshaler, key sdk.StoreKey, bk types.BankKeeper, ak types.AccountKeeper, paramstore paramtypes.Subspace, maccs map[string]bool) Keeper
NewKeeper creates a bep3 keeper
func (Keeper) AssetSupplies ¶ added in v0.3.0
func (k Keeper) AssetSupplies(c context.Context, req *types.QueryAssetSuppliesRequest) (*types.QueryAssetSuppliesResponse, error)
func (Keeper) AssetSupply ¶ added in v0.3.0
func (k Keeper) AssetSupply(c context.Context, req *types.QueryAssetSupplyRequest) (*types.QueryAssetSupplyResponse, error)
func (Keeper) ClaimAtomicSwapState ¶ added in v0.3.0
func (k Keeper) ClaimAtomicSwapState(ctx sdk.Context, from sdk.AccAddress, swapID []byte, randomNumber []byte) (*sdk.Result, error)
claimAtomicSwap validates a claim attempt, and if successful, sends the escrowed amount and closes the AtomicSwap.
func (Keeper) CreateAtomicSwapState ¶ added in v0.3.0
func (k Keeper) CreateAtomicSwapState(ctx sdk.Context, randomNumberHash []byte, timestamp, swapTimeSpanMin int64, sender, recipient sdk.AccAddress, senderOtherChain, recipientOtherChain string, amount sdk.Coins, crossChain bool) (*sdk.Result, error)
createAtomicSwap creates a new atomic swap.
func (Keeper) CreateNewAssetSupply ¶
CreateNewAssetSupply creates a new AssetSupply in the store for the input denom
func (Keeper) DecrementCurrentAssetSupply ¶
DecrementCurrentAssetSupply decrement an asset's supply by the coin
func (Keeper) DecrementIncomingAssetSupply ¶
DecrementIncomingAssetSupply decrements an asset's incoming supply
func (Keeper) DecrementOutgoingAssetSupply ¶
DecrementOutgoingAssetSupply decrements an asset's outgoing supply
func (Keeper) DeleteClosedAtomicSwapsFromLongtermStorage ¶
DeleteClosedAtomicSwapsFromLongtermStorage removes swaps one week after completion.
func (Keeper) EnsureModuleAccountPermissions ¶
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.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) GetAssetByCoinID ¶
GetAssetByCoinID returns an asset by its denom
func (Keeper) GetAssetSupply ¶
GetAssetSupply gets an asset's current supply from the store.
func (Keeper) GetAtomicSwap ¶
GetAtomicSwap gets an AtomicSwap from the store.
func (Keeper) GetDeputyAddress ¶
GetDeputyAddress returns the deputy address for the input denom
func (Keeper) GetFixedFee ¶
GetFixedFee returns the fixed fee for incoming swaps
func (Keeper) GetMaxSwapAmount ¶
GetMaxSwapAmount returns the maximum swap amount
func (Keeper) GetMinSwapAmount ¶
GetMinSwapAmount returns the minimum swap amount
func (Keeper) GetPreviousBlockTime ¶
GetPreviousBlockTime get the block time for the previous block
func (Keeper) GetSupplyLimit ¶
GetSupplyLimit returns the supply limit for the input denom
func (Keeper) GetSwapTime ¶ added in v0.2.0
GetSwapTime returns the swap creation block Unix seconds timestamp
func (Keeper) GetTimeSpanMin ¶ added in v0.3.0
GetTimeSpanMin returns the swap minutes allowance
func (Keeper) IncrementCurrentAssetSupply ¶
IncrementCurrentAssetSupply increments an asset's supply by the coin
func (Keeper) IncrementIncomingAssetSupply ¶
IncrementIncomingAssetSupply increments an asset's incoming supply
func (Keeper) IncrementOutgoingAssetSupply ¶
IncrementOutgoingAssetSupply increments an asset's outgoing supply
func (Keeper) InsertIntoByTimestamp ¶ added in v0.2.0
func (k Keeper) InsertIntoByTimestamp(ctx sdk.Context, atomicSwap types.AtomicSwap)
InsertIntoByTimestamp adds a swap ID and expiration time into the byTimestamp 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 roughly 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 int64, 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) RefundAtomicSwapState ¶ added in v0.3.0
func (k Keeper) RefundAtomicSwapState(ctx sdk.Context, from sdk.AccAddress, swapID []byte) (*sdk.Result, error)
refundAtomicSwap refunds an AtomicSwap, sending assets to the original sender and closing the AtomicSwap.
func (Keeper) RemoveAtomicSwap ¶
RemoveAtomicSwap removes an AtomicSwap from the AtomicSwapKeyPrefix.
func (Keeper) RemoveFromByTimestamp ¶ added in v0.2.0
func (k Keeper) RemoveFromByTimestamp(ctx sdk.Context, atomicSwap types.AtomicSwap)
RemoveFromByTimestamp removes an AtomicSwap from the byTimestamp 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 ¶
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) SetPreviousBlockTime ¶
SetPreviousBlockTime set the time of the previous block
func (Keeper) Swap ¶ added in v0.3.0
func (k Keeper) Swap(c context.Context, req *types.QuerySwapRequest) (*types.QuerySwapResponse, error)
func (Keeper) Swaps ¶ added in v0.3.0
func (k Keeper) Swaps(c context.Context, req *types.QuerySwapsRequest) (*types.QuerySwapsResponse, error)
func (Keeper) UpdateExpiredAtomicSwaps ¶
UpdateExpiredAtomicSwaps finds all AtomicSwaps that are past (or at) their ending times and expires them.
func (Keeper) UpdateTimeBasedSupplyLimits ¶
UpdateTimeBasedSupplyLimits updates the time based supply for each asset, resetting it if the current time window has elapsed.