types

package
v0.13.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: Apache-2.0 Imports: 16 Imported by: 14

Documentation

Index

Constants

View Source
const (
	EventTypeHardDeposit               = "hard_deposit"
	EventTypeHardDelegatorDistribution = "hard_delegator_distribution"
	EventTypeHardLPDistribution        = "hard_lp_distribution"
	EventTypeDeleteHardDeposit         = "delete_hard_deposit"
	EventTypeHardWithdrawal            = "hard_withdrawal"
	EventTypeHardBorrow                = "hard_borrow"
	EventTypeHardLiquidation           = "hard_liquidation"
	EventTypeHardRepay                 = "hard_repay"
	AttributeValueCategory             = ModuleName
	AttributeKeyBlockHeight            = "block_height"
	AttributeKeyRewardsDistribution    = "rewards_distributed"
	AttributeKeyDeposit                = "deposit"
	AttributeKeyDepositDenom           = "deposit_denom"
	AttributeKeyDepositCoins           = "deposit_coins"
	AttributeKeyDepositor              = "depositor"
	AttributeKeyBorrow                 = "borrow"
	AttributeKeyBorrower               = "borrower"
	AttributeKeyBorrowCoins            = "borrow_coins"
	AttributeKeySender                 = "sender"
	AttributeKeyRepayCoins             = "repay_coins"
	AttributeKeyLiquidatedOwner        = "liquidated_owner"
	AttributeKeyLiquidatedCoins        = "liquidated_coins"
	AttributeKeyKeeper                 = "keeper"
	AttributeKeyKeeperRewardCoins      = "keeper_reward_coins"
	AttributeKeyOwner                  = "owner"
)

Event types for hard module

View Source
const (
	// ModuleName name that will be used throughout the module
	ModuleName = "hard"

	// ModuleAccountName name of module account used to hold deposits
	ModuleAccountName = "hard"

	// StoreKey Top level store key where all module items will be stored
	StoreKey = ModuleName

	// RouterKey Top level router key
	RouterKey = ModuleName

	// QuerierRoute Top level query string
	QuerierRoute = ModuleName

	// DefaultParamspace default name for parameter store
	DefaultParamspace = ModuleName
)
View Source
const (
	QueryGetParams         = "params"
	QueryGetModuleAccounts = "accounts"
	QueryGetDeposits       = "deposits"
	QueryGetTotalDeposited = "total-deposited"
	QueryGetBorrows        = "borrows"
	QueryGetTotalBorrowed  = "total-borrowed"
	QueryGetInterestRate   = "interest-rate"
)

Querier routes for the hard module

Variables

