FantomBundleMarketplace.sol

Documentation for FantomBundleMarketplace.sol


Overview

The FantomBundleMarketplace contract facilitates the bundling and selling of multiple Digital Assets in a single transaction on the Fantom blockchain. It offers features such as creating bundles, listing them for sale, buying bundles, placing and accepting offers, and more.

Key Features

  • Creating Digital Asset bundles

  • Listing bundles for sale

  • Buying bundles

  • Placing offers on bundles

  • Accepting bundle offers

  • Cancelling listings and offers

  • Collecting platform fees in ERC20 tokens

  • Transferring bundles

  • Reentrancy prevention

Structs

  • Listing: Contains information such as the Digital Assets in the bundle, their quantities, and the price in ERC20 tokens.

  • Offer: Contains details about an offer made for a bundle, including the offered price in ERC20 tokens.

Mappings

  • listings: Maps the owner and bundle ID to a Listing struct.

  • owners: Maps a bundle ID to an owner's address.

  • offers: Maps a bundle ID and its creator to an Offer struct.

  • bundleIdsPerItem: Keeps track of which bundles contain a specific Digital Asset.

  • nftIndexes: Maps a bundle ID and a Digital Asset to its index within the bundle.

Events

  • ItemListed: Emitted when a new bundle is listed.

  • ItemUpdated: Emitted when a bundle's listing is updated.

  • ItemSold: Emitted when a bundle is sold.

  • OfferCreated: Emitted when a new offer is made.

  • OfferCanceled: Emitted when an offer is canceled.

Methods

  • listItem: Lists a new bundle for sale, collecting a listing fee in ERC20 tokens.

  • cancelListing: Cancels a bundle listing and refunds the listing fee in ERC20 tokens.

  • updateListing: Updates the price of a bundle listing.

  • buyItem: Purchases a listed bundle, transferring the price in ERC20 tokens.

  • createOffer: Makes an offer on a bundle, locking the offered ERC20 tokens.

  • cancelOffer: Cancels an existing offer and unlocks the offered ERC20 tokens.

  • acceptOffer: Accepts an offer on a bundle the caller owns, transferring the offered ERC20 tokens.

Access Control

  • Admin Only: Can update the address registry.

  • External Contract Only: validateItemSold is called by the marketplace upon a sale.

  • Public: Can query bundle listing details.

  • Owner Only: Can cancel listings, update listings, and accept offers on owned bundles.

  • KYC Only: Allowed to list bundles, buy bundles, make offers, and cancel offers.

Payment System and Fees

  • Tokens for Payments: The contract exclusively uses approved ERC20 tokens for transactions.

  • Fees: Fees such as platformFee and royaltyFee are handled during transactions in ERC20 tokens.

ERC-20 Token Initialization

The contract does not initialize ERC-20 tokens itself. It uses the IERC20 and SafeERC20 interfaces from OpenZeppelin for safe ERC-20 token interactions. The specific ERC-20 token to be used for payments is typically set when bundles are listed or offers are made.


Last updated