Documentation ¶
Index ¶
- func GetBuiltInTokenPair() *types.TokenPair
- func ModuleAccountInvariant(keeper IKeeper, supplyKeeper SupplyKeeper) sdk.Invariant
- func NewQuerier(keeper IKeeper) sdk.Querier
- func RegisterInvariants(ir sdk.InvariantRegistry, keeper IKeeper, supplyKeeper SupplyKeeper)
- type BankKeeper
- type GovKeeper
- type IKeeper
- type Keeper
- func (k Keeper) AfterDepositPeriodPassed(ctx sdk.Context, proposal govTypes.Proposal)
- func (k Keeper) AfterSubmitProposalHandler(ctx sdk.Context, proposal govTypes.Proposal)
- func (k Keeper) CheckMsgSubmitProposal(ctx sdk.Context, msg govTypes.MsgSubmitProposal) (sdkErr sdk.Error)
- func (k Keeper) CheckTokenPairUnderDexDelist(ctx sdk.Context, product string) (isDelisting bool, err error)
- func (k Keeper) CompleteWithdraw(ctx sdk.Context, addr sdk.AccAddress) error
- func (k Keeper) DeleteTokenPairByName(ctx sdk.Context, owner sdk.AccAddress, product string)
- func (k Keeper) DeleteWithdrawCompleteTimeAddress(ctx sdk.Context, timestamp time.Time, delAddr sdk.AccAddress)
- func (k Keeper) Deposit(ctx sdk.Context, product string, from sdk.AccAddress, amount sdk.DecCoin) sdk.Error
- func (k Keeper) GetBankKeeper() BankKeeper
- func (k Keeper) GetFeeCollector() string
- func (k Keeper) GetLockedProductsCopy(ctx sdk.Context) *ordertypes.ProductLockMap
- func (k Keeper) GetMaxDepositPeriod(ctx sdk.Context, content gov.Content) (maxDepositPeriod time.Duration)
- func (k Keeper) GetMaxTokenPairID(ctx sdk.Context) (tokenPairMaxID uint64)
- func (k Keeper) GetMinDeposit(ctx sdk.Context, content gov.Content) (minDeposit sdk.DecCoins)
- func (k Keeper) GetOperator(ctx sdk.Context, addr sdk.AccAddress) (operator types.DEXOperator, isExist bool)
- func (k Keeper) GetParamSubspace() params.Subspace
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetSupplyKeeper() SupplyKeeper
- func (k Keeper) GetTokenKeeper() TokenKeeper
- func (k Keeper) GetTokenPair(ctx sdk.Context, product string) *types.TokenPair
- func (k Keeper) GetTokenPairFromStore(ctx sdk.Context, product string) *types.TokenPair
- func (k Keeper) GetTokenPairs(ctx sdk.Context) (tokenPairs []*types.TokenPair)
- func (k Keeper) GetTokenPairsOrdered(ctx sdk.Context) types.TokenPairs
- func (k Keeper) GetUserTokenPairs(ctx sdk.Context, owner sdk.AccAddress) (tokenPairs []*types.TokenPair)
- func (k Keeper) GetVotingPeriod(ctx sdk.Context, content gov.Content) (votingPeriod time.Duration)
- func (k Keeper) GetWithdrawInfo(ctx sdk.Context, addr sdk.AccAddress) (withdrawInfo types.WithdrawInfo, ok bool)
- func (k Keeper) IsAnyProductLocked(ctx sdk.Context) bool
- func (k Keeper) IsTokenPairLocked(ctx sdk.Context, product string) bool
- func (k Keeper) IterateOperators(ctx sdk.Context, cb func(operator types.DEXOperator) (stop bool))
- func (k Keeper) IterateWithdrawAddress(ctx sdk.Context, currentTime time.Time, ...)
- func (k Keeper) IterateWithdrawInfo(ctx sdk.Context, ...)
- func (k Keeper) LoadProductLocks(ctx sdk.Context) *ordertypes.ProductLockMap
- func (k Keeper) LockTokenPair(ctx sdk.Context, product string, lock *ordertypes.ProductLock)
- func (k Keeper) RejectedHandler(ctx sdk.Context, content govTypes.Content)
- func (k Keeper) RemoveFromActiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time)
- func (k Keeper) SaveTokenPair(ctx sdk.Context, tokenPair *types.TokenPair) error
- func (k *Keeper) SetGovKeeper(gk GovKeeper)
- func (k Keeper) SetMaxTokenPairID(ctx sdk.Context, MaxtokenPairID uint64)
- func (k *Keeper) SetObserverKeeper(sk exported.StreamKeeper)
- func (k Keeper) SetOperator(ctx sdk.Context, operator types.DEXOperator)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetWithdrawCompleteTimeAddress(ctx sdk.Context, completeTime time.Time, addr sdk.AccAddress)
- func (k Keeper) SetWithdrawInfo(ctx sdk.Context, withdrawInfo types.WithdrawInfo)
- func (k Keeper) SortProducts(ctx sdk.Context, products []string)
- func (k Keeper) TransferOwnership(ctx sdk.Context, product string, from sdk.AccAddress, to sdk.AccAddress) sdk.Error
- func (k Keeper) UnlockTokenPair(ctx sdk.Context, product string)
- func (k Keeper) UpdateTokenPair(ctx sdk.Context, product string, tokenPair *types.TokenPair)
- func (k Keeper) VoteHandler(ctx sdk.Context, proposal govTypes.Proposal, vote govTypes.Vote) (string, sdk.Error)
- func (k Keeper) Withdraw(ctx sdk.Context, product string, to sdk.AccAddress, amount sdk.DecCoin) sdk.Error
- type StakingKeeper
- type SupplyKeeper
- type TokenKeeper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetBuiltInTokenPair ¶
GetBuiltInTokenPair returns built in token pair for test
func ModuleAccountInvariant ¶
func ModuleAccountInvariant(keeper IKeeper, supplyKeeper SupplyKeeper) sdk.Invariant
ModuleAccountInvariant checks that the module account coins reflects the sum of locks amounts held on store
func NewQuerier ¶
NewQuerier is the module level router for state queries
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, keeper IKeeper, supplyKeeper SupplyKeeper)
RegisterInvariants registers all dex invariants
Types ¶
type BankKeeper ¶
BankKeeper defines the expected bank Keeper
type GovKeeper ¶
type GovKeeper interface {
RemoveFromActiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time)
}
GovKeeper defines the expected gov Keeper
type IKeeper ¶
type IKeeper interface { GetTokenPair(ctx sdk.Context, product string) *types.TokenPair GetTokenPairs(ctx sdk.Context) []*types.TokenPair GetUserTokenPairs(ctx sdk.Context, owner sdk.AccAddress) []*types.TokenPair GetTokenPairsOrdered(ctx sdk.Context) types.TokenPairs SaveTokenPair(ctx sdk.Context, tokenPair *types.TokenPair) error DeleteTokenPairByName(ctx sdk.Context, owner sdk.AccAddress, tokenPairName string) Deposit(ctx sdk.Context, product string, from sdk.AccAddress, amount sdk.DecCoin) sdk.Error Withdraw(ctx sdk.Context, product string, to sdk.AccAddress, amount sdk.DecCoin) sdk.Error GetSupplyKeeper() SupplyKeeper GetTokenKeeper() TokenKeeper GetBankKeeper() BankKeeper GetParamSubspace() params.Subspace GetParams(ctx sdk.Context) (params types.Params) SetParams(ctx sdk.Context, params types.Params) GetFeeCollector() string TransferOwnership(ctx sdk.Context, product string, from sdk.AccAddress, to sdk.AccAddress) sdk.Error LockTokenPair(ctx sdk.Context, product string, lock *ordertypes.ProductLock) LoadProductLocks(ctx sdk.Context) *ordertypes.ProductLockMap SetWithdrawInfo(ctx sdk.Context, withdrawInfo types.WithdrawInfo) SetWithdrawCompleteTimeAddress(ctx sdk.Context, completeTime time.Time, addr sdk.AccAddress) IterateWithdrawAddress(ctx sdk.Context, currentTime time.Time, fn func(index int64, key []byte) (stop bool)) CompleteWithdraw(ctx sdk.Context, addr sdk.AccAddress) error IterateWithdrawInfo(ctx sdk.Context, fn func(index int64, withdrawInfo types.WithdrawInfo) (stop bool)) DeleteWithdrawCompleteTimeAddress(ctx sdk.Context, timestamp time.Time, delAddr sdk.AccAddress) SetOperator(ctx sdk.Context, operator types.DEXOperator) GetOperator(ctx sdk.Context, addr sdk.AccAddress) (operator types.DEXOperator, isExist bool) IterateOperators(ctx sdk.Context, cb func(operator types.DEXOperator) (stop bool)) GetMaxTokenPairID(ctx sdk.Context) (tokenPairMaxID uint64) SetMaxTokenPairID(ctx sdk.Context, tokenPairMaxID uint64) }
IKeeper defines the expected dex Keeper
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper maintains the link to data storage and exposes getter/setter methods for the various parts of the state machine
func NewKeeper ¶
func NewKeeper(feeCollectorName string, supplyKeeper SupplyKeeper, dexParamsSubspace params.Subspace, tokenKeeper TokenKeeper, stakingKeeper StakingKeeper, bankKeeper BankKeeper, storeKey, tokenPairStoreKey sdk.StoreKey, cdc *codec.Codec) Keeper
NewKeeper creates new instances of the token Keeper
func (Keeper) AfterDepositPeriodPassed ¶
AfterDepositPeriodPassed handles delist proposal when passed
func (Keeper) AfterSubmitProposalHandler ¶
nolint
func (Keeper) CheckMsgSubmitProposal ¶
func (k Keeper) CheckMsgSubmitProposal(ctx sdk.Context, msg govTypes.MsgSubmitProposal) (sdkErr sdk.Error)
CheckMsgSubmitProposal validates MsgSubmitProposal
func (Keeper) CheckTokenPairUnderDexDelist ¶
func (k Keeper) CheckTokenPairUnderDexDelist(ctx sdk.Context, product string) (isDelisting bool, err error)
CheckTokenPairUnderDexDelist checks if token pair is under delist. for x/order: It's not allowed to place an order about the tokenpair under dex delist
func (Keeper) CompleteWithdraw ¶
CompleteWithdraw completes withdrawing of addr
func (Keeper) DeleteTokenPairByName ¶
DeleteTokenPairByName deletes the token pair by name
func (Keeper) DeleteWithdrawCompleteTimeAddress ¶
func (k Keeper) DeleteWithdrawCompleteTimeAddress(ctx sdk.Context, timestamp time.Time, delAddr sdk.AccAddress)
DeleteWithdrawCompleteTimeAddress deletes withdraw time key
func (Keeper) Deposit ¶
func (k Keeper) Deposit(ctx sdk.Context, product string, from sdk.AccAddress, amount sdk.DecCoin) sdk.Error
Deposit deposits amount of tokens for a product
func (Keeper) GetBankKeeper ¶
func (k Keeper) GetBankKeeper() BankKeeper
GetBankKeeper returns bank Keeper
func (Keeper) GetFeeCollector ¶
GetFeeCollector returns feeCollectorName
func (Keeper) GetLockedProductsCopy ¶
func (k Keeper) GetLockedProductsCopy(ctx sdk.Context) *ordertypes.ProductLockMap
GetLockedProductsCopy returns deep copy of product locked
func (Keeper) GetMaxDepositPeriod ¶
func (k Keeper) GetMaxDepositPeriod(ctx sdk.Context, content gov.Content) (maxDepositPeriod time.Duration)
GetMaxDepositPeriod returns max deposit period
func (Keeper) GetMaxTokenPairID ¶
GetMaxTokenPairID returns the max ID of token pair
func (Keeper) GetMinDeposit ¶
GetMinDeposit returns min deposit
func (Keeper) GetOperator ¶
func (k Keeper) GetOperator(ctx sdk.Context, addr sdk.AccAddress) (operator types.DEXOperator, isExist bool)
GetOperator gets the DEXOperator and checks whether the operator with address exist or not
func (Keeper) GetParamSubspace ¶
GetParamSubspace returns paramSubspace
func (Keeper) GetSupplyKeeper ¶
func (k Keeper) GetSupplyKeeper() SupplyKeeper
GetSupplyKeeper returns supply Keeper
func (Keeper) GetTokenKeeper ¶
func (k Keeper) GetTokenKeeper() TokenKeeper
GetTokenKeeper returns token Keeper
func (Keeper) GetTokenPair ¶
GetTokenPair gets the token pair by product
func (Keeper) GetTokenPairFromStore ¶
GetTokenPairFromStore returns token pair from store without cache
func (Keeper) GetTokenPairs ¶
GetTokenPairs returns all token pairs from store without cache
func (Keeper) GetTokenPairsOrdered ¶
func (k Keeper) GetTokenPairsOrdered(ctx sdk.Context) types.TokenPairs
GetTokenPairsOrdered returns token pairs ordered by product
func (Keeper) GetUserTokenPairs ¶
func (k Keeper) GetUserTokenPairs(ctx sdk.Context, owner sdk.AccAddress) (tokenPairs []*types.TokenPair)
GetUserTokenPairs returns all token pairs belong to an account from store
func (Keeper) GetVotingPeriod ¶
GetVotingPeriod returns voting period
func (Keeper) GetWithdrawInfo ¶
func (k Keeper) GetWithdrawInfo(ctx sdk.Context, addr sdk.AccAddress) (withdrawInfo types.WithdrawInfo, ok bool)
GetWithdrawInfo returns withdraw info binding the addr
func (Keeper) IsAnyProductLocked ¶
IsAnyProductLocked checks if any product is locked
func (Keeper) IsTokenPairLocked ¶
IsTokenPairLocked return true if token pair locked
func (Keeper) IterateOperators ¶
IterateOperators iterates over the all the operators and performs a callback function
func (Keeper) IterateWithdrawAddress ¶
func (k Keeper) IterateWithdrawAddress(ctx sdk.Context, currentTime time.Time, fn func(index int64, key []byte) (stop bool))
IterateWithdrawAddress itreates withdraw time keys, and returns address
func (Keeper) IterateWithdrawInfo ¶
func (k Keeper) IterateWithdrawInfo(ctx sdk.Context, fn func(index int64, withdrawInfo types.WithdrawInfo) (stop bool))
IterateWithdrawInfo iterates withdraw address key, and returns withdraw info
func (Keeper) LoadProductLocks ¶
func (k Keeper) LoadProductLocks(ctx sdk.Context) *ordertypes.ProductLockMap
LoadProductLocks loads product locked
func (Keeper) LockTokenPair ¶
func (k Keeper) LockTokenPair(ctx sdk.Context, product string, lock *ordertypes.ProductLock)
LockTokenPair locks token pair
func (Keeper) RejectedHandler ¶
RejectedHandler handles delist proposal when rejected
func (Keeper) RemoveFromActiveProposalQueue ¶
func (k Keeper) RemoveFromActiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time)
RemoveFromActiveProposalQueue removes active proposal in queue
func (Keeper) SaveTokenPair ¶
SaveTokenPair saves the token pair to db key is base:quote
func (*Keeper) SetGovKeeper ¶
SetGovKeeper sets keeper of gov
func (Keeper) SetMaxTokenPairID ¶
SetMaxTokenPairID sets the max ID of token pair
func (*Keeper) SetObserverKeeper ¶
func (k *Keeper) SetObserverKeeper(sk exported.StreamKeeper)
func (Keeper) SetOperator ¶
func (k Keeper) SetOperator(ctx sdk.Context, operator types.DEXOperator)
SetOperator save the operator information
func (Keeper) SetWithdrawCompleteTimeAddress ¶
func (k Keeper) SetWithdrawCompleteTimeAddress(ctx sdk.Context, completeTime time.Time, addr sdk.AccAddress)
SetWithdrawCompleteTimeAddress sets withdraw time key with empty []byte{} value
func (Keeper) SetWithdrawInfo ¶
func (k Keeper) SetWithdrawInfo(ctx sdk.Context, withdrawInfo types.WithdrawInfo)
SetWithdrawInfo sets withdraw address key with withdraw info
func (Keeper) SortProducts ¶
SortProducts sorts products
func (Keeper) TransferOwnership ¶
func (k Keeper) TransferOwnership(ctx sdk.Context, product string, from sdk.AccAddress, to sdk.AccAddress) sdk.Error
TransferOwnership transfers ownership of product
func (Keeper) UnlockTokenPair ¶
UnlockTokenPair unlocks token pair
func (Keeper) UpdateTokenPair ¶
UpdateTokenPair updates token pair in the store and the cache
type StakingKeeper ¶
type StakingKeeper interface {
IsValidator(ctx sdk.Context, addr sdk.AccAddress) bool
}
StakingKeeper defines the expected staking Keeper (noalias)
type SupplyKeeper ¶
type SupplyKeeper interface { SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) sdk.Error SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) sdk.Error GetModuleAccount(ctx sdk.Context, moduleName string) exported.ModuleAccountI GetModuleAddress(moduleName string) sdk.AccAddress MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) sdk.Error }
SupplyKeeper defines the expected supply Keeper