View Source
var (
	// ErrInvalidDepositDenom error for invalid deposit denoms
	ErrInvalidDepositDenom = sdkerrors.Register(ModuleName, 2, "invalid deposit denom")
	// ErrDepositNotFound error for deposit not found
	ErrDepositNotFound = sdkerrors.Register(ModuleName, 3, "deposit not found")
	// ErrInvalidWithdrawAmount error for invalid withdrawal amount
	ErrInvalidWithdrawAmount = sdkerrors.Register(ModuleName, 4, "invalid withdrawal amount")
	// ErrInsufficientModAccountBalance error for module account with innsufficient balance
	ErrInsufficientModAccountBalance = sdkerrors.Register(ModuleName, 5, "module account has insufficient balance to pay reward")
	// ErrInvalidAccountType error for unsupported accounts
	ErrInvalidAccountType = sdkerrors.Register(ModuleName, 6, "receiver account type not supported")
	// ErrAccountNotFound error for accounts that are not found in state
	ErrAccountNotFound = sdkerrors.Register(ModuleName, 7, "account not found")
	// ErrInvalidReceiver error for when sending and receiving accounts don't match
	ErrInvalidReceiver = sdkerrors.Register(ModuleName, 8, "receiver account must match sender account")
	// ErrMoneyMarketNotFound error for money market param not found
	ErrMoneyMarketNotFound = sdkerrors.Register(ModuleName, 9, "no money market found")
	// ErrDepositsNotFound error for no deposits found
	ErrDepositsNotFound = sdkerrors.Register(ModuleName, 10, "no deposits found")
	// ErrInsufficientLoanToValue error for when an attempted borrow exceeds maximum loan-to-value
	ErrInsufficientLoanToValue = sdkerrors.Register(ModuleName, 11, "not enough collateral supplied by account")
	// ErrMarketNotFound error for when a market for the input denom is not found
	ErrMarketNotFound = sdkerrors.Register(ModuleName, 12, "no market found for denom")
	// ErrPriceNotFound error for when a price for the input market is not found
	ErrPriceNotFound = sdkerrors.Register(ModuleName, 13, "no price found for market")
	// ErrBorrowExceedsAvailableBalance for when a requested borrow exceeds available module acc balances
	ErrBorrowExceedsAvailableBalance = sdkerrors.Register(ModuleName, 14, "exceeds module account balance")
	// ErrBorrowedCoinsNotFound error for when the total amount of borrowed coins cannot be found
	ErrBorrowedCoinsNotFound = sdkerrors.Register(ModuleName, 15, "no borrowed coins found")
	// ErrNegativeBorrowedCoins error for when substracting coins from the total borrowed balance results in a negative amount
	ErrNegativeBorrowedCoins = sdkerrors.Register(ModuleName, 16, "subtraction results in negative borrow amount")
	// ErrGreaterThanAssetBorrowLimit error for when a proposed borrow would increase borrowed amount over the asset's global borrow limit
	ErrGreaterThanAssetBorrowLimit = sdkerrors.Register(ModuleName, 17, "fails global asset borrow limit validation")
	// ErrBorrowEmptyCoins error for when you cannot borrow empty coins
	ErrBorrowEmptyCoins = sdkerrors.Register(ModuleName, 18, "cannot borrow zero coins")
	// ErrBorrowNotFound error for when a user's borrow is not found in the store
	ErrBorrowNotFound = sdkerrors.Register(ModuleName, 19, "borrow not found")
	// ErrPreviousAccrualTimeNotFound error for no previous accrual time found in store
	ErrPreviousAccrualTimeNotFound = sdkerrors.Register(ModuleName, 20, "no previous accrual time found")
	// ErrInsufficientBalanceForRepay error for when requested repay exceeds user's balance
	ErrInsufficientBalanceForRepay = sdkerrors.Register(ModuleName, 21, "insufficient balance")
	// ErrBorrowNotLiquidatable error for when a borrow is within valid LTV and cannot be liquidated
	ErrBorrowNotLiquidatable = sdkerrors.Register(ModuleName, 22, "borrow not liquidatable")
	// ErrInsufficientCoins error for when there are not enough coins for the operation
	ErrInsufficientCoins = sdkerrors.Register(ModuleName, 23, "unrecoverable state - insufficient coins")
	// ErrInsufficientBalanceForBorrow error for when the requested borrow exceeds user's balance
	ErrInsufficientBalanceForBorrow = sdkerrors.Register(ModuleName, 24, "insufficient balance")
	// ErrSuppliedCoinsNotFound error for when the total amount of supplied coins cannot be found
	ErrSuppliedCoinsNotFound = sdkerrors.Register(ModuleName, 25, "no supplied coins found")
	// ErrNegativeSuppliedCoins error for when substracting coins from the total supplied balance results in a negative amount
	ErrNegativeSuppliedCoins = sdkerrors.Register(ModuleName, 26, "subtraction results in negative supplied amount")
	// ErrInvalidWithdrawDenom error for when user attempts to withdraw a non-supplied coin type
	ErrInvalidWithdrawDenom = sdkerrors.Register(ModuleName, 27, "no coins of this type deposited")
	// ErrInvalidRepaymentDenom error for when user attempts to repay a non-borrowed coin type
	ErrInvalidRepaymentDenom = sdkerrors.Register(ModuleName, 28, "no coins of this type borrowed")
	// ErrInvalidIndexFactorDenom error for when index factor denom cannot be found
	ErrInvalidIndexFactorDenom = sdkerrors.Register(ModuleName, 29, "no index factor found for denom")
	// ErrBelowMinimumBorrowValue error for when a proposed borrow position is less than the minimum USD value
	ErrBelowMinimumBorrowValue = sdkerrors.Register(ModuleName, 30, "invalid proposed borrow value")
)
View Source
var (
	DepositsKeyPrefix             = []byte{0x01}
	BorrowsKeyPrefix              = []byte{0x02}
	BorrowedCoinsPrefix           = []byte{0x03}
	SuppliedCoinsPrefix           = []byte{0x04}
	MoneyMarketsPrefix            = []byte{0x05}
	PreviousAccrualTimePrefix     = []byte{0x06} // denom -> time
	TotalReservesPrefix           = []byte{0x07} // denom -> sdk.Coin
	BorrowInterestFactorPrefix    = []byte{0x08} // denom -> sdk.Dec
	SupplyInterestFactorPrefix    = []byte{0x09} // denom -> sdk.Dec
	DelegatorInterestFactorPrefix = []byte{0x10} // denom -> sdk.Dec

)
View Source
var (
	KeyMoneyMarkets              = []byte("MoneyMarkets")
	KeyMinimumBorrowUSDValue     = []byte("MinimumBorrowUSDValue")
	DefaultMoneyMarkets          = MoneyMarkets{}
	DefaultMinimumBorrowUSDValue = sdk.NewDec(10) // $10 USD minimum borrow value
	GovDenom                     = cdptypes.DefaultGovDenom
	DefaultAccumulationTimes     = GenesisAccumulationTimes{}
	DefaultTotalSupplied         = sdk.Coins{}
	DefaultTotalBorrowed         = sdk.Coins{}
	DefaultTotalReserves         = sdk.Coins{}
	DefaultDeposits              = Deposits{}
	DefaultBorrows               = Borrows{}
)

