Skip to main content

IMarketplace

Methods

acceptOffer

function acceptOffer(uint256 _listingId, address _offeror, address _currency, uint256 _totalPrice) external nonpayable

Lets a listing's creator accept an offer to their direct listing.

Parameters

NameTypeDescription
_listingIduint256The unique ID of the listing for which to accept the offer.
_offeroraddressThe address of the buyer whose offer is to be accepted.
_currencyaddressThe currency of the offer that is to be accepted.
_totalPriceuint256The total price of the offer that is to be accepted.

buy

function buy(uint256 _listingId, address _buyFor, uint256 _quantity, address _currency, uint256 _totalPrice) external payable

Lets someone buy a given quantity of tokens from a direct listing by paying the fixed price.

A sale will fail to execute if either: (1) buyer does not own or has not approved Marketplace to transfer the appropriate amount of currency (or hasn't sent the appropriate amount of native tokens) (2) the lister does not own or has removed Marketplace's approval to transfer the tokens listed for sale.

Parameters

NameTypeDescription
_listingIduint256The uid of the direct listing to buy from.
_buyForaddressThe receiver of the NFT being bought.
_quantityuint256The amount of NFTs to buy from the direct listing.
_currencyaddressThe currency to pay the price in.
_totalPriceuint256The total price to pay for the tokens being bought.

cancelDirectListing

function cancelDirectListing(uint256 _listingId) external nonpayable

Lets a direct listing creator cancel their listing.

Parameters

NameTypeDescription
_listingIduint256The unique Id of the listing to cancel.

closeAuction

function closeAuction(uint256 _listingId, address _closeFor) external nonpayable

Lets any account close an auction on behalf of either the (1) auction's creator, or (2) winning bidder. For (1): The auction creator is sent the winning bid amount. For (2): The winning bidder is sent the auctioned NFTs.

Parameters

NameTypeDescription
_listingIduint256The uid of the listing (the auction to close).
_closeForaddressFor whom the auction is being closed - the auction creator or winning bidder.

contractType

function contractType() external pure returns (bytes32)

Returns the module type of the contract.

Returns

NameTypeDescription
_0bytes32undefined

contractURI

function contractURI() external view returns (string)

Returns the metadata URI of the contract.

Returns

NameTypeDescription
_0stringundefined

contractVersion

function contractVersion() external pure returns (uint8)

Returns the version of the contract.

Returns

NameTypeDescription
_0uint8undefined

createListing

function createListing(IMarketplace.ListingParameters _params) external nonpayable

Parameters

NameTypeDescription
_paramsIMarketplace.ListingParametersundefined

getPlatformFeeInfo

function getPlatformFeeInfo() external view returns (address, uint16)

Returns the platform fee bps and recipient.

Returns

NameTypeDescription
_0addressundefined
_1uint16undefined

offer

function offer(uint256 _listingId, uint256 _quantityWanted, address _currency, uint256 _pricePerToken, uint256 _expirationTimestamp) external payable

Lets someone make an offer to a direct listing, or bid in an auction.

Each (address, listing ID) pair maps to a single unique offer. So e.g. if a buyer makes two offers to the same direct listing, the last offer is counted as the buyer's offer to that listing.

Parameters

NameTypeDescription
_listingIduint256The unique ID of the listing to make an offer/bid to.
_quantityWanteduint256For auction listings: the 'quantity wanted' is the total amount of NFTs being auctioned, regardless of the value of _quantityWanted passed. For direct listings: _quantityWanted is the quantity of NFTs from the listing, for which the offer is being made.
_currencyaddressFor auction listings: the 'currency of the bid' is the currency accepted by the auction, regardless of the value of _currency passed. For direct listings: this is the currency in which the offer is made.
_pricePerTokenuint256For direct listings: offered price per token. For auction listings: the bid amount per token. The total offer/bid amount is _quantityWanted * _pricePerToken.
_expirationTimestampuint256For auction listings: inapplicable. For direct listings: The timestamp after which the seller can no longer accept the offer.

setContractURI

function setContractURI(string _uri) external nonpayable

Sets contract URI for the storefront-level metadata of the contract. Only module admin can call this function.

Parameters

NameTypeDescription
_uristringundefined

setPlatformFeeInfo

function setPlatformFeeInfo(address _platformFeeRecipient, uint256 _platformFeeBps) external nonpayable

Lets a module admin update the fees on primary sales.

Parameters

NameTypeDescription
_platformFeeRecipientaddressundefined
_platformFeeBpsuint256undefined

updateListing

function updateListing(uint256 _listingId, uint256 _quantityToList, uint256 _reservePricePerToken, uint256 _buyoutPricePerToken, address _currencyToAccept, uint256 _startTime, uint256 _secondsUntilEndTime) external nonpayable

Lets a listing's creator edit the listing's parameters. A direct listing can be edited whenever. An auction listing cannot be edited after the auction has started.

Parameters

NameTypeDescription
_listingIduint256The uid of the listing to edit.
_quantityToListuint256The amount of NFTs to list for sale in the listing. For direct listings, the contract only checks whether the listing creator owns and has approved Marketplace to transfer _quantityToList amount of NFTs to list for sale. For auction listings, the contract ensures that exactly _quantityToList amount of NFTs to list are escrowed.
_reservePricePerTokenuint256For direct listings: this value is ignored. For auctions: the minimum bid amount of the auction is reservePricePerToken * quantityToList
_buyoutPricePerTokenuint256For direct listings: interpreted as 'price per token' listed. For auctions: if buyoutPricePerToken is greater than 0, and a bidder's bid is at least as great as buyoutPricePerToken * quantityToList, the bidder wins the auction, and the auction is closed.
_currencyToAcceptaddressFor direct listings: the currency in which a buyer must pay the listing's fixed price to buy the NFT(s). For auctions: the currency in which the bidders must make bids.
_startTimeuint256The unix timestamp after which listing is active. For direct listings: 'active' means NFTs can be bought from the listing. For auctions, 'active' means bids can be made in the auction.
_secondsUntilEndTimeuint256No. of seconds after the provided _startTime, after which the listing is inactive. For direct listings: 'inactive' means NFTs cannot be bought from the listing. For auctions: 'inactive' means bids can no longer be made in the auction.

Events

AuctionBuffersUpdated

event AuctionBuffersUpdated(uint256 timeBuffer, uint256 bidBufferBps)

Emitted when auction buffers are updated.

Parameters

NameTypeDescription
timeBufferuint256undefined
bidBufferBpsuint256undefined

AuctionClosed

event AuctionClosed(uint256 indexed listingId, address indexed closer, bool indexed cancelled, address auctionCreator, address winningBidder)

Emitted when an auction is closed.

Parameters

NameTypeDescription
listingId indexeduint256undefined
closer indexedaddressundefined
cancelled indexedboolundefined
auctionCreatoraddressundefined
winningBidderaddressundefined

ListingAdded

event ListingAdded(uint256 indexed listingId, address indexed assetContract, address indexed lister, IMarketplace.Listing listing)

Emitted when a new listing is created.

Parameters

NameTypeDescription
listingId indexeduint256undefined
assetContract indexedaddressundefined
lister indexedaddressundefined
listingIMarketplace.Listingundefined

ListingRemoved

event ListingRemoved(uint256 indexed listingId, address indexed listingCreator)

Emitted when a listing is cancelled.

Parameters

NameTypeDescription
listingId indexeduint256undefined
listingCreator indexedaddressundefined

ListingUpdated

event ListingUpdated(uint256 indexed listingId, address indexed listingCreator)

Emitted when the parameters of a listing are updated.

Parameters

NameTypeDescription
listingId indexeduint256undefined
listingCreator indexedaddressundefined

NewOffer

event NewOffer(uint256 indexed listingId, address indexed offeror, enum IMarketplace.ListingType indexed listingType, uint256 quantityWanted, uint256 totalOfferAmount, address currency)

Emitted when (1) a new offer is made to a direct listing, or (2) when a new bid is made in an auction.

Parameters

NameTypeDescription
listingId indexeduint256undefined
offeror indexedaddressundefined
listingType indexedenum IMarketplace.ListingTypeundefined
quantityWanteduint256undefined
totalOfferAmountuint256undefined
currencyaddressundefined

NewSale

event NewSale(uint256 indexed listingId, address indexed assetContract, address indexed lister, address buyer, uint256 quantityBought, uint256 totalPricePaid)

Emitted when a buyer buys from a direct listing, or a lister accepts some buyer's offer to their direct listing.

Parameters

NameTypeDescription
listingId indexeduint256undefined
assetContract indexedaddressundefined
lister indexedaddressundefined
buyeraddressundefined
quantityBoughtuint256undefined
totalPricePaiduint256undefined

PlatformFeeInfoUpdated

event PlatformFeeInfoUpdated(address indexed platformFeeRecipient, uint256 platformFeeBps)

Parameters

NameTypeDescription
platformFeeRecipient indexedaddressundefined
platformFeeBpsuint256undefined