Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/verumlotus/nft-call-option
On-chain call option for ERC721 assets.
https://github.com/verumlotus/nft-call-option
evm foundry options solidity
Last synced: 19 days ago
JSON representation
On-chain call option for ERC721 assets.
- Host: GitHub
- URL: https://github.com/verumlotus/nft-call-option
- Owner: verumlotus
- License: mit
- Created: 2022-02-09T23:18:57.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2022-02-10T16:33:44.000Z (almost 3 years ago)
- Last Synced: 2024-12-21T12:34:57.193Z (about 1 month ago)
- Topics: evm, foundry, options, solidity
- Language: Solidity
- Homepage:
- Size: 34.2 KB
- Stars: 32
- Watchers: 2
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NFT Call Options
Call options for any ERC721 conforming asset.
[NiftyOptions](https://niftyoptions.org/) is an on-chain options protocol for NFTs, but it currently only support the creation of puts. While this minimizes downside risk for NFT holders, the needs of NFT speculators is left unmet. Thus, call options.
Selling covered call options for NFTs allows sellers to generate a premium and guarantee a fixed upside from the current price. For call purchasers, these options are a way to speculate on NFT price movement for a small premium.
## Flow for an Option Seller
- Deploy an instance of the `Option.sol` contract, specifying parameters such as the `quoteToken`, `strike`, `premium`, and `expiry`.
- Deposit the NFT into the contract via `deposit`.
- At expiry, if the option has not been exericsed, the seller can call `closeOption` to receive their NFT.
- At any time, if the contract has not been purchased yet, the seller can call `closeOption` to close the contract and receive their NFT.## Flow for an Option Buyer
- Call `purchaseCall`: the buyer can either call `approve` on the `quoteToken`, or can provide an EIP-2612 Permit signature.
- To exercise an option, the buyer can call `exerciseOption` and pay the strike price to receive the NFT.## Build & Testing
This repo uses Foundry for both the build and testing flows. Run `forge build` to build the repo and `forge test` for tests.## Disclaimer
This was created mostly for fun, and should not be used in production. It's not gas optimized and only has very basic tests.