Code

https://github.com/Meph1587/AuctionHouse

Introduction

This contract acts as an auction house mechanism. Auctions can be created by the DAO for any allowed ERC721 tokens. Proceeds (ETH) are split between owner and item creator if a creator fee is set. Each time an auction is settled, the settlement transaction will send the ERC721 token to the highest bidder. While settlement is most heavily incentivized for the winning bidder, it can be triggered by anyone, allowing the system to trustlessly run auctions as long as Ethereum is operational and there are interested bidders.

This contract will be used by the Forgotten Council multisig to sell various ERC721 tokens in auctions.

Main Methods

initialize

Initialise the auction house and base contracts, populate configuration values, and pause the contract.

createNewAuction

The owner can create a new auction for an ERC721 token, the token needs to be owned and approved by the owner. The token is transferred into the contract and the endTime for the auction is set. A creator parameter can be set to have a portion of the auction proceeds go to a third party address of the item creator.

createBid

Anyone can call this method to make a bid on an active auction. Bid size needs to be above reserve price and increase the last bid by at least the minimum increment, the ETH is immediately transferred to the contract and the previous bidder is refunded. In case a bid is entered in the timeBuffer interval before the auction end, the auction is extended.

settleAuction

Anyone can settle a finished Auction, the ERC721 is sent to the highest bidder and the ETH is split between the owner and the token creator if one is set. A new auction can only be created if the previous auction is settled.

Other Methods

These are admin methods that can be called only by the multisig and self-explanatory: