-
Notifications
You must be signed in to change notification settings - Fork 50
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
Implement ERC721 standard in both Linear and Pro contracts #131
Conversation
45e1a35
to
2a4e756
Compare
Is worth mentioning that the changes will increase the gas cost for the Before: https://imgur.com/a/reBfXXR |
2a4e756
to
3003b34
Compare
Great work! I have left multiple specific bits of feedback to your code above. Separately, this is my general feedback: Common InheritanceYou should have inherited from
Unfortunately, it doesn't look like Solmate offers any interface for ERC-721. To achieve this, I had to switch over to OpenZeppelin. RecipientI agree that it would be useful to keep the |
test/unit/sablier-v2-pro/create-with-duration/createWithDuration.tree
Outdated
Show resolved
Hide resolved
7e9cec0
to
835ff40
Compare
I have just went through all tests and they generally looked good to me, but there several wordings that needed improvements, which I did in my latest commit. There are two things left to do in this PR:
|
As discussed privately, we can keep using OZ's What we certainly don't want is to keep |
956c1a4
to
ffae193
Compare
Given that usually the functions which return a boolean use the "is" prefix. I suggest we rename the modifier from |
@andreivladbrg let's discuss that separately outside of this PR. For now I would like to keep Why did you use |
Ok.
I followed the openzeppelin recommendation. Just noticed that gas cost increased by 711 using |
feat: inherit "ERC721" in "SablierV2Linear" feat: inherit "ERC721" in "SablierV2Pro" feat: mint NFT in the "_create" function feat: add "isApprovedOrOwner" function feat: change the modifier to "isAuthorizedForStream" feat: add "tokenURI" function perf: remove the recipient address from the "Stream" struct refactor: swap the order of the checks in the "withdrawTo" function test: change the struct recipient with the "users.recipient" test: make recipient the default caller in the "cancel" function test: order correctly the branches in the "cancel" tree test: order correctly the branches in the "cancelAll" tree test: order correctly the branches in the "withdraw" tree test: when the caller is an approved third party in the "cancel" function test: when the caller is an approved third party in the "cancelAll" funtion test: when the caller is an approved third party in the "withdraw" function test: when the caller is an approved third party in the "withdrawAll" function test: when the caller is an approved third party in the "withdrawAllTo" function test: when the caller is an approved third party in the "withdtawTo" function test: when the recipient is no longer the owner of the stream in the "cancel" function test: when the recipient is no longer the owner of the stream in the "withdraw" function test: when the recipient is no longer the owner of the streams in the "cancelAll" function test: when the recipient is no longer the owner of the streams in the "withdrawAll" function test: when the recipient is no longer the owner of the streams in the "withdrawAllTo" function test: when the recipient is no longer the owner of the stream in the "withrawTo" function test: remove the local "withdrawAmount" variable from the test functions test: change the new owner of the streams to "eve" when using "safeTransferFrom" function test: "isApprovedOrOwner" function in the "SablierV2Linear" contract test: "isApprovedOrOwner" function in the "SablierV2Pro" contract test: correct comment about return value for the "isCancelable" function
build: remove "solmate" build: install "openzeppelin-contracts" lib build: upgrade to latest "prb-math" lib chore: add ".solhintignore" file chore: improve wording in comments docs: improve wording in NatSpec refactor: change the ERC-721 name refactor: name return args in "isApprovedOrOwner" and "tokenURI" refactor: refer to "to" as "recipient" refactor: use OpenZeppelin's ERC721 implementation refactor: use "_isApprovedOrOwner" from OpenZeppelin test: add dummy function implementations in "AbstractSablierV2" test: delete "isApprovedOrOwner" tests
build: upgrade to "release-v4.8" of "openzeppelin-contracts"
test: add new "operator" user test: add new testing branches for un/authorized test: delete superfluous warps in "withdraw" tests test: move assertions for recipients at the bottom test: refer to approved "third-party" as "operator" test: rename "withdrawAmountZero" to "withdrawAmount" test: refactor "CallerRecipient" to "OriginalRecipient" test: use the new operator user in the "approved operator" tests
chore: add visibility keyword in function separators refactor: inherit from ERC721 last test: simplify AbstractSablierV2 contract
chore: remove unnecessary imports
test: update tests to check for burned NFT
4da6bc2
to
ae2eeed
Compare
* feat: ERC721 build: install "openzeppelin-contracts" lib feat: inherit "ERC721" in "SablierV2Linear" feat: inherit "ERC721" in "SablierV2Pro" feat: mint NFT in the "_create" function feat: add "isApprovedOrOwner" function feat: change the modifier to "isAuthorizedForStream" feat: add "tokenURI" function perf: remove the recipient address from the "Stream" struct refactor: swap the order of the checks in the "withdrawTo" function test: change the struct recipient with the "users.recipient" test: make recipient the default caller in the "cancel" function test: order correctly the branches in the "cancel" tree test: order correctly the branches in the "cancelAll" tree test: order correctly the branches in the "withdraw" tree test: when the caller is an approved third party in the "cancel" function test: when the caller is an approved third party in the "cancelAll" funtion test: when the caller is an approved third party in the "withdraw" function test: when the caller is an approved third party in the "withdrawAll" function test: when the caller is an approved third party in the "withdrawAllTo" function test: when the caller is an approved third party in the "withdtawTo" function test: when the recipient is no longer the owner of the stream in the "cancel" function test: when the recipient is no longer the owner of the stream in the "withdraw" function test: when the recipient is no longer the owner of the streams in the "cancelAll" function test: when the recipient is no longer the owner of the streams in the "withdrawAll" function test: when the recipient is no longer the owner of the streams in the "withdrawAllTo" function test: when the recipient is no longer the owner of the stream in the "withrawTo" function test: remove the local "withdrawAmount" variable from the test functions test: change the new owner of the streams to "eve" when using "safeTransferFrom" function test: "isApprovedOrOwner" function in the "SablierV2Linear" contract test: "isApprovedOrOwner" function in the "SablierV2Pro" contract test: correct comment about return value for the "isCancelable" function * refactor: inherit from "IERC721" in "ISablierV2" build: upgrade to latest "prb-math" lib chore: add ".solhintignore" file chore: improve wording in comments docs: improve wording in NatSpec refactor: change the ERC-721 name refactor: name return args in "isApprovedOrOwner" and "tokenURI" refactor: refer to "to" as "recipient" refactor: use OpenZeppelin's ERC721 implementation refactor: use "_isApprovedOrOwner" from OpenZeppelin test: add dummy function implementations in "AbstractSablierV2" test: delete "isApprovedOrOwner" tests * fix: use "_ownerOf" ERC721 function build: upgrade to "release-v4.8" of "openzeppelin-contracts" * test: improve wording in testing trees test: add new "operator" user test: add new testing branches for un/authorized test: delete superfluous warps in "withdraw" tests test: move assertions for recipients at the bottom test: refer to approved "third-party" as "operator" test: rename "withdrawAmountZero" to "withdrawAmount" test: refactor "CallerRecipient" to "OriginalRecipient" test: use the new operator user in the "approved operator" tests * refactor: isApprovedOrOwner chore: add visibility keyword in function separators refactor: inherit from ERC721 last test: simplify AbstractSablierV2 contract * chore: remove unnecessary imports * style: order imports chore: remove unnecessary imports * refactor: burn NFT when stream is ended test: update tests to check for burned NFT * refactor: use "safeMint" in the "create" function * test: correct explanatory comment Co-authored-by: Paul Razvan Berg <[email protected]>
create
function in both contractsrecipient
address from theStream
struct in both contractsisApprovedOrOwner
function that returns abool
value wether the caller is theowner
of the stream or isapproved
onlySenderOrRecipient
modifier toisAuthorizedForStream
that callsisApprovedOrOwner
functionapproved
third party in thecancel
cancelAll
withdraw
withdrawAll
withdrawAllTo
withdrawTo
functionscancel
cancelAll
withdraw
withdrawAll
withdrawAllTo
withdrawTo
functions