keeper

package
v1.4.3 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: Apache-2.0 Imports: 46 Imported by: 0

Documentation

Index

Constants

View Source
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"
)
View Source
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

func NewMsgServerImpl(keeper Keeper) types.MsgServer

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 DepositTWB struct {
	Address string
	Amount  sdkmath.Int
}

type DrawResult

type DrawResult struct {
	PrizeDraws     []PrizeDraw
	TotalWinCount  uint64
	TotalWinAmount sdkmath.Int
}

type ICACallback

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

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

func (k Keeper) AddDeposit(ctx sdk.Context, deposit *types.Deposit)

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

func (k Keeper) AddPool(ctx sdk.Context, pool *types.Pool)

AddPool Set a pool structure in the KVStore for a given pool ID

func (Keeper) AddPrize

func (k Keeper) AddPrize(ctx sdk.Context, prize types.Prize)

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

func (k Keeper) BlockPoolUpdates(ctx sdk.Context) (successCount, errorCount int)

BlockPoolUpdates runs all pool updates and draws Called in each BeginBlock

func (Keeper) BlockPrizeUpdates

func (k Keeper) BlockPrizeUpdates(ctx sdk.Context) (successCount, errorCount int)

BlockPrizeUpdates runs all prize updates (clawback) Called in each EndBlock

func (Keeper) BlockWithdrawalUpdates

func (k Keeper) BlockWithdrawalUpdates(ctx sdk.Context) (successCount, errorCount int)

BlockWithdrawalUpdates runs all matured withdrawals updates (transfer post unbonding) Called in each EndBlock

func (Keeper) BroadcastICAMessages

func (k Keeper) BroadcastICAMessages(ctx sdk.Context, poolID uint64, accountType string, msgs []sdk.Msg, timeoutTimestamp uint64, callbackId string, callbackArgs []byte) (uint64, error)

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

func (k Keeper) ClawBackPrize(ctx sdk.Context, poolID uint64, drawID uint64, prizeID uint64) error

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

func (k Keeper) DequeueEPCBQueue(ctx sdk.Context, endTime time.Time) (prizes []types.PrizeIDs)

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

func (k Keeper) DrawsIterator(ctx sdk.Context) sdk.Iterator

DrawsIterator Return a ready to use iterator for the draws store (all draws from all pools)

func (Keeper) EPCBQueueIterator

func (k Keeper) EPCBQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

EPCBQueueIterator returns an iterator for the EPCB queue up to the specified endTime

func (Keeper) ExecuteDraw

func (k Keeper) ExecuteDraw(ctx sdk.Context, poolID uint64, drawID uint64) (*types.Draw, error)

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

func (k Keeper) GetChainID(ctx sdk.Context, connectionID string) (string, error)

GetChainID Return the chain ID fetched from the ibc connection layer

func (Keeper) GetConnectionID

func (k Keeper) GetConnectionID(ctx sdk.Context, portId string) (string, error)

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

func (k Keeper) GetNextDepositID(ctx sdk.Context) uint64

GetNextDepositID gets the next deposit ID

func (Keeper) GetNextDepositIdAndIncrement

func (k Keeper) GetNextDepositIdAndIncrement(ctx sdk.Context) uint64

GetNextDepositIdAndIncrement gets the next deposit ID and store the incremented ID

func (Keeper) GetNextPoolID

func (k Keeper) GetNextPoolID(ctx sdk.Context) uint64

GetNextPoolID Return the next pool id to be used

func (Keeper) GetNextPoolIDAndIncrement

func (k Keeper) GetNextPoolIDAndIncrement(ctx sdk.Context) uint64

func (Keeper) GetNextPrizeID

func (k Keeper) GetNextPrizeID(ctx sdk.Context) uint64

GetNextPrizeID gets the next prize ID

func (Keeper) GetNextPrizeIdAndIncrement

func (k Keeper) GetNextPrizeIdAndIncrement(ctx sdk.Context) uint64

GetNextPrizeIdAndIncrement gets the next prize ID and store the incremented ID

func (Keeper) GetNextWithdrawalID

func (k Keeper) GetNextWithdrawalID(ctx sdk.Context) uint64

GetNextWithdrawalID gets the next withdrawal deposit ID

func (Keeper) GetNextWithdrawalIdAndIncrement

func (k Keeper) GetNextWithdrawalIdAndIncrement(ctx sdk.Context) uint64

GetNextWithdrawalIdAndIncrement gets the next withdrawal ID and store the incremented ID

func (Keeper) GetParams

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

func (Keeper) GetPool

func (k Keeper) GetPool(ctx sdk.Context, poolID uint64) (types.Pool, error)

GetPool Returns a pool instance for the given poolID

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

func (k Keeper) GetPoolDraw(ctx sdk.Context, poolID uint64, drawID uint64) (types.Draw, error)

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 (k Keeper) GetPoolForChainID(ctx sdk.Context, chainID string) (types.Pool, bool)

func (Keeper) GetPoolForConnectionID

func (k Keeper) GetPoolForConnectionID(ctx sdk.Context, connectionID string) (types.Pool, bool)

func (Keeper) GetPoolForControllerPortID

func (k Keeper) GetPoolForControllerPortID(ctx sdk.Context, controllerPortID string) (types.Pool, bool)

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

func (k Keeper) HasPool(ctx sdk.Context, poolID uint64) bool

HasPool Returns a boolean that indicates if the given poolID exists in the KVStore or not

func (Keeper) HasPoolDraw

func (k Keeper) HasPoolDraw(ctx sdk.Context, poolID uint64, drawID uint64) bool

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

func (k Keeper) IterateDraws(ctx sdk.Context, cb func(draw types.Draw) bool)

