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

Add ERC721 support #82

Merged
merged 12 commits into from
May 20, 2024
Merged

Add ERC721 support #82

merged 12 commits into from
May 20, 2024

Conversation

andreivladbrg
Copy link
Member

@andreivladbrg andreivladbrg commented May 16, 2024

Closes #47 #73 #66 #63

Changes

  • inherit ERC721 in SablierV2OpenEndedState
  • implement _update hook
  • implement _isCallerStreamRecipientOrApproved helper function
  • inherit IERC4906 and add updateMetadata modifier
  • introduce a new amount (remainingAmount) in Stream struct
  • remove balance subtraction in _extractFromStream function
  • add isTransferable bool
  • mint the NFT in _create function
  • remove ERC20 transfers from cancel and adjustRatePerSecond function
  • allow withdraw function to be called after the stream is canceled
  • update withdrawableAmountOf function to include remainingAmount
  • use modifiers only in external/public function
  • add Access Control table in README
  • update invariants in README
  • update tests accordingly to the above changes in src

Also, I've created some useful diagrams, but they will be correct once we make the cancel --> pause change:

Diagrams

State diagram

OE_state_diagram


Calculation diagrams

Amounts_Calculation

@andreivladbrg andreivladbrg requested a review from smol-ninja May 16, 2024 13:36
Copy link
Member

@smol-ninja smol-ninja left a comment

Choose a reason for hiding this comment

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

Since its a huge PR and there are so many ongoing changes for other open issues, should we merge it after the following review and start working on top of it? We can create more smaller issues if we find problem with it later. cc @andreivladbrg wdyt?

PS: I have't reviewed the tests yet.

src/abstracts/SablierV2OpenEndedState.sol Outdated Show resolved Hide resolved
src/interfaces/ISablierV2OpenEndedState.sol Outdated Show resolved Hide resolved
src/types/DataTypes.sol Show resolved Hide resolved
src/abstracts/SablierV2OpenEndedState.sol Outdated Show resolved Hide resolved
src/SablierV2OpenEnded.sol Show resolved Hide resolved
@smol-ninja
Copy link
Member

While reviewing this PR, I have realized that it would have been easier to review it if it had been split into multiple PRs.

  • 1 PR introduces ERC721 implementation
  • 1 PR introduces withdrawableAmountOf changes
  • 1 PR introduces isTransferable

What do you think @PaulRBerg @andreivladbrg? imo we should avoid large PRs until its absolutely necessary.

@PaulRBerg
Copy link
Member

agree, let's split in multiple PRs

feat: inherit IERC721Metadata in ISablierV2OpenEndedState
refactor: add constructor in SablierV2OpenEnded
@andreivladbrg
Copy link
Member Author

@smol-ninja I've pushed a new commit addressing some of your feedback

And, as we discussed privately, we will merge this PR as is (to make things moving faster), and we will create future issues in case of problem

@smol-ninja
Copy link
Member

yeah sounds good.

@smol-ninja smol-ninja merged commit 73c0dce into main May 20, 2024
6 checks passed
@smol-ninja smol-ninja deleted the feat/NFT branch May 20, 2024 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement NFT
3 participants