auction

package
v1.2.0-fork8-fix4 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2023 License: LGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// normal min amount is 10 mtr, autobid is 0.1 mtr
	MinimumBidAmount = new(big.Int).Mul(big.NewInt(10), big.NewInt(1e18))
	AutobidMinAmount = big.NewInt(1e17)
)

Functions

This section is empty.

Types

type Auction

type Auction struct {
	// contains filtered or unexported fields
}

Candidate indicates the structure of a candidate

func NewAuction

func NewAuction(ch *chain.Chain, sc *state.Creator) *Auction

func (*Auction) ClearAuction

func (a *Auction) ClearAuction(env *setypes.ScriptEnv, cb *meter.AuctionCB, validatorBenefitRatio *big.Int) (*big.Int, *big.Int, []*meter.DistMtrg, error)

////////////////////// called when auction is over

func (*Auction) CloseAuctionCB

func (a *Auction) CloseAuctionCB(env *setypes.ScriptEnv, ab *AuctionBody, gas uint64) (leftOverGas uint64, err error)

func (*Auction) Handle

func (a *Auction) Handle(senv *setypes.ScriptEnv, payload []byte, to *meter.Address, gas uint64) (seOutput *setypes.ScriptEngineOutput, leftOverGas uint64, err error)

func (*Auction) HandleAuctionTx

func (a *Auction) HandleAuctionTx(env *setypes.ScriptEnv, ab *AuctionBody, gas uint64) (leftOverGas uint64, err error)

func (*Auction) MintMTRGToBidder

func (a *Auction) MintMTRGToBidder(env *setypes.ScriptEnv, addr meter.Address, amount *big.Int)

func (*Auction) StartAuctionCB

func (a *Auction) StartAuctionCB(env *setypes.ScriptEnv, ab *AuctionBody, gas uint64) (leftOverGas uint64, err error)

type AuctionBody

type AuctionBody struct {
	Opcode        uint32
	Version       uint32
	Option        uint32
	StartHeight   uint64
	StartEpoch    uint64
	EndHeight     uint64
	EndEpoch      uint64
	Sequence      uint64
	AuctionID     meter.Bytes32
	Bidder        meter.Address
	Amount        *big.Int
	ReserveAmount *big.Int
	Token         byte   // meter or meter gov
	Timestamp     uint64 // timestamp
	Nonce         uint64 // nonce
}

Candidate indicates the structure of a candidate

func DecodeFromBytes

func DecodeFromBytes(bytes []byte) (*AuctionBody, error)

func (*AuctionBody) GetOpName

func (ab *AuctionBody) GetOpName(op uint32) string

func (*AuctionBody) String added in v1.2.0

func (sb *AuctionBody) String() string

func (*AuctionBody) ToString

func (ab *AuctionBody) ToString() string

func (*AuctionBody) UniteHash added in v1.2.0

func (sb *AuctionBody) UniteHash() (hash meter.Bytes32)

Jump to

Keyboard shortcuts

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