Documentation ¶
Index ¶
- Constants
- Variables
- func GetPoolHistoricalRewardsPoolNamePeriod(key []byte) (poolName string, period uint64)
- func NewQuerier(k Keeper) sdk.Querier
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func SetSwapTokenPair(ctx sdk.Context, k Keeper, token0Symbol, token1Symbol string)
- type GovKeeper
- type Keeper
- func (k Keeper) AfterDepositPeriodPassed(_ sdk.Context, _ govTypes.Proposal)
- func (k Keeper) AfterSubmitProposalHandler(_ sdk.Context, _ govTypes.Proposal)
- func (k Keeper) CalculateAmountYieldedBetween(ctx sdk.Context, pool types.FarmPool) (types.FarmPool, sdk.SysCoins)
- func (k Keeper) CheckMsgManageWhiteListProposal(ctx sdk.Context, proposal types.ManageWhiteListProposal) sdk.Error
- func (k Keeper) CheckMsgSubmitProposal(ctx sdk.Context, msg govTypes.MsgSubmitProposal) sdk.Error
- func (k Keeper) DeleteAddressInFarmPool(ctx sdk.Context, poolName string, addr sdk.AccAddress)
- func (k Keeper) DeleteFarmPool(ctx sdk.Context, poolName string)
- func (k Keeper) DeleteLockInfo(ctx sdk.Context, addr sdk.AccAddress, poolName string)
- func (k Keeper) DeletePoolCurrentRewards(ctx sdk.Context, poolName string)
- func (k Keeper) DeletePoolHistoricalReward(ctx sdk.Context, poolName string, period uint64)
- func (k Keeper) DeleteWhiteList(ctx sdk.Context, poolName string)
- func (k Keeper) EvmKeeper() evm.Keeper
- func (k Keeper) GetEarnings(ctx sdk.Context, poolName string, accAddr sdk.AccAddress) (types.Earnings, sdk.Error)
- func (k Keeper) GetFarmPool(ctx sdk.Context, poolName string) (pool types.FarmPool, found bool)
- func (k Keeper) GetFarmPoolNamesForAccount(ctx sdk.Context, accAddr sdk.AccAddress) (poolNames types.PoolNameList)
- func (k Keeper) GetFarmPools(ctx sdk.Context) (pools types.FarmPools)
- func (k Keeper) GetFeeCollector() string
- func (k Keeper) GetLockInfo(ctx sdk.Context, addr sdk.AccAddress, poolName string) (info types.LockInfo, found bool)
- func (k Keeper) GetMaxDepositPeriod(ctx sdk.Context, content sdkGov.Content) (maxDepositPeriod time.Duration)
- func (k Keeper) GetMinDeposit(ctx sdk.Context, content sdkGov.Content) (minDeposit sdk.SysCoins)
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) GetPoolCurrentRewards(ctx sdk.Context, poolName string) (period types.PoolCurrentRewards)
- func (k Keeper) GetPoolHistoricalRewards(ctx sdk.Context, poolName string, period uint64) (rewards types.PoolHistoricalRewards)
- func (k Keeper) GetPoolLockedValue(ctx sdk.Context, pool types.FarmPool) sdk.Dec
- func (k Keeper) GetVotingPeriod(ctx sdk.Context, content sdkGov.Content) (votingPeriod time.Duration)
- func (k Keeper) GetWhitelist(ctx sdk.Context) (whitelist types.PoolNameList)
- func (k Keeper) HasAddressInFarmPool(ctx sdk.Context, poolName string, addr sdk.AccAddress) bool
- func (k Keeper) HasFarmPool(ctx sdk.Context, poolName string) bool
- func (k Keeper) HasLockInfo(ctx sdk.Context, addr sdk.AccAddress, poolName string) bool
- func (k Keeper) HasPoolCurrentRewards(ctx sdk.Context, poolName string) bool
- func (k Keeper) IncrementPoolPeriod(ctx sdk.Context, poolName string, totalValueLocked sdk.SysCoin, ...) uint64
- func (k Keeper) IterateAllLockInfos(ctx sdk.Context, handler func(lockInfo types.LockInfo) (stop bool))
- func (k Keeper) IterateAllPoolCurrentRewards(ctx sdk.Context, ...)
- func (k Keeper) IterateAllPoolHistoricalRewards(ctx sdk.Context, ...)
- func (k Keeper) IteratePoolHistoricalRewards(ctx sdk.Context, poolName string, ...)
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) OnClaim(ctx sdk.Context, address sdk.AccAddress, poolName string, ...)
- func (k Keeper) RejectedHandler(_ sdk.Context, _ govTypes.Content)
- func (k Keeper) SetAddressInFarmPool(ctx sdk.Context, poolName string, addr sdk.AccAddress)
- func (k Keeper) SetFarmPool(ctx sdk.Context, pool types.FarmPool)
- func (k *Keeper) SetGovKeeper(gk GovKeeper)
- func (k Keeper) SetLockInfo(ctx sdk.Context, lockInfo types.LockInfo)
- func (k *Keeper) SetObserverKeeper(bk types.BackendKeeper)
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetPoolCurrentRewards(ctx sdk.Context, poolName string, rewards types.PoolCurrentRewards)
- func (k Keeper) SetPoolHistoricalRewards(ctx sdk.Context, poolName string, period uint64, ...)
- func (k Keeper) SetWhitelist(ctx sdk.Context, poolName string)
- func (k Keeper) StoreKey() sdk.StoreKey
- func (k Keeper) SupplyKeeper() supply.Keeper
- func (k Keeper) SwapKeeper() swap.Keeper
- func (k Keeper) TokenKeeper() token.Keeper
- func (k Keeper) UpdateLockInfo(ctx sdk.Context, addr sdk.AccAddress, poolName string, changedAmount sdk.Dec)
- func (k Keeper) VoteHandler(_ sdk.Context, _ govTypes.Proposal, _ govTypes.Vote) (string, sdk.Error)
- func (k Keeper) WithdrawRewards(ctx sdk.Context, poolName string, totalValueLocked sdk.SysCoin, ...) (sdk.SysCoins, sdk.Error)
- type MockContent
- type MockFarmKeeper
- type MockObserverData
- type MockObserverKeeper
Constants ¶
const (
TestChainID = "evoblockchain"
)
Variables ¶
var (
Addrs = createTestAddrs(10)
)
Functions ¶
func GetPoolHistoricalRewardsPoolNamePeriod ¶
gets the address & period from a validator's historical rewards key
func NewQuerier ¶
NewQuerier creates a new querier for farm clients.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
RegisterInvariants registers all farm invariants
Types ¶
type GovKeeper ¶
type GovKeeper interface { RemoveFromActiveProposalQueue(ctx sdk.Context, proposalID uint64, endTime time.Time) GetDepositParams(ctx sdk.Context) govtypes.DepositParams GetVotingParams(ctx sdk.Context) govtypes.VotingParams }
GovKeeper defines the expected gov Keeper
type Keeper ¶
type Keeper struct { ObserverKeeper []types.BackendKeeper // contains filtered or unexported fields }
Keeper of the farm store
func NewKeeper ¶
func NewKeeper(feeCollectorName string, supplyKeeper supply.Keeper, tokenKeeper token.Keeper, swapKeeper swap.Keeper, evmKeeper evm.Keeper, paramSubspace types.ParamSubspace, key sdk.StoreKey, cdc *codec.Codec) Keeper
NewKeeper creates a farm keeper
func (Keeper) AfterDepositPeriodPassed ¶
func (Keeper) AfterSubmitProposalHandler ¶
nolint
func (Keeper) CalculateAmountYieldedBetween ¶
func (k Keeper) CalculateAmountYieldedBetween(ctx sdk.Context, pool types.FarmPool) (types.FarmPool, sdk.SysCoins)
CalculateAmountYieldedBetween is used for calculating how many tokens haven been yielded from startBlockHeight to endBlockHeight. And return the amount.
func (Keeper) CheckMsgManageWhiteListProposal ¶
func (k Keeper) CheckMsgManageWhiteListProposal(ctx sdk.Context, proposal types.ManageWhiteListProposal) sdk.Error
CheckMsgManageWhiteListProposal checks msg manage white list proposal
func (Keeper) CheckMsgSubmitProposal ¶
CheckMsgSubmitProposal validates MsgSubmitProposal
func (Keeper) DeleteAddressInFarmPool ¶
func (Keeper) DeleteLockInfo ¶
func (Keeper) DeletePoolCurrentRewards ¶
delete current rewards for a pool
func (Keeper) DeletePoolHistoricalReward ¶
DeletePoolHistoricalReward deletes a historical reward
func (Keeper) DeleteWhiteList ¶
DeleteWhiteList removes the pool name from whitelist
func (Keeper) GetEarnings ¶
func (k Keeper) GetEarnings( ctx sdk.Context, poolName string, accAddr sdk.AccAddress, ) (types.Earnings, sdk.Error)
GetEarnings gets the earnings info by a given user address and a specific pool name
func (Keeper) GetFarmPool ¶
func (Keeper) GetFarmPoolNamesForAccount ¶
func (k Keeper) GetFarmPoolNamesForAccount(ctx sdk.Context, accAddr sdk.AccAddress) (poolNames types.PoolNameList)
GetFarmPoolNamesForAccount gets all pool names that an account has locked coins in from the store
func (Keeper) GetFarmPools ¶
GetFarmPools gets all pools that exist currently in the store
func (Keeper) GetFeeCollector ¶
GetFeeCollector returns feeCollectorName
func (Keeper) GetLockInfo ¶
func (Keeper) GetMaxDepositPeriod ¶
func (k Keeper) GetMaxDepositPeriod(ctx sdk.Context, content sdkGov.Content) (maxDepositPeriod time.Duration)
GetMaxDepositPeriod returns max deposit period
func (Keeper) GetMinDeposit ¶
GetMinDeposit returns min deposit
func (Keeper) GetPoolCurrentRewards ¶
func (Keeper) GetPoolHistoricalRewards ¶
func (Keeper) GetPoolLockedValue ¶
GetPoolLockedValue gets the value of locked tokens in pool priced in quote symbol
func (Keeper) GetVotingPeriod ¶
func (k Keeper) GetVotingPeriod(ctx sdk.Context, content sdkGov.Content) (votingPeriod time.Duration)
GetVotingPeriod returns voting period
func (Keeper) GetWhitelist ¶
func (k Keeper) GetWhitelist(ctx sdk.Context) (whitelist types.PoolNameList)
GetWhitelist gets the whole whitelist currently
func (Keeper) HasAddressInFarmPool ¶
HasAddressInFarmPool check existence of the pool associated with a address
func (Keeper) HasLockInfo ¶
HasLockInfo check existence of the address associated with a pool
func (Keeper) HasPoolCurrentRewards ¶
HasPoolCurrentRewards check existence of the pool_current_period associated with a pool_name
func (Keeper) IncrementPoolPeriod ¶
func (k Keeper) IncrementPoolPeriod( ctx sdk.Context, poolName string, totalValueLocked sdk.SysCoin, yieldedTokens sdk.SysCoins, ) uint64
IncrementPoolPeriod increments pool period, returning the period just ended
func (Keeper) IterateAllLockInfos ¶
func (k Keeper) IterateAllLockInfos( ctx sdk.Context, handler func(lockInfo types.LockInfo) (stop bool), )
Iterate over all lock infos
func (Keeper) IterateAllPoolCurrentRewards ¶
func (k Keeper) IterateAllPoolCurrentRewards( ctx sdk.Context, handler func(poolName string, curRewards types.PoolCurrentRewards) (stop bool), )
Iterate over current rewards
func (Keeper) IterateAllPoolHistoricalRewards ¶
func (k Keeper) IterateAllPoolHistoricalRewards( ctx sdk.Context, handler func(poolName string, period uint64, rewards types.PoolHistoricalRewards) (stop bool), )
Iterate over historical rewards
func (Keeper) IteratePoolHistoricalRewards ¶
func (k Keeper) IteratePoolHistoricalRewards( ctx sdk.Context, poolName string, handler func(store sdk.KVStore, key []byte, value []byte) (stop bool), )
IteratePoolHistoricalRewards deletes historical rewards for a pool
func (Keeper) SetAddressInFarmPool ¶
func (*Keeper) SetGovKeeper ¶
SetGovKeeper sets keeper of gov
func (*Keeper) SetObserverKeeper ¶
func (k *Keeper) SetObserverKeeper(bk types.BackendKeeper)
func (Keeper) SetPoolCurrentRewards ¶
func (Keeper) SetPoolHistoricalRewards ¶
func (Keeper) SetWhitelist ¶
GetWhitelist sets the pool name as a member into whitelist
func (Keeper) SupplyKeeper ¶
func (Keeper) SwapKeeper ¶
func (Keeper) TokenKeeper ¶
func (Keeper) UpdateLockInfo ¶
func (k Keeper) UpdateLockInfo(ctx sdk.Context, addr sdk.AccAddress, poolName string, changedAmount sdk.Dec)
UpdateLockInfo updates lock info for the modified lock info
func (Keeper) VoteHandler ¶
type MockContent ¶
type MockContent struct{}
func (MockContent) GetDescription ¶
func (m MockContent) GetDescription() string
func (MockContent) GetTitle ¶
func (m MockContent) GetTitle() string
func (MockContent) ProposalRoute ¶
func (m MockContent) ProposalRoute() string
func (MockContent) ProposalType ¶
func (m MockContent) ProposalType() string
func (MockContent) String ¶
func (m MockContent) String() string
func (MockContent) ValidateBasic ¶
func (m MockContent) ValidateBasic() sdk.Error
type MockFarmKeeper ¶
type MockFarmKeeper struct { Keeper StoreKey sdk.StoreKey SupplyKeeper supply.Keeper MountedStore store.MultiStore AccKeeper auth.AccountKeeper BankKeeper bank.Keeper TokenKeeper token.Keeper SwapKeeper swap.Keeper ObserverKeeper *MockObserverKeeper }
func NewMockFarmKeeper ¶
func NewMockFarmKeeper( k Keeper, keyStoreKey sdk.StoreKey, sKeeper supply.Keeper, ms store.MultiStore, accKeeper auth.AccountKeeper, bankKeeper bank.Keeper, tokenKeeper token.Keeper, swapKeeper swap.Keeper, observerKeeper *MockObserverKeeper, ) MockFarmKeeper
type MockObserverData ¶
type MockObserverData struct { Address sdk.AccAddress PoolName string ClaimedCoins sdk.SysCoins }
type MockObserverKeeper ¶
type MockObserverKeeper struct {
ObserverData MockObserverData
}
func (*MockObserverKeeper) OnFarmClaim ¶
func (ok *MockObserverKeeper) OnFarmClaim(ctx sdk.Context, address sdk.AccAddress, poolName string, claimedCoins sdk.SysCoins)