Rare Protocol
Search
K

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.
+-> Marketplace
/
Bazaar --+
\
+-> AuctionHouse
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.
Contract Arch

Functions

offer(originContract, tokenId, currencyAddress, amount, convertible)
buy(originContract, tokenId, currencyAddress, amount)
cancelOffer(originContract, tokenId, currencyAddress)
setSalePrice(originContract, tokenId, currencyAddress, listPrice, target, splitAddresses, splitRatios)
removeSalePrice(originContract, tokenId, target)
acceptOffer(originContract, tokenId, currencyAddress, amount, splitAddresses, splitRatios)
configureAuction(auctionType, originContract, tokenId, startingAmount, currencyAddress, lengthOfAuction, startTime, splitAddresses, splitRatios)
cancelAuction(originContract, tokenId)
bid(originContract, tokenId, currencyAddress, amount)
convertOfferToAuction(originContract, tokenId, currencyAddress, amount, lengthOfAuction, splitAddresses, splitRatios)
settleAuction(originContract, tokenId)
tokenCurrentOffers(originContract, tokenId, currencyAddress)
getAuctionDetails(originContract, tokenId)
getSalePrice(originContract, tokenId, target)

Events

Sold(address originContract, address buyer, address seller, address currencyAddress, uint256 amount, uint256 tokenId)
SetSalePrice(address originContract, address currencyAddress, address target, uint256 amount, uint256 tokenId, address payable[] splitRecipients, uint8[] splitRatios)
OfferPlaced(address originContract, address bidder, address currencyAddress, uint256 amount, uint256 tokenId, bool convertible)
AcceptOffer(address originContract, address bidder, address seller, address currencyAddress, uint256 amount, uint256 tokenId, address payable[] splitAddresses, uint8[] splitRatios)
CancelOffer(address originContract, address bidder, address currencyAddress, uint256 amount, uint256 tokenId)
NewAuction(address contractAddress, tokenId, address auctionCreator, address currencyAddress, uint256 startingTime, uint256 minimumBid, uint256 lengthOfAuction)
CancelAuction(address contractAddress, uint256 okenId, address auctionCreator)
AuctionBid(address contractAddress, address bidder, uint256 tokenId, address currencyAddress, uint256 amount, bool startedAuction, uint256 newAuctionLength, address previousBidder)
AuctionSettled(address contractAddress, address bidder, address seller, uint256 tokenId, address currencyAddress, uint256 amount);

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