FantomMarketplace.sol
Documentation for FantomMarketplace.sol
Overview
The FantomMarketplace
contract allows for the trading of ERC721 and ERC1155 Digital Assets. It offers a comprehensive set of features for listing Digital Assets for sale, buying listed NFTs, making and accepting offers, collecting fees, and more.
Key Features
Listing Digital Assets for sale
Buying listed Digital Assets
Making offers on Digital Assets
Accepting offers on Digital Assets
Collecting platform and royalty fees in ERC20 tokens
Transferring Digital Assets between users
Reentrancy prevention
Structs
Listing: Contains details such as the price and quantity of the Digital Asset listed.
Offer: Contains specifics of an offer made for a Digital Asset, including the offer price in ERC20 tokens.
Mappings
listings: Maps the Digital Asset address, tokenId, and owner to a Listing struct.
offers: Maps the Digital Asset address, tokenId, and the creator of the offer to an Offer struct.
Events
ItemListed: Emitted when a Digital Asset is listed for sale.
ItemUpdated: Emitted when a Digital Asset listing is updated.
ItemSold: Emitted when a Digital Asset is sold.
OfferCreated: Emitted when a new offer is made.
OfferCanceled: Emitted when an offer is canceled.
Modifiers
isListed: Checks if the Digital Asset is listed by its owner.
notListed: Checks if the Digital Asset is not already listed.
isActive: Checks if the Digital Asset is active.
offerExists: Checks if the offer exists and is not expired.
offerNotExists: Checks if the offer does not already exist.
Methods
listItem: Lists a Digital Asset for sale, collecting a listing fee in ERC20 tokens.
cancelListing: Cancels a Digital Asset listing, refunding the listing fee in ERC20 tokens.
updateListing: Updates the price of a Digital Asset listing.
buyItem: Buys a listed Digital Asset using ERC20 tokens.
createOffer: Makes an offer on a Digital Asset, locking up the offered ERC20 tokens.
cancelOffer: Cancels an existing offer, unlocking the offered ERC20 tokens.
acceptOffer: Accepts an offer on an owned Digital Asset, transferring the locked ERC20 tokens to the owner.
Access Control
Admin Only: Can update the address registry.
External Contract Only:
validateItemSold
is called by the BundleMarketplace on the sale of a Digital Asset.Public: Can get the price of a token.
Owner Only: Can cancel and update listings, and accept offers on owned Digital Assets.
KYC Only: Can list Digital Assets for sale, buy Digital Assets, make offers, and cancel offers.
Payment System and Fees
Tokens for Payments: Transactions in this contract, including buying and selling Digital Assets, are conducted using approved ERC20 tokens. No native FTM tokens are used.
Fees: The contract involves
platformFee
androyaltyFee
, which are collected in approved ERC20 tokens.There are no payments made using native tokens like ETH or FTM.
ERC-20 Token Initialization
The contract does not initialize any ERC-20 tokens. It uses the IERC20
and SafeERC20
interfaces from OpenZeppelin for secure interactions with ERC-20 tokens. The specific ERC-20 token used for transactions is generally set when Digital Assets are listed or offers are made.
Last updated