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 SablierV2Cliff contract #2

Merged
merged 25 commits into from
May 3, 2022
Merged

Add SablierV2Cliff contract #2

merged 25 commits into from
May 3, 2022

Conversation

andreivladbrg
Copy link
Member

@andreivladbrg andreivladbrg commented Apr 22, 2022

  • Add SablierV2Cliff.
  • Change SablierV2UnitTest to a parent contract for linear and cliff unit testing contracts.
  • Move decreaseAuthorization and increaseAuthorization to the common interface.

@PaulRBerg
Copy link
Member

PaulRBerg commented Apr 27, 2022

I left comments under the specific lines where you made mistakes that should be corrected. Besides those, here's what you have to do to make this PR complete:

Todos

  • Refactor createWithDuration and createFromWithDuration to have a cliffDuration argument rather than a cliffTime. The latter does not make sense.
  • Write tests to cover the cliff-specific logic. More specifically: test create, createWithDuration, getReturnableAmount and getWithdrawableAmount. Also please modify the test trees with bespoke descriptions of your tests cases, and also modify the test function names accordingly.

In addition, some more feedback:

Generic Feedback

  • All of your commit messages are one-liners. Are you familiar with the git commit -e command? It opens up a vim editor in which you can add more than just one line. This is especially useful when different types of changes have been made (e.g. refactor and fix). If you don't know what vim is, you'll have to learn how to use it.
  • It seems to me that you're spreading yourself too thin. For example, the refactor of the authorization functions was performed in multiple commits (ad5d0a, 8bbdd9), and the removal of an if condition was again performed in multiple commits(42527d and 1aa017).
  • You're adding little information in your git commit messages. Try to add the name of the function, contract, etc., you added, modified or deleted. Examples for vague commits: 38c065, d71f0d and d0199e.

Commit Message Feedback

  • A better explanation for what happened in commit 0fc95f would have been "docs: fix @inheritdoc in SablierV2Linear".
  • In certain cases, the order of variables in Solidity influences the gas costs, so commit 0cc557 is certainly not a style, maybe a chore or a perf.
  • Not sure what you did in commit 1aa017 but that is certainly not a perf (it may be an optimization).
  • Typo in commit 42527d. In English, "an" is used instead of "a" before words that begin with vowels.
  • Typo in commit bcaa81. It's "comparison operator" not "compare operator".
  • You installed the openzeppelin-contracts library in the b95d19 git commit but you did not mention this in the commit message. You could have used git commit -e to add multiple lines.
  • You should have used build instead of docs in commit d8a651.
  • You should have used chore instead of style in the commits 46234e and 5f8819. style should be used only for code formatting-related changed.
  • You should have used refactor instead of feat in the commit 8bbdd9, because removing things is not adding a new feature or functionality. Removing things is almost always git commited with refactor.
  • You should have used refactor instead of style in commits 442d90 and 094d5b. Renaming things is a refactor, not a style change.
  • You should have used test instead of feat in the commit d71f0d, because you did not add any new feature or functionality, you just modified a variable used in testing.
  • You should have used test instead of feat in commits 38c065 and f95dc4, because you did not add any new feature or functionality, you just wrote some tests.

refactor: change in which order to revert uint256 from custom error
test: add cliff duration constant
test: add cliff duration constant in create with duration
test: change what to expect to be reverted
test/unit/sablier-v2-cliff/SablierV2Cliff.t.sol Outdated Show resolved Hide resolved
src/SablierV2Cliff.sol Show resolved Hide resolved
src/SablierV2Cliff.sol Outdated Show resolved Hide resolved
src/interfaces/ISablierV2Cliff.sol Outdated Show resolved Hide resolved
src/interfaces/ISablierV2Cliff.sol Outdated Show resolved Hide resolved
src/SablierV2Cliff.sol Outdated Show resolved Hide resolved
src/SablierV2Cliff.sol Outdated Show resolved Hide resolved
@PaulRBerg
Copy link
Member

Also, I just noticed that you didn't write any tests for getReturnableAmount.

remappings.txt Outdated Show resolved Hide resolved
src/SablierV2Cliff.sol Show resolved Hide resolved
test/unit/sablier-v2-cliff/create/create.tree Show resolved Hide resolved
src/SablierV2Cliff.sol Outdated Show resolved Hide resolved
src/SablierV2Cliff.sol Show resolved Hide resolved
refactor: remove open zeppelin contracts
style: upper case to lower case
@PaulRBerg
Copy link
Member

Great job!

@PaulRBerg PaulRBerg merged commit a82bbfe into main May 3, 2022
@PaulRBerg PaulRBerg deleted the andreivladbrg/cliff branch May 3, 2022 13:34
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.

2 participants