ListingMarketUpgradeable
Contract that handles the listing and buying process of tokens on a marketplace.
Inherits from BaseMarketUpgradeable. It introduces functions to list, delist and buy tokens, as well as their permit alternatives that use EIP-712 signatures.
listings
Nested mapping from a collection address to token ID to ERC20 address to a price. It tracks the prices of listed tokens. First address represents the collection, second the token id and the third is the address of the ERC20 token used as currency.
constructor
The constructor initializes the base contract.
list
Allows the caller to list a token for sale.
Parameters
_collection
address
The address of the collection contract to which the token belongs.
_tokenId
uint256
The ID of the token to be listed for sale.
_erc20
address
The address of the ERC20 token to be used as the payment currency.
_price
uint256
The price for which the token is listed.
permitList
Allows a trusted contract to list a token for sale on behalf of a seller.
Parameters
_collection
address
The address of the collection contract to which the token belongs.
_tokenId
uint256
The ID of the token to be listed for sale.
_erc20
address
The address of the ERC20 token to be used as the payment currency.
_price
uint256
The price for which the token is listed.
_signature
struct Signature
The seller's signature, deadline and address
delist
Allows the caller to delist a token.
Parameters
_collection
address
The address of the collection contract to which the token belongs.
_tokenId
uint256
The ID of the token to be delisted.
_erc20
address
The address of the ERC20 token that was to be used as the payment currency.
permitDelist
Allows a trusted contract to delist a token on behalf of a seller.
Parameters
_collection
address
The address of the collection contract from which the token is to be delisted.
_tokenId
uint256
The ID of the token to be delisted.
_erc20
address
The address of the ERC20 token that was to be used as the payment currency.
_signature
struct Signature
The seller's signature, deadline and address
buy
Allows the caller to buy a token.
Parameters
_collection
address
The address of the collection contract to which the token belongs.
_tokenId
uint256
The ID of the token to be bought.
_erc20
address
The address of the ERC20 token to be used as the payment currency.
permitBuy
Allows a trusted contract to buy a token on behalf of a buyer.
Parameters
_collection
address
The address of the collection contract from which the token is to be bought.
_tokenId
uint256
The ID of the token to be bought.
_erc20
address
The address of the ERC20 token to be used as the payment currency.
_signature
struct Signature
The buyer's signature, deadline and address
permitOffChainPaymentBuy
Allows a trusted contract to buy a token on behalf of a buyer using off-chain payment.
Parameters
_collection
address
The address of the collection contract from which the token is to be bought.
_tokenId
uint256
The ID of the token to be bought.
_erc20
address
The address of the ERC20 token to be used as the payment currency.
_signature
struct Signature
The buyer's signature, deadline and address
handleSaleClosed
Handles when a token is no longer available
Notifies that a particular sale for a ERC721 has closed (i.e. successfully sold, fault/not as described, or lost/damaged in shipment)
Parameters
_saleId
uint256
The id of the sale that has closed.
supportsInterface
Checks if the contract implements an interface.
Parameters
_interfaceId
bytes4
The ID of the interface.
Return Values
[0]
bool
True if the contract implements the interface, false otherwise.
_list
Private function that lists a token for sale.
Parameters
_seller
address
The address of the seller.
_collection
address
The address of the collection contract to which the token belongs.
_tokenId
uint256
The ID of the token to be listed for sale.
_erc20
address
The address of the ERC20 token to be used as the payment currency.
_price
uint256
The price for which the token is listed.
_delist
Private function that delists a token.
Parameters
_seller
address
The address of the seller.
_collection
address
The address of the collection contract to which the token belongs.
_tokenId
uint256
The ID of the token to be delisted.
_erc20
address
The address of the ERC20 token that was to be used as the payment currency.
_buy
Private function that manages the buying of a token.
Parameters
_spender
address
The address of the spender (who actually sends the payment).
_buyer
address
The address of the buyer (who will become the new owner).
_collection
address
The address of the collection contract from which the token is to be bought.
_tokenId
uint256
The ID of the token to be bought.
_erc20
address
The address of the ERC20 token to be used as the payment currency.
getListedPrice
Gets the listed price of a token.
Parameters
_collection
address
The address of the collection contract to which the token belongs.
_tokenId
uint256
The ID of the token whose price to return.
_erc20
address
The address of the ERC20 token used as the payment currency.
Return Values
[0]
uint256
Returns the price at which the token is listed.
_getPermitListHash
Computes the EIP-712 hash that should be signed by the seller to allow listing a token.
Parameters
_signature
struct Signature
The sellers signature, address and deadline
_collection
address
The address of the collection contract to which the token belongs.
_tokenId
uint256
The ID of the token to be listed for sale.
_erc20
address
The address of the ERC20 token to be used as the payment currency.
_price
uint256
The price for which the token is listed.
Return Values
[0]
bytes32
Returns the EIP-712 hash.
_getPermitDelistHash
Computes the EIP-712 hash that should be signed by the seller to delist a token.
Parameters
_signature
struct Signature
The sellers' signature, address and deadline
_collection
address
The address of the collection contract to which the token belongs.
_tokenId
uint256
The ID of the token to be delisted.
_erc20
address
The address of the ERC20 token that was to be used as the payment currency.
Return Values
[0]
bytes32
Returns the EIP-712 hash.
_getPermitBuyHash
Computes the EIP-712 hash that should be signed by the buyer to buy a token.
Parameters
_signature
struct Signature
The address of the buyer and the deadline
_collection
address
The address of the collection contract from which the token is to be bought.
_tokenId
uint256
The ID of the token to be bought.
_erc20
address
The address of the ERC20 token to be used as the payment currency.
Return Values
[0]
bytes32
Returns the EIP-712 hash.
_getPermitOffChainPaymentBuyHash
Computes the EIP-712 hash that should be signed by the buyer for off-chain payment to buy a token.
Parameters
_signature
struct Signature
The address of the buyer and the deadline
_collection
address
The address of the collection contract from which the token is to be bought.
_tokenId
uint256
The ID of the token to be bought.
_erc20
address
The address of the ERC20 token to be used as the payment currency.
Return Values
[0]
bytes32
Returns the EIP-712 hash.
Last updated