keeper

package
v0.0.0-...-f498596 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	TestChainID = "fbchain"
)

Variables

View Source
var (
	Addrs = createTestAddrs(10)
)

Functions

func GetPoolHistoricalRewardsPoolNamePeriod

func GetPoolHistoricalRewardsPoolNamePeriod(key []byte) (poolName string, period uint64)

gets the address & period from a validator's historical rewards key

func NewQuerier

func NewQuerier(k Keeper) sdk.Querier

NewQuerier creates a new querier for farm clients.

func RegisterInvariants

func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)

RegisterInvariants registers all farm invariants

func SetSwapTokenPair

func SetSwapTokenPair(ctx sdk.Context, k Keeper, token0Symbol, token1Symbol string)

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 (k Keeper) AfterDepositPeriodPassed(_ sdk.Context, _ govTypes.Proposal)

func (Keeper) AfterSubmitProposalHandler

func (k Keeper) AfterSubmitProposalHandler(_ sdk.Context, _ govTypes.Proposal)

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

func (k Keeper) CheckMsgSubmitProposal(ctx sdk.Context, msg govTypes.MsgSubmitProposal) sdk.Error

CheckMsgSubmitProposal validates MsgSubmitProposal

func (Keeper) DeleteAddressInFarmPool

func (k Keeper) DeleteAddressInFarmPool(ctx sdk.Context, poolName string, addr sdk.AccAddress)

func (Keeper) DeleteFarmPool

func (k Keeper) DeleteFarmPool(ctx sdk.Context, poolName string)

func (Keeper) DeleteLockInfo

func (k Keeper) DeleteLockInfo(ctx sdk.Context, addr sdk.AccAddress, poolName string)

func (Keeper) DeletePoolCurrentRewards

func (k Keeper) DeletePoolCurrentRewards(ctx sdk.Context, poolName string)

delete current rewards for a pool

func (Keeper) DeletePoolHistoricalReward

func (k Keeper) DeletePoolHistoricalReward(ctx sdk.Context, poolName string, period uint64)

DeletePoolHistoricalReward deletes a historical reward

func (Keeper) DeleteWhiteList

func (k Keeper) DeleteWhiteList(ctx sdk.Context, poolName string)

DeleteWhiteList removes the pool name from whitelist

func (Keeper) EvmKeeper

func (k Keeper) EvmKeeper() evm.Keeper

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 (k Keeper) GetFarmPool(ctx sdk.Context, poolName string) (pool types.FarmPool, found bool)

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

func (k Keeper) GetFarmPools(ctx sdk.Context) (pools types.FarmPools)

GetFarmPools gets all pools that exist currently in the store

func (Keeper) GetFeeCollector

func (k Keeper) GetFeeCollector() string

GetFeeCollector returns feeCollectorName

func (Keeper) GetLockInfo

func (k Keeper) GetLockInfo(ctx sdk.Context, addr sdk.AccAddress, poolName string) (info types.LockInfo, found bool)

func (Keeper) GetMaxDepositPeriod

func (k Keeper) GetMaxDepositPeriod(ctx sdk.Context, content sdkGov.Content) (maxDepositPeriod time.Duration)

GetMaxDepositPeriod returns max deposit period

func (Keeper) GetMinDeposit

func (k Keeper) GetMinDeposit(ctx sdk.Context, content sdkGov.Content) (minDeposit sdk.SysCoins)

GetMinDeposit returns min deposit

func (Keeper) GetParams

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

GetParams returns the total set of farm parameters.

func (Keeper) GetPoolCurrentRewards

func (k Keeper) GetPoolCurrentRewards(ctx sdk.Context, poolName string) (period types.PoolCurrentRewards)

func (Keeper) GetPoolHistoricalRewards

func (k Keeper) GetPoolHistoricalRewards(
	ctx sdk.Context, poolName string, period uint64,
) (rewards types.PoolHistoricalRewards)

func (Keeper) GetPoolLockedValue

func (k Keeper) GetPoolLockedValue(ctx sdk.Context, pool types.FarmPool) sdk.Dec

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

func (k Keeper) HasAddressInFarmPool(ctx sdk.Context, poolName string, addr sdk.AccAddress) bool

HasAddressInFarmPool check existence of the pool associated with a address

func (Keeper) HasFarmPool

func (k Keeper) HasFarmPool(ctx sdk.Context, poolName string) bool

func (Keeper) HasLockInfo

func (k Keeper) HasLockInfo(ctx sdk.Context, addr sdk.AccAddress, poolName string) bool

HasLockInfo check existence of the address associated with a pool

func (Keeper) HasPoolCurrentRewards

func (k Keeper) HasPoolCurrentRewards(ctx sdk.Context, poolName string) bool

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

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

Logger returns a module-specific logger

func (Keeper) OnClaim

func (k Keeper) OnClaim(ctx sdk.Context, address sdk.AccAddress, poolName string, claimedCoins sdk.SysCoins)

func (Keeper) RejectedHandler

func (k Keeper) RejectedHandler(_ sdk.Context, _ govTypes.Content)

func (Keeper) SetAddressInFarmPool

func (k Keeper) SetAddressInFarmPool(ctx sdk.Context, poolName string, addr sdk.AccAddress)

func (Keeper) SetFarmPool

func (k Keeper) SetFarmPool(ctx sdk.Context, pool types.FarmPool)

func (*Keeper) SetGovKeeper

func (k *Keeper) SetGovKeeper(gk GovKeeper)

SetGovKeeper sets keeper of gov

func (Keeper) SetLockInfo

func (k Keeper) SetLockInfo(ctx sdk.Context, lockInfo types.LockInfo)

func (*Keeper) SetObserverKeeper

func (k *Keeper) SetObserverKeeper(bk types.BackendKeeper)

func (Keeper) SetParams

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

SetParams sets the farm parameters to the param space.

func (Keeper) SetPoolCurrentRewards

func (k Keeper) SetPoolCurrentRewards(ctx sdk.Context, poolName string, rewards types.PoolCurrentRewards)

func (Keeper) SetPoolHistoricalRewards

func (k Keeper) SetPoolHistoricalRewards(
	ctx sdk.Context, poolName string, period uint64, rewards types.PoolHistoricalRewards,
)

func (Keeper) SetWhitelist

func (k Keeper) SetWhitelist(ctx sdk.Context, poolName string)

GetWhitelist sets the pool name as a member into whitelist

func (Keeper) StoreKey

func (k Keeper) StoreKey() sdk.StoreKey

func (Keeper) SupplyKeeper

func (k Keeper) SupplyKeeper() supply.Keeper

func (Keeper) SwapKeeper

func (k Keeper) SwapKeeper() swap.Keeper

func (Keeper) TokenKeeper

func (k Keeper) TokenKeeper() token.Keeper

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

func (k Keeper) VoteHandler(_ sdk.Context, _ govTypes.Proposal, _ govTypes.Vote) (string, sdk.Error)

func (Keeper) WithdrawRewards

func (k Keeper) WithdrawRewards(
	ctx sdk.Context, poolName string, totalValueLocked sdk.SysCoin, yieldedTokens sdk.SysCoins, addr sdk.AccAddress,
) (sdk.SysCoins, sdk.Error)

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 GetKeeper

func GetKeeper(t *testing.T) (sdk.Context, MockFarmKeeper)

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)

Jump to

Keyboard shortcuts

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