Documentation ¶
Overview ¶
Package Liquidator settles bad debt from undercollateralized CSDTs by seizing them and raising funds through auctions.
Notes
- Missing the debt queue thing from Vow
- seized collateral and csdt are stored in the module account, but debt (aka Sin) is stored in keeper
- The boundary between the liquidator and the csdt modules is messy.
- The CSDT type is used in liquidator
- csdt knows about seizing
- seizing of a CSDT is split across each module
- recording of debt is split across modules
- liquidator needs get access to stable and gov denoms from the csdt module
TODO
- Is returning unsold collateral to the CSDT owner rather than the CSDT a problem? It could prevent the CSDT from becoming safe again.
- Add some kind of more complete test
- Add constants for the module and route names
- tags
- custom error types, codespace
Index ¶
- Constants
- Variables
- func ParamKeyTable() subspace.KeyTable
- func RegisterCodec(cdc *codec.Codec)
- func ValidateGenesis(data GenesisState) error
- type AuctionKeeper
- type BankKeeper
- type CollateralParams
- type CsdtKeeper
- type GenesisState
- type LiquidatorParams
- type MsgSeizeAndStartCollateralAuction
- func (msg MsgSeizeAndStartCollateralAuction) GetSignBytes() []byte
- func (msg MsgSeizeAndStartCollateralAuction) GetSigners() []sdk.AccAddress
- func (msg MsgSeizeAndStartCollateralAuction) Route() string
- func (msg MsgSeizeAndStartCollateralAuction) Type() string
- func (msg MsgSeizeAndStartCollateralAuction) ValidateBasic() sdk.Error
- type MsgStartDebtAuction
- type SeizeAndStartCollateralAuctionRequest
- type SeizedDebt
- type StartDebtAuctionRequest
- type SupplyKeeper
Constants ¶
const ( // ModuleKey is the name of the module ModuleName = "liquidator" // StoreKey is the store key string for issue StoreKey = ModuleName // RouterKey is the message route for issue RouterKey = ModuleName // QuerierRoute is the querier route for issue QuerierRoute = ModuleName // Parameter store default namestore DefaultParamspace = ModuleName QueryGetOutstandingDebt = "outstanding_debt" // Get the outstanding seized debt )
Variables ¶
var ( KeyDebtAuctionSize = []byte("DebtAuctionSize") KeyCollateralParams = []byte("CollateralParams") )
Parameter keys
var ModuleCdc = codec.New()
var ModuleParamsKey = []byte("LiquidatorModuleParams")
Functions ¶
func RegisterCodec ¶
RegisterCodec registers concrete types on the codec.
func ValidateGenesis ¶
func ValidateGenesis(data GenesisState) error
ValidateGenesis performs basic validation of genesis data returning an error for any failed validation criteria.
Types ¶
type AuctionKeeper ¶
type AuctionKeeper interface { StartForwardAuction(sdk.Context, sdk.AccAddress, sdk.Coin, sdk.Coin) (auction.ID, sdk.Error) StartReverseAuction(sdk.Context, sdk.AccAddress, sdk.Coin, sdk.Coin) (auction.ID, sdk.Error) StartForwardReverseAuction(sdk.Context, sdk.AccAddress, sdk.Coin, sdk.Coin, sdk.AccAddress) (auction.ID, sdk.Error) }
type BankKeeper ¶
type CollateralParams ¶
type CollateralParams struct { Denom string `json:"denom" yaml:"denom"` AuctionSize sdk.Int `json:"auction_size" yaml:"auction_size"` }
CollateralParams params storing information about each collateral for the liquidator module
func (CollateralParams) String ¶
func (cp CollateralParams) String() string
String implements stringer interface
type CsdtKeeper ¶
type CsdtKeeper interface { GetCSDT(sdk.Context, sdk.AccAddress, string) (csdt.CSDT, bool) PartialSeizeCSDT(sdk.Context, sdk.AccAddress, string, sdk.Int, sdk.Int) sdk.Error ReduceGlobalDebt(sdk.Context, sdk.Int) sdk.Error GetStableDenom() string // TODO can this be removed somehow? GetGovDenom() string }
type GenesisState ¶
type GenesisState struct {
Params LiquidatorParams `json:"liquidator_params" yaml:"liquidator_params"`
}
GenesisState is the state that must be provided at genesis.
func DefaultGenesisState ¶
func DefaultGenesisState() GenesisState
DefaultGenesisState returns a default genesis state TODO pick better values
type LiquidatorParams ¶
type LiquidatorParams struct { DebtAuctionSize sdk.Int `json:"debt_auction_size" yaml:"debt_auction_size"` //SurplusAuctionSize sdk.Int CollateralParams []CollateralParams `json:"collateral_params" yaml:"collateral_params"` }
LiquidatorParams store params for the liquidator module
func NewLiquidatorParams ¶
func NewLiquidatorParams(debtAuctionSize sdk.Int, collateralParams []CollateralParams) LiquidatorParams
NewLiquidatorParams returns a new params object for the liquidator module
func (*LiquidatorParams) ParamSetPairs ¶
func (p *LiquidatorParams) ParamSetPairs() subspace.ParamSetPairs
ParamSetPairs implements the ParamSet interface and returns all the key/value pairs pairs of liquidator module's parameters. nolint
func (LiquidatorParams) String ¶
func (p LiquidatorParams) String() string
String implements fmt.Stringer
func (LiquidatorParams) Validate ¶
func (p LiquidatorParams) Validate() error
type MsgSeizeAndStartCollateralAuction ¶
type MsgSeizeAndStartCollateralAuction struct { Sender sdk.AccAddress `json:"sender" yaml:"sender"` CsdtOwner sdk.AccAddress `json:"owner" yaml:"owner"` CollateralDenom string `json:"collateral_denom" yaml:"collateral_denom"` }
func (MsgSeizeAndStartCollateralAuction) GetSignBytes ¶
func (msg MsgSeizeAndStartCollateralAuction) GetSignBytes() []byte
GetSignBytes gets the canonical byte representation of the Msg.
func (MsgSeizeAndStartCollateralAuction) GetSigners ¶
func (msg MsgSeizeAndStartCollateralAuction) GetSigners() []sdk.AccAddress
GetSigners returns the addresses of signers that must sign.
func (MsgSeizeAndStartCollateralAuction) Route ¶
func (msg MsgSeizeAndStartCollateralAuction) Route() string
Route return the message type used for routing the message.
func (MsgSeizeAndStartCollateralAuction) Type ¶
func (msg MsgSeizeAndStartCollateralAuction) Type() string
Type returns a human-readable string for the message, intended for utilization within tags.
func (MsgSeizeAndStartCollateralAuction) ValidateBasic ¶
func (msg MsgSeizeAndStartCollateralAuction) ValidateBasic() sdk.Error
ValidateBasic does a simple validation check that doesn't require access to any other information.
type MsgStartDebtAuction ¶
type MsgStartDebtAuction struct {
Sender sdk.AccAddress `json:"sender" yaml:"sender"`
}
func (MsgStartDebtAuction) GetSignBytes ¶
func (msg MsgStartDebtAuction) GetSignBytes() []byte
func (MsgStartDebtAuction) GetSigners ¶
func (msg MsgStartDebtAuction) GetSigners() []sdk.AccAddress
func (MsgStartDebtAuction) Route ¶
func (msg MsgStartDebtAuction) Route() string
func (MsgStartDebtAuction) Type ¶
func (msg MsgStartDebtAuction) Type() string
func (MsgStartDebtAuction) ValidateBasic ¶
func (msg MsgStartDebtAuction) ValidateBasic() sdk.Error
type SeizeAndStartCollateralAuctionRequest ¶
type SeizeAndStartCollateralAuctionRequest struct { BaseReq rest.BaseReq `json:"base_req"` Sender sdk.AccAddress `json:"sender"` CdpOwner sdk.AccAddress `json:"cdp_owner"` CollateralDenom string `json:"collateral_denom"` }
type SeizedDebt ¶
type SeizedDebt struct { Total sdk.Int // Total debt seized from CSDTs. Known as Awe in maker. SentToAuction sdk.Int // Portion of seized debt that has had a (reverse) auction was started for it. Known as Ash in maker. }
func (SeizedDebt) Available ¶
func (sd SeizedDebt) Available() sdk.Int
Available gets the seized debt that has not been sent for auction. Known as Woe in maker.
func (SeizedDebt) Settle ¶
func (sd SeizedDebt) Settle(amount sdk.Int) (SeizedDebt, sdk.Error)
type StartDebtAuctionRequest ¶
type StartDebtAuctionRequest struct { BaseReq rest.BaseReq `json:"base_req"` Sender sdk.AccAddress `json:"sender"` // TODO use baseReq.From instead? }
type SupplyKeeper ¶
type SupplyKeeper interface { GetSupply(ctx sdk.Context) (supply exported.SupplyI) SetSupply(ctx sdk.Context, supply exported.SupplyI) SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) sdk.Error SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) sdk.Error SendCoinsFromModuleToModule(ctx sdk.Context, senderModule, recipientModule string, amt sdk.Coins) sdk.Error GetModuleAddress(moduleName string) sdk.AccAddress BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) sdk.Error MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) sdk.Error //testing GetModuleAddressAndPermissions(moduleName string) (addr sdk.AccAddress, permissions []string) }