Documentation ¶
Overview ¶
nolint: gocritic
Index ¶
- func NewMsgServerImpl(keeper Keeper) types.MsgServer
- func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
- type Keeper
- func (k Keeper) BorrowAsset(ctx sdk.Context, borrowerAddr sdk.AccAddress, loan sdk.Coin) error
- func (k Keeper) FromTokenToUTokenDenom(ctx sdk.Context, tokenDenom string) string
- func (k Keeper) FromUTokenToTokenDenom(ctx sdk.Context, uTokenDenom string) string
- func (k Keeper) GetAllBorrowerLoans(ctx sdk.Context, borrowerAddr sdk.AccAddress) (sdk.Coins, error)
- func (k Keeper) GetCollateralSetting(ctx sdk.Context, borrowerAddr sdk.AccAddress, denom string) bool
- func (k Keeper) GetLoan(ctx sdk.Context, borrowerAddr sdk.AccAddress, denom string) sdk.Coin
- func (k Keeper) GetParams(ctx sdk.Context) (params types.Params)
- func (k Keeper) IsAcceptedToken(ctx sdk.Context, tokenDenom string) bool
- func (k Keeper) IsAcceptedUToken(ctx sdk.Context, uTokenDenom string) bool
- func (k Keeper) LendAsset(ctx sdk.Context, lenderAddr sdk.AccAddress, loan sdk.Coin) error
- func (k Keeper) Logger(ctx sdk.Context) log.Logger
- func (k Keeper) RepayAsset(ctx sdk.Context, borrowerAddr sdk.AccAddress, payment sdk.Coin) error
- func (k Keeper) SetAsset(ctx sdk.Context, asset types.Asset)
- func (k Keeper) SetCollateralSetting(ctx sdk.Context, borrowerAddr sdk.AccAddress, denom string, enable bool) error
- func (k Keeper) SetParams(ctx sdk.Context, params types.Params)
- func (k Keeper) SetRegisteredToken(ctx sdk.Context, token types.Token)
- func (k Keeper) SetTokenDenom(ctx sdk.Context, tokenDenom string)
- func (k Keeper) TotalUTokenSupply(ctx sdk.Context, uTokenDenom string) sdk.Coin
- func (k Keeper) WithdrawAsset(ctx sdk.Context, lenderAddr sdk.AccAddress, uToken sdk.Coin) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewMsgServerImpl ¶
NewMsgServerImpl returns an implementation of MsgServer for the x/leverage module.
func NewQuerier ¶
func NewQuerier(k Keeper, legacyQuerierCdc *codec.LegacyAmino) sdk.Querier
Types ¶
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func NewKeeper ¶
func NewKeeper( cdc codec.Codec, storeKey sdk.StoreKey, paramStore paramtypes.Subspace, bk types.BankKeeper, ) Keeper
func (Keeper) BorrowAsset ¶
BorrowAsset attempts to borrow assets from the leverage module account using collateral uTokens. If asset type is invalid, collateral is insufficient, or module balance is insufficient, we return an error.
func (Keeper) FromTokenToUTokenDenom ¶
FromTokenToUTokenDenom returns the associated uToken denom for the given token denom. If the token denom does not exist, we assume the association is invalid and we return an empty string.
func (Keeper) FromUTokenToTokenDenom ¶
FromUTokenToTokenDenom returns the associated token denom for the given uToken denom. If the uToken denom does not exist, we assume the association is invalid and we return an empty string.
func (Keeper) GetAllBorrowerLoans ¶
func (k Keeper) GetAllBorrowerLoans(ctx sdk.Context, borrowerAddr sdk.AccAddress) (sdk.Coins, error)
GetAllBorrowerLoans returns an sdk.Coins object containing all open borrows associated with an address
func (Keeper) GetCollateralSetting ¶
func (k Keeper) GetCollateralSetting(ctx sdk.Context, borrowerAddr sdk.AccAddress, denom string) bool
GetCollateralSetting checks if a uToken denom is enabled for use as collateral by a single borrower.
func (Keeper) GetLoan ¶
GetLoan returns an sdk.Coin representing how much of a given denom a borrower currently owes.
func (Keeper) IsAcceptedToken ¶
IsAcceptedToken returns true if a given (non-UToken) token denom is an accepted asset type.
func (Keeper) IsAcceptedUToken ¶
IsAcceptedUToken returns true if a given uToken denom is an accepted asset type.
func (Keeper) LendAsset ¶
LendAsset attempts to deposit assets into the leverage module account in exchange for uTokens. If asset type is invalid or account balance is insufficient, we return an error.
func (Keeper) RepayAsset ¶
RepayAsset attempts to repay an open borrow position with base assets. If asset type is invalid, account balance is insufficient, or no open borrow position exists, we return an error. Additionally, if the amount provided is greater than the full repayment amount, only the necessary amount is transferred.
func (Keeper) SetCollateralSetting ¶
func (k Keeper) SetCollateralSetting(ctx sdk.Context, borrowerAddr sdk.AccAddress, denom string, enable bool) error
SetCollateralSetting enables or disables a uToken denom for use as collateral by a single borrower.
func (Keeper) SetRegisteredToken ¶
SetRegisteredToken stores a token into the x/leverage module's KVStore.
func (Keeper) SetTokenDenom ¶
SetTokenDenom stores the token denom along with the uToken denom association.
func (Keeper) TotalUTokenSupply ¶
TotalUTokenSupply returns an sdk.Coin representing the total balance of a given uToken type if valid. If the denom is not an accepted uToken type, we return a zero amount.
func (Keeper) WithdrawAsset ¶
WithdrawAsset attempts to deposit uTokens into the leverage module in exchange for the original tokens lent. If the uToken type is invalid or account balance insufficient on either side, we return an error.