-
Notifications
You must be signed in to change notification settings - Fork 2
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
refactor: amount
param in _withdraw
#232
Conversation
As a reminder to us:
|
e12c17c
to
6dd2d15
Compare
2d2eb19
to
dd917e2
Compare
test: update tests accordingly
dd917e2
to
c772b5b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @andreivladbrg. Great work on this. Here is a partial review and the rest of the review depends on the conclusion from the following comments.
amount
param in _withdraw
@smol-ninja I've pushed a commit a8b77f5 to address your feedback, lmk if it looks good |
test: change token symbols
test: assertions in withdrawMax fuzz test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given a full review. I must say with amount
as input parameter, the code now looks a bit better.
Except https://github.com/sablier-labs/flow/actions/runs/10811580895/job/29991351943?pr=232 (which I have yet to investigate), everything looks great. Left some comments below.
@andreivladbrg feel free to merge this PR now. And open separate PRs for other works such as related to invariant or the ones mentioned above (refactoring withdraw branches). I am convinced this is the way to go so lets gooo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work with this btw. I still look forward to some failing tests but until then, this is the winner.
sounds good, merging now
thank you, great suggestions as well |
* refactor: change the time param in withdraw with an amount test: update tests accordingly * docs: fix * perf: remove redudant assert * Shub's feedback * test: remove redundant lines in withdraw handler test: change token symbols * undeeded imports * test: add getRenormalizedAmount in Utils.sol test: assertions in withdrawMax fuzz test * test: set lower bound for timejump to 0 in fuzz and invariant * remove comment * test: lower bound for rps * refactor: remove corrected time logic (#236) * chore: polish * chore: polish --------- Co-authored-by: smol-ninja <[email protected]> Co-authored-by: gavriliumircea <[email protected]>
Closes
amount
param inwithdraw
#224Helpers.calculateAmountsFromFee
#230Depends on #220
Changes
time
withamount
inwithdraw
time
param in all functions and rely only onblock.timestamp
balance == 0
check inwithdraw
totalWithdrawAmount
variablewithdraw
and amount calculation functionsSome notes:
We now can allow withdrawals for an amount less than
snapshotDebt
which previously not possible withtime
param.Since now the withdraw amount is bounded between [1, coveredDebt], I have used unchecked for the balance subtraction, as we know for sure is not going to be greater than it.
flow/src/SablierFlow.sol
Lines 787 to 790 in c772b5b
and
flow/src/SablierFlow.sol
Lines 823 to 826 in c772b5b
Also, this is why I've added the equal check in
else
branch:flow/src/SablierFlow.sol
Line 843 in c772b5b