Parameter keys and default values

View Source
var ModuleCdc *codec.Codec

ModuleCdc generic sealed codec to be used throughout module

Functions

func DepositTypeIteratorKey

func DepositTypeIteratorKey(denom string) []byte

DepositTypeIteratorKey returns an interator prefix for interating over deposits by deposit denom

func GetTotalVestingPeriodLength

func GetTotalVestingPeriodLength(periods vesting.Periods) int64

GetTotalVestingPeriodLength returns the summed length of all vesting periods

func NewPeriod

func NewPeriod(amount sdk.Coins, length int64) vesting.Period

NewPeriod returns a new vesting period

func ParamKeyTable

func ParamKeyTable() params.KeyTable

ParamKeyTable Key declaration for parameters

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

RegisterCodec registers the necessary types for hard module

Types

type AccountKeeper

type AccountKeeper interface {
	GetAccount(ctx sdk.Context, addr sdk.AccAddress) authexported.Account
	SetAccount(ctx sdk.Context, acc authexported.Account)
}

AccountKeeper defines the expected keeper interface for interacting with account

type AuctionKeeper

type AuctionKeeper interface {
	StartCollateralAuction(ctx sdk.Context, seller string, lot sdk.Coin, maxBid sdk.Coin, lotReturnAddrs []sdk.AccAddress, lotReturnWeights []sdk.Int, debt sdk.Coin) (uint64, error)
}

AuctionKeeper expected interface for the auction keeper (noalias)

type Borrow

type Borrow struct {
	Borrower sdk.AccAddress        `json:"borrower" yaml:"borrower"`
	Amount   sdk.Coins             `json:"amount" yaml:"amount"`
	Index    BorrowInterestFactors `json:"index" yaml:"index"`
}

Borrow defines an amount of coins borrowed from a hard module account

func NewBorrow

func NewBorrow(borrower sdk.AccAddress, amount sdk.Coins, index BorrowInterestFactors) Borrow

NewBorrow returns a new Borrow instance

func (Borrow) String

func (b Borrow) String() string

func (Borrow) Validate

func (b Borrow) Validate() error

Validate deposit validation

type BorrowInterestFactor

type BorrowInterestFactor struct {
	Denom string  `json:"denom" yaml:"denom"`
	Value sdk.Dec `json:"value" yaml:"value"`
}

BorrowInterestFactor defines an individual borrow interest factor

func NewBorrowInterestFactor

func NewBorrowInterestFactor(denom string, value sdk.Dec) BorrowInterestFactor

NewBorrowInterestFactor returns a new BorrowInterestFactor instance

func (BorrowInterestFactor) String

func (bif BorrowInterestFactor) String() string

func (BorrowInterestFactor) Validate

func (bif BorrowInterestFactor) Validate() error

Validate validates BorrowInterestFactor values

type BorrowInterestFactors

type BorrowInterestFactors []BorrowInterestFactor

BorrowInterestFactors is a slice of BorrowInterestFactor, because Amino won't marshal maps

func (BorrowInterestFactors) GetInterestFactor

func (bifs BorrowInterestFactors) GetInterestFactor(denom string) (sdk.Dec, bool)

GetInterestFactor returns a denom's interest factor value

func (BorrowInterestFactors) RemoveInterestFactor

func (bifs BorrowInterestFactors) RemoveInterestFactor(denom string) (BorrowInterestFactors, bool)

RemoveInterestFactor removes a denom's interest factor value

func (BorrowInterestFactors) SetInterestFactor

func (bifs BorrowInterestFactors) SetInterestFactor(denom string, factor sdk.Dec) BorrowInterestFactors

SetInterestFactor sets a denom's interest factor value

func (BorrowInterestFactors) String

func (bifs BorrowInterestFactors) String() string

func (BorrowInterestFactors) Validate

func (bifs BorrowInterestFactors) Validate() error

Validate validates BorrowInterestFactors

type BorrowLimit

type BorrowLimit struct {
	HasMaxLimit  bool    `json:"has_max_limit" yaml:"has_max_limit"`
	MaximumLimit sdk.Dec `json:"maximum_limit" yaml:"maximum_limit"`
	LoanToValue  sdk.Dec `json:"loan_to_value" yaml:"loan_to_value"`
}

BorrowLimit enforces restrictions on a money market

func NewBorrowLimit

func NewBorrowLimit(hasMaxLimit bool, maximumLimit, loanToValue sdk.Dec) BorrowLimit

NewBorrowLimit returns a new BorrowLimit

func (BorrowLimit) Equal

func (bl BorrowLimit) Equal(blCompareTo BorrowLimit) bool

Equal returns a boolean indicating if an BorrowLimit is equal to another BorrowLimit

func (BorrowLimit) Validate

