Auction House implements English auction with fixed step
npm install @rarible/auctionFor now there are two AuctionHouse contracts, the main difference between them is the type of sell asset:
- AuctionHouse721
- sell asset = ERC721
- buy asset = ETH or ERC20
- AuctionHouse1155
- sell asset = ERC1155
- buy asset = ETH or ERC20
There are two parameters of AuctionHouse that are the same for all autions and can be changed by AuctionHouse owner:
- minimalDuration
- defines the minimal duration of auctions
- minimalStepBasePoint
- is the minimal persentage increase between bids (in base points)
- e.g. minimalStepBasePoint = 300 = 3%, first bid is 100 ETH, the second one should be not less than (100 + 100*3% =) 103
ERC721 Auction supports party bid
durationminimalDuration(default value is 15 days) and 1000 days (constant)startTimeSo there are two cases of how the auction time frame can work:
- if startTime is 0, then then the auction starts at the first bid that satisfies minimalPrice. Then the endTime is calculated at the moment of the first bid as well (now + duration)
- if startTime is set, then the endTime is calculated at the creation of an auction (startTime + duration)
If a new bid is put when auction has less than minimalDuration left till endTime, then endTime = now + minimalDuration
Biddata field Biddata field #### Bid:
- amount - bid amount
- dataType - version of data field
- data - encoded additional data, V1 fields :
- uint originFee - bid origin fee in one uint slot (first 12 bytes store value, last 20 bytes store recipient)
AuctionCreated(uint indexed auctionId, address seller, uint128 endTime)#### putBid -
- puts bid on specific auction
- emits event BidPlaced(uint indexed auctionId, address seller, uint128 endTime)
- can be called from anyone
- arguments:
- _auctionId - auction Id
- bid - bid struct
#### finishAuction -
- finishes auction if it's ended(now > endTime) and has at least 1 bid
- emits event AuctionFinished(_auctionId)
- can be called from anyone
- arguments:
- _auctionId - auction Id
#### buyOut -
- buy out the sell item and finishes the auction
- emits event AuctionBuyOut(uint indexed auctionId, address buyer)
- emits event AuctionFinished(_auctionId)
- can be called from anyone
- arguments:
- _auctionId - auction Id
- bid - bid struct
#### finishAuction -
- finishes auction if it's not started and has no bids
- emits event AuctionCancelled(uint indexed auctionId)
- emits event AuctionFinished(_auctionId)
- can be called from auction creator
- arguments:
- _auctionId - auction Id