Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Covered Calls ETH #162

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open

feat: Covered Calls ETH #162

wants to merge 8 commits into from

Conversation

kulkarohan
Copy link
Contributor

@kulkarohan kulkarohan commented Apr 10, 2022

New Module Proposal

Description

This module enables users to create ETH covered call options on NFTs.

Motivation and Context

https://twitter.com/will__price/status/1473036686691082248?s=21

How has this been tested?

Relevant tests have been included via Foundry.

Checklist:

  • The module includes tests written for Foundry
  • The module is documented with NATSPEC
  • The documentation includes UML Diagrams for external and public functions
  • The module is a Hyperstructure

require(call.expiry > block.timestamp, "INVALID_CALL");

// Ensure the specified strike matches the call strike
require(call.strike == _strike, "MUST_MATCH_STRIKE");

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why even pass strike if they have to match? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its to prevent a buyer from getting rugged on a strike price they didn't intend to purchase the option for

there'd be a race condition upon a pending buy where the seller could cancel the call and create a new one with the same premium but higher strike price

_handleOutgoingTransfer(seller, premium, address(0), 50000);

// Mark the option as purchased
call.buyer = msg.sender;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be moved above any of the external calls. Currently the seller could re-enter and cancel after receiving premium :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow lol ty for catching that!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants