Documentation ¶
Index ¶
- func AllInvariants(k Keeper) sdk.Invariant
- func HandleCommunityPoolDepositProposal(ctx sdk.Context, k Keeper, p *types.CommunityPoolDepositProposal) error
- func HandleCommunityPoolWithdrawProposal(ctx sdk.Context, k Keeper, p *types.CommunityPoolWithdrawProposal) error
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQueryServerImpl(k Keeper) types.QueryServer
- func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
- func ShareRecordsInvariant(k Keeper) sdk.Invariant
- func VaultRecordsInvariant(k Keeper) sdk.Invariant
- func VaultSharesInvariant(k Keeper) sdk.Invariant
- type HardStrategy
- type Keeper
- func (k Keeper) AfterVaultDepositCreated(ctx sdk.Context, vaultDenom string, depositor sdk.AccAddress, ...)
- func (k Keeper) BeforeVaultDepositModified(ctx sdk.Context, vaultDenom string, depositor sdk.AccAddress, ...)
- func (k *Keeper) ClearHooks()
- func (k *Keeper) ConvertToAssets(ctx sdk.Context, share types.VaultShare) (sdk.Coin, error)
- func (k *Keeper) ConvertToShares(ctx sdk.Context, assets sdk.Coin) (types.VaultShare, error)
- func (k *Keeper) DeleteVaultRecord(ctx sdk.Context, vaultDenom string)
- func (k *Keeper) DeleteVaultShareRecord(ctx sdk.Context, acc sdk.AccAddress)
- func (k *Keeper) Deposit(ctx sdk.Context, depositor sdk.AccAddress, amount sdk.Coin, ...) error
- func (k *Keeper) DepositFromModuleAccount(ctx sdk.Context, from string, wantAmount sdk.Coin, ...) error
- func (k Keeper) GetAllVaultRecords(ctx sdk.Context) types.VaultRecords
- func (k Keeper) GetAllVaultShareRecords(ctx sdk.Context) types.VaultShareRecords
- func (k *Keeper) GetAllowedVault(ctx sdk.Context, vaultDenom string) (types.AllowedVault, bool)
- func (k Keeper) GetAllowedVaults(ctx sdk.Context) types.AllowedVaults
- func (k Keeper) GetParams(ctx sdk.Context) types.Params
- func (k *Keeper) GetStrategy(strategyType types.StrategyType) (Strategy, error)
- func (k *Keeper) GetVaultAccountShares(ctx sdk.Context, acc sdk.AccAddress) (types.VaultShares, bool)
- func (k *Keeper) GetVaultAccountValue(ctx sdk.Context, denom string, acc sdk.AccAddress) (sdk.Coin, error)
- func (k *Keeper) GetVaultRecord(ctx sdk.Context, vaultDenom string) (types.VaultRecord, bool)
- func (k *Keeper) GetVaultShareRecord(ctx sdk.Context, acc sdk.AccAddress) (types.VaultShareRecord, bool)
- func (k *Keeper) GetVaultTotalShares(ctx sdk.Context, denom string) (types.VaultShare, bool)
- func (k *Keeper) GetVaultTotalValue(ctx sdk.Context, denom string) (sdk.Coin, error)
- func (k Keeper) IterateVaultRecords(ctx sdk.Context, cb func(record types.VaultRecord) (stop bool))
- func (k Keeper) IterateVaultShareRecords(ctx sdk.Context, cb func(record types.VaultShareRecord) (stop bool))
- func (k *Keeper) SetHooks(sh types.EarnHooks) *Keeper
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k *Keeper) SetVaultRecord(ctx sdk.Context, record types.VaultRecord)
- func (k *Keeper) SetVaultShareRecord(ctx sdk.Context, record types.VaultShareRecord)
- func (k *Keeper) ShareIsDust(ctx sdk.Context, share types.VaultShare) (bool, error)
- func (k *Keeper) UpdateVaultRecord(ctx sdk.Context, vaultRecord types.VaultRecord)
- func (k *Keeper) UpdateVaultShareRecord(ctx sdk.Context, record types.VaultShareRecord)
- func (k *Keeper) Withdraw(ctx sdk.Context, from sdk.AccAddress, wantAmount sdk.Coin, ...) (sdk.Coin, error)
- func (k *Keeper) WithdrawFromModuleAccount(ctx sdk.Context, from string, wantAmount sdk.Coin, ...) (sdk.Coin, error)
- type SavingsStrategy
- func (s *SavingsStrategy) Deposit(ctx sdk.Context, amount sdk.Coin) error
- func (s *SavingsStrategy) GetEstimatedTotalAssets(ctx sdk.Context, denom string) (sdk.Coin, error)
- func (s *SavingsStrategy) GetStrategyType() types.StrategyType
- func (s *SavingsStrategy) Withdraw(ctx sdk.Context, amount sdk.Coin) error
- type Strategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AllInvariants ¶
AllInvariants runs all invariants of the swap module
func HandleCommunityPoolDepositProposal ¶
func HandleCommunityPoolDepositProposal(ctx sdk.Context, k Keeper, p *types.CommunityPoolDepositProposal) error
HandleCommunityPoolDepositProposal is a handler for executing a passed community pool deposit proposal
func HandleCommunityPoolWithdrawProposal ¶
func HandleCommunityPoolWithdrawProposal(ctx sdk.Context, k Keeper, p *types.CommunityPoolWithdrawProposal) error
HandleCommunityPoolWithdrawProposal is a handler for executing a passed community pool withdraw proposal.
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of the earn MsgServer interface for the provided Keeper.
func NewQueryServerImpl ¶
func NewQueryServerImpl(k Keeper) types.QueryServer
NewQueryServerImpl creates a new server for handling gRPC queries.
func RegisterInvariants ¶
func RegisterInvariants(ir sdk.InvariantRegistry, k Keeper)
RegisterInvariants registers the swap module invariants
func ShareRecordsInvariant ¶
ShareRecordsInvariant iterates all share records and asserts that they are valid
func VaultRecordsInvariant ¶
VaultRecordsInvariant iterates all vault records and asserts that they are valid
func VaultSharesInvariant ¶
VaultSharesInvariant iterates all vaults and shares and ensures the total vault shares match the sum of depositor shares
Types ¶
type HardStrategy ¶
type HardStrategy Keeper
HardStrategy defines the strategy that deposits assets to Hard
func (*HardStrategy) GetEstimatedTotalAssets ¶
GetEstimatedTotalAssets returns the current value of all assets deposited in hard.
func (*HardStrategy) GetStrategyType ¶
func (s *HardStrategy) GetStrategyType() types.StrategyType
GetStrategyType returns the strategy type
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
Keeper keeper for the earn module
func NewKeeper ¶
func NewKeeper( cdc codec.Codec, key sdk.StoreKey, paramstore paramtypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, liquidKeeper types.LiquidKeeper, hardKeeper types.HardKeeper, savingsKeeper types.SavingsKeeper, communityPoolMaccName string, ) Keeper
NewKeeper creates a new keeper
func (Keeper) AfterVaultDepositCreated ¶
func (k Keeper) AfterVaultDepositCreated( ctx sdk.Context, vaultDenom string, depositor sdk.AccAddress, sharesOwned sdk.Dec, )
AfterVaultDepositCreated - call hook if registered
func (Keeper) BeforeVaultDepositModified ¶
func (k Keeper) BeforeVaultDepositModified( ctx sdk.Context, vaultDenom string, depositor sdk.AccAddress, sharesOwned sdk.Dec, )
BeforeVaultDepositModified - call hook if registered
func (*Keeper) ConvertToAssets ¶
ConvertToAssets converts a given amount of shares to tokens.
func (*Keeper) ConvertToShares ¶
ConvertToShares converts a given amount of tokens to shares.
func (*Keeper) DeleteVaultRecord ¶
DeleteVaultRecord deletes the vault record for a given denom.
func (*Keeper) DeleteVaultShareRecord ¶
func (k *Keeper) DeleteVaultShareRecord( ctx sdk.Context, acc sdk.AccAddress, )
DeleteVaultShareRecord deletes the vault share record for a given account.
func (*Keeper) Deposit ¶
func (k *Keeper) Deposit( ctx sdk.Context, depositor sdk.AccAddress, amount sdk.Coin, depositStrategy types.StrategyType, ) error
Deposit adds the provided amount from a depositor to a vault. The vault is specified by the denom in the amount.
func (*Keeper) DepositFromModuleAccount ¶
func (k *Keeper) DepositFromModuleAccount( ctx sdk.Context, from string, wantAmount sdk.Coin, withdrawStrategy types.StrategyType, ) error
DepositFromModuleAccount adds the provided amount from a depositor module account to a vault. The vault is specified by the denom in the amount.
func (Keeper) GetAllVaultRecords ¶
func (k Keeper) GetAllVaultRecords(ctx sdk.Context) types.VaultRecords
GetAllVaultRecords returns all vault records from the store.
func (Keeper) GetAllVaultShareRecords ¶
func (k Keeper) GetAllVaultShareRecords(ctx sdk.Context) types.VaultShareRecords
GetAllVaultShareRecords returns all vault share records from the store.
func (*Keeper) GetAllowedVault ¶
GetAllowedVault returns the AllowedVault that corresponds to the given denom. If the denom starts with "bmage-" where it will return the "bmage" AllowedVault. Otherwise, it will return the exact match for the corresponding AllowedVault denom.
func (Keeper) GetAllowedVaults ¶
func (k Keeper) GetAllowedVaults(ctx sdk.Context) types.AllowedVaults
GetAllowedVaults returns the list of allowed vaults from the module params.
func (*Keeper) GetStrategy ¶
func (k *Keeper) GetStrategy(strategyType types.StrategyType) (Strategy, error)
GetStrategy returns the strategy for the given strategy type.
func (*Keeper) GetVaultAccountShares ¶
func (k *Keeper) GetVaultAccountShares( ctx sdk.Context, acc sdk.AccAddress, ) (types.VaultShares, bool)
GetVaultAccountShares returns the shares for a single address for all vaults.
func (*Keeper) GetVaultAccountValue ¶
func (k *Keeper) GetVaultAccountValue( ctx sdk.Context, denom string, acc sdk.AccAddress, ) (sdk.Coin, error)
GetVaultAccountValue returns the value of a single address within a vault if the account were to withdraw their entire balance.
func (*Keeper) GetVaultRecord ¶
GetVaultRecord returns the vault record for a given denom.
func (*Keeper) GetVaultShareRecord ¶
func (k *Keeper) GetVaultShareRecord( ctx sdk.Context, acc sdk.AccAddress, ) (types.VaultShareRecord, bool)
GetVaultShareRecord returns the vault share record for a given denom and account.
func (*Keeper) GetVaultTotalShares ¶
GetVaultTotalShares returns the total shares of a vault.
func (*Keeper) GetVaultTotalValue ¶
GetVaultTotalValue returns the total value of a vault, i.e. the realizable total value if the vault were to liquidate its entire strategies.
**Note:** This does not include the tokens held in bank by the module account. If it were to be included, also note that the module account is unblocked and can receive funds from bank sends.
func (Keeper) IterateVaultRecords ¶
func (k Keeper) IterateVaultRecords( ctx sdk.Context, cb func(record types.VaultRecord) (stop bool), )
IterateVaultRecords iterates over all vault objects in the store and performs a callback function.
func (Keeper) IterateVaultShareRecords ¶
func (k Keeper) IterateVaultShareRecords( ctx sdk.Context, cb func(record types.VaultShareRecord) (stop bool), )
IterateVaultShareRecords iterates over all vault share objects in the store and performs a callback function.
func (*Keeper) SetVaultRecord ¶
func (k *Keeper) SetVaultRecord(ctx sdk.Context, record types.VaultRecord)
SetVaultRecord sets the vault record for a given denom.
func (*Keeper) SetVaultShareRecord ¶
func (k *Keeper) SetVaultShareRecord( ctx sdk.Context, record types.VaultShareRecord, )
SetVaultShareRecord sets the vault share record for a given account.
func (*Keeper) ShareIsDust ¶
ShareIsDust returns true if the share value is less than 1 coin
func (*Keeper) UpdateVaultRecord ¶
func (k *Keeper) UpdateVaultRecord( ctx sdk.Context, vaultRecord types.VaultRecord, )
UpdateVaultRecord updates the vault record in state for a given denom. This deletes it if the supply is zero and updates the state if supply is non-zero.
func (*Keeper) UpdateVaultShareRecord ¶
func (k *Keeper) UpdateVaultShareRecord( ctx sdk.Context, record types.VaultShareRecord, )
UpdateVaultShareRecord updates the vault share record in state for a given denom and account. This deletes it if the supply is zero and updates the state if supply is non-zero.
func (*Keeper) Withdraw ¶
func (k *Keeper) Withdraw( ctx sdk.Context, from sdk.AccAddress, wantAmount sdk.Coin, withdrawStrategy types.StrategyType, ) (sdk.Coin, error)
Withdraw removes the amount of supplied tokens from a vault and transfers it back to the account.
func (*Keeper) WithdrawFromModuleAccount ¶
func (k *Keeper) WithdrawFromModuleAccount( ctx sdk.Context, from string, wantAmount sdk.Coin, withdrawStrategy types.StrategyType, ) (sdk.Coin, error)
WithdrawFromModuleAccount removes the amount of supplied tokens from a vault and transfers it back to the module account. The module account must be unblocked from receiving transfers.
type SavingsStrategy ¶
type SavingsStrategy Keeper
SavingsStrategy defines the strategy that deposits assets to x/savings
func (*SavingsStrategy) GetEstimatedTotalAssets ¶
GetEstimatedTotalAssets returns the current value of all assets deposited in savings.
func (*SavingsStrategy) GetStrategyType ¶
func (s *SavingsStrategy) GetStrategyType() types.StrategyType
GetStrategyType returns the strategy type
type Strategy ¶
type Strategy interface { // GetStrategyType returns the strategy type GetStrategyType() types.StrategyType // GetEstimatedTotalAssets returns the estimated total assets of the // strategy with the specified denom. This is the value if the strategy were // to liquidate all assets. // // **Note:** This may not reflect the true value as it may become outdated // from market changes. GetEstimatedTotalAssets(ctx sdk.Context, denom string) (sdk.Coin, error) // Deposit the specified amount of coins into this strategy. Deposit(ctx sdk.Context, amount sdk.Coin) error // Withdraw the specified amount of coins from this strategy. Withdraw(ctx sdk.Context, amount sdk.Coin) error }
Strategy is the interface that must be implemented by a strategy.