keeper

package
v0.21.0 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2023 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMsgServerImpl

func NewMsgServerImpl(keeper Keeper) types.MsgServer

NewMsgServerImpl returns an implementation of the MsgServer interface for the provided Keeper.

Types

type AmmHooks

type AmmHooks struct {
	// contains filtered or unexported fields
}

Hooks wrapper struct for incentive keeper

func (AmmHooks) AfterExitPool

func (h AmmHooks) AfterExitPool(ctx sdk.Context, sender sdk.AccAddress, pool ammtypes.Pool, shareInAmount sdk.Int, exitCoins sdk.Coins) error

AfterExitPool is called after ExitPool, ExitSwapShareAmountIn, and ExitSwapExternAmountOut

func (AmmHooks) AfterJoinPool

func (h AmmHooks) AfterJoinPool(ctx sdk.Context, sender sdk.AccAddress, pool ammtypes.Pool, enterCoins sdk.Coins, shareOutAmount sdk.Int)

AfterJoinPool is called after JoinPool, JoinSwapExternAmountIn, and JoinSwapShareAmountOut

func (AmmHooks) AfterPoolCreated

func (h AmmHooks) AfterPoolCreated(ctx sdk.Context, sender sdk.AccAddress, pool ammtypes.Pool)

AfterPoolCreated is called after CreatePool

func (AmmHooks) AfterSwap

func (h AmmHooks) AfterSwap(ctx sdk.Context, sender sdk.AccAddress, pool ammtypes.Pool, input sdk.Coins, output sdk.Coins) error

AfterSwap is called after SwapExactAmountIn and SwapExactAmountOut

type CommitmentHooks

type CommitmentHooks struct {
	// contains filtered or unexported fields
}

Hooks wrapper struct for incentive keeper

func (CommitmentHooks) CommitmentChanged

func (h CommitmentHooks) CommitmentChanged(ctx sdk.Context, creator string, amount sdk.Coins)

CommitmentChanged implements CommentmentHook

func (CommitmentHooks) EdenUncommitted added in v0.12.0

func (h CommitmentHooks) EdenUncommitted(ctx sdk.Context, creator string, amount sdk.Coin)

EdenUncommitted implements EdenUncommitted

type Keeper

type Keeper struct {
	// contains filtered or unexported fields
}

func NewKeeper

func NewKeeper(
	cdc codec.BinaryCodec,
	storeKey,
	memKey storetypes.StoreKey,
	ps paramtypes.Subspace,
	ck types.CommitmentKeeper,
	sk types.StakingKeeper,
	ak types.AccountKeeper,
	bk types.BankKeeper,
	amm types.AmmKeeper,
	ok types.OracleKeeper,
	ap types.AssetProfileKeeper,
	epochsKeeper types.EpochsKeeper,
	stableKeeper types.StableStakeKeeper,
	tokenomicsKeeper types.TokenomicsKeeper,
	feeCollectorName string,
	dexRevCollectorName string,
	authority string,
) *Keeper

func (Keeper) AfterDelegationModified

func (k Keeper) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error

Updating commitments on delegation changes

func (Keeper) AfterExitPool

func (k Keeper) AfterExitPool(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, shareInAmount sdk.Int, exitCoins sdk.Coins) error

AfterExitPool is called after ExitPool, ExitSwapShareAmountIn, and ExitSwapExternAmountOut

func (Keeper) AfterJoinPool

func (k Keeper) AfterJoinPool(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, enterCoins sdk.Coins, shareOutAmount sdk.Int)

AfterJoinPool is called after JoinPool, JoinSwapExternAmountIn, and JoinSwapShareAmountOut

func (Keeper) AfterPoolCreated

func (k Keeper) AfterPoolCreated(ctx sdk.Context, sender sdk.AccAddress, poolId uint64)

AfterPoolCreated is called after CreatePool

func (Keeper) AfterSwap

func (k Keeper) AfterSwap(ctx sdk.Context, sender sdk.AccAddress, poolId uint64, input sdk.Coins, output sdk.Coins) error

AfterSwap is called after SwapExactAmountIn and SwapExactAmountOut

func (Keeper) AmmHooks

func (k Keeper) AmmHooks() AmmHooks

Return the wrapper struct

func (Keeper) BeforeDelegationCreated

func (k Keeper) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error

Creating a commitment object for a delegator if one does not exist:

func (Keeper) BeforeDelegationRemoved

func (k Keeper) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error

func (Keeper) BeforeDelegationSharesModified

func (k Keeper) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error

func (Keeper) BurnEdenBFromEdenUncommitted added in v0.12.0

func (k Keeper) BurnEdenBFromEdenUncommitted(ctx sdk.Context, delegator string, uncommitAmt sdk.Int) error

Burn EdenBoost from Eden unclaimed

func (Keeper) BurnEdenBFromElysUnstaking added in v0.12.0

func (k Keeper) BurnEdenBFromElysUnstaking(ctx sdk.Context, delegator sdk.AccAddress) error

Burn EdenBoost from Elys unstaked

func (Keeper) CalcAmountSubbucketsPerProgram added in v0.17.0

func (k Keeper) CalcAmountSubbucketsPerProgram(ctx sdk.Context, delegator string, denom string, withdrawType commitmenttypes.EarnType, commitments commitmenttypes.Commitments) sdk.Int

Deduct rewards per program per denom

func (Keeper) CalculateApr added in v0.17.0

func (k Keeper) CalculateApr(ctx sdk.Context, query *types.QueryAprRequest) (sdk.Int, error)

func (Keeper) CalculateDelegatedAmount

func (k Keeper) CalculateDelegatedAmount(ctx sdk.Context, delegator string) sdk.Int

Calculate the delegated amount

func (Keeper) CalculateEdenBoostRewards

func (k Keeper) CalculateEdenBoostRewards(ctx sdk.Context, delegatedAmt sdk.Int, commitments ctypes.Commitments, incentiveInfo types.IncentiveInfo, edenBoostAPR sdk.Dec) (sdk.Int, sdk.Int, sdk.Int)

Calculate new Eden-Boost token amounts based on the given conditions and user's current unclaimed token balance

func (Keeper) CalculateEpochCountsPerYear

func (k Keeper) CalculateEpochCountsPerYear(ctx sdk.Context, epochIdentifier string) int64

Calculate epoch counts per year to be used in APR calculation

func (Keeper) CalculatePoolRatio added in v0.20.0

func (k Keeper) CalculatePoolRatio(ctx sdk.Context, pool *ammtypes.Pool) string

Calculate the amm pool ratio

func (Keeper) CalculatePoolShareForStableStakeLPs added in v0.17.0

func (k Keeper) CalculatePoolShareForStableStakeLPs(ctx sdk.Context, totalProxyTVL sdk.Dec, baseCurrency string) sdk.Dec

Calculate pool share for stable stake pool

func (Keeper) CalculateProxyTVL

func (k Keeper) CalculateProxyTVL(ctx sdk.Context, baseCurrency string) sdk.Dec

Calculate Proxy TVL

func (Keeper) CalculateRewardsForLPs

func (k Keeper) CalculateRewardsForLPs(ctx sdk.Context, totalProxyTVL sdk.Dec, commitments ctypes.Commitments, edenAmountForLpPerDistribution sdk.Int, gasFeesForLPsPerDistribution sdk.Dec) (sdk.Int, sdk.Int)

Calculate new Eden token amounts based on LpElys committed and MElys committed

func (Keeper) CalculateRewardsForStableStakeLPs added in v0.15.0

func (k Keeper) CalculateRewardsForStableStakeLPs(ctx sdk.Context, totalProxyTVL sdk.Dec, commitments ctypes.Commitments, edenAmountPerEpochLp sdk.Int, gasFeesForLPs sdk.Dec, baseCurrency string) (sdk.Int, sdk.Int)

Calculate new Eden token amounts based on LpElys committed and MElys committed

func (Keeper) CalculateRewardsForStakersByCommitted added in v0.12.0

func (k Keeper) CalculateRewardsForStakersByCommitted(ctx sdk.Context, amt sdk.Int, edenAmountPerEpoch sdk.Int, dexRevenueAmtForStakers sdk.Dec) (sdk.Int, sdk.Int)

Calculate new Eden token amounts based on the given conditions and user's current unclaimed token balance

func (Keeper) CalculateRewardsForStakersByElysStaked added in v0.12.0

