The Bazaar
The Bazaar
Overview
The entry point into the Rare Protocol ecosystem is the Bazaar. This contract unifies the previously separate Marketplace and Auction House, allowing users to only approve a single contract and give us the ability for new functionality such as converting offers into auction bids.
This works by unifying the storage and interaction into the Bazaar with the logic for each living in the Marketplace and AuctionHouse contracts. Calls to the Bazaar are then delegated to the corresponding contract which allows the logic of the Marketplace/Auction House to be executed in the scope/state of the Bazaar.
Functions
Events
Functionality Spec
Writes
offer(address originContract, uint256 tokenId, address currencyAddress, uint256 amount, bool convertible) -> ()
Places an offer on the ERC721 described by the given originContract
and tokenId
with the amount
of currencyAddress
. The zero address for currencyAddress
corresponds to an offer in ether.
If a previous offer of the same currencyAddress
exists then the new offer must be greater than minimumBidIncreasePercentage
above the existing offer. The beaten offer is then refunded.
Note: Offers made with convertible
set to true
can be used as a reserve auction triggering bid.
Emits an OfferPlaced
event.
Requirements:β currencyAddress
is approved via ApprovedTokenRegistry
.β _msgSender()
approved marketplace for amount
of currencyAddress
.β Amount sent/transfered must include amount + marketplaceFee
.
buy(address originContract, uint256 tokenId, address currencyAddress, uint256 amount) -> ()
Purchase an ERC721 token described by originContract
and tokenId
with the amount
of currencyAddress
. The zero address for currencyAddress
corresponds to buying with ether.
A SalePrice
of amount
of currencyAddress
must exist.
Emits a Sold
event.
Requirements:β The token owner must have the bazaar approved.β Amount sent/transfered must include amount + marketplaceFee
.
cancelOffer(address originContract, uint256 tokenId, address currencyAddress) -> ()
Removes a given offer on an ERC721 token described by originContract
and tokenId
under the given currencyAddress
and refunds the sender. The zero address for currencyAddress
corresponds to an offer in ether.
Emits a CancelOffer
event.
Requirements:β offerCancelationDelay
seconds must have passed since the offer was placed.
setSalePrice(address originContract, uint256 tokenId, address currencyAddress, uint256 listPrice, address target, address payable[] splitAddresses, uint8[] splitRatios) -> ()
Sets the sale price for an ERC721 token described by originContract
and tokenId
of amount
of currencyAddress
. The zero address for currencyAddress
corresponds to a sale price in ether.
This supports both general and direct sale prices through the target
field where the zero address indicates a general sale price.
The splitAddresses
and splitRatios
correspond to the recipients of funds from a sale.
Note: Only 1 sale price for a target
can exist.
Emits a SetSalePrice
event.
Requirements:β currencyAddress
is approved via ApprovedTokenRegistry
.β The token owner must have the bazaar approved.β _msgSender()
must be the token owner.β splitAddresses
and splitRatios
must be the same length and the ratios must add up to 100.
removeSalePrice(address originContract, uint256 tokenId, address target) -> ()
Removes the sale price on an ERC721 token described by originContract
and tokenId
for a given target
.
Emits a SetSalePrice
event with all zero values.
Requirements:β _msgSender()
must be the token owner.
acceptOffer(address originContract, uint256 tokenId, address currencyAddress, uint256 amount, address payable[] splitAddresses, uint8[] splitRatios) -> ()
Accepts an offer placed on an ERC721 described by originContract
and tokenId
for the amount
of currencyAddress
.
Zero address for currencyAddress
means the offer was made in ether.
The splitAddresses
and splitRatios
correspond to the recipients of funds from a sale.
Emits an AcceptOffer
event.
Requirements:β currencyAddress
is approved via ApprovedTokenRegistry
.β The token owner must have the bazaar approved.β _msgSender()
must be the token owner.β splitAddresses
and splitRatios
must be the same length and the ratios must add up to 100.
configureAuction(bytes32 auctionType, address originContract, uint256 tokenId, uint256 startingAmount, address currencyAddress, uint256 lengthOfAuction, uint256 startTime, address payable[] splitAddresses, uint8[] splitRatios) -> ()
Configures a fully onchain auction of an ERC721 token described by originContract
and tokenId
with a starting price of amount
of currencyAddress
. Only 1 auction per token can exist at a given time.
The splitAddresses
and splitRatios
correspond to the recipients of funds from a sale.
Auction Types:β Reserve (Coldie): An auction that is triggered when the startingAmount
is met.β Scheduled: An auction with a minumum bid of startingAmount
of currencyAddress
that starts at startTime
and runs for lengthOfAuction
seconds.
The auctionType
for reserve auctions is 0x434f4c4449455f41554354494f4e000000000000000000000000000000000000
and scheduled auction is 0x5343484544554c45445f41554354494f4e000000000000000000000000000000
.
Note: The startTime
must be 0
when the auctionType
corresponds to a reserve auction.
Emits a NewAuction
event.
Requirements:β currencyAddress
is approved via ApprovedTokenRegistry
.β The token owner must have the bazaar approved.β _msgSender()
must be the token owner.β splitAddresses
and splitRatios
must be the same length and the ratios must add up to 100.β auctionType
must be either a reserve or scheduled auction.β Auctions cannot start in the past.
cancelAuction(address originContract, uint256 tokenId) -> ()
Cancels an existing auction on ERC721 token originContract
and tokenId
transfering back the token to _msgSender()
if held in escrow.
Emits a CancelAuction
event.
Requirements:β An auction on the token must exist.β The auction must not have started yet.β _msgSender()
must be the auction creator or owner of the token.
bid(address originContract, uint256 tokenId, address currencyAddress, uint256 amount) -> ()
Places a bid on an existing auction on ERC721 token originContract
and tokenId
for amount
of currencyAddress
. Beaten bids will be refunded to the previous bidder.
If a bid is placed and there is less than auctionLengthExtension
seconds left then the auction ending is updated so that the legnth is equal to auctionLengthExtension
.
Emits an AuctionBid
event.
Requirements:β An auction on the token must exist.β Bidder cannot be the auction creator.β Auction must have started.β Bid must be greater than 0
, minimumBid
, or currentBid + minimumIncrease
.β Bid must be higher than marketplaceSettings.getMarketplaceMaxValue()
.β Amount sent/transfered must include amount + marketplaceFee
.β Auction creator must be the owner or the token must be escrowed.β Token owner must have the bazaar approved.
convertOfferToAuction(address originContract, uint256 tokenId, address currencyAddress, uint256 amount, uint256 lengthOfAuction, address payable[] splitAddresses, uint8[] splitRatios) -> ()
Uses an existing offer on ERC721 token originContract : tokenId
to kick off a reserve auction with proceeds being sent to splitAddresses
each receiving splitRatios
percentage.
Emits NewAuction
and AuctionBid
events.
Requirements:β The offer must be convertible
.β _msgSender()
must be the token owner.β splitAddresses
and splitRatios
must be the same length and the ratios must add up to 100.β Token owner must have the bazaar approved.β _msgSender()
cannot convert their own offer.β Amount being converted must be the same as the offer.
settleAuction(address originContract, uint256 tokenId) -> ()
Settles an existing auction on ERC721 originContract : tokenId
that has ended. Ending mean that the current block timestamp is greater than the auction startTime + lengthOfAuction
.
In the event that the auction received no bids, the token is sent back to the auction creator.
Emits an AuctionSettled
event.
Requirements:β An auction on the token must exist.β The block timestamp is greater than startTime + lengthOfAuction
.
Reads
tokenCurrentOffers(originContract, tokenId, currencyAddress) -> (address payable buyer, uint256 amount, uint256 timestamp, uint8 marketplaceFee, bool convertible)
Returns the current offer on ERC721 originContract : tokenId
for the given currencyAddress
.
getAuctionDetails(address originContract, uint256 tokenId) -> (address auctionCreator, uint256 creationBlockNum, uint256 startTime, uint256 lengthOfAuction, address currencyAddress, uint256 minBid, bytes32 auctionType, address payable[] splitAddresses, uint8[] splitRatios)
Returns the auction details for ERC721 originContract : tokenId
.
The auctionType
for reserve auctions is 0x434f4c4449455f41554354494f4e000000000000000000000000000000000000
, scheduled auction is 0x5343484544554c45445f41554354494f4e000000000000000000000000000000
, and no auction is bytes(0)
.
getSalePrice(address originContract, uint256 tokenId, address target) -> (address seller, address currencyAddress, uint256 amount, address payable[] splitAddresses, uint8[] splitRatios)
Returns the sale price for ERC721 originContract : tokenId
with a target buyer of target
.
Note: A target
of the zero address indicates that anyone can buy at that price.
Addresses
Mainnet
Contract Name | Contract Address |
---|---|
Bazaar | 0x6D7c44773C52D396F43c2D511B81aa168E9a7a42 |
Marketplace | 0x5e62454d6AA7392925ccd3E7cd33f2D7c2f33D97 |
AuctionHouse | 0xDd867a8Eb1720185B3fdAD7F81Caed4E8132Be19 |
Last updated