Documentation ¶
Overview ¶
DONTCOVER
Index ¶
- Constants
- Variables
- func CdpKey(denomByte byte, cdpID uint64) []byte
- func CollateralRatioBytes(ratio sdk.Dec) []byte
- func CollateralRatioIterKey(denomByte byte, ratio sdk.Dec) []byte
- func CollateralRatioKey(denomByte byte, cdpID uint64, ratio sdk.Dec) []byte
- func DenomIterKey(denomByte byte) []byte
- func DepositIterKey(cdpID uint64) []byte
- func DepositKey(cdpID uint64, depositor sdk.AccAddress) []byte
- func ErrBelowDebtFloor(codespace sdk.CodespaceType, debt sdk.Coins, floor sdk.Int) sdk.Error
- func ErrCdpAlreadyExists(codespace sdk.CodespaceType, owner sdk.AccAddress, denom string) sdk.Error
- func ErrCdpNotAvailable(codespace sdk.CodespaceType, cdpID uint64) sdk.Error
- func ErrCdpNotFound(codespace sdk.CodespaceType, owner sdk.AccAddress, denom string) sdk.Error
- func ErrCollateralNotSupported(codespace sdk.CodespaceType, denom string) sdk.Error
- func ErrDebtNotSupported(codespace sdk.CodespaceType, denom string) sdk.Error
- func ErrDepositNotAvailable(codespace sdk.CodespaceType, cdpID uint64, depositor sdk.AccAddress) sdk.Error
- func ErrDepositNotFound(codespace sdk.CodespaceType, depositor sdk.AccAddress, cdpID uint64) sdk.Error
- func ErrExceedsDebtLimit(codespace sdk.CodespaceType, proposed sdk.Coins, limit sdk.Coins) sdk.Error
- func ErrInvalidCollateralDenom(codespace sdk.CodespaceType, denom string) sdk.Error
- func ErrInvalidCollateralLength(codespace sdk.CodespaceType, length int) sdk.Error
- func ErrInvalidCollateralRatio(codespace sdk.CodespaceType, denom string, collateralRatio sdk.Dec, ...) sdk.Error
- func ErrInvalidDepositDenom(codespace sdk.CodespaceType, cdpID uint64, expected string, actual string) sdk.Error
- func ErrInvalidPaymentDenom(codespace sdk.CodespaceType, cdpID uint64, expected []string, actual []string) sdk.Error
- func ErrInvalidWithdrawAmount(codespace sdk.CodespaceType, withdraw sdk.Coins, deposit sdk.Coins) sdk.Error
- func ErrLoadingAugmentedCDP(codespace sdk.CodespaceType, cdpID uint64) sdk.Error
- func ErrPaymentExceedsDebt(codespace sdk.CodespaceType, payment sdk.Coins, principal sdk.Coins) sdk.Error
- func GetCdpIDBytes(cdpID uint64) (cdpIDBz []byte)
- func GetCdpIDFromBytes(bz []byte) (cdpID uint64)
- func ParamKeyTable() params.KeyTable
- func ParseDecBytes(db []byte) (sdk.Dec, error)
- func RegisterCodec(cdc *codec.Codec)
- func RelativePow(x sdk.Int, n sdk.Int, b sdk.Int) (z sdk.Int)
- func SortableDecBytes(dec sdk.Dec) []byte
- func SplitCdpKey(key []byte) (byte, uint64)
- func SplitCollateralRatioIterKey(key []byte) (denom byte, ratio sdk.Dec)
- func SplitCollateralRatioKey(key []byte) (denom byte, cdpID uint64, ratio sdk.Dec)
- func SplitDenomIterKey(key []byte) byte
- func SplitDepositIterKey(key []byte) (cdpID uint64)
- func SplitDepositKey(key []byte) (uint64, sdk.AccAddress)
- func ValidSortableDec(dec sdk.Dec) bool
- type AccountKeeper
- type AuctionKeeper
- type AugmentedCDP
- type AugmentedCDPs
- type CDP
- type CDPs
- type CollateralParam
- type CollateralParams
- type DebtParam
- type DebtParams
- type Deposit
- type Deposits
- type GenesisState
- type MsgCreateCDP
- type MsgDeposit
- type MsgDrawDebt
- type MsgRepayDebt
- type MsgWithdraw
- type Params
- type PricefeedKeeper
- type QueryCdpDeposits
- type QueryCdpParams
- type QueryCdpsByRatioParams
- type QueryCdpsParams
- type SupplyKeeper
Constants ¶
const ( DefaultCodespace sdk.CodespaceType = ModuleName CodeCdpAlreadyExists sdk.CodeType = 1 CodeCollateralLengthInvalid sdk.CodeType = 2 CodeCollateralNotSupported sdk.CodeType = 3 CodeDebtNotSupported sdk.CodeType = 4 CodeExceedsDebtLimit sdk.CodeType = 5 CodeInvalidCollateralRatio sdk.CodeType = 6 CodeCdpNotFound sdk.CodeType = 7 CodeDepositNotFound sdk.CodeType = 8 CodeInvalidDepositDenom sdk.CodeType = 9 CodeInvalidPaymentDenom sdk.CodeType = 10 CodeDepositNotAvailable sdk.CodeType = 11 CodeInvalidCollateralDenom sdk.CodeType = 12 CodeInvalidWithdrawAmount sdk.CodeType = 13 CodeCdpNotAvailable sdk.CodeType = 14 CodeBelowDebtFloor sdk.CodeType = 15 CodePaymentExceedsDebt sdk.CodeType = 16 CodeLoadingAugmentedCDP sdk.CodeType = 17 )
Error codes specific to cdp module
const ( EventTypeCreateCdp = "create_cdp" EventTypeCdpDeposit = "cdp_deposit" EventTypeCdpDraw = "cdp_draw" EventTypeCdpRepay = "cdp_repayment" EventTypeCdpClose = "cdp_close" EventTypeCdpWithdrawal = "cdp_withdrawal" EventTypeCdpLiquidation = "cdp_liquidation" EventTypeBeginBlockerFatal = "cdp_begin_block_error" AttributeKeyCdpID = "cdp_id" AttributeKeyDepositor = "depositor" AttributeValueCategory = "cdp" AttributeKeyError = "error_message" )
Event types for cdp module
const ( // ModuleName The name that will be used throughout the module ModuleName = "cdp" // 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 // LiquidatorMacc module account for liquidator LiquidatorMacc = "liquidator" // SavingsRateMacc module account for savings rate SavingsRateMacc = "savings" )
const ( QueryGetCdp = "cdp" QueryGetCdpDeposits = "deposits" QueryGetCdps = "cdps" QueryGetCdpsByCollateralization = "ratio" QueryGetParams = "params" RestOwner = "owner" RestCollateralDenom = "collateral-denom" RestRatio = "ratio" )
Querier routes for the cdp module
Variables ¶
var ( CdpIDKeyPrefix = []byte{0x00} CdpKeyPrefix = []byte{0x01} CollateralRatioIndexPrefix = []byte{0x02} CdpIDKey = []byte{0x03} DebtDenomKey = []byte{0x04} GovDenomKey = []byte{0x05} DepositKeyPrefix = []byte{0x06} PrincipalKeyPrefix = []byte{0x07} PreviousBlockTimeKey = []byte{0x08} PreviousDistributionTimeKey = []byte{0x09} )
KVStore key prefixes
var ( KeyGlobalDebtLimit = []byte("GlobalDebtLimit") KeyCollateralParams = []byte("CollateralParams") KeyDebtParams = []byte("DebtParams") KeyDistributionFrequency = []byte("DistributionFrequency") KeyCircuitBreaker = []byte("CircuitBreaker") KeyDebtThreshold = []byte("DebtThreshold") KeySurplusThreshold = []byte("SurplusThreshold") DefaultGlobalDebt = sdk.Coins{} DefaultCircuitBreaker = false DefaultCollateralParams = CollateralParams{} DefaultDebtParams = DebtParams{} DefaultCdpStartingID = uint64(1) DefaultDebtDenom = "debt" DefaultGovDenom = "ukava" DefaultSurplusThreshold = sdk.NewInt(1000000000) DefaultDebtThreshold = sdk.NewInt(1000000000) DefaultPreviousBlockTime = tmtime.Canonical(time.Unix(0, 0)) DefaultPreviousDistributionTime = tmtime.Canonical(time.Unix(0, 0)) DefaultSavingsDistributionFrequency = time.Hour * 24 * 2 )
Parameter keys
var MaxSortableDec = sdk.OneDec().Quo(sdk.SmallestDec())
MaxSortableDec largest sortable sdk.Dec
var ModuleCdc *codec.Codec
ModuleCdc generic sealed codec to be used throughout module
Functions ¶
func CollateralRatioBytes ¶
CollateralRatioBytes returns the liquidation ratio as sortable bytes
func CollateralRatioIterKey ¶
CollateralRatioIterKey returns the key for iterating over cdps by denom and liquidation ratio
func CollateralRatioKey ¶
CollateralRatioKey returns the key for querying a cdp by its liquidation ratio
func DenomIterKey ¶
DenomIterKey returns the key for iterating over cdps of a certain denom in the store
func DepositIterKey ¶
DepositIterKey returns the prefix key for iterating over deposits to a cdp
func DepositKey ¶
func DepositKey(cdpID uint64, depositor sdk.AccAddress) []byte
DepositKey key of a specific deposit in the store
func ErrBelowDebtFloor ¶
ErrBelowDebtFloor error for creating a cdp with debt below the minimum
func ErrCdpAlreadyExists ¶
func ErrCdpAlreadyExists(codespace sdk.CodespaceType, owner sdk.AccAddress, denom string) sdk.Error
ErrCdpAlreadyExists error for duplicate cdps
func ErrCdpNotAvailable ¶
func ErrCdpNotAvailable(codespace sdk.CodespaceType, cdpID uint64) sdk.Error
ErrCdpNotAvailable error for depositing to a CDP in liquidation
func ErrCdpNotFound ¶
func ErrCdpNotFound(codespace sdk.CodespaceType, owner sdk.AccAddress, denom string) sdk.Error
ErrCdpNotFound error cdp not found
func ErrCollateralNotSupported ¶
func ErrCollateralNotSupported(codespace sdk.CodespaceType, denom string) sdk.Error
ErrCollateralNotSupported error for unsupported collateral
func ErrDebtNotSupported ¶
func ErrDebtNotSupported(codespace sdk.CodespaceType, denom string) sdk.Error
ErrDebtNotSupported error for unsupported debt
func ErrDepositNotAvailable ¶
func ErrDepositNotAvailable(codespace sdk.CodespaceType, cdpID uint64, depositor sdk.AccAddress) sdk.Error
ErrDepositNotAvailable error for withdrawing deposits in liquidation
func ErrDepositNotFound ¶
func ErrDepositNotFound(codespace sdk.CodespaceType, depositor sdk.AccAddress, cdpID uint64) sdk.Error
ErrDepositNotFound error for deposit not found
func ErrExceedsDebtLimit ¶
func ErrExceedsDebtLimit(codespace sdk.CodespaceType, proposed sdk.Coins, limit sdk.Coins) sdk.Error
ErrExceedsDebtLimit error for attempted draws that exceed debt limit
func ErrInvalidCollateralDenom ¶
func ErrInvalidCollateralDenom(codespace sdk.CodespaceType, denom string) sdk.Error
ErrInvalidCollateralDenom error for invalid collateral denoms
func ErrInvalidCollateralLength ¶
func ErrInvalidCollateralLength(codespace sdk.CodespaceType, length int) sdk.Error
ErrInvalidCollateralLength error for invalid collateral input length
func ErrInvalidCollateralRatio ¶
func ErrInvalidCollateralRatio(codespace sdk.CodespaceType, denom string, collateralRatio sdk.Dec, liquidationRatio sdk.Dec) sdk.Error
ErrInvalidCollateralRatio error for attempted draws that are below liquidation ratio
func ErrInvalidDepositDenom ¶
func ErrInvalidDepositDenom(codespace sdk.CodespaceType, cdpID uint64, expected string, actual string) sdk.Error
ErrInvalidDepositDenom error for invalid deposit denoms
func ErrInvalidPaymentDenom ¶
func ErrInvalidPaymentDenom(codespace sdk.CodespaceType, cdpID uint64, expected []string, actual []string) sdk.Error
ErrInvalidPaymentDenom error for invalid payment denoms
func ErrInvalidWithdrawAmount ¶
func ErrInvalidWithdrawAmount(codespace sdk.CodespaceType, withdraw sdk.Coins, deposit sdk.Coins) sdk.Error
ErrInvalidWithdrawAmount error for invalid withdrawal amount
func ErrLoadingAugmentedCDP ¶
func ErrLoadingAugmentedCDP(codespace sdk.CodespaceType, cdpID uint64) sdk.Error
ErrLoadingAugmentedCDP error loading augmented cdp
func ErrPaymentExceedsDebt ¶
func ErrPaymentExceedsDebt(codespace sdk.CodespaceType, payment sdk.Coins, principal sdk.Coins) sdk.Error
ErrPaymentExceedsDebt error for repayments that are greater than the debt amount
func GetCdpIDBytes ¶
GetCdpIDBytes returns the byte representation of the cdpID
func GetCdpIDFromBytes ¶
GetCdpIDFromBytes returns cdpID in uint64 format from a byte array
func ParamKeyTable ¶
ParamKeyTable Key declaration for parameters
func ParseDecBytes ¶
ParseDecBytes parses a []byte encoded using SortableDecBytes back to sdk.Dec
func RegisterCodec ¶
RegisterCodec registers the necessary types for cdp module
func RelativePow ¶
RelativePow raises x to the power of n, where x (and the result, z) are scaled by factor b. For example, RelativePow(210, 2, 100) = 441 (2.1^2 = 4.41) Only defined for positive ints.
func SortableDecBytes ¶
SortableDecBytes returns a byte slice representation of a Dec that can be sorted. Left and right pads with 0s so there are 18 digits to left and right of the decimal point. For this reason, there is a maximum and minimum value for this, enforced by ValidSortableDec.
func SplitCdpKey ¶
SplitCdpKey returns the component parts of a cdp key
func SplitCollateralRatioIterKey ¶
SplitCollateralRatioIterKey split the collateral ratio key and return the denom, cdp id, and collateral:debt ratio
func SplitCollateralRatioKey ¶
SplitCollateralRatioKey split the collateral ratio key and return the denom, cdp id, and collateral:debt ratio
func SplitDenomIterKey ¶
SplitDenomIterKey returns the component part of a key for iterating over cdps by denom
func SplitDepositIterKey ¶
SplitDepositIterKey returns the component parts of a key for iterating over deposits on a cdp
func SplitDepositKey ¶
func SplitDepositKey(key []byte) (uint64, sdk.AccAddress)
SplitDepositKey returns the component parts of a deposit key
func ValidSortableDec ¶
ValidSortableDec sdk.Dec can't have precision of less than 10^-18
Types ¶
type AccountKeeper ¶ added in v0.5.0
type AccountKeeper interface {
IterateAccounts(ctx sdk.Context, cb func(account authexported.Account) (stop bool))
}
AccountKeeper expected interface for the account keeper (noalias)
type AuctionKeeper ¶
type AuctionKeeper interface { StartSurplusAuction(ctx sdk.Context, seller string, lot sdk.Coin, bidDenom string) (uint64, sdk.Error) StartDebtAuction(ctx sdk.Context, buyer string, bid sdk.Coin, initialLot sdk.Coin, debt sdk.Coin) (uint64, sdk.Error) StartCollateralAuction(ctx sdk.Context, seller string, lot sdk.Coin, maxBid sdk.Coin, lotReturnAddrs []sdk.AccAddress, lotReturnWeights []sdk.Int, debt sdk.Coin) (uint64, sdk.Error) }
AuctionKeeper expected interface for the auction keeper (noalias)
type AugmentedCDP ¶
type AugmentedCDP struct { CDP `json:"cdp" yaml:"cdp"` CollateralValue sdk.Coin `json:"collateral_value" yaml:"collateral_value"` // collateral's market value in debt coin CollateralizationRatio sdk.Dec `json:"collateralization_ratio" yaml:"collateralization_ratio"` // current collateralization ratio }
AugmentedCDP provides additional information about an active CDP
func NewAugmentedCDP ¶
func NewAugmentedCDP(cdp CDP, collateralValue sdk.Coin, collateralizationRatio sdk.Dec) AugmentedCDP
NewAugmentedCDP creates a new AugmentedCDP object
func (AugmentedCDP) String ¶
func (augCDP AugmentedCDP) String() string
String implements fmt.stringer
type AugmentedCDPs ¶
type AugmentedCDPs []AugmentedCDP
AugmentedCDPs a collection of AugmentedCDP objects
func (AugmentedCDPs) String ¶
func (augcdps AugmentedCDPs) String() string
String implements stringer
type CDP ¶
type CDP struct { ID uint64 `json:"id" yaml:"id"` // unique id for cdp Owner sdk.AccAddress `json:"owner" yaml:"owner"` // Account that authorizes changes to the CDP Collateral sdk.Coins `json:"collateral" yaml:"collateral"` // Amount of collateral stored in this CDP Principal sdk.Coins `json:"principal" yaml:"principal"` AccumulatedFees sdk.Coins `json:"accumulated_fees" yaml:"accumulated_fees"` FeesUpdated time.Time `json:"fees_updated" yaml:"fees_updated"` // Amount of stable coin drawn from this CDP }
CDP is the state of a single collateralized debt position.
type CollateralParam ¶
type CollateralParam struct { Denom string `json:"denom" yaml:"denom"` // Coin name of collateral type LiquidationRatio sdk.Dec `json:"liquidation_ratio" yaml:"liquidation_ratio"` // The ratio (Collateral (priced in stable coin) / Debt) under which a CDP will be liquidated DebtLimit sdk.Coins `json:"debt_limit" yaml:"debt_limit"` // Maximum amount of debt allowed to be drawn from this collateral type StabilityFee sdk.Dec `json:"stability_fee" yaml:"stability_fee"` // per second stability fee for loans opened using this collateral AuctionSize sdk.Int `json:"auction_size" yaml:"auction_size"` // Max amount of collateral to sell off in any one auction. LiquidationPenalty sdk.Dec `json:"liquidation_penalty" yaml:"liquidation_penalty"` // percentage penalty (between [0, 1]) applied to a cdp if it is liquidated Prefix byte `json:"prefix" yaml:"prefix"` MarketID string `json:"market_id" yaml:"market_id"` // marketID for fetching price of the asset from the pricefeed ConversionFactor sdk.Int `json:"conversion_factor" yaml:"conversion_factor"` // factor for converting internal units to one base unit of collateral }
CollateralParam governance parameters for each collateral type within the cdp module
func (CollateralParam) String ¶
func (cp CollateralParam) String() string
String implements fmt.Stringer
type CollateralParams ¶
type CollateralParams []CollateralParam
CollateralParams array of CollateralParam
func (CollateralParams) String ¶
func (cps CollateralParams) String() string
String implements fmt.Stringer
type DebtParam ¶
type DebtParam struct { Denom string `json:"denom" yaml:"denom"` ReferenceAsset string `json:"reference_asset" yaml:"reference_asset"` ConversionFactor sdk.Int `json:"conversion_factor" yaml:"conversion_factor"` DebtFloor sdk.Int `json:"debt_floor" yaml:"debt_floor"` // minimum active loan size, used to prevent dust SavingsRate sdk.Dec `json:"savings_rate" yaml:"savings_rate"` // the percentage of stability fees that are redirected to savings rate }
DebtParam governance params for debt assets
type Deposit ¶
type Deposit struct { CdpID uint64 `json:"cdp_id" yaml:"cdp_id"` // cdpID of the cdp Depositor sdk.AccAddress `json:"depositor" yaml:"depositor"` // Address of the depositor Amount sdk.Coins `json:"amount" yaml:"amount"` // Deposit amount }
Deposit defines an amount of coins deposited by an account to a cdp
func NewDeposit ¶
NewDeposit creates a new Deposit object
type Deposits ¶
type Deposits []Deposit
Deposits a collection of Deposit objects
func (Deposits) SumCollateral ¶
SumCollateral returns the total amount of collateral in the input deposits
type GenesisState ¶
type GenesisState struct { Params Params `json:"params" yaml:"params"` CDPs CDPs `json:"cdps" yaml:"cdps"` Deposits Deposits `json:"deposits" yaml:"deposits"` StartingCdpID uint64 `json:"starting_cdp_id" yaml:"starting_cdp_id"` DebtDenom string `json:"debt_denom" yaml:"debt_denom"` GovDenom string `json:"gov_denom" yaml:"gov_denom"` PreviousBlockTime time.Time `json:"previous_block_time" yaml:"previous_block_time"` PreviousDistributionTime time.Time `json:"previous_distribution_time" yaml"previous_distribution_time"` }
GenesisState is the state that must be provided at genesis.
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState returns a default genesis state
func NewGenesisState ¶ added in v0.5.0
func NewGenesisState(params Params, cdps CDPs, deposits Deposits, startingCdpID uint64, debtDenom, govDenom string, previousBlockTime time.Time, previousDistTime time.Time) 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 MsgCreateCDP ¶
type MsgCreateCDP struct { Sender sdk.AccAddress `json:"sender" yaml:"sender"` Collateral sdk.Coins `json:"collateral" yaml:"collateral"` Principal sdk.Coins `json:"principal" yaml:"principal"` }
MsgCreateCDP creates a cdp
func NewMsgCreateCDP ¶
func NewMsgCreateCDP(sender sdk.AccAddress, collateral sdk.Coins, principal sdk.Coins) MsgCreateCDP
NewMsgCreateCDP returns a new MsgPlaceBid.
func (MsgCreateCDP) GetSignBytes ¶
func (msg MsgCreateCDP) GetSignBytes() []byte
GetSignBytes gets the canonical byte representation of the Msg.
func (MsgCreateCDP) GetSigners ¶
func (msg MsgCreateCDP) GetSigners() []sdk.AccAddress
GetSigners returns the addresses of signers that must sign.
func (MsgCreateCDP) Route ¶
func (msg MsgCreateCDP) Route() string
Route return the message type used for routing the message.
func (MsgCreateCDP) String ¶
func (msg MsgCreateCDP) String() string
String implements the Stringer interface
func (MsgCreateCDP) Type ¶
func (msg MsgCreateCDP) Type() string
Type returns a human-readable string for the message, intended for utilization within tags.
func (MsgCreateCDP) ValidateBasic ¶
func (msg MsgCreateCDP) ValidateBasic() sdk.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"` Owner sdk.AccAddress `json:"owner" yaml:"owner"` Collateral sdk.Coins `json:"collateral" yaml:"collateral"` }
MsgDeposit deposit collateral to an existing cdp.
func NewMsgDeposit ¶
func NewMsgDeposit(owner sdk.AccAddress, depositor sdk.AccAddress, collateral 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() sdk.Error
ValidateBasic does a simple validation check that doesn't require access to any other information.
type MsgDrawDebt ¶
type MsgDrawDebt struct { Sender sdk.AccAddress `json:"sender" yaml:"sender"` CdpDenom string `json:"cdp_denom" yaml:"cdp_denom"` Principal sdk.Coins `json:"principal" yaml:"principal"` }
MsgDrawDebt draw coins off of collateral in cdp
func NewMsgDrawDebt ¶
func NewMsgDrawDebt(sender sdk.AccAddress, denom string, principal sdk.Coins) MsgDrawDebt
NewMsgDrawDebt returns a new MsgDrawDebt
func (MsgDrawDebt) GetSignBytes ¶
func (msg MsgDrawDebt) GetSignBytes() []byte
GetSignBytes gets the canonical byte representation of the Msg.
func (MsgDrawDebt) GetSigners ¶
func (msg MsgDrawDebt) GetSigners() []sdk.AccAddress
GetSigners returns the addresses of signers that must sign.
func (MsgDrawDebt) Route ¶
func (msg MsgDrawDebt) Route() string
Route return the message type used for routing the message.
func (MsgDrawDebt) String ¶
func (msg MsgDrawDebt) String() string
String implements the Stringer interface
func (MsgDrawDebt) Type ¶
func (msg MsgDrawDebt) Type() string
Type returns a human-readable string for the message, intended for utilization within tags.
func (MsgDrawDebt) ValidateBasic ¶
func (msg MsgDrawDebt) ValidateBasic() sdk.Error
ValidateBasic does a simple validation check that doesn't require access to any other information.
type MsgRepayDebt ¶
type MsgRepayDebt struct { Sender sdk.AccAddress `json:"sender" yaml:"sender"` CdpDenom string `json:"cdp_denom" yaml:"cdp_denom"` Payment sdk.Coins `json:"payment" yaml:"payment"` }
MsgRepayDebt repay debt drawn off the collateral in a CDP
func NewMsgRepayDebt ¶
func NewMsgRepayDebt(sender sdk.AccAddress, denom string, payment sdk.Coins) MsgRepayDebt
NewMsgRepayDebt returns a new MsgRepayDebt
func (MsgRepayDebt) GetSignBytes ¶
func (msg MsgRepayDebt) GetSignBytes() []byte
GetSignBytes gets the canonical byte representation of the Msg.
func (MsgRepayDebt) GetSigners ¶
func (msg MsgRepayDebt) GetSigners() []sdk.AccAddress
GetSigners returns the addresses of signers that must sign.
func (MsgRepayDebt) Route ¶
func (msg MsgRepayDebt) Route() string
Route return the message type used for routing the message.
func (MsgRepayDebt) String ¶
func (msg MsgRepayDebt) String() string
String implements the Stringer interface
func (MsgRepayDebt) Type ¶
func (msg MsgRepayDebt) Type() string
Type returns a human-readable string for the message, intended for utilization within tags.
func (MsgRepayDebt) ValidateBasic ¶
func (msg MsgRepayDebt) ValidateBasic() sdk.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"` Owner sdk.AccAddress `json:"owner" yaml:"owner"` Collateral sdk.Coins `json:"collateral" yaml:"collateral"` }
MsgWithdraw withdraw collateral from an existing cdp.
func NewMsgWithdraw ¶
func NewMsgWithdraw(owner sdk.AccAddress, depositor sdk.AccAddress, collateral sdk.Coins) MsgWithdraw
NewMsgWithdraw returns a new MsgDeposit
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() sdk.Error
ValidateBasic does a simple validation check that doesn't require access to any other information.
type Params ¶
type Params struct { CollateralParams CollateralParams `json:"collateral_params" yaml:"collateral_params"` DebtParams DebtParams `json:"debt_params" yaml:"debt_params"` GlobalDebtLimit sdk.Coins `json:"global_debt_limit" yaml:"global_debt_limit"` SurplusAuctionThreshold sdk.Int `json:"surplus_auction_threshold" yaml:"surplus_auction_threshold"` DebtAuctionThreshold sdk.Int `json:"debt_auction_threshold" yaml:"debt_auction_threshold"` SavingsDistributionFrequency time.Duration `json:"savings_distribution_frequency" yaml:"savings_distribution_frequency"` CircuitBreaker bool `json:"circuit_breaker" yaml:"circuit_breaker"` }
Params governance parameters for cdp module
func DefaultParams ¶
func DefaultParams() Params
DefaultParams returns default params for cdp module
func NewParams ¶
func NewParams(debtLimit sdk.Coins, collateralParams CollateralParams, debtParams DebtParams, surplusThreshold sdk.Int, debtThreshold sdk.Int, distributionFreq time.Duration, breaker bool) 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 pairs of auth module's parameters. nolint
type PricefeedKeeper ¶
type PricefeedKeeper interface { GetCurrentPrice(sdk.Context, string) (pftypes.CurrentPrice, sdk.Error) GetParams(sdk.Context) pftypes.Params // These are used for testing TODO replace mockApp with keeper in tests to remove these SetParams(sdk.Context, pftypes.Params) SetPrice(sdk.Context, sdk.AccAddress, string, sdk.Dec, time.Time) (pftypes.PostedPrice, sdk.Error) SetCurrentPrices(sdk.Context, string) sdk.Error }
PricefeedKeeper defines the expected interface for the pricefeed
type QueryCdpDeposits ¶
type QueryCdpDeposits struct { CollateralDenom string // get CDPs with this collateral denom Owner sdk.AccAddress // get CDPs belonging to this owner }
QueryCdpDeposits params for query /cdp/deposits
func NewQueryCdpDeposits ¶
func NewQueryCdpDeposits(owner sdk.AccAddress, denom string) QueryCdpDeposits
NewQueryCdpDeposits returns QueryCdpDeposits
type QueryCdpParams ¶
type QueryCdpParams struct { CollateralDenom string // get CDPs with this collateral denom Owner sdk.AccAddress // get CDPs belonging to this owner }
QueryCdpParams params for query /cdp/cdp
func NewQueryCdpParams ¶
func NewQueryCdpParams(owner sdk.AccAddress, denom string) QueryCdpParams
NewQueryCdpParams returns QueryCdpParams
type QueryCdpsByRatioParams ¶
type QueryCdpsByRatioParams struct { CollateralDenom string // get CDPs with this collateral denom Ratio sdk.Dec // get CDPs below this collateral:debt ratio }
QueryCdpsByRatioParams params for query /cdp/cdps/ratio
func NewQueryCdpsByRatioParams ¶
func NewQueryCdpsByRatioParams(denom string, ratio sdk.Dec) QueryCdpsByRatioParams
NewQueryCdpsByRatioParams returns QueryCdpsByRatioParams
type QueryCdpsParams ¶
type QueryCdpsParams struct {
CollateralDenom string // get CDPs with this collateral denom
}
QueryCdpsParams params for query /cdp/cdps
func NewQueryCdpsParams ¶
func NewQueryCdpsParams(denom string) QueryCdpsParams
NewQueryCdpsParams returns QueryCdpsParams
type SupplyKeeper ¶
type SupplyKeeper interface { GetModuleAddress(name string) sdk.AccAddress GetModuleAccount(ctx sdk.Context, name string) supplyexported.ModuleAccountI // TODO remove with genesis 2-phases refactor https://github.com/cosmos/cosmos-sdk/issues/2862 SetModuleAccount(sdk.Context, supplyexported.ModuleAccountI) SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) sdk.Error SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) sdk.Error SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) sdk.Error BurnCoins(ctx sdk.Context, name string, amt sdk.Coins) sdk.Error MintCoins(ctx sdk.Context, name string, amt sdk.Coins) sdk.Error GetSupply(ctx sdk.Context) (supply supplyexported.SupplyI) }
SupplyKeeper defines the expected supply keeper for module accounts