func (bl BorrowLimit) Validate() error

Validate BorrowLimit

type Borrows

type Borrows []Borrow

Borrows is a slice of Borrow

func (Borrows) Validate

func (bs Borrows) Validate() error

Validate validates Borrows

type Deposit

type Deposit struct {
	Depositor sdk.AccAddress        `json:"depositor" yaml:"depositor"`
	Amount    sdk.Coins             `json:"amount" yaml:"amount"`
	Index     SupplyInterestFactors `json:"index" yaml:"index"`
}

Deposit defines an amount of coins deposited into a hard module account

func NewDeposit

func NewDeposit(depositor sdk.AccAddress, amount sdk.Coins, indexes SupplyInterestFactors) Deposit

NewDeposit returns a new deposit

func (Deposit) String

func (d Deposit) String() string

func (Deposit) Validate

func (d Deposit) Validate() error

Validate deposit validation

type Deposits

type Deposits []Deposit

Deposits is a slice of Deposit

func (Deposits) Validate

func (ds Deposits) Validate() error

Validate validates Deposits

type GenesisAccumulationTime

type GenesisAccumulationTime struct {
	CollateralType           string    `json:"collateral_type" yaml:"collateral_type"`
	PreviousAccumulationTime time.Time `json:"previous_accumulation_time" yaml:"previous_accumulation_time"`
	SupplyInterestFactor     sdk.Dec   `json:"supply_interest_factor" yaml:"supply_interest_factor"`
	BorrowInterestFactor     sdk.Dec   `json:"borrow_interest_factor" yaml:"borrow_interest_factor"`
}

GenesisAccumulationTime stores the previous distribution time and its corresponding denom

func NewGenesisAccumulationTime

func NewGenesisAccumulationTime(ctype string, prevTime time.Time, supplyFactor, borrowFactor sdk.Dec) GenesisAccumulationTime

NewGenesisAccumulationTime returns a new GenesisAccumulationTime

func (GenesisAccumulationTime) Validate

func (gat GenesisAccumulationTime) Validate() error

Validate performs validation of GenesisAccumulationTime

type GenesisAccumulationTimes

type GenesisAccumulationTimes []GenesisAccumulationTime

GenesisAccumulationTimes slice of GenesisAccumulationTime

func (GenesisAccumulationTimes) Validate

func (gats GenesisAccumulationTimes) Validate() error

Validate performs validation of GenesisAccumulationTimes

type GenesisState

type GenesisState struct {
	Params                    Params                   `json:"params" yaml:"params"`
	PreviousAccumulationTimes GenesisAccumulationTimes `json:"previous_accumulation_times" yaml:"previous_accumulation_times"`
	Deposits                  Deposits                 `json:"deposits" yaml:"deposits"`
	Borrows                   Borrows                  `json:"borrows" yaml:"borrows"`
	TotalSupplied             sdk.Coins                `json:"total_supplied" yaml:"total_supplied"`
	TotalBorrowed             sdk.Coins                `json:"total_borrowed" yaml:"total_borrowed"`
	TotalReserves             sdk.Coins                `json:"total_reserves" yaml:"total_reserves"`
}

GenesisState is the state that must be provided at genesis.

func DefaultGenesisState

func DefaultGenesisState() GenesisState

DefaultGenesisState returns a default genesis state

func NewGenesisState

func NewGenesisState(
	params Params, prevAccumulationTimes GenesisAccumulationTimes, deposits Deposits,
	borrows Borrows, totalSupplied, totalBorrowed, totalReserves sdk.Coins) GenesisState

NewGenesisState returns a new genesis state

func (GenesisState) Equal

func (gs GenesisState) Equal(gs2 GenesisState) bool

Equal checks whether two gov GenesisState structs are equivalent

func (GenesisState) IsEmpty

func (gs GenesisState) IsEmpty() bool

IsEmpty returns true if a GenesisState is empty

func (GenesisState) Validate

func (gs GenesisState) Validate() error

Validate performs basic validation of genesis data returning an error for any failed validation criteria.

type HARDHooks

type HARDHooks interface {
	AfterDepositCreated(ctx sdk.Context, deposit Deposit)
	BeforeDepositModified(ctx sdk.Context, deposit Deposit)
	AfterDepositModified(ctx sdk.Context, deposit Deposit)
	AfterBorrowCreated(ctx sdk.Context, borrow Borrow)
	BeforeBorrowModified(ctx sdk.Context, borrow Borrow)
	AfterBorrowModified(ctx sdk.Context, borrow Borrow)
}

HARDHooks event hooks for other keepers to run code in response to HARD modifications

type InterestRateModel

type InterestRateModel struct {
	BaseRateAPY    sdk.Dec `json:"base_rate_apy" yaml:"base_rate_apy"`
	BaseMultiplier sdk.Dec `json:"base_multiplier" yaml:"base_multiplier"`
	Kink           sdk.Dec `json:"kink" yaml:"kink"`
	JumpMultiplier sdk.Dec `json:"jump_multiplier" yaml:"jump_multiplier"`
}

