Documentation ¶
Index ¶
- Constants
- func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
- type Auction
- type BaseAuction
- func (a BaseAuction) GetBid() sdk.Coin
- func (a BaseAuction) GetBidder() sdk.AccAddress
- func (a BaseAuction) GetEndTime() time.Time
- func (a BaseAuction) GetHasReceivedBids() bool
- func (a BaseAuction) GetID() uint64
- func (a BaseAuction) GetInitiator() string
- func (a BaseAuction) GetLot() sdk.Coin
- func (a BaseAuction) GetMaxEndTime() time.Time
- func (a BaseAuction) GetType() string
- func (a BaseAuction) Validate() error
- type CollateralAuction
- func (a CollateralAuction) GetLotReturns() WeightedAddresses
- func (a CollateralAuction) GetModuleAccountCoins() sdk.Coins
- func (a CollateralAuction) GetPhase() string
- func (a CollateralAuction) GetType() string
- func (a CollateralAuction) IsReversePhase() bool
- func (a CollateralAuction) Validate() error
- func (a CollateralAuction) WithID(id uint64) Auction
- type DebtAuction
- type GenesisAuction
- type GenesisAuctions
- type GenesisState
- type Params
- type SurplusAuction
- type WeightedAddresses
Constants ¶
const ( CollateralAuctionType = "collateral" SurplusAuctionType = "surplus" DebtAuctionType = "debt" ForwardAuctionPhase = "forward" ReverseAuctionPhase = "reverse" )
const (
// ModuleName The name that will be used throughout the module
ModuleName = "auction"
)
Variables ¶
This section is empty.
Functions ¶
func RegisterLegacyAminoCodec ¶
func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)
RegisterCodec registers concrete types on the codec.
Types ¶
type Auction ¶
type Auction interface { GetID() uint64 WithID(uint64) Auction GetInitiator() string GetLot() sdk.Coin GetBidder() sdk.AccAddress GetBid() sdk.Coin GetEndTime() time.Time GetHasReceivedBids() bool GetMaxEndTime() time.Time GetType() string GetPhase() string }
Auction is an interface for handling common actions on auctions.
type BaseAuction ¶
type BaseAuction struct { ID uint64 `json:"id" yaml:"id"` Initiator string `json:"initiator" yaml:"initiator"` // Module name that starts the auction. Pays out Lot. Lot sdk.Coin `json:"lot" yaml:"lot"` // Coins that will paid out by Initiator to the winning bidder. Bidder sdk.AccAddress `json:"bidder" yaml:"bidder"` // Latest bidder. Receiver of Lot. Bid sdk.Coin `json:"bid" yaml:"bid"` // Coins paid into the auction the bidder. HasReceivedBids bool `json:"has_received_bids" yaml:"has_received_bids"` // Whether the auction has received any bids or not. EndTime time.Time `json:"end_time" yaml:"end_time"` // Current auction closing time. Triggers at the end of the block with time ≥ EndTime. MaxEndTime time.Time `json:"max_end_time" yaml:"max_end_time"` // Maximum closing time. Auctions can close before this but never after. }
BaseAuction is a common type shared by all Auctions.
func (BaseAuction) GetBid ¶
func (a BaseAuction) GetBid() sdk.Coin
GetBid is a getter for auction Bid.
func (BaseAuction) GetBidder ¶
func (a BaseAuction) GetBidder() sdk.AccAddress
GetBidder is a getter for auction Bidder.
func (BaseAuction) GetEndTime ¶
func (a BaseAuction) GetEndTime() time.Time
GetEndTime is a getter for auction end time.
func (BaseAuction) GetHasReceivedBids ¶
func (a BaseAuction) GetHasReceivedBids() bool
GetMaxEndTime is a getter for GetHasReceivedBids
func (BaseAuction) GetInitiator ¶
func (a BaseAuction) GetInitiator() string
GetInitiator is a getter for auction Initiator.
func (BaseAuction) GetLot ¶
func (a BaseAuction) GetLot() sdk.Coin
GetLot is a getter for auction Lot.
func (BaseAuction) GetMaxEndTime ¶
func (a BaseAuction) GetMaxEndTime() time.Time
GetMaxEndTime is a getter for MaxEndTime
func (BaseAuction) GetType ¶
func (a BaseAuction) GetType() string
GetType returns the auction type. Used to identify auctions in event attributes.
func (BaseAuction) Validate ¶
func (a BaseAuction) Validate() error
Validate verifies that the auction end time is before max end time
type CollateralAuction ¶
type CollateralAuction struct { BaseAuction `json:"base_auction" yaml:"base_auction"` CorrespondingDebt sdk.Coin `json:"corresponding_debt" yaml:"corresponding_debt"` MaxBid sdk.Coin `json:"max_bid" yaml:"max_bid"` LotReturns WeightedAddresses `json:"lot_returns" yaml:"lot_returns"` }
CollateralAuction is a two phase auction. Initially, in forward auction phase, bids can be placed up to a max bid. Then it switches to a reverse auction phase, where the initial amount up for auction is bid down. Unsold Lot is sent to LotReturns, being divided among the addresses by weight. Collateral auctions are normally used to sell off collateral seized from CDPs.
func (CollateralAuction) GetLotReturns ¶
func (a CollateralAuction) GetLotReturns() WeightedAddresses
GetLotReturns returns a collateral auction's lot owners
func (CollateralAuction) GetModuleAccountCoins ¶
func (a CollateralAuction) GetModuleAccountCoins() sdk.Coins
GetModuleAccountCoins returns the total number of coins held in the module account for this auction. It is used in genesis initialize the module account correctly.
func (CollateralAuction) GetPhase ¶
func (a CollateralAuction) GetPhase() string
GetPhase returns the direction of a collateral auction.
func (CollateralAuction) GetType ¶
func (a CollateralAuction) GetType() string
GetType returns the auction type. Used to identify auctions in event attributes.
func (CollateralAuction) IsReversePhase ¶
func (a CollateralAuction) IsReversePhase() bool
IsReversePhase returns whether the auction has switched over to reverse phase or not. CollateralAuctions initially start in forward phase.
func (CollateralAuction) Validate ¶
func (a CollateralAuction) Validate() error
Validate validates the CollateralAuction fields values.
func (CollateralAuction) WithID ¶
func (a CollateralAuction) WithID(id uint64) Auction
WithID returns an auction with the ID set.
type DebtAuction ¶
type DebtAuction struct { BaseAuction `json:"base_auction" yaml:"base_auction"` CorrespondingDebt sdk.Coin `json:"corresponding_debt" yaml:"corresponding_debt"` }
DebtAuction is a reverse auction that mints what it pays out. It is normally used to acquire pegged asset to cover the CDP system's debts that were not covered by selling collateral.
func (DebtAuction) GetModuleAccountCoins ¶
func (a DebtAuction) GetModuleAccountCoins() sdk.Coins
GetModuleAccountCoins returns the total number of coins held in the module account for this auction. It is used in genesis initialize the module account correctly.
func (DebtAuction) GetPhase ¶
func (a DebtAuction) GetPhase() string
GetPhase returns the direction of a debt auction, which never changes.
func (DebtAuction) GetType ¶
func (a DebtAuction) GetType() string
GetType returns the auction type. Used to identify auctions in event attributes.
func (DebtAuction) Validate ¶
func (a DebtAuction) Validate() error
Validate validates the DebtAuction fields values.
func (DebtAuction) WithID ¶
func (a DebtAuction) WithID(id uint64) Auction
WithID returns an auction with the ID set.
type GenesisAuction ¶
GenesisAuction is an interface that extends the auction interface to add functionality needed for initializing auctions from genesis.
type GenesisAuctions ¶
type GenesisAuctions []GenesisAuction
GenesisAuctions is a slice of genesis auctions.
type GenesisState ¶
type GenesisState struct { NextAuctionID uint64 `json:"next_auction_id" yaml:"next_auction_id"` Params Params `json:"params" yaml:"params"` Auctions GenesisAuctions `json:"auctions" yaml:"auctions"` }
GenesisState is auction state that must be provided at chain genesis.
type Params ¶
type Params struct { MaxAuctionDuration time.Duration `json:"max_auction_duration" yaml:"max_auction_duration"` // max length of auction BidDuration time.Duration `json:"bid_duration" yaml:"bid_duration"` // additional time added to the auction end time after each bid, capped by the expiry. IncrementSurplus sdk.Dec `json:"increment_surplus" yaml:"increment_surplus"` // percentage change (of auc.Bid) required for a new bid on a surplus auction IncrementDebt sdk.Dec `json:"increment_debt" yaml:"increment_debt"` // percentage change (of auc.Lot) required for a new bid on a debt auction IncrementCollateral sdk.Dec `json:"increment_collateral" yaml:"increment_collateral"` // percentage change (of auc.Bid or auc.Lot) required for a new bid on a collateral auction }
Params is the governance parameters for the auction module.
type SurplusAuction ¶
type SurplusAuction struct {
BaseAuction `json:"base_auction" yaml:"base_auction"`
}
SurplusAuction is a forward auction that burns what it receives from bids. It is normally used to sell off excess pegged asset acquired by the CDP system.
func (SurplusAuction) GetModuleAccountCoins ¶
func (a SurplusAuction) GetModuleAccountCoins() sdk.Coins
GetModuleAccountCoins returns the total number of coins held in the module account for this auction. It is used in genesis initialize the module account correctly.
func (SurplusAuction) GetPhase ¶
func (a SurplusAuction) GetPhase() string
GetPhase returns the direction of a surplus auction, which never changes.
func (SurplusAuction) GetType ¶
func (a SurplusAuction) GetType() string
GetType returns the auction type. Used to identify auctions in event attributes.
func (SurplusAuction) WithID ¶
func (a SurplusAuction) WithID(id uint64) Auction
WithID returns an auction with the ID set.
type WeightedAddresses ¶
type WeightedAddresses struct { Addresses []sdk.AccAddress `json:"addresses" yaml:"addresses"` Weights []sdk.Int `json:"weights" yaml:"weights"` }
WeightedAddresses is a type for storing some addresses and associated weights.
func (WeightedAddresses) Validate ¶
func (wa WeightedAddresses) Validate() error
Validate checks for that the weights are not negative, not all zero, and the lengths match.