Mini-Mart is a gas-efficient, signature-based (EIP-712) ERC721 marketplace contract built with the Foundry framework. It allows users to list NFTs for sale with off-chain signatures, minimizing gas costs for sellers. The marketplace logic is executed on-chain only during the fulfillment of an order.
- On-Chain Order Fulfillment: A buyer fills the seller's signed order to the contract, and the
fulfillOrder
function atomically handles payment, fee collection, and NFT transfer. - Buyer Protection: If an order cannot be fulfilled (e.g., the NFT was transferred, approval was revoked, or the listing expired), the buyer's payment is automatically refunded within the same transaction.
- Fixed Platform Fee: A 3% fee is collected on every successful sale.
- Admin Controls:
- Pausable: The owner can pause and unpause all trading activity (
addOrder
,fulfillOrder
) in case of an emergency. - Fee Withdrawal: The owner can withdraw all accumulated fees from the contract.
- Pausable: The owner can pause and unpause all trading activity (
- Comprehensive Testing: The project includes an extensive test suite using Foundry, covering unit tests, negative paths, and fuzz testing.
- Foundry: You will need
forge
andanvil
installed. - Slither: For static analysis.
- Mythril: For symbolic execution analysis.
forge script script/Deploy.s.sol --account mulf-deployer --broadcast
This is the core contract. It implements the EIP-712 standard to create verifiable order data.
Order Flow:
- Seller: Creates an
Order
struct with sale details (price, tokenId, etc.) and signs its EIP-712 hash. - Buyer: Submits the
Order
struct and the seller'ssignature
to theaddOrder()
function. The contract verifies the signature and lists the order. - Buyer: Calls
fulfillOrder()
with the correctmsg.value
to purchase the NFT. The contract verifies all conditions (e.g., ownership, approval), transfers the NFT to the buyer, and pays the seller (minus fees).
Most recent deploy
0x3e8B8b44cC9bf47e25dEF41aCf8bB43e1f36adBE