InterestRateModel contains information about an asset's interest rate

func NewInterestRateModel

func NewInterestRateModel(baseRateAPY, baseMultiplier, kink, jumpMultiplier sdk.Dec) InterestRateModel

NewInterestRateModel returns a new InterestRateModel

func (InterestRateModel) Equal

func (irm InterestRateModel) Equal(irmCompareTo InterestRateModel) bool

Equal returns a boolean indicating if an InterestRateModel is equal to another InterestRateModel

func (InterestRateModel) Validate

func (irm InterestRateModel) Validate() error

Validate InterestRateModel param

type InterestRateModels

type InterestRateModels []InterestRateModel

InterestRateModels slice of InterestRateModel

type MoneyMarket

type MoneyMarket struct {
	Denom                  string            `json:"denom" yaml:"denom"`
	BorrowLimit            BorrowLimit       `json:"borrow_limit" yaml:"borrow_limit"`
	SpotMarketID           string            `json:"spot_market_id" yaml:"spot_market_id"`
	ConversionFactor       sdk.Int           `json:"conversion_factor" yaml:"conversion_factor"`
	InterestRateModel      InterestRateModel `json:"interest_rate_model" yaml:"interest_rate_model"`
	ReserveFactor          sdk.Dec           `json:"reserve_factor" yaml:"reserve_factor"`
	KeeperRewardPercentage sdk.Dec           `json:"keeper_reward_percentage" yaml:"keeper_reward_percentages"`
}

MoneyMarket is a money market for an individual asset

func NewMoneyMarket

func NewMoneyMarket(denom string, borrowLimit BorrowLimit, spotMarketID string, conversionFactor sdk.Int,
	interestRateModel InterestRateModel, reserveFactor, keeperRewardPercentage sdk.Dec) MoneyMarket

NewMoneyMarket returns a new MoneyMarket

func (MoneyMarket) Equal

func (mm MoneyMarket) Equal(mmCompareTo MoneyMarket) bool

Equal returns a boolean indicating if a MoneyMarket is equal to another MoneyMarket

func (MoneyMarket) Validate

func (mm MoneyMarket) Validate() error

Validate MoneyMarket param

type MoneyMarketInterestRate

type MoneyMarketInterestRate struct {
	Denom              string  `json:"denom" yaml:"denom"`
	SupplyInterestRate sdk.Dec `json:"supply_interest_rate" yaml:"supply_interest_rate"`
	BorrowInterestRate sdk.Dec `json:"borrow_interest_rate" yaml:"borrow_interest_rate"`
}

MoneyMarketInterestRate is a unique type returned by interest rate queries

func NewMoneyMarketInterestRate

func NewMoneyMarketInterestRate(denom string, supplyInterestRate, borrowInterestRate sdk.Dec) MoneyMarketInterestRate

NewMoneyMarketInterestRate returns a new instance of MoneyMarketInterestRate

type MoneyMarketInterestRates

type MoneyMarketInterestRates []MoneyMarketInterestRate

MoneyMarketInterestRates is a slice of MoneyMarketInterestRate

type MoneyMarkets

type MoneyMarkets []MoneyMarket

MoneyMarkets slice of MoneyMarket

func (MoneyMarkets) Validate

func (mms MoneyMarkets) Validate() error

Validate borrow limits

type MsgBorrow

type MsgBorrow struct {
	Borrower sdk.AccAddress `json:"borrower" yaml:"borrower"`
	Amount   sdk.Coins      `json:"amount" yaml:"amount"`
}

MsgBorrow borrows funds from the hard module.

func NewMsgBorrow

func NewMsgBorrow(borrower sdk.AccAddress, amount sdk.Coins) MsgBorrow

NewMsgBorrow returns a new MsgBorrow

func (MsgBorrow) GetSignBytes

func (msg MsgBorrow) GetSignBytes() []byte

GetSignBytes gets the canonical byte representation of the Msg.

func (MsgBorrow) GetSigners

func (msg MsgBorrow) GetSigners() []sdk.AccAddress

GetSigners returns the addresses of signers that must sign.

func (MsgBorrow) Route

func (msg MsgBorrow) Route() string

Route return the message type used for routing the message.

func (MsgBorrow) String

func (msg MsgBorrow) String() string

String implements the Stringer interface

func (MsgBorrow) Type

func (msg MsgBorrow) Type() string

Type returns a human-readable string for the message, intended for utilization within tags.

func (MsgBorrow) ValidateBasic

func (msg MsgBorrow) ValidateBasic() error

ValidateBasic does a simple validation check that doesn't require access to any other information.

type MsgDeposit

type MsgDeposit struct {
	Depositor sdk.AccAddress `json:"depositor" yaml:"depositor"`
	Amount    sdk.Coins      `json:"amount" yaml:"amount"`
}