IterateDraws Iterate over the draws store (all draws from all pools), and for each entry call the callback

func (Keeper) IteratePoolDraws

func (k Keeper) IteratePoolDraws(ctx sdk.Context, poolID uint64, cb func(draw types.Draw) bool)

IteratePoolDraws Iterates over a pool draws store, and for each entry call the callback

func (Keeper) IteratePools

func (k Keeper) IteratePools(ctx sdk.Context, callback func(pool types.Pool) (stop bool))

IteratePools Iterate over the pools, and for each entry call the callback

func (Keeper) LaunchNewDraw

func (k Keeper) LaunchNewDraw(ctx sdk.Context, poolID uint64) (*types.Draw, error)

LaunchNewDraw initiates a new draw and triggers the ICA get reward phase See UpdateDrawAtStateICAOp for next phase

func (Keeper) ListAccountDeposits

func (k Keeper) ListAccountDeposits(ctx sdk.Context, addr sdk.Address) (deposits []types.Deposit)

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

func (k Keeper) ListAccountPrizes(ctx sdk.Context, addr sdk.Address) (prizes []types.Prize)

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

func (k Keeper) ListDeposits(ctx sdk.Context) (deposits []types.Deposit)

ListDeposits return all the deposits for and address Warning: expensive operation

func (Keeper) ListDraws

func (k Keeper) ListDraws(ctx sdk.Context) (draws []types.Draw)

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

func (k Keeper) ListPoolDeposits(ctx sdk.Context, poolID uint64) (deposits []types.Deposit)

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

func (k Keeper) ListPoolDraws(ctx sdk.Context, poolID uint64) (draws []types.Draw)

ListPoolDraws return the full pool draws list expensive operation that should only be used by Genesis like features and unittests

func (Keeper) ListPoolPrizes

func (k Keeper) ListPoolPrizes(ctx sdk.Context, poolID uint64) (prizes []types.Prize)

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

func (k Keeper) ListPools(ctx sdk.Context) (pools []types.Pool)

ListPools Return the pools

func (Keeper) ListPoolsToDraw

func (k Keeper) ListPoolsToDraw(ctx sdk.Context) (pools []types.Pool)

ListPoolsToDraw Returns the pools which should be launching a Draw

func (Keeper) ListPrizes

func (k Keeper) ListPrizes(ctx sdk.Context) (prizes []types.Prize)

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

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

Logger Return a keeper logger instance

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

func (k Keeper) MaturedWithdrawalQueueIterator(ctx sdk.Context, endTime time.Time) sdk.Iterator

MaturedWithdrawalQueueIterator returns an iterator for the Withdrawal Matured queue up to the specified endTime

func (Keeper) NewFeeCollector

func (k Keeper) NewFeeCollector(ctx sdk.Context, pool types.Pool) feeCollector

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 (k Keeper) OnQueryRewardsOnNativeChainCompleted(ctx sdk.Context, poolID uint64, drawID uint64, coins sdk.Coins, isError bool) (*types.Draw, error)

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

func (k Keeper) PoolDrawsIterator(ctx sdk.Context, poolID uint64) sdk.Iterator

PoolDrawsIterator Return a ready to use iterator for a pool draws store

func (Keeper) PoolsIterator

func (k Keeper) PoolsIterator(ctx sdk.Context) sdk.Iterator

PoolsIterator Return a ready to use iterator for the pools store

func (Keeper) QueryBalance

func (k Keeper) QueryBalance(ctx sdk.Context, poolID uint64, drawID uint64) (*types.Draw, error)

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

func (k Keeper) RemoveDeposit(ctx sdk.Context, deposit *types.Deposit)

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

func (k Keeper) RemovePrize(ctx sdk.Context, prize types.Prize) error

RemovePrize removes a prize from the store

func (Keeper) RemoveWithdrawal

func (k Keeper) RemoveWithdrawal(ctx sdk.Context, withdrawal types.Withdrawal) error

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

func (k Keeper) SetNextDepositID(ctx sdk.Context, depositId uint64)

SetNextDepositID sets next deposit ID

func (Keeper) SetNextPoolID

func (k Keeper) SetNextPoolID(ctx sdk.Context, poolId uint64)

SetNextPoolID sets next pool ID

func (Keeper) SetNextPrizeID

func (k Keeper) SetNextPrizeID(ctx sdk.Context, prizeID uint64)

SetNextPrizeID sets next prize ID

func (Keeper) SetNextWithdrawalID

func (k Keeper) SetNextWithdrawalID(ctx sdk.Context, withdrawalID uint64)

SetNextWithdrawalID sets next withdrawal ID

func (Keeper) SetParams

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

func (Keeper) SetPoolDraw

func (k Keeper) SetPoolDraw(ctx sdk.Context, draw types.Draw)

SetPoolDraw Sets a draw result in the KVStore for a given poolID and drawID

func (Keeper) SetupPoolICA

func (k Keeper) SetupPoolICA(ctx sdk.Context, poolID uint64) (*types.Pool, error)

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

func (k Keeper) SetupPoolWithdrawalAddress(ctx sdk.Context, poolID uint64) (*types.Pool, error)

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

func (k Keeper) UnsafeKillPool(ctx sdk.Context, poolID uint64) (types.Pool, error)

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

func (Keeper) UpdateWithdrawalStatus

func (k Keeper) UpdateWithdrawalStatus(ctx sdk.Context, poolID uint64, withdrawalID uint64, status types.WithdrawalState, unbondingEndsAt *time.Time, isError bool)

UpdateWithdrawalStatus Update a given withdrawal status by its ID

type PrizeDraw

type PrizeDraw struct {
	Amount sdkmath.Int
	Winner *DepositTWB
}

Jump to

Keyboard shortcuts

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