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 GetOwnerMarginPromille ¶
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) SumOfBids ¶
func (ai *AuctionInfo) SumOfBids() int64
func (*AuctionInfo) WinningBid ¶
func (ai *AuctionInfo) WinningBid() *BidInfo
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) WinsAgainst ¶
Click to show internal directories.
Click to hide internal directories.