MsgDeposit deposit collateral to the hard module.

func NewMsgDeposit

func NewMsgDeposit(depositor sdk.AccAddress, amount sdk.Coins) MsgDeposit

NewMsgDeposit returns a new MsgDeposit

func (MsgDeposit) GetSignBytes

func (msg MsgDeposit) GetSignBytes() []byte

GetSignBytes gets the canonical byte representation of the Msg.

func (MsgDeposit) GetSigners

func (msg MsgDeposit) GetSigners() []sdk.AccAddress

GetSigners returns the addresses of signers that must sign.

func (MsgDeposit) Route

func (msg MsgDeposit) Route() string

Route return the message type used for routing the message.

func (MsgDeposit) String

func (msg MsgDeposit) String() string

String implements the Stringer interface

func (MsgDeposit) Type

func (msg MsgDeposit) Type() string

Type returns a human-readable string for the message, intended for utilization within tags.

func (MsgDeposit) ValidateBasic

func (msg MsgDeposit) ValidateBasic() error

ValidateBasic does a simple validation check that doesn't require access to any other information.

type MsgLiquidate

type MsgLiquidate struct {
	Keeper   sdk.AccAddress `json:"keeper" yaml:"keeper"`
	Borrower sdk.AccAddress `json:"borrower" yaml:"borrower"`
}

MsgLiquidate attempts to liquidate a borrower's borrow

func NewMsgLiquidate

func NewMsgLiquidate(keeper, borrower sdk.AccAddress) MsgLiquidate

NewMsgLiquidate returns a new MsgLiquidate

func (MsgLiquidate) GetSignBytes

func (msg MsgLiquidate) GetSignBytes() []byte

GetSignBytes gets the canonical byte representation of the Msg.

func (MsgLiquidate) GetSigners

func (msg MsgLiquidate) GetSigners() []sdk.AccAddress

GetSigners returns the addresses of signers that must sign.

func (MsgLiquidate) Route

func (msg MsgLiquidate) Route() string

Route return the message type used for routing the message.

func (MsgLiquidate) String

func (msg MsgLiquidate) String() string

String implements the Stringer interface

func (MsgLiquidate) Type

func (msg MsgLiquidate) Type() string

Type returns a human-readable string for the message, intended for utilization within tags.

func (MsgLiquidate) ValidateBasic

func (msg MsgLiquidate) ValidateBasic() error

ValidateBasic does a simple validation check that doesn't require access to any other information.

type MsgRepay

type MsgRepay struct {
	Sender sdk.AccAddress `json:"sender" yaml:"sender"`
	Owner  sdk.AccAddress `json:"owner" yaml:"owner"`
	Amount sdk.Coins      `json:"amount" yaml:"amount"`
}

MsgRepay repays funds to the hard module.

func NewMsgRepay

func NewMsgRepay(sender, owner sdk.AccAddress, amount sdk.Coins) MsgRepay

NewMsgRepay returns a new MsgRepay

func (MsgRepay) GetSignBytes

func (msg MsgRepay) GetSignBytes() []byte

GetSignBytes gets the canonical byte representation of the Msg.

func (MsgRepay) GetSigners

func (msg MsgRepay) GetSigners() []sdk.AccAddress

GetSigners returns the addresses of signers that must sign.

func (MsgRepay) Route

func (msg MsgRepay) Route() string

Route return the message type used for routing the message.

func (MsgRepay) String

func (msg MsgRepay) String() string

String implements the Stringer interface

func (MsgRepay) Type

func (msg MsgRepay) Type() string

Type returns a human-readable string for the message, intended for utilization within tags.

func (MsgRepay) ValidateBasic

func (msg MsgRepay) ValidateBasic() error

ValidateBasic does a simple validation check that doesn't require access to any other information.

type MsgWithdraw

type MsgWithdraw struct {
	Depositor sdk.AccAddress `json:"depositor" yaml:"depositor"`
	Amount    sdk.Coins      `json:"amount" yaml:"amount"`
}

MsgWithdraw withdraw from the hard module.

func NewMsgWithdraw

func NewMsgWithdraw(depositor sdk.AccAddress, amount sdk.Coins) MsgWithdraw

NewMsgWithdraw returns a new MsgWithdraw

func (MsgWithdraw) GetSignBytes

func (msg MsgWithdraw) GetSignBytes() []byte

GetSignBytes gets the canonical byte representation of the Msg.

func (MsgWithdraw) GetSigners

func (msg MsgWithdraw) GetSigners() []sdk.AccAddress

GetSigners returns the addresses of signers that must sign.

func (MsgWithdraw) Route

func (msg MsgWithdraw) Route() string

Route return the message type used for routing the message.

func (MsgWithdraw) String

func (msg MsgWithdraw) String() string

String implements the Stringer interface

func (MsgWithdraw) Type

func (msg MsgWithdraw) Type() string

