fairauction

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2020 License: Apache-2.0, BSD-2-Clause Imports: 11 Imported by: 0

Documentation

Overview

hard coded implementation of the FairAuction smart contract The auction dApp is automatically run by committee, a distributed market for colored tokens

Index

Constants

View Source
const (
	RequestInitSC          = sctransaction.RequestCode(uint16(0)) // NOP
	RequestStartAuction    = sctransaction.RequestCode(uint16(1))
	RequestFinalizeAuction = sctransaction.RequestCode(uint16(2))
	RequestPlaceBid        = sctransaction.RequestCode(uint16(3))
	RequestSetOwnerMargin  = sctransaction.RequestCode(uint16(4) | sctransaction.RequestCodeProtected)
)
View Source
const (
	// request vars
	VarReqAuctionColor                = "color"
	VarReqStartAuctionDescription     = "dscr"
	VarReqStartAuctionDurationMinutes = "duration"
	VarReqStartAuctionMinimumBid      = "minimum" // in iotas
	VarReqOwnerMargin                 = "ownerMargin"

	// state vars
	VarStateAuctions            = "auctions"
	VarStateOwnerMarginPromille = "ownerMargin" // owner margin in percents
)

string constants for request arguments and state variable names

View Source
const (
	// minimum duration of auction
	MinAuctionDurationMinutes = 1
	// default duration of the auction
	AuctionDurationDefaultMinutes = 60
	// Owner of the smart contract takes %% from the winning bid. The default, min, max
	OwnerMarginDefault = 50  // 5%
	OwnerMarginMin     = 5   // minimum 0.5%
	OwnerMarginMax     = 100 // max 10%
	MaxDescription     = 150
)
View Source
const ProgramHash = "4NbQFgvnsfgE3n9ZhtJ3p9hWZzfYUEDHfKU93wp8UowB"

program has is an id of the program

Variables

This section is empty.

Functions

func GetExpectedDeposit

func GetExpectedDeposit(minimumBid int64, ownerMargin int64) int64

func GetOwnerMarginPromille

func GetOwnerMarginPromille(ownerMargin int64, ok bool) int64

func GetProcessor

func GetProcessor() vmtypes.Processor

statical link point to the Wasp node

Types

type AuctionInfo

type AuctionInfo struct {
	// color of the tokens for sale. Max one auction per color at same time is allowed
	// all tokens are being sold as one lot
	Color balance.Color
	// number of tokens for sale
	NumTokens int64
	// minimum bid. Set by the auction initiator
	MinimumBid int64
	// any text, like "AuctionOwner of the token have a right to call me for a date". Set by auction initiator
	Description string
	// timestamp when auction started
	WhenStarted int64
	// duration of the auctions in minutes. Should be >= MinAuctionDurationMinutes
	DurationMinutes int64
	// address which issued StartAuction transaction
	AuctionOwner address.Address
	// total deposit by the auction owner. Iotas sent by the auction owner together with the tokens for sale in the same
	// transaction.
	TotalDeposit int64
	// AuctionOwner's margin in promilles, taken at the moment of creation of smart contract
	OwnerMargin int64
	// list of bids to the auction
	Bids []*BidInfo
}

AuctionInfo describes active auction

func (*AuctionInfo) Due

func (ai *AuctionInfo) Due() int64

func (*AuctionInfo) Read

func (ai *AuctionInfo) Read(r io.Reader) error

func (*AuctionInfo) SumOfBids

func (ai *AuctionInfo) SumOfBids() int64

func (*AuctionInfo) WinningBid

func (ai *AuctionInfo) WinningBid() *BidInfo

func (*AuctionInfo) Write

func (ai *AuctionInfo) Write(w io.Writer) error

type BidInfo

type BidInfo struct {
	// total sum of the bid = total amount of iotas available in the request - 1 - SC reward - ServiceFeeBid
	// the total is a cumulative sum of all bids from the same bidder
	Total int64
	// originator of the bid
	Bidder address.Address
	// timestamp Unix nano
	When int64
}

BidInfo represents one bid to the auction

func (*BidInfo) Read

func (bi *BidInfo) Read(r io.Reader) error

func (*BidInfo) WinsAgainst

func (bi *BidInfo) WinsAgainst(other *BidInfo) bool

func (*BidInfo) Write

func (bi *BidInfo) Write(w io.Writer) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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