func (k Keeper) CalculateRewardsForStakersByElysStaked(ctx sdk.Context, delegatedAmt sdk.Int, edenAmountPerDistribution sdk.Int, dexRevenueAmtForStakersPerDistribution sdk.Dec) (sdk.Int, sdk.Int, sdk.Dec)

Calculate new Eden token amounts based on the given conditions and user's current unclaimed token balance

func (Keeper) CalculateTVL

func (k Keeper) CalculateTVL(ctx sdk.Context) sdk.Dec

Caculate total TVL

func (Keeper) CalculateTotalShareOfStaking

func (k Keeper) CalculateTotalShareOfStaking(amount sdk.Int) sdk.Dec

Calculate total share of staking

func (Keeper) CollectDEXRevenue

func (k Keeper) CollectDEXRevenue(ctx sdk.Context) (sdk.Coins, sdk.DecCoins, sdk.DecCoins)

Collect all DEX revenues to DEX revenue wallet, while tracking the 65% of it for LPs reward distribution transfer collected fees from different wallets(liquidity pool, margin module etc) to the distribution module account Assume this is already in USDC. TODO: + Collect revenue from margin, lend module

func (Keeper) CollectGasFeesToIncentiveModule

func (k Keeper) CollectGasFeesToIncentiveModule(ctx sdk.Context, baseCurrency string) sdk.Coins

Move gas fees collected to dex revenue wallet Convert it into USDC

func (Keeper) CommitmentChanged

func (k Keeper) CommitmentChanged(ctx sdk.Context, creator string, amount sdk.Coins)

Process commitmentChanged hook

func (Keeper) CommitmentHooks

func (k Keeper) CommitmentHooks() CommitmentHooks

Return the wrapper struct

func (Keeper) DistributeFromFeePool

func (k Keeper) DistributeFromFeePool(ctx sdk.Context, amount sdk.Coins, receiveAddr sdk.AccAddress) error

DistributeFromFeePool distributes funds from the distribution module account to a receiver address while updating the community pool

func (Keeper) EdenUncommitted added in v0.12.0

func (k Keeper) EdenUncommitted(ctx sdk.Context, creator string, amount sdk.Coin)

Process eden uncommitted hook

func (Keeper) EndBlocker added in v0.12.0

func (k Keeper) EndBlocker(ctx sdk.Context)

EndBlocker of incentive module

func (Keeper) EstimatePrice added in v0.17.0

func (k Keeper) EstimatePrice(ctx sdk.Context, tokenIn sdk.Coin, baseCurrency string) sdk.Int

Estimate the price : eg, 1 Eden -> x usdc

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState

ExportGenesis returns the module's exported genesis

func (Keeper) FindPool

func (k Keeper) FindPool(ctx sdk.Context, in_denom string, out_denom string) (ammtypes.Pool, bool)

FindPool function gets a pool that can convert in_denom token to out_denom token TODO: Later on: add a logic to choose best pool

func (Keeper) GetAllElysStaked added in v0.12.0

func (k Keeper) GetAllElysStaked(ctx sdk.Context) (list []types.ElysStaked)

GetAllElysStaked returns all elysStaked

func (Keeper) GetCommunityTax

func (k Keeper) GetCommunityTax(ctx sdk.Context) (percent sdk.Dec)

GetCommunityTax returns the current distribution community tax.

func (Keeper) GetDEXRewardPortionForLPs

func (k Keeper) GetDEXRewardPortionForLPs(ctx sdk.Context) (percent sdk.Dec)

GetDEXRewardPortionForLPs returns the dex revenue percent for Lps

func (Keeper) GetDEXRewardPortionForStakers added in v0.20.0

func (k Keeper) GetDEXRewardPortionForStakers(ctx sdk.Context) (percent sdk.Dec)

GetDEXRewardPortionForStakers returns the dex revenue percent for Stakers

func (Keeper) GetDexRewardsAmountForPool added in v0.20.0

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

Get total dex rewards amount from the specified pool

func (Keeper) GetElysStaked added in v0.12.0

func (k Keeper) GetElysStaked(
	ctx sdk.Context,
	address string,
) (val types.ElysStaked, found bool)

GetElysStaked returns a elysStaked from its index

func (Keeper) GetFeePool

func (k Keeper) GetFeePool(ctx sdk.Context) (feePool types.FeePool)

get the global fee pool distribution info

func (Keeper) GetFeePoolCommunityCoins

