📈 The first NFT options trading smart contract
Web Interface (Work In Progress): https://nft-call-options.vercel.app/
- Users can offer to buy call options for any NFT in a collection
- Users can sell covered call options against NFTs they own by accepting offers
- The smart contract is immutable and has no ownership mechanism
- Contracts
- Solidity v0.8.15 - for writing smart contracts
- Foundry/Forge - for tests/builds
- Based on foundry-rs/forge-template
- Web Interface (in
interface/
)- Next.js - for the web framework
- MUI - for styles
- Ethers.js - for interacting with the blockchain
- wagmi - for accessing providers
- RainbowKit - for connecting wallets
See docs/roadmap.md
for a list of existing and planned features.
- User A can offer to buy a call option for an NFT
- User A selects a collection to buy a call on
- The floor price is an important metric here because any NFT from the collection can be used in this transaction
- User A selects a strike price (in Ether)
- User A selects a expiration time (in a Unix timestamp)
- User A selects an amount of premium to pay (in Ether)
- User A pays the premium upfront to prevent order spoofing
- Their premium is held in the contract until the offer is cancelled or the offer is accepted
- User A selects a collection to buy a call on
- User B can accept User A's offer by selling a covered call against an NFT that they own
- User B uses their NFT as collateral, and receives the premium
- User B's NFT can be any NFT in the collection chosen by User A
- The NFT is locked up until the expiration time
- Before the expiration time, User A can pay the strike price in for the NFT
- After the expiration time, User B can withdraw their NFT if it wasn't bought
- User B uses their NFT as collateral, and receives the premium
This project uses Foundry. See the book for instructions on how to install and use Foundry.
- Core contracts are in
src/
- Build contracts with
forge build
- Build contracts with
- Tests are in
test/
- Run tests with
forge test
- Run tests with