keeper

package
v6.4.1 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ModuleAddr

func ModuleAddr() sdk.AccAddress

func NewMsgServerImpl

func NewMsgServerImpl(kb Builder) metoken.MsgServer

NewMsgServerImpl returns an implementation of MsgServer for the x/metoken module.

Types

type Builder

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

Builder constructs Keeper by preparing all related dependencies (notably the store).

func NewKeeperBuilder

func NewKeeperBuilder(
	cdc codec.Codec,
	storeKey storetypes.StoreKey,
	bankKeeper metoken.BankKeeper,
	leverageKeeper metoken.LeverageKeeper,
	oracleKeeper metoken.OracleKeeper,
	ugov ugov.EmergencyGroupBuilder,
) Builder

NewKeeperBuilder returns Builder object.

func (Builder) Keeper

func (b Builder) Keeper(ctx *sdk.Context) Keeper

Keeper creates a new Keeper object

type Keeper

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

func (Keeper) ClaimLeverageInterest

func (k Keeper) ClaimLeverageInterest() error

ClaimLeverageInterest sends accrued interest from x/leverage module to x/metoken account.

func (Keeper) ExportGenesis

func (k Keeper) ExportGenesis() *metoken.GenesisState

ExportGenesis returns the x/metoken module's exported genesis state.

func (Keeper) GetAllIndexesBalances

func (k Keeper) GetAllIndexesBalances() []metoken.IndexBalances

GetAllIndexesBalances returns asset balances of every Index

func (Keeper) GetAllRegisteredIndexes

func (k Keeper) GetAllRegisteredIndexes() []metoken.Index

GetAllRegisteredIndexes returns all the registered Indexes from the x/metoken module's KVStore.

func (Keeper) GetParams

func (k Keeper) GetParams() metoken.Params

GetParams gets the x/metoken module's parameters.

func (Keeper) IndexBalances

func (k Keeper) IndexBalances(meTokenDenom string) (metoken.IndexBalances, error)

IndexBalances returns Index Token supply, if it's not found returns an error.

func (Keeper) InitGenesis

func (k Keeper) InitGenesis(genState metoken.GenesisState)

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

func (Keeper) Logger

func (k Keeper) Logger() log.Logger

Logger returns module Logger

func (Keeper) Prices

func (k Keeper) Prices(index metoken.Index) (metoken.IndexPrices, error)

Prices calculates meToken price as an avg of median prices of all index accepted assets.

func (Keeper) RebalanceReserves

func (k Keeper) RebalanceReserves() error

RebalanceReserves checks if the portion of reserves is below the desired and transfer the missing amount from x/leverage to x/metoken reserves, or vice versa.

func (Keeper) RegisteredIndex

func (k Keeper) RegisteredIndex(meTokenDenom string) (metoken.Index, error)

RegisteredIndex gets an Index from the x/metoken module's KVStore, if not found returns an error.

func (Keeper) SetParams

func (k Keeper) SetParams(params metoken.Params) error

SetParams sets the x/metoken module's parameters.

func (Keeper) SetPricesToOracle added in v6.2.0

func (k Keeper) SetPricesToOracle() error

SetPricesToOracle of every registered index.

func (Keeper) UpdateIndexes

func (k Keeper) UpdateIndexes(toAdd, toUpdate []metoken.Index, byEmergencyGroup bool) error

UpdateIndexes registers `toAdd` and processes `toUpdate` to update existing indexes.

type Querier

type Querier struct {
	Builder
}

Querier implements a QueryServer for the x/metoken module.

func NewQuerier

func NewQuerier(kb Builder) Querier

NewQuerier returns Querier object.

func (Querier) IndexBalances

IndexBalances returns balances from the x/metoken module. If index balance denom is not specified, returns all the balances.

func (Querier) IndexPrices

IndexPrices returns Index price from the x/metoken module. If index denom is not specified, returns prices for all the registered indexes.

func (Querier) Indexes

Indexes returns registered indexes in the x/metoken module. If index denom is not specified, returns all the registered indexes.

func (Querier) Params

Params returns params of the x/metoken module.

func (Querier) RedeemFee

RedeemFee returns the fee for the redeem operation, given a specific amount of meTokens and the asset denom.

func (Querier) SwapFee

SwapFee returns the fee for the swap operation, given a specific amount of tokens and the meToken denom.

Jump to

Keyboard shortcuts

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