types

package
v0.0.0-...-c736a29 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2021 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
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
)
View Source
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.

View Source
const (
	BidStatusCommitted = "commit"
	BidStatusRevealed  = "reveal"
)

Bid status values.

View Source
const (
	DefaultParamspace = ModuleName
)

Default parameter namespace.

View Source
const RouterKey = ModuleName // this was defined in your key.go file

RouterKey is the module name router key

Variables

View Source
var (
	ErrInvalid = sdkerrors.Register(ModuleName, 1, "custom error message")
)
View Source
var ModuleCdc = codec.New()

ModuleCdc is the codec for the module

Functions

func ParamKeyTable

func ParamKeyTable() subspace.KeyTable

ParamKeyTable - ParamTable for bond module.

func RegisterCodec

func RegisterCodec(cdc *codec.Codec)

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 Auction) GetCommitsEndTime() string

func (Auction) GetCreateTime

func (auction Auction) GetCreateTime() string

func (Auction) GetRevealsEndTime

func (auction Auction) GetRevealsEndTime() string

type AuctionBidInfo

type AuctionBidInfo struct {
	AuctionID     ID
	BidderAddress string
}

AuctionBidInfo is used in the block changeset.

type AuctionID

type AuctionID struct {
	Address  sdk.Address
	AccNum   uint64
	Sequence uint64
}

AuctionID simplifies generation of auction IDs.

func (AuctionID) Generate

func (auctionID AuctionID) Generate() string

Generate creates the auction ID.

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 Bid) GetCommitTime() string

func (Bid) GetRevealTime

func (bid Bid) GetRevealTime() string

type ID

type ID string

ID for auctions.

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) Route

func (msg MsgCommitBid) Route() string

Route Implements Msg.

func (MsgCommitBid) Type

func (msg MsgCommitBid) Type() string

Type 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) Route

func (msg MsgCreateAuction) Route() string

Route Implements Msg.

func (MsgCreateAuction) Type

func (msg MsgCreateAuction) Type() string

Type 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) Route

func (msg MsgRevealBid) Route() string

Route Implements Msg.

func (MsgRevealBid) Type

func (msg MsgRevealBid) Type() string

Type 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 DefaultParams

func DefaultParams() Params

DefaultParams returns a default set of parameters.

func NewParams

func NewParams() Params

NewParams creates a new Params instance

func (Params) Equal

func (p Params) Equal(p2 Params) bool

Equal returns a boolean determining if two Params types are identical.

func (*Params) ParamSetPairs

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

ParamSetPairs - implements params.ParamSet

func (Params) String

func (p Params) String() string

String returns a human readable string representation of the parameters.

func (Params) Validate

func (p Params) Validate() error

Validate a set of params.

Jump to

Keyboard shortcuts

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