Type returns a human-readable string for the message, intended for utilization within tags.

func (MsgWithdraw) ValidateBasic

func (msg MsgWithdraw) ValidateBasic() error

ValidateBasic does a simple validation check that doesn't require access to any other information.

type MultiHARDHooks

type MultiHARDHooks []HARDHooks

MultiHARDHooks combine multiple HARD hooks, all hook functions are run in array sequence

func NewMultiHARDHooks

func NewMultiHARDHooks(hooks ...HARDHooks) MultiHARDHooks

NewMultiHARDHooks returns a new MultiHARDHooks

func (MultiHARDHooks) AfterBorrowCreated

func (h MultiHARDHooks) AfterBorrowCreated(ctx sdk.Context, borrow Borrow)

AfterBorrowCreated runs after a borrow is created

func (MultiHARDHooks) AfterBorrowModified

func (h MultiHARDHooks) AfterBorrowModified(ctx sdk.Context, borrow Borrow)

AfterBorrowModified runs after a borrow is modified

func (MultiHARDHooks) AfterDepositCreated

func (h MultiHARDHooks) AfterDepositCreated(ctx sdk.Context, deposit Deposit)

AfterDepositCreated runs after a deposit is created

func (MultiHARDHooks) AfterDepositModified

func (h MultiHARDHooks) AfterDepositModified(ctx sdk.Context, deposit Deposit)

AfterDepositModified runs after a deposit is modified

func (MultiHARDHooks) BeforeBorrowModified

func (h MultiHARDHooks) BeforeBorrowModified(ctx sdk.Context, borrow Borrow)

BeforeBorrowModified runs before a borrow is modified

func (MultiHARDHooks) BeforeDepositModified

func (h MultiHARDHooks) BeforeDepositModified(ctx sdk.Context, deposit Deposit)

BeforeDepositModified runs before a deposit is modified

type Params

type Params struct {
	MoneyMarkets          MoneyMarkets `json:"money_markets" yaml:"money_markets"`
	MinimumBorrowUSDValue sdk.Dec      `json:"minimum_borrow_usd_value" yaml:"minimum_borrow_usd_value"`
}

Params governance parameters for hard module

func DefaultParams

func DefaultParams() Params

DefaultParams returns default params for hard module

func NewParams

func NewParams(moneyMarkets MoneyMarkets, minimumBorrowUSDValue sdk.Dec) Params

NewParams returns a new params object

func (*Params) ParamSetPairs

func (p *Params) ParamSetPairs() params.ParamSetPairs

ParamSetPairs implements the ParamSet interface and returns all the key/value pairs

func (Params) String

func (p Params) String() string

String implements fmt.Stringer

func (Params) Validate

func (p Params) Validate() error

Validate checks that the parameters have valid values.

type PricefeedKeeper

type PricefeedKeeper interface {
	GetCurrentPrice(sdk.Context, string) (pftypes.CurrentPrice, error)
}

PricefeedKeeper defines the expected interface for the pricefeed

type QueryAccountParams

type QueryAccountParams struct {
	Page  int    `json:"page" yaml:"page"`
	Limit int    `json:"limit" yaml:"limit"`
	Name  string `json:"name" yaml:"name"`
}

QueryAccountParams is the params for a filtered module account query

func NewQueryAccountParams

func NewQueryAccountParams(page, limit int, name string) QueryAccountParams

NewQueryAccountParams returns QueryAccountParams

type QueryBorrowsParams

type QueryBorrowsParams struct {
	Page  int            `json:"page" yaml:"page"`
	Limit int            `json:"limit" yaml:"limit"`
	Owner sdk.AccAddress `json:"owner" yaml:"owner"`
	Denom string         `json:"denom" yaml:"denom"`
}

QueryBorrowsParams is the params for a filtered borrows query

func NewQueryBorrowsParams

func NewQueryBorrowsParams(page, limit int, owner sdk.AccAddress, denom string) QueryBorrowsParams

NewQueryBorrowsParams creates a new QueryBorrowsParams

type QueryDepositsParams

type QueryDepositsParams struct {
	Page  int            `json:"page" yaml:"page"`
	Limit int            `json:"limit" yaml:"limit"`
	Denom string         `json:"denom" yaml:"denom"`
	Owner sdk.AccAddress `json:"owner" yaml:"owner"`
}

QueryDepositsParams is the params for a filtered deposit query

func NewQueryDepositsParams

func NewQueryDepositsParams(page, limit int, denom string, owner sdk.AccAddress) QueryDepositsParams

NewQueryDepositsParams creates a new QueryDepositsParams

type QueryInterestRateParams

type QueryInterestRateParams struct {
	Denom string `json:"denom" yaml:"denom"`
}

QueryInterestRateParams is the params for a filtered interest rate query

func NewQueryInterestRateParams

func NewQueryInterestRateParams(denom string) QueryInterestRateParams

