Documentation ¶
Index ¶
Constants ¶
const ( // ModuleName is the name of the module ModuleName = "auction" // AuctionBurnModuleAccountName is the name of the auction burn module account. AuctionBurnModuleAccountName = "auction_burn" // StoreKey to be used when creating the KVStore StoreKey = ModuleName )
const ( // Auction is in commit phase. AuctionStatusCommitPhase = "commit" // Auction is in reveal phase. AuctionStatusRevealPhase = "reveal" // Auction has ended (no reveals allowed). AuctionStatusExpired = "expired" // Auction has completed (winner selected). AuctionStatusCompleted = "completed" )
Auction status values.
const ( BidStatusCommitted = "commit" BidStatusRevealed = "reveal" )
Bid status values.
const (
DefaultParamspace = ModuleName
)
Default parameter namespace.
const RouterKey = ModuleName // this was defined in your key.go file
RouterKey is the module name router key
Variables ¶
var (
ErrInvalid = sdkerrors.Register(ModuleName, 1, "custom error message")
)
var ModuleCdc = codec.New()
ModuleCdc is the codec for the module
Functions ¶
func ParamKeyTable ¶
ParamKeyTable - ParamTable for bond module.
func RegisterCodec ¶
RegisterCodec registers concrete types on the Amino codec
Types ¶
type Auction ¶
type Auction struct { ID ID `json:"id,omitempty"` Status string `json:"status,omitempty"` // Creator of the auction. OwnerAddress string `json:"ownerAddress,omitempty"` // Auction create time. CreateTime time.Time `json:"createTime,omitempty"` // Time when the commit phase ends. CommitsEndTime time.Time `json:"commitsEndTime,omitempty"` // Time when the reveal phase ends. RevealsEndTime time.Time `json:"revealsEndTime,omitempty"` // Commit Fee + Reveal Fee both need to be paid when committing a bid. // Reveal Fee is returned ONLY if the bid is revealed. CommitFee sdk.Coin `json:"commitFee,omitempty"` RevealFee sdk.Coin `json:"revealFee,omitempty"` // Minimum bid for a valid commit. MinimumBid sdk.Coin `json:"minimumBid,omitempty"` // Winner address. WinnerAddress string `json:"winnerAddress,omitempty"` // Winning bid, i.e. highest bid. WinnerBid sdk.Coin `json:"winnerBid,omitempty"` // Amount winner actually pays, i.e. 2nd highest bid. // As it's a 2nd price auction. WinnerPrice sdk.Coin `json:"winnerPrice,omitempty"` }
Auction is a 2nd price sealed-bid on-chain auction.
func (Auction) GetCommitsEndTime ¶
func (Auction) GetCreateTime ¶
func (Auction) GetRevealsEndTime ¶
type AuctionBidInfo ¶
AuctionBidInfo is used in the block changeset.
type AuctionUsageKeeper ¶
type AuctionUsageKeeper interface { ModuleName() string UsesAuction(ctx sdk.Context, auctionID ID) bool OnAuction(ctx sdk.Context, auctionID ID) OnAuctionBid(ctx sdk.Context, auctionID ID, bidderAddress string) OnAuctionWinnerSelected(ctx sdk.Context, auctionID ID) }
AuctionUsageKeeper keep track of auction usage in other modules. Used to, for example, prevent deletion of a auction that's in use.
type Bid ¶
type Bid struct { AuctionID ID `json:"auctionId,omitempty"` BidderAddress string `json:"bidderAddress,omitempty"` Status string `json:"status,omitempty"` CommitHash string `json:"commitHash,omitempty"` CommitTime time.Time `json:"commitTime,omitempty"` CommitFee sdk.Coin `json:"commitFee,omitempty"` RevealTime time.Time `json:"revealTime,omitempty"` RevealFee sdk.Coin `json:"revealFee,omitempty"` BidAmount sdk.Coin `json:"bidAmount,omitempty"` }
Bid represents a sealed bid (commit) made during the auction.
func (Bid) GetCommitTime ¶
func (Bid) GetRevealTime ¶
type MsgCommitBid ¶
type MsgCommitBid struct { AuctionID ID `json:"auctionId,omitempty"` CommitHash string `json:"commit,omitempty"` Signer sdk.AccAddress `json:"signer"` }
MsgCommitBid defines a commit bid message.
func NewMsgCommitBid ¶
func NewMsgCommitBid(auctionID string, commitHash string, signer sdk.AccAddress) MsgCommitBid
NewMsgCommitBid is the constructor function for MsgCommitBid.
func (MsgCommitBid) GetSignBytes ¶
func (msg MsgCommitBid) GetSignBytes() []byte
GetSignBytes Implements Msg.
func (MsgCommitBid) GetSigners ¶
func (msg MsgCommitBid) GetSigners() []sdk.AccAddress
GetSigners Implements Msg.
func (MsgCommitBid) ValidateBasic ¶
func (msg MsgCommitBid) ValidateBasic() error
ValidateBasic Implements Msg.
type MsgCreateAuction ¶
type MsgCreateAuction struct { CommitsDuration time.Duration `json:"commitsDuration,omitempty"` RevealsDuration time.Duration `json:"revealsDuration,omitempty"` CommitFee sdk.Coin `json:"commitFee,omitempty"` RevealFee sdk.Coin `json:"revealFee,omitempty"` MinimumBid sdk.Coin `json:"minimumBid,omitempty"` Signer sdk.AccAddress `json:"signer"` }
MsgCreateAuction defines a create auction message.
func NewMsgCreateAuction ¶
func NewMsgCreateAuction(params Params, signer sdk.AccAddress) MsgCreateAuction
NewMsgCreateAuction is the constructor function for MsgCreateAuction.
func (MsgCreateAuction) GetSignBytes ¶
func (msg MsgCreateAuction) GetSignBytes() []byte
GetSignBytes Implements Msg.
func (MsgCreateAuction) GetSigners ¶
func (msg MsgCreateAuction) GetSigners() []sdk.AccAddress
GetSigners Implements Msg.
func (MsgCreateAuction) ValidateBasic ¶
func (msg MsgCreateAuction) ValidateBasic() error
ValidateBasic Implements Msg.
type MsgRevealBid ¶
type MsgRevealBid struct { AuctionID ID `json:"auctionId,omitempty"` Reveal string `json:"reveal,omitempty"` Signer sdk.AccAddress `json:"signer"` }
MsgRevealBid defines a reveal bid message.
func NewMsgRevealBid ¶
func NewMsgRevealBid(auctionID string, reveal string, signer sdk.AccAddress) MsgRevealBid
NewMsgRevealBid is the constructor function for MsgRevealBid.
func (MsgRevealBid) GetSignBytes ¶
func (msg MsgRevealBid) GetSignBytes() []byte
GetSignBytes Implements Msg.
func (MsgRevealBid) GetSigners ¶
func (msg MsgRevealBid) GetSigners() []sdk.AccAddress
GetSigners Implements Msg.
func (MsgRevealBid) ValidateBasic ¶
func (msg MsgRevealBid) ValidateBasic() error
ValidateBasic Implements Msg.
type Params ¶
type Params struct { // Duration of commits phase in seconds. CommitsDuration time.Duration `json:"commits_duration"` // Duration of reveals phase in seconds. RevealsDuration time.Duration `json:"reveals_duration"` // Commit and reveal fees. CommitFee sdk.Coin `json:"commit_fee"` RevealFee sdk.Coin `json:"reveal_fee"` MinimumBid sdk.Coin `json:"minimum_bid"` }
Params defines the parameters for the auction module.
func (*Params) ParamSetPairs ¶
func (p *Params) ParamSetPairs() subspace.ParamSetPairs
ParamSetPairs - implements params.ParamSet