Documentation ¶
Index ¶
- Constants
- func BalanceCallback(k Keeper, ctx sdk.Context, args []byte, query icqueriestypes.Query, ...) error
- func ClaimCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ...) error
- func DelegateCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ...) error
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQueryServerImpl(keeper Keeper) types.QueryServer
- func RedelegateCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ...) error
- func SetWithdrawAddressCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ...) error
- func TransferFromNativeCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ...) error
- func TransferToNativeCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ...) error
- func UndelegateCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ...) error
- type DepositTWB
- type DrawResult
- type ICACallback
- type ICACallbacks
- func (c ICACallbacks) AddICACallback(id string, fn interface{}) icacallbackstypes.ICACallbackHandler
- func (c ICACallbacks) CallICACallback(ctx sdk.Context, id string, packet channeltypes.Packet, ...) error
- func (c ICACallbacks) HasICACallback(id string) bool
- func (c ICACallbacks) RegisterICACallbacks() icacallbackstypes.ICACallbackHandler
- type ICQCallback
- type ICQCallbacks
- func (c ICQCallbacks) AddICQCallback(id string, fn interface{}) icqueriestypes.QueryCallbacks
- func (c ICQCallbacks) CallICQCallback(ctx sdk.Context, id string, args []byte, query icqueriestypes.Query, ...) error
- func (c ICQCallbacks) HasICQCallback(id string) bool
- func (c ICQCallbacks) RegisterICQCallbacks() icqueriestypes.QueryCallbacks
- type Keeper
- func (k Keeper) AddDeposit(ctx sdk.Context, deposit *types.Deposit)
- func (k Keeper) AddPool(ctx sdk.Context, pool *types.Pool)
- func (k Keeper) AddPrize(ctx sdk.Context, prize types.Prize)
- func (k Keeper) AddWithdrawal(ctx sdk.Context, withdrawal types.Withdrawal)
- func (k Keeper) BlockPoolUpdates(ctx sdk.Context) (successCount, errorCount int)
- func (k Keeper) BlockPrizeUpdates(ctx sdk.Context) (successCount, errorCount int)
- func (k Keeper) BlockWithdrawalUpdates(ctx sdk.Context) (successCount, errorCount int)
- func (k Keeper) BroadcastICAMessages(ctx sdk.Context, poolID uint64, accountType string, msgs []sdk.Msg, ...) (uint64, error)
- func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error
- func (k Keeper) ClaimRewardsOnNativeChain(ctx sdk.Context, poolID uint64, drawID uint64) (*types.Draw, error)
- func (k Keeper) ClawBackPrize(ctx sdk.Context, poolID uint64, drawID uint64, prizeID uint64) error
- func (k Keeper) ComputeDepositsTWB(ctx sdk.Context, depositStartAt time.Time, drawAt time.Time, ...) []DepositTWB
- func (k Keeper) DelegateDepositOnNativeChain(ctx sdk.Context, poolID uint64, depositID uint64) error
- func (k Keeper) DequeueEPCBQueue(ctx sdk.Context, endTime time.Time) (prizes []types.PrizeIDs)
- func (k Keeper) DequeueMaturedWithdrawalQueue(ctx sdk.Context, endTime time.Time) (withdrawalsIDs []types.WithdrawalIDs)
- func (k Keeper) DistributePrizes(ctx sdk.Context, fc feeCollector, dRes DrawResult, draw types.Draw) error
- func (k Keeper) DrawsIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) EPCBQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- func (k Keeper) ExecuteDraw(ctx sdk.Context, poolID uint64, drawID uint64) (*types.Draw, error)
- func (k Keeper) GetChainID(ctx sdk.Context, connectionID string) (string, error)
- func (k Keeper) GetConnectionID(ctx sdk.Context, portId string) (string, error)
- func (k Keeper) GetLatestUnbondingCompletionTime(ctx sdk.Context, msgResponses [][]byte) (*time.Time, error)
- func (k Keeper) GetNextDepositID(ctx sdk.Context) uint64
- func (k Keeper) GetNextDepositIdAndIncrement(ctx sdk.Context) uint64
- func (k Keeper) GetNextPoolID(ctx sdk.Context) uint64
- func (k Keeper) GetNextPoolIDAndIncrement(ctx sdk.Context) uint64
- func (k Keeper) GetNextPrizeID(ctx sdk.Context) uint64
- func (k Keeper) GetNextPrizeIdAndIncrement(ctx sdk.Context) uint64
- func (k Keeper) GetNextWithdrawalID(ctx sdk.Context) uint64
- func (k Keeper) GetNextWithdrawalIdAndIncrement(ctx sdk.Context) uint64
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k Keeper) GetPool(ctx sdk.Context, poolID uint64) (types.Pool, error)
- func (k Keeper) GetPoolDeposit(ctx sdk.Context, poolID uint64, depositID uint64) (types.Deposit, error)
- func (k Keeper) GetPoolDraw(ctx sdk.Context, poolID uint64, drawID uint64) (types.Draw, error)
- func (k Keeper) GetPoolDrawPrize(ctx sdk.Context, poolID uint64, drawID uint64, prizeID uint64) (types.Prize, error)
- func (k Keeper) GetPoolForChainID(ctx sdk.Context, chainID string) (types.Pool, bool)
- func (k Keeper) GetPoolForConnectionID(ctx sdk.Context, connectionID string) (types.Pool, bool)
- func (k Keeper) GetPoolForControllerPortID(ctx sdk.Context, controllerPortID string) (types.Pool, bool)
- func (k Keeper) GetPoolWithdrawal(ctx sdk.Context, poolID uint64, withdrawalID uint64) (types.Withdrawal, error)
- func (k Keeper) GetPrizeIDsEPCBQueue(ctx sdk.Context, timestamp time.Time) (col types.PrizeIDsCollection)
- func (k Keeper) GetWithdrawalIDsMaturedQueue(ctx sdk.Context, timestamp time.Time) (col types.WithdrawalIDsCollection)
- func (k Keeper) HasPool(ctx sdk.Context, poolID uint64) bool
- func (k Keeper) HasPoolDraw(ctx sdk.Context, poolID uint64, drawID uint64) bool
- func (k Keeper) ICACallbackHandler() ICACallbacks
- func (k Keeper) ICQCallbackHandler() ICQCallbacks
- func (k Keeper) IterateDraws(ctx sdk.Context, cb func(draw types.Draw) bool)
- func (k Keeper) IteratePoolDraws(ctx sdk.Context, poolID uint64, cb func(draw types.Draw) bool)
- func (k Keeper) IteratePools(ctx sdk.Context, callback func(pool types.Pool) (stop bool))
- func (k Keeper) LaunchNewDraw(ctx sdk.Context, poolID uint64) (*types.Draw, error)
- func (k Keeper) ListAccountDeposits(ctx sdk.Context, addr sdk.Address) (deposits []types.Deposit)
- func (k Keeper) ListAccountPoolDeposits(ctx sdk.Context, addr sdk.Address, poolID uint64) (deposits []types.Deposit)
- func (k Keeper) ListAccountPoolPrizes(ctx sdk.Context, addr sdk.Address, poolID uint64) (prizes []types.Prize)
- func (k Keeper) ListAccountPoolWithdrawals(ctx sdk.Context, addr sdk.Address, poolID uint64) (withdrawals []types.Withdrawal)
- func (k Keeper) ListAccountPrizes(ctx sdk.Context, addr sdk.Address) (prizes []types.Prize)
- func (k Keeper) ListAccountWithdrawals(ctx sdk.Context, addr sdk.Address) (withdrawals []types.Withdrawal)
- func (k Keeper) ListDeposits(ctx sdk.Context) (deposits []types.Deposit)
- func (k Keeper) ListDraws(ctx sdk.Context) (draws []types.Draw)
- func (k Keeper) ListPoolDeposits(ctx sdk.Context, poolID uint64) (deposits []types.Deposit)
- func (k Keeper) ListPoolDrawPrizes(ctx sdk.Context, poolID uint64, drawID uint64) (prizes []types.Prize)
- func (k Keeper) ListPoolDraws(ctx sdk.Context, poolID uint64) (draws []types.Draw)
- func (k Keeper) ListPoolPrizes(ctx sdk.Context, poolID uint64) (prizes []types.Prize)
- func (k Keeper) ListPoolWithdrawals(ctx sdk.Context, poolID uint64) (withdrawals []types.Withdrawal)
- func (k Keeper) ListPools(ctx sdk.Context) (pools []types.Pool)
- func (k Keeper) ListPoolsToDraw(ctx sdk.Context) (pools []types.Pool)
- func (k Keeper) ListPrizes(ctx sdk.Context) (prizes []types.Prize)
- func (k Keeper) ListWithdrawals(ctx sdk.Context) (withdrawals []types.Withdrawal)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) MarshalClaimCallbackArgs(ctx sdk.Context, claimCallback types.ClaimRewardsCallback) ([]byte, error)
- func (k Keeper) MarshalDelegateCallbackArgs(ctx sdk.Context, delegateCallback types.DelegateCallback) ([]byte, error)
- func (k Keeper) MarshalRedelegateCallbackArgs(ctx sdk.Context, redelegateCallback types.RedelegateCallback) ([]byte, error)
- func (k Keeper) MarshalSetWithdrawAddressCallbackArgs(ctx sdk.Context, setWithdrawAddrCallback types.SetWithdrawAddressCallback) ([]byte, error)
- func (k Keeper) MarshalTransferFromNativeCallbackArgs(ctx sdk.Context, transferCallback types.TransferFromNativeCallback) ([]byte, error)
- func (k Keeper) MarshalTransferToNativeCallbackArgs(ctx sdk.Context, transferCallback types.TransferToNativeCallback) ([]byte, error)
- func (k Keeper) MarshalUndelegateCallbackArgs(ctx sdk.Context, undelegateCallback types.UndelegateCallback) ([]byte, error)
- func (k Keeper) MaturedWithdrawalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator
- func (k Keeper) NewFeeCollector(ctx sdk.Context, pool types.Pool) feeCollector
- func (k Keeper) OnClaimRewardsOnNativeChainCompleted(ctx sdk.Context, poolID uint64, drawID uint64, isError bool) (*types.Draw, error)
- func (k Keeper) OnDelegateDepositOnNativeChainCompleted(ctx sdk.Context, poolID uint64, depositID uint64, ...) error
- func (k Keeper) OnExecuteDrawCompeleted(ctx sdk.Context, pool *types.Pool, draw *types.Draw, err error) (*types.Draw, error)
- func (k Keeper) OnQueryRewardsOnNativeChainCompleted(ctx sdk.Context, poolID uint64, drawID uint64, coins sdk.Coins, isError bool) (*types.Draw, error)
- func (k Keeper) OnSetupPoolICACompleted(ctx sdk.Context, poolID uint64, icaType string, icaAddress string) (*types.Pool, error)
- func (k Keeper) OnSetupPoolWithdrawalAddressCompleted(ctx sdk.Context, poolID uint64) (*types.Pool, error)
- func (k Keeper) OnTransferDepositToNativeChainCompleted(ctx sdk.Context, poolID uint64, depositID uint64, isError bool) error
- func (k Keeper) OnTransferRewardsToLocalChainCompleted(ctx sdk.Context, poolID uint64, drawID uint64, isError bool) (*types.Draw, error)
- func (k Keeper) OnTransferWithdrawalToLocalChainCompleted(ctx sdk.Context, poolID uint64, withdrawalID uint64, isError bool) error
- func (k Keeper) OnUndelegateWithdrawalOnNativeChainCompleted(ctx sdk.Context, poolID uint64, withdrawalID uint64, ...) error
- func (k Keeper) PoolDrawsIterator(ctx sdk.Context, poolID uint64) sdk.Iterator
- func (k Keeper) PoolsIterator(ctx sdk.Context) sdk.Iterator
- func (k Keeper) QueryBalance(ctx sdk.Context, poolID uint64, drawID uint64) (*types.Draw, error)
- func (k Keeper) RegisterPool(ctx sdk.Context, ...) (uint64, error)
- func (k Keeper) RemoveDeposit(ctx sdk.Context, deposit *types.Deposit)
- func (k Keeper) RemovePrize(ctx sdk.Context, prize types.Prize) error
- func (k Keeper) RemoveWithdrawal(ctx sdk.Context, withdrawal types.Withdrawal) error
- func (k Keeper) RunDrawPrizes(ctx sdk.Context, prizePool sdk.Coin, prizeStrat types.PrizeStrategy, ...) (result DrawResult, err error)
- func (k Keeper) SetNextDepositID(ctx sdk.Context, depositId uint64)
- func (k Keeper) SetNextPoolID(ctx sdk.Context, poolId uint64)
- func (k Keeper) SetNextPrizeID(ctx sdk.Context, prizeID uint64)
- func (k Keeper) SetNextWithdrawalID(ctx sdk.Context, withdrawalID uint64)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPoolDraw(ctx sdk.Context, draw types.Draw)
- func (k Keeper) SetupPoolICA(ctx sdk.Context, poolID uint64) (*types.Pool, error)
- func (k Keeper) SetupPoolWithdrawalAddress(ctx sdk.Context, poolID uint64) (*types.Pool, error)
- func (k Keeper) TransferAmountFromPoolToNativeChain(ctx sdk.Context, poolID uint64, amount sdk.Coin) (*ibctransfertypes.MsgTransfer, *ibctransfertypes.MsgTransferResponse, error)
- func (k Keeper) TransferDepositToNativeChain(ctx sdk.Context, poolID uint64, depositID uint64) error
- func (k Keeper) TransferRewardsToLocalChain(ctx sdk.Context, poolID uint64, drawID uint64) (*types.Draw, error)
- func (k Keeper) TransferWithdrawalToLocalChain(ctx sdk.Context, poolID uint64, withdrawalID uint64) error
- func (k Keeper) UndelegateWithdrawalOnNativeChain(ctx sdk.Context, poolID uint64, withdrawalID uint64) error
- func (k Keeper) UnmarshalClaimCallbackArgs(ctx sdk.Context, claimCallback []byte) (*types.ClaimRewardsCallback, error)
- func (k Keeper) UnmarshalDelegateCallbackArgs(ctx sdk.Context, delegateCallback []byte) (*types.DelegateCallback, error)
- func (k Keeper) UnmarshalRedelegateCallbackArgs(ctx sdk.Context, redelegateCallback []byte) (*types.RedelegateCallback, error)
- func (k Keeper) UnmarshalSetWithdrawAddressCallbackArgs(ctx sdk.Context, setWithdrawAddrCallback []byte) (*types.SetWithdrawAddressCallback, error)
- func (k Keeper) UnmarshalTransferFromNativeCallbackArgs(ctx sdk.Context, transferCallback []byte) (*types.TransferFromNativeCallback, error)
- func (k Keeper) UnmarshalTransferToNativeCallbackArgs(ctx sdk.Context, transferCallback []byte) (*types.TransferToNativeCallback, error)
- func (k Keeper) UnmarshalUndelegateCallbackArgs(ctx sdk.Context, undelegateCallback []byte) (*types.UndelegateCallback, error)
- func (k Keeper) UnsafeKillPool(ctx sdk.Context, poolID uint64) (types.Pool, error)
- func (k Keeper) UpdateDepositStatus(ctx sdk.Context, poolID uint64, depositID uint64, status types.DepositState, ...)
- func (k Keeper) UpdatePool(ctx sdk.Context, poolID uint64, vals []string, minDepositAmount *math.Int, ...) error
- func (k Keeper) UpdateWithdrawalStatus(ctx sdk.Context, poolID uint64, withdrawalID uint64, ...)
- type PrizeDraw
Constants ¶
const ( ICACallbackID_Delegate = "delegate" ICACallbackID_Claim = "claim" ICACallbackID_Undelegate = "undelegate" ICACallbackID_Redelegate = "redelegate" ICACallbackID_TransferToNative = "transfer_to_native" ICACallbackID_TransferFromNative = "transfer_from_native" ICACallbackID_SetWithdrawAddress = "set_withdraw_address" )
const (
ICQCallbackID_Balance = "balance"
)
Variables ¶
This section is empty.
Functions ¶
func BalanceCallback ¶
func BalanceCallback(k Keeper, ctx sdk.Context, args []byte, query icqueriestypes.Query, status icqueriestypes.QueryResponseStatus) error
func ClaimCallback ¶
func ClaimCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error
func DelegateCallback ¶
func DelegateCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.
func NewQueryServerImpl ¶
func NewQueryServerImpl(keeper Keeper) types.QueryServer
NewQueryServerImpl returns an implementation of the QueryServer interface for the provided Keeper.
func RedelegateCallback ¶
func RedelegateCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error
func SetWithdrawAddressCallback ¶
func SetWithdrawAddressCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error
func TransferFromNativeCallback ¶
func TransferFromNativeCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error
func TransferToNativeCallback ¶
func TransferToNativeCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error
func UndelegateCallback ¶
func UndelegateCallback(k Keeper, ctx sdk.Context, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error
Types ¶
type DepositTWB ¶
type DrawResult ¶
type ICACallback ¶
type ICACallback func(Keeper, sdk.Context, channeltypes.Packet, *icacallbackstypes.AcknowledgementResponse, []byte) error
ICACallback wrapper struct for millions keeper
type ICACallbacks ¶
type ICACallbacks struct {
// contains filtered or unexported fields
}
func (ICACallbacks) AddICACallback ¶
func (c ICACallbacks) AddICACallback(id string, fn interface{}) icacallbackstypes.ICACallbackHandler
func (ICACallbacks) CallICACallback ¶
func (c ICACallbacks) CallICACallback(ctx sdk.Context, id string, packet channeltypes.Packet, ackResponse *icacallbackstypes.AcknowledgementResponse, args []byte) error
func (ICACallbacks) HasICACallback ¶
func (c ICACallbacks) HasICACallback(id string) bool
func (ICACallbacks) RegisterICACallbacks ¶
func (c ICACallbacks) RegisterICACallbacks() icacallbackstypes.ICACallbackHandler
type ICQCallback ¶
type ICQCallback func(Keeper, sdk.Context, []byte, icqueriestypes.Query, icqueriestypes.QueryResponseStatus) error
ICQCallback wrapper struct for millions keeper
type ICQCallbacks ¶
type ICQCallbacks struct {
// contains filtered or unexported fields
}
func (ICQCallbacks) AddICQCallback ¶
func (c ICQCallbacks) AddICQCallback(id string, fn interface{}) icqueriestypes.QueryCallbacks
func (ICQCallbacks) CallICQCallback ¶
func (c ICQCallbacks) CallICQCallback(ctx sdk.Context, id string, args []byte, query icqueriestypes.Query, status icqueriestypes.QueryResponseStatus) error
func (ICQCallbacks) HasICQCallback ¶
func (c ICQCallbacks) HasICQCallback(id string) bool
func (ICQCallbacks) RegisterICQCallbacks ¶
func (c ICQCallbacks) RegisterICQCallbacks() icqueriestypes.QueryCallbacks
type Keeper ¶
type Keeper struct { AccountKeeper account.AccountKeeper IBCKeeper ibckeeper.Keeper IBCTransferKeeper ibctransferkeeper.Keeper ICAControllerKeeper icacontrollerkeeper.Keeper ICACallbacksKeeper icacallbackskeeper.Keeper ICQueriesKeeper icquerieskeeper.Keeper BankKeeper bankkeeper.Keeper DistributionKeeper *distributionkeeper.Keeper StakingKeeper *stakingkeeper.Keeper // contains filtered or unexported fields }
func NewKeeper ¶
func NewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, paramSpace paramtypes.Subspace, scopedKeeper capabilitykeeper.ScopedKeeper, accountKeeper account.AccountKeeper, ibcKeeper ibckeeper.Keeper, ibcTransferKeeper ibctransferkeeper.Keeper, icaKeeper icacontrollerkeeper.Keeper, icaCallbacksKeeper icacallbackskeeper.Keeper, icqueriesKeeper icquerieskeeper.Keeper, bank bankkeeper.Keeper, distribution *distributionkeeper.Keeper, stakingKeeper *stakingkeeper.Keeper, ) *Keeper
NewKeeper Initialize the keeper with the base params
func (Keeper) AddDeposit ¶
AddDeposit adds a deposit to a pool and account A new depositID is generated if not provided - adds it to the pool {pool_id, deposit_id} - adds it to the account {address, pool_id, deposit_id} deposits
func (Keeper) AddPrize ¶
AddPrizes adds a prize to a pool and an account A new prizeID is generated if not provided - adds it to the pool {pool_id, draw_id, prize_id} - adds it to the account {winner_address, pool_id, draw_id} prizes
func (Keeper) AddWithdrawal ¶
func (k Keeper) AddWithdrawal(ctx sdk.Context, withdrawal types.Withdrawal)
AddWithdrawal adds a withdrawDeposit to a pool and account - adds it to the pool {pool_id, withdrawal_id} - adds it to the account {depositor_address, pool_id, withdrawal_id} withdrawDeposits
func (Keeper) BlockPoolUpdates ¶
BlockPoolUpdates runs all pool updates and draws Called in each BeginBlock
func (Keeper) BlockPrizeUpdates ¶
BlockPrizeUpdates runs all prize updates (clawback) Called in each EndBlock
func (Keeper) BlockWithdrawalUpdates ¶
BlockWithdrawalUpdates runs all matured withdrawals updates (transfer post unbonding) Called in each EndBlock
func (Keeper) BroadcastICAMessages ¶
func (Keeper) ClaimCapability ¶
func (k Keeper) ClaimCapability(ctx sdk.Context, cap *capabilitytypes.Capability, name string) error
ClaimCapability claims the channel capability passed via the OnOpenChanInit callback
func (Keeper) ClaimRewardsOnNativeChain ¶
func (k Keeper) ClaimRewardsOnNativeChain(ctx sdk.Context, poolID uint64, drawID uint64) (*types.Draw, error)
ClaimRewardsOnNativeChain Claim staking rewards from the native chain validators - wait for the ICA callback to move to OnClaimRewardsOnNativeChainCompleted - or go to OnClaimRewardsOnNativeChainCompleted directly upon claim rewards success if local zone
func (Keeper) ClawBackPrize ¶
ClawBackPrize claw backs a prize by adding its amount to the clawback prize pool
func (Keeper) ComputeDepositsTWB ¶
func (k Keeper) ComputeDepositsTWB(ctx sdk.Context, depositStartAt time.Time, drawAt time.Time, deposits []types.Deposit) []DepositTWB
ComputeDepositsTWB takes deposits and computes the weight based on their deposit time and the draw duration It essentially compute the Time Weighted Balance of each deposit for the DrawPrizes phase
func (Keeper) DelegateDepositOnNativeChain ¶
func (k Keeper) DelegateDepositOnNativeChain(ctx sdk.Context, poolID uint64, depositID uint64) error
DelegateDepositOnNativeChain Delegates a deposit to the native chain validators - wait for the ICA callback to move to OnDelegateDepositOnNativeChainCompleted - or go to OnDelegateDepositOnNativeChainCompleted directly if local zone
func (Keeper) DequeueEPCBQueue ¶
DequeueEPCBQueue return all the Expired Prizes to Claw Back and remove them from the queue
func (Keeper) DequeueMaturedWithdrawalQueue ¶
func (k Keeper) DequeueMaturedWithdrawalQueue(ctx sdk.Context, endTime time.Time) (withdrawalsIDs []types.WithdrawalIDs)
DequeueMaturedWithdrawalQueue return all the Matured Withdrawals that can be transfered and can be removed from the queue
func (Keeper) DistributePrizes ¶
func (k Keeper) DistributePrizes(ctx sdk.Context, fc feeCollector, dRes DrawResult, draw types.Draw) error
DistributePrizes distributes the prizes if they have a winner
func (Keeper) DrawsIterator ¶
DrawsIterator Return a ready to use iterator for the draws store (all draws from all pools)
func (Keeper) EPCBQueueIterator ¶
EPCBQueueIterator returns an iterator for the EPCB queue up to the specified endTime
func (Keeper) ExecuteDraw ¶
ExecuteDraw completes the draw phases by effectively drawing prizes This is the last phase of a Draw WARNING: this method can eventually commit critical partial store updates if the caller does not return on error
func (Keeper) GetChainID ¶
GetChainID Return the chain ID fetched from the ibc connection layer
func (Keeper) GetConnectionID ¶
func (Keeper) GetLatestUnbondingCompletionTime ¶
func (k Keeper) GetLatestUnbondingCompletionTime(ctx sdk.Context, msgResponses [][]byte) (*time.Time, error)
Get the latest completion time across each MsgUndelegate in the ICA transaction
func (Keeper) GetNextDepositID ¶
GetNextDepositID gets the next deposit ID
func (Keeper) GetNextDepositIdAndIncrement ¶
GetNextDepositIdAndIncrement gets the next deposit ID and store the incremented ID
func (Keeper) GetNextPoolID ¶
GetNextPoolID Return the next pool id to be used
func (Keeper) GetNextPoolIDAndIncrement ¶
func (Keeper) GetNextPrizeID ¶
GetNextPrizeID gets the next prize ID
func (Keeper) GetNextPrizeIdAndIncrement ¶
GetNextPrizeIdAndIncrement gets the next prize ID and store the incremented ID
func (Keeper) GetNextWithdrawalID ¶
GetNextWithdrawalID gets the next withdrawal deposit ID
func (Keeper) GetNextWithdrawalIdAndIncrement ¶
GetNextWithdrawalIdAndIncrement gets the next withdrawal ID and store the incremented ID
func (Keeper) GetPoolDeposit ¶
func (k Keeper) GetPoolDeposit(ctx sdk.Context, poolID uint64, depositID uint64) (types.Deposit, error)
GetPoolDeposit returns a deposit by ID for a given poolID
func (Keeper) GetPoolDraw ¶
GetPoolDraw Returns a draw instance for the given poolID and drawID combination
func (Keeper) GetPoolDrawPrize ¶
func (k Keeper) GetPoolDrawPrize(ctx sdk.Context, poolID uint64, drawID uint64, prizeID uint64) (types.Prize, error)
GetPoolDrawPrize returns a prize by poolID, drawID, prizeID
func (Keeper) GetPoolForChainID ¶
func (Keeper) GetPoolForConnectionID ¶
func (Keeper) GetPoolForControllerPortID ¶
func (Keeper) GetPoolWithdrawal ¶
func (k Keeper) GetPoolWithdrawal(ctx sdk.Context, poolID uint64, withdrawalID uint64) (types.Withdrawal, error)
GetPoolWithdrawal returns a withdrawal by poolID, withdrawalID
func (Keeper) GetPrizeIDsEPCBQueue ¶
func (k Keeper) GetPrizeIDsEPCBQueue(ctx sdk.Context, timestamp time.Time) (col types.PrizeIDsCollection)
GetPrizeIDsEPCBQueue gets a prize IDs collection for the expiring timestamp
func (Keeper) GetWithdrawalIDsMaturedQueue ¶
func (k Keeper) GetWithdrawalIDsMaturedQueue(ctx sdk.Context, timestamp time.Time) (col types.WithdrawalIDsCollection)
GetWithdrawalIDsMaturedQueue gets a withdrawal IDs collection for the matured unbonding timestamp
func (Keeper) HasPool ¶
HasPool Returns a boolean that indicates if the given poolID exists in the KVStore or not
func (Keeper) HasPoolDraw ¶
HasPoolDraw Returns a boolean that indicates if the given poolID and drawID combination exists in the KVStore or not
func (Keeper) ICACallbackHandler ¶
func (k Keeper) ICACallbackHandler() ICACallbacks
func (Keeper) ICQCallbackHandler ¶
func (k Keeper) ICQCallbackHandler() ICQCallbacks
func (Keeper) IterateDraws ¶
IterateDraws Iterate over the draws store (all draws from all pools), and for each entry call the callback
func (Keeper) IteratePoolDraws ¶
IteratePoolDraws Iterates over a pool draws store, and for each entry call the callback
func (Keeper) IteratePools ¶
IteratePools Iterate over the pools, and for each entry call the callback
func (Keeper) LaunchNewDraw ¶
LaunchNewDraw initiates a new draw and triggers the ICA get reward phase See UpdateDrawAtStateICAOp for next phase
func (Keeper) ListAccountDeposits ¶
ListAccountDeposits return deposits all the deposits for an address Warning: expensive operation
func (Keeper) ListAccountPoolDeposits ¶
func (k Keeper) ListAccountPoolDeposits(ctx sdk.Context, addr sdk.Address, poolID uint64) (deposits []types.Deposit)
ListAccountPoolDeposits return all the deposits for and address and a poolID Warning: expensive operation
func (Keeper) ListAccountPoolPrizes ¶
func (k Keeper) ListAccountPoolPrizes(ctx sdk.Context, addr sdk.Address, poolID uint64) (prizes []types.Prize)
ListAccountPoolPrizes return all the prizes for an account and a pool Warning: expensive operation
func (Keeper) ListAccountPoolWithdrawals ¶
func (k Keeper) ListAccountPoolWithdrawals(ctx sdk.Context, addr sdk.Address, poolID uint64) (withdrawals []types.Withdrawal)
ListAccountPoolWithdrawals return all the withdrawals for and address and a poolID Warning: expensive operation
func (Keeper) ListAccountPrizes ¶
ListAccountPrizes return all the prizes for an account Warning: expensive operation
func (Keeper) ListAccountWithdrawals ¶
func (k Keeper) ListAccountWithdrawals(ctx sdk.Context, addr sdk.Address) (withdrawals []types.Withdrawal)
ListAccountWithdrawals return all the withdraw deposits account Warning: expensive operation
func (Keeper) ListDeposits ¶
ListDeposits return all the deposits for and address Warning: expensive operation
func (Keeper) ListDraws ¶
ListDraws return the full draws list (all draws from all pools) expensive operation that should only be used by Genesis like features
func (Keeper) ListPoolDeposits ¶
ListPoolDeposits returns all deposits for a given poolID Warning: expensive operation
func (Keeper) ListPoolDrawPrizes ¶
func (k Keeper) ListPoolDrawPrizes(ctx sdk.Context, poolID uint64, drawID uint64) (prizes []types.Prize)
ListPoolDrawPrizes return all the prizes for a pool draw Warning: expensive operation
func (Keeper) ListPoolDraws ¶
ListPoolDraws return the full pool draws list expensive operation that should only be used by Genesis like features and unittests
func (Keeper) ListPoolPrizes ¶
ListPoolPrizes return all the prizes for a pool Warning: expensive operation
func (Keeper) ListPoolWithdrawals ¶
func (k Keeper) ListPoolWithdrawals(ctx sdk.Context, poolID uint64) (withdrawals []types.Withdrawal)
ListPoolWithdrawals returns all withdrawals for a given poolID Warning: expensive operation
func (Keeper) ListPoolsToDraw ¶
ListPoolsToDraw Returns the pools which should be launching a Draw
func (Keeper) ListPrizes ¶
ListPrizes return all the prizes for an address Warning: expensive operation
func (Keeper) ListWithdrawals ¶
func (k Keeper) ListWithdrawals(ctx sdk.Context) (withdrawals []types.Withdrawal)
ListWithdrawals return all the withdrawals Warning: expensive operation
func (Keeper) MarshalClaimCallbackArgs ¶
func (k Keeper) MarshalClaimCallbackArgs(ctx sdk.Context, claimCallback types.ClaimRewardsCallback) ([]byte, error)
MarshalClaimCallbackArgs Marshal claim ClaimCallback arguments
func (Keeper) MarshalDelegateCallbackArgs ¶
func (k Keeper) MarshalDelegateCallbackArgs(ctx sdk.Context, delegateCallback types.DelegateCallback) ([]byte, error)
MarshalDelegateCallbackArgs Marshal delegate DelegateCallback arguments
func (Keeper) MarshalRedelegateCallbackArgs ¶
func (k Keeper) MarshalRedelegateCallbackArgs(ctx sdk.Context, redelegateCallback types.RedelegateCallback) ([]byte, error)
MarshalRedelegateCallbackArgs Marshal delegate RedelegateCallback arguments
func (Keeper) MarshalSetWithdrawAddressCallbackArgs ¶
func (k Keeper) MarshalSetWithdrawAddressCallbackArgs(ctx sdk.Context, setWithdrawAddrCallback types.SetWithdrawAddressCallback) ([]byte, error)
MarshalSetWithdrawAddressCallbackArgs Marshal delegate RedelegateCallback arguments
func (Keeper) MarshalTransferFromNativeCallbackArgs ¶
func (k Keeper) MarshalTransferFromNativeCallbackArgs(ctx sdk.Context, transferCallback types.TransferFromNativeCallback) ([]byte, error)
MarshalTransferFromNativeCallbackArgs Marshal TransferFromNativeCallback arguments
func (Keeper) MarshalTransferToNativeCallbackArgs ¶
func (k Keeper) MarshalTransferToNativeCallbackArgs(ctx sdk.Context, transferCallback types.TransferToNativeCallback) ([]byte, error)
MarshalTransferToNativeCallbackArgs Marshal TransferToNativeCallback arguments
func (Keeper) MarshalUndelegateCallbackArgs ¶
func (k Keeper) MarshalUndelegateCallbackArgs(ctx sdk.Context, undelegateCallback types.UndelegateCallback) ([]byte, error)
MarshalUndelegateCallbackArgs Marshal delegate UndelegateCallback arguments
func (Keeper) MaturedWithdrawalQueueIterator ¶
MaturedWithdrawalQueueIterator returns an iterator for the Withdrawal Matured queue up to the specified endTime
func (Keeper) NewFeeCollector ¶
NewFeeCollector creates a new fee collector for the specified pool
func (Keeper) OnClaimRewardsOnNativeChainCompleted ¶
func (k Keeper) OnClaimRewardsOnNativeChainCompleted(ctx sdk.Context, poolID uint64, drawID uint64, isError bool) (*types.Draw, error)
OnClaimRewardsOnNativeChainCompleted Acknowledge the ICA claim rewards from the native chain validators response and trigger an ICQ if success
func (Keeper) OnDelegateDepositOnNativeChainCompleted ¶
func (k Keeper) OnDelegateDepositOnNativeChainCompleted(ctx sdk.Context, poolID uint64, depositID uint64, splits []*types.SplitDelegation, isError bool) error
OnDelegateDepositOnNativeChainCompleted Acknowledge the ICA delegate to the native chain validators response
func (Keeper) OnExecuteDrawCompeleted ¶
func (k Keeper) OnExecuteDrawCompeleted(ctx sdk.Context, pool *types.Pool, draw *types.Draw, err error) (*types.Draw, error)
OnExecuteDrawCompeleted wrappers for draw state update upon drawing phase completion returns the error specified in parameters and does not produce any internal error
func (Keeper) OnQueryRewardsOnNativeChainCompleted ¶
func (Keeper) OnSetupPoolICACompleted ¶
func (k Keeper) OnSetupPoolICACompleted(ctx sdk.Context, poolID uint64, icaType string, icaAddress string) (*types.Pool, error)
OnPoolICASetupCompleted Acknowledge the ICA account creation on the native chain then moves to SetupPoolWithdrawalAddress once all ICA accounts have been created TODO: error management based on the callback response
func (Keeper) OnSetupPoolWithdrawalAddressCompleted ¶
func (k Keeper) OnSetupPoolWithdrawalAddressCompleted(ctx sdk.Context, poolID uint64) (*types.Pool, error)
OnSetupPoolWithdrawalAddressCompleted Acknowledge the withdrawal address configuration on the native chain then sets the pool to status ready in case of success
func (Keeper) OnTransferDepositToNativeChainCompleted ¶
func (k Keeper) OnTransferDepositToNativeChainCompleted(ctx sdk.Context, poolID uint64, depositID uint64, isError bool) error
OnTransferDepositToNativeChainCompleted Acknowledge the IBC transfer to the native chain response then moves to DelegateDepositOnNativeChain in case of success
func (Keeper) OnTransferRewardsToLocalChainCompleted ¶
func (k Keeper) OnTransferRewardsToLocalChainCompleted(ctx sdk.Context, poolID uint64, drawID uint64, isError bool) (*types.Draw, error)
OnTransferRewardsToLocalChainCompleted Acknowledge the transfer of the claimed rewards finalises the Draw if success
func (Keeper) OnTransferWithdrawalToLocalChainCompleted ¶
func (k Keeper) OnTransferWithdrawalToLocalChainCompleted(ctx sdk.Context, poolID uint64, withdrawalID uint64, isError bool) error
OnTransferWithdrawalToLocalChainCompleted Acknowledge the IBC transfer to the local chain response
func (Keeper) OnUndelegateWithdrawalOnNativeChainCompleted ¶
func (k Keeper) OnUndelegateWithdrawalOnNativeChainCompleted(ctx sdk.Context, poolID uint64, withdrawalID uint64, splits []*types.SplitDelegation, unbondingEndsAt *time.Time, isError bool) error
OnUndelegateWithdrawalOnNativeChainCompleted Acknowledge the ICA undelegate from the native chain validators response once unbonding ends one can call TransferWithdrawalToLocalChain to transfer the withdrawn amount to the requested account
func (Keeper) PoolDrawsIterator ¶
PoolDrawsIterator Return a ready to use iterator for a pool draws store
func (Keeper) PoolsIterator ¶
PoolsIterator Return a ready to use iterator for the pools store
func (Keeper) QueryBalance ¶
func (Keeper) RegisterPool ¶
func (k Keeper) RegisterPool( ctx sdk.Context, denom, nativeDenom, chainId, connectionId, transferChannelId string, vals []string, bech32Acc, bech32Val string, minDepositAmount math.Int, drawSchedule types.DrawSchedule, prizeStrategy types.PrizeStrategy, ) (uint64, error)
RegisterPool Register a given pool from the transaction message
func (Keeper) RemoveDeposit ¶
RemoveDeposit removes a deposit from a pool - removes it from the {pool_id, deposit_id} - removes it from the {address, pool_id, deposit_id} deposits
func (Keeper) RemovePrize ¶
RemovePrize removes a prize from the store
func (Keeper) RemoveWithdrawal ¶
RemoveWithdrawal removes a successful withdrawal for a given account and pool
func (Keeper) RunDrawPrizes ¶
func (k Keeper) RunDrawPrizes(ctx sdk.Context, prizePool sdk.Coin, prizeStrat types.PrizeStrategy, deposits []DepositTWB, randSeed int64) (result DrawResult, err error)
RunDrawPrizes computes available prizes and draws the prizes and their potential winners based on the specified prize strategy this method does not store nor send anything, it only computes the DrawResult
func (Keeper) SetNextDepositID ¶
SetNextDepositID sets next deposit ID
func (Keeper) SetNextPoolID ¶
SetNextPoolID sets next pool ID
func (Keeper) SetNextPrizeID ¶
SetNextPrizeID sets next prize ID
func (Keeper) SetNextWithdrawalID ¶
SetNextWithdrawalID sets next withdrawal ID
func (Keeper) SetPoolDraw ¶
SetPoolDraw Sets a draw result in the KVStore for a given poolID and drawID
func (Keeper) SetupPoolICA ¶
SetupPoolICA registers the ICA account on the native chain - waits for the ICA callback to move to OnSetupPoolICACompleted - or go to OnSetupPoolICACompleted directly if local zone
func (Keeper) SetupPoolWithdrawalAddress ¶
SetupPoolWithdrawalAddress sets the PrizePoolAddress as the Staking withdrawal address for the DepositAddress - waits for the ICA callback to move to OnSetupPoolWithdrawalAddressCompleted - or go to OnSetupPoolWithdrawalAddressCompleted directly upon setting up the withdrawal address if local zone
func (Keeper) TransferAmountFromPoolToNativeChain ¶
func (k Keeper) TransferAmountFromPoolToNativeChain(ctx sdk.Context, poolID uint64, amount sdk.Coin) (*ibctransfertypes.MsgTransfer, *ibctransfertypes.MsgTransferResponse, error)
TransferAmountFromPoolToNativeChain Transfer a given amount to the native chain ICA account from the local module account amount denom must be based on pool.Denom
func (Keeper) TransferDepositToNativeChain ¶
func (k Keeper) TransferDepositToNativeChain(ctx sdk.Context, poolID uint64, depositID uint64) error
TransferDepositToNativeChain Transfer a deposit to a native chain - wait for the ICA callback to move to OnTransferDepositToNativeChainCompleted - or go to OnTransferDepositToNativeChainCompleted directly if local zone
func (Keeper) TransferRewardsToLocalChain ¶
func (k Keeper) TransferRewardsToLocalChain(ctx sdk.Context, poolID uint64, drawID uint64) (*types.Draw, error)
TransferRewardsToLocalChain Transfer the claimed rewards to the local chain - wait for the ICA callback to move to OnTransferRewardsToLocalChainCompleted - or go to OnTransferRewardsToLocalChainCompleted directly if local zone
func (Keeper) TransferWithdrawalToLocalChain ¶
func (k Keeper) TransferWithdrawalToLocalChain(ctx sdk.Context, poolID uint64, withdrawalID uint64) error
TransferWithdrawalToLocalChain Transfer a withdrawal from the native chain to the local chain - wait for the ICA callback to move to OnTransferWithdrawalToLocalChainCompleted - or go to OnTransferWithdrawalToLocalChainCompleted directly if local zone already
func (Keeper) UndelegateWithdrawalOnNativeChain ¶
func (k Keeper) UndelegateWithdrawalOnNativeChain(ctx sdk.Context, poolID uint64, withdrawalID uint64) error
UndelegateWithdrawalOnNativeChain Undelegates a withdrawal from the native chain validators - go to OnUndelegateWithdrawalOnNativeChainCompleted directly upon undelegate success if local zone - or wait for the ICA callback to move to OnUndelegateWithdrawalOnNativeChainCompleted
func (Keeper) UnmarshalClaimCallbackArgs ¶
func (k Keeper) UnmarshalClaimCallbackArgs(ctx sdk.Context, claimCallback []byte) (*types.ClaimRewardsCallback, error)
UnmarshalClaimCallbackArgs Marshal claim callback arguments into a ClaimCallback struct
func (Keeper) UnmarshalDelegateCallbackArgs ¶
func (k Keeper) UnmarshalDelegateCallbackArgs(ctx sdk.Context, delegateCallback []byte) (*types.DelegateCallback, error)
UnmarshalDelegateCallbackArgs Marshal delegate callback arguments into a DelegateCallback struct
func (Keeper) UnmarshalRedelegateCallbackArgs ¶
func (k Keeper) UnmarshalRedelegateCallbackArgs(ctx sdk.Context, redelegateCallback []byte) (*types.RedelegateCallback, error)
UnmarshalRedelegateCallbackArgs Marshal delegate callback arguments into a RedelegateCallback struct
func (Keeper) UnmarshalSetWithdrawAddressCallbackArgs ¶
func (k Keeper) UnmarshalSetWithdrawAddressCallbackArgs(ctx sdk.Context, setWithdrawAddrCallback []byte) (*types.SetWithdrawAddressCallback, error)
UnmarshalSetWithdrawAddressCallbackArgs Marshal delegate callback arguments into a RedelegateCallback struct
func (Keeper) UnmarshalTransferFromNativeCallbackArgs ¶
func (k Keeper) UnmarshalTransferFromNativeCallbackArgs(ctx sdk.Context, transferCallback []byte) (*types.TransferFromNativeCallback, error)
UnmarshalTransferFromNativeCallbackArgs Marshal callback arguments into a TransferFromNativeCallback struct
func (Keeper) UnmarshalTransferToNativeCallbackArgs ¶
func (k Keeper) UnmarshalTransferToNativeCallbackArgs(ctx sdk.Context, transferCallback []byte) (*types.TransferToNativeCallback, error)
UnmarshalTransferToNativeCallbackArgs Marshal callback arguments into a TransferToNativeCallback struct
func (Keeper) UnmarshalUndelegateCallbackArgs ¶
func (k Keeper) UnmarshalUndelegateCallbackArgs(ctx sdk.Context, undelegateCallback []byte) (*types.UndelegateCallback, error)
UnmarshalUndelegateCallbackArgs Marshal delegate callback arguments into a UndelegateCallback struct
func (Keeper) UnsafeKillPool ¶ added in v1.4.3
UnsafeKillPool This method switches the provided pool state but does not handle any withdrawal or deposit. It shouldn't be used and is very specific to UNUSED and EMPTY pools
func (Keeper) UpdateDepositStatus ¶
func (k Keeper) UpdateDepositStatus(ctx sdk.Context, poolID uint64, depositID uint64, status types.DepositState, isError bool)
UpdateDepositStatus Update a given deposit status by its ID
func (Keeper) UpdatePool ¶
func (k Keeper) UpdatePool( ctx sdk.Context, poolID uint64, vals []string, minDepositAmount *math.Int, drawSchedule *types.DrawSchedule, prizeStrategy *types.PrizeStrategy, ) error
UpdatePool Update the updatable properties of a pool from the transaction message
type PrizeDraw ¶
type PrizeDraw struct { Amount sdkmath.Int Winner *DepositTWB }
Source Files ¶
- callbacks.go
- callbacks_claim.go
- callbacks_delegate.go
- callbacks_redelegate.go
- callbacks_set_withdraw_address.go
- callbacks_transfer_from_native.go
- callbacks_transfer_to_native.go
- callbacks_undelegate.go
- grpc_query.go
- grpc_query_deposit.go
- grpc_query_draw.go
- grpc_query_params.go
- grpc_query_pool.go
- grpc_query_prize.go
- grpc_query_withdrawal.go
- keeper.go
- keeper_blockers.go
- keeper_deposit.go
- keeper_draw.go
- keeper_fees.go
- keeper_params.go
- keeper_pool.go
- keeper_prize.go
- keeper_withdrawal.go
- msg_server.go
- msg_server_deposit.go
- msg_server_draw.go
- msg_server_pool.go
- msg_server_prize.go
- msg_server_withdrawal.go
- queries.go
- queries_balance.go