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: option to set transferability of NFTs when creating stream #668

Merged
merged 8 commits into from
Aug 31, 2023
Merged

feat: option to set transferability of NFTs when creating stream #668

merged 8 commits into from
Aug 31, 2023

Conversation

smol-ninja
Copy link
Member

@smol-ninja smol-ninja commented Aug 25, 2023

Resolves #630.

It adds:

  • a new transferrable boolean parameter in the create stream parameter structs in "DataTypes.sol".
  • implementation of _beforeTokenTransfer() in "src/SablierV2LockupDynamic.sol" and "src/SablierV2LockupLinear.sol".
  • test cases
  • resolves Questions on NFT transferability #669

@smol-ninja
Copy link
Member Author

@PaulRBerg can you please review this PR?

@smol-ninja smol-ninja changed the title feat: toggle transferability of stream NFTs feat: option to enable/disable transferability of stream NFTs Aug 29, 2023
@smol-ninja smol-ninja changed the title feat: option to enable/disable transferability of stream NFTs feat: option to set transferability of NFTs when creating stream Aug 29, 2023
Copy link
Member

@PaulRBerg PaulRBerg left a comment

Choose a reason for hiding this comment

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

Thanks, @smol-ninja. Feedback left below.

We need to add a new branch in the burn.tree test file to show that non-transferable streams can be burned.

I will let you do this.

src/SablierV2LockupDynamic.sol Outdated Show resolved Hide resolved
src/SablierV2LockupLinear.sol Outdated Show resolved Hide resolved
src/abstracts/SablierV2Lockup.sol Outdated Show resolved Hide resolved
src/abstracts/SablierV2Lockup.sol Outdated Show resolved Hide resolved
src/libraries/Errors.sol Outdated Show resolved Hide resolved
test/invariant/handlers/LockupLinearCreateHandler.sol Outdated Show resolved Hide resolved
PaulRBerg and others added 2 commits August 29, 2023 20:30
refactor: remove "canStreamTransfer"
refactor: remove double "r" in "transferrable"
refactor: simplify implementation
test: allow non-transferable streams in invariant tests
test: dry tests for "isTransferable"
test: improve function and test names
@smol-ninja
Copy link
Member Author

Thanks, @smol-ninja. Feedback left below.

We need to add a new branch in the burn.tree test file to show that non-transferable streams can be burned.

I will let you do this.

https://github.com/smol-ninja/v2-core/commit/699fafe9fb01e68c6c621823220057930d70d11f

@smol-ninja smol-ninja requested a review from PaulRBerg August 29, 2023 18:48
Copy link
Member

@PaulRBerg PaulRBerg left a comment

Choose a reason for hiding this comment

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

Finished the review - great job, @smol-ninja! Lovely working with you.

We will merge the PR after the CI checks pass.

test/integration/concrete/lockup/burn/burn.t.sol Outdated Show resolved Hide resolved
test/integration/concrete/lockup/burn/burn.tree Outdated Show resolved Hide resolved
@PaulRBerg PaulRBerg changed the base branch from main to 2.1 August 30, 2023 18:24
@smol-ninja
Copy link
Member Author

Finished the review - great job, @smol-ninja! Lovely working with you.

We will merge the PR after the CI checks pass.

Thanks, the pleasure is mine too. I realized I should focus more on polishing the code so you don't have to refactor it. Are there any documented best code practices that you follow for this? For example, I see you use streamId_ over _streamId.

@PaulRBerg
Copy link
Member

Are there any documented best code practices that you follow for this?

Yes! See this Twitter thread and our Notion document Coding Practices on Notion.

I see you use streamId_ over _streamId

Yep, that is part of the Coding Practices.

@PaulRBerg
Copy link
Member

Fork tests are failing because you don't have the Mainnet URLs set in your fork of the repo.

That's fine.

@smol-ninja
Copy link
Member Author

I didn't know that it would use the keys from my fork. I have now added them to my repo for the future.

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.

Add "transferrable" boolean flag in create stream parameter structs
2 participants