func (k Keeper) GetFeePoolCommunityCoins(ctx sdk.Context) sdk.DecCoins

get the community coins

func (Keeper) GetParams

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

GetParams get all parameters as types.Params

func (Keeper) GetPoolInfo

func (k Keeper) GetPoolInfo(ctx sdk.Context, poolId uint64) (types.PoolInfo, bool)

GetPoolInfo

func (Keeper) GetWithdrawAddrEnabled

func (k Keeper) GetWithdrawAddrEnabled(ctx sdk.Context) (enabled bool)

GetWithdrawAddrEnabled returns the current distribution withdraw address enabled parameter.

func (Keeper) GiveCommissionToValidators

func (k Keeper) GiveCommissionToValidators(ctx sdk.Context, delegator string, totalDelegationAmt sdk.Int, newUnclaimedAmt sdk.Int, dexRewards sdk.Dec, baseCurrency string) (sdk.Int, sdk.Int)

Give commissions to validators

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(ctx sdk.Context, data types.GenesisState)

InitGenesis initializes the module's state from a provided genesis state.

func (Keeper) InitPoolParams added in v0.20.0

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

InitPoolMultiplier: create a pool information responding to the pool creation.

func (Keeper) InitStableStakePoolParams added in v0.20.0

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

InitStableStakePoolMultiplier: create a stable stake pool information responding to the pool creation.

func (Keeper) IsLPRewardsDistributionEpoch added in v0.17.0

func (k Keeper) IsLPRewardsDistributionEpoch(ctx sdk.Context) (bool, types.IncentiveInfo)

func (Keeper) IsStakerRewardsDistributionEpoch added in v0.17.0

func (k Keeper) IsStakerRewardsDistributionEpoch(ctx sdk.Context) (bool, types.IncentiveInfo)

func (Keeper) Logger

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

func (Keeper) Params

func (Keeper) ProcessElysStakedTracking added in v0.17.0

func (k Keeper) ProcessElysStakedTracking(ctx sdk.Context)

Elys staked amount tracking

func (Keeper) ProcessRewardsDistribution added in v0.17.0

func (k Keeper) ProcessRewardsDistribution(ctx sdk.Context)

Rewards distribution

func (Keeper) ProcessUpdateIncentiveParams added in v0.18.0

func (k Keeper) ProcessUpdateIncentiveParams(ctx sdk.Context) bool

func (Keeper) ProcessWithdrawRewards

func (k Keeper) ProcessWithdrawRewards(ctx sdk.Context, delegator string, withdrawType commitmenttypes.EarnType) error

withdraw rewards Eden, EdenBoost and Elys to USDC

func (Keeper) RecordWithdrawValidatorCommission added in v0.15.0

func (k Keeper) RecordWithdrawValidatorCommission(ctx sdk.Context, delegator string, validator string) error

Update commitments for validator commission Eden, EdenBoost and USDC

func (Keeper) RemoveElysStaked added in v0.12.0

func (k Keeper) RemoveElysStaked(
	ctx sdk.Context,
	address string,
)

RemoveElysStaked removes a elysStaked from the store

func (Keeper) SetElysStaked added in v0.12.0

func (k Keeper) SetElysStaked(ctx sdk.Context, elysStaked types.ElysStaked)

SetElysStaked set a specific elysStaked in the store from its index

func (Keeper) SetFeePool

func (k Keeper) SetFeePool(ctx sdk.Context, feePool types.FeePool)

set the global fee pool distribution info

func (Keeper) SetParams

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

SetParams set the params

func (Keeper) SetPoolInfo added in v0.20.0

func (k Keeper) SetPoolInfo(ctx sdk.Context, poolId uint64, poolInfo types.PoolInfo) bool

SetPoolInfo

func (Keeper) StakingHooks

func (k Keeper) StakingHooks() StakingHooks

Return the wrapper struct

func (Keeper) UpdateAmmPoolAPR added in v0.20.0

func (k Keeper) UpdateAmmPoolAPR(ctx sdk.Context, lpIncentive types.IncentiveInfo, totalProxyTVL sdk.Dec)

Update APR for AMM pool

func (Keeper) UpdateCommitments

func (k Keeper) UpdateCommitments(ctx sdk.Context, creator string, commitments *ctypes.Commitments, newUnclaimedEdenTokens sdk.Int, newUnclaimedEdenBoostTokens sdk.Int, dexRewards sdk.Int, baseCurrency string)

Update commitment record

func (Keeper) UpdateCommitmentsSubBuckets added in v0.15.0

func (k Keeper) UpdateCommitmentsSubBuckets(ctx sdk.Context, creator string, commitments *ctypes.Commitments, rewardsByElysStaking sdk.Coins, rewardsByEdenCommitted sdk.Coins, rewardsByEdenBCommitted sdk.Coins, rewardsByUSDCDeposit sdk.Coins)

Update sub bucket commitment record

func (Keeper) UpdateCommunityPool

func (k Keeper) UpdateCommunityPool(ctx sdk.Context, amt sdk.DecCoins) sdk.DecCoins

Fund community pool based on community tax

func (Keeper) UpdateLPRewardsUnclaimed added in v0.17.0

func (k Keeper) UpdateLPRewardsUnclaimed(ctx sdk.Context, lpIncentive types.IncentiveInfo) error

Update unclaimed token amount Called back through epoch hook

func (Keeper) UpdatePoolMultipliers

func (k Keeper) UpdatePoolMultipliers(ctx sdk.Context, poolMultipliers []types.PoolMultipliers) bool

UpdatePoolMultipliers updates pool multipliers through gov proposal

func (Keeper) UpdateStakersRewardsUnclaimed added in v0.17.0

func (k Keeper) UpdateStakersRewardsUnclaimed(ctx sdk.Context, stakeIncentive types.IncentiveInfo) error

Update unclaimed token amount Called back through epoch hook

func (Keeper) UpdateTokensForValidator

func (k Keeper) UpdateTokensForValidator(ctx sdk.Context, validator string, newUnclaimedEdenTokens sdk.Int, dexRewards sdk.Dec, baseCurrency string)

Increase unclaimed token amount for the corresponding validator

func (Keeper) UpdateTotalCommitmentInfo

func (k Keeper) UpdateTotalCommitmentInfo(ctx sdk.Context, baseCurrency string)

Update total commitment info

type StakingHooks

type StakingHooks struct {
	// contains filtered or unexported fields
}

StakingHooks wrapper struct for slashing keeper

func (StakingHooks) AfterDelegationModified

func (h StakingHooks) AfterDelegationModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error

func (StakingHooks) AfterUnbondingInitiated

func (h StakingHooks) AfterUnbondingInitiated(ctx sdk.Context, id uint64) error

staking StakingHooks Must be called when a validator is created

func (StakingHooks) AfterValidatorBeginUnbonding

func (h StakingHooks) AfterValidatorBeginUnbonding(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error

Must be called when a validator begins unbonding

func (StakingHooks) AfterValidatorBonded

func (h StakingHooks) AfterValidatorBonded(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error

Must be called when a validator is bonded

func (StakingHooks) AfterValidatorCreated

func (h StakingHooks) AfterValidatorCreated(ctx sdk.Context, valAddr sdk.ValAddress) error

staking StakingHooks Must be called when a validator is created

func (StakingHooks) AfterValidatorRemoved

func (h StakingHooks) AfterValidatorRemoved(ctx sdk.Context, consAddr sdk.ConsAddress, valAddr sdk.ValAddress) error

Must be called when a validator is deleted

func (StakingHooks) BeforeDelegationCreated

func (h StakingHooks) BeforeDelegationCreated(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error

Must be called when a delegation is created

func (StakingHooks) BeforeDelegationRemoved

func (h StakingHooks) BeforeDelegationRemoved(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error

Must be called when a delegation is removed

func (StakingHooks) BeforeDelegationSharesModified

func (h StakingHooks) BeforeDelegationSharesModified(ctx sdk.Context, delAddr sdk.AccAddress, valAddr sdk.ValAddress) error

Must be called when a delegation's shares are modified

func (StakingHooks) BeforeValidatorModified

func (h StakingHooks) BeforeValidatorModified(ctx sdk.Context, valAddr sdk.ValAddress) error

Must be called when a validator's state changes

func (StakingHooks) BeforeValidatorSlashed

func (h StakingHooks) BeforeValidatorSlashed(ctx sdk.Context, valAddr sdk.ValAddress, fraction sdk.Dec) error

Jump to

Keyboard shortcuts

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