NewQueryInterestRateParams creates a new QueryInterestRateParams

type QueryTotalBorrowedParams

type QueryTotalBorrowedParams struct {
	Denom string `json:"denom" yaml:"denom"`
}

QueryTotalBorrowedParams is the params for a filtered total borrowed coins query

func NewQueryTotalBorrowedParams

func NewQueryTotalBorrowedParams(denom string) QueryTotalBorrowedParams

NewQueryTotalBorrowedParams creates a new QueryTotalBorrowedParams

type QueryTotalDepositedParams

type QueryTotalDepositedParams struct {
	Denom string `json:"denom" yaml:"denom"`
}

QueryTotalDepositedParams is the params for a filtered total deposited coins query

func NewQueryTotalDepositedParams

func NewQueryTotalDepositedParams(denom string) QueryTotalDepositedParams

NewQueryTotalDepositedParams creates a new QueryTotalDepositedParams

type StakingKeeper

type StakingKeeper interface {
	IterateLastValidators(ctx sdk.Context, fn func(index int64, validator stakingexported.ValidatorI) (stop bool))
	IterateValidators(sdk.Context, func(index int64, validator stakingexported.ValidatorI) (stop bool))
	IterateAllDelegations(ctx sdk.Context, cb func(delegation stakingtypes.Delegation) (stop bool))
	GetBondedPool(ctx sdk.Context) (bondedPool exported.ModuleAccountI)
	BondDenom(ctx sdk.Context) (res string)
}

StakingKeeper defines the expected keeper interface for the staking keeper

type SupplyInterestFactor

type SupplyInterestFactor struct {
	Denom string  `json:"denom" yaml:"denom"`
	Value sdk.Dec `json:"value" yaml:"value"`
}

SupplyInterestFactor defines an individual borrow interest factor

func NewSupplyInterestFactor

func NewSupplyInterestFactor(denom string, value sdk.Dec) SupplyInterestFactor

NewSupplyInterestFactor returns a new SupplyInterestFactor instance

func (SupplyInterestFactor) String

func (sif SupplyInterestFactor) String() string

func (SupplyInterestFactor) Validate

func (sif SupplyInterestFactor) Validate() error

Validate validates SupplyInterestFactor values

type SupplyInterestFactors

type SupplyInterestFactors []SupplyInterestFactor

SupplyInterestFactors is a slice of SupplyInterestFactor, because Amino won't marshal maps

func (SupplyInterestFactors) GetInterestFactor

func (sifs SupplyInterestFactors) GetInterestFactor(denom string) (sdk.Dec, bool)

GetInterestFactor returns a denom's interest factor value

func (SupplyInterestFactors) RemoveInterestFactor

func (sifs SupplyInterestFactors) RemoveInterestFactor(denom string) (SupplyInterestFactors, bool)

RemoveInterestFactor removes a denom's interest factor value

func (SupplyInterestFactors) SetInterestFactor

func (sifs SupplyInterestFactors) SetInterestFactor(denom string, factor sdk.Dec) SupplyInterestFactors

SetInterestFactor sets a denom's interest factor value

func (SupplyInterestFactors) String

func (sifs SupplyInterestFactors) String() string

func (SupplyInterestFactors) Validate

func (sifs SupplyInterestFactors) Validate() error

Validate validates SupplyInterestFactors

type SupplyKeeper

type SupplyKeeper interface {
	GetModuleAddress(name string) sdk.AccAddress
	GetModuleAccount(ctx sdk.Context, name string) exported.ModuleAccountI
	GetSupply(ctx sdk.Context) (supply exported.SupplyI)
	SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) error
	SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error
	SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error
	MintCoins(ctx sdk.Context, name string, amt sdk.Coins) error
}

SupplyKeeper defines the expected supply keeper

type ValuationMap

type ValuationMap struct {
	Usd map[string]sdk.Dec
}

ValuationMap holds the USD value of various coin types

func NewValuationMap

func NewValuationMap() ValuationMap

NewValuationMap returns a new instance of ValuationMap

func (ValuationMap) Decrement

func (m ValuationMap) Decrement(denom string, amount sdk.Dec)

Decrement decrements the USD value of a denom

func (ValuationMap) Get

func (m ValuationMap) Get(denom string) sdk.Dec

Get returns the USD value for a specific denom

func (ValuationMap) GetSortedKeys

func (m ValuationMap) GetSortedKeys() []string

GetSortedKeys returns an array of the map's keys in alphabetical order

func (ValuationMap) Increment

func (m ValuationMap) Increment(denom string, amount sdk.Dec)

Increment increments the USD value of a denom

func (ValuationMap) SetZero

func (m ValuationMap) SetZero(denom string)

SetZero sets the USD value for a specific denom to 0

func (ValuationMap) Sum

func (m ValuationMap) Sum() sdk.Dec

Sum returns the total USD value of all coins in the map

Jump to

Keyboard shortcuts

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