-
Notifications
You must be signed in to change notification settings - Fork 48
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: add unlock amounts functionality #1075
base: staging
Are you sure you want to change the base?
Conversation
3e0cf63
to
9d7e555
Compare
@smol-ninja the PR is ready for your review, I have updated the OP with some useful comments, please get first through them before reviewing, |
b65cb8f
to
d4d8187
Compare
@smol-ninja just rebased from Note: the size of the contract is at its limit, adding new things to the contract would require us to decrease the optimizer runs.
|
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
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.
Nice work on the PR. Reviewed the src
and left my comments below.
@@ -36,6 +36,9 @@ contract SablierMerkleLL is | |||
/// @inheritdoc ISablierMerkleLL | |||
MerkleLL.Schedule public override schedule; | |||
|
|||
/// @inheritdoc ISablierMerkleLL | |||
LockupLinear.UnlockAmounts public override unlockAmounts; |
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.
Instead of creating is as a separate variable, how about merging it into schedule
. The name schedule
is very generic and can include amounts as well.
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.
hmm, not sure what to say, will think more about this
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.
i would like to keep the current version to have two different structs 1. for time related variables 2. amount related amounts
schedule name is more suited for time related variables IMO
151dbdd
to
57d7def
Compare
57d7def
to
8ca1274
Compare
d4d8187
to
d8865fd
Compare
8ca1274
to
9050f98
Compare
d8865fd
to
8e1364a
Compare
237cadb
to
e98d613
Compare
@smol-ninja I have addressed all the |
@@ -408,36 +433,47 @@ contract SablierLockup is ISablierLockup, SablierLockupBase { | |||
}); | |||
} | |||
|
|||
struct CreateLLParams { |
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.
temporarily added this due to stack too deep error
will try to think of a better option, but couldn't find one yet (tried scoping {}
blocks of code, tried a different function for the event, tried splitting the logic, and didn't work unfortunetely)
e98d613
to
290eb76
Compare
62d26a3
to
20e40ba
Compare
267b7fd
to
4b8a424
Compare
refactor: some polishes docs: update explanatory comments test: add new test branches in create function test: streamed amount in lockup linear test: fix common streamed amount tests test: remove unneeded branches build: update deps test: fix tranches default function feat: include unlock amounts in StreamLL docs: fix some comments test: improve fuzz streamed amount tests test: update fork with unlock amounts test: fix last failing tests docs: last polishes
4b8a424
to
5d48595
Compare
Closes #1043 and #1067
Since we have the invariant:$\text{cliff time} = 0 \implies \text{cliff unlock amount} = 0$ , we would have these 6 possible scenarios for the streamed amount function:
Plot graphs with docs code
Scenario 2
Code to update the docs shapes with:
Scenario 4
Code to update the docs shapes with:
Note: Since the mathematical function has changed in
SablierLockupLinear._calculateStreamedAmount
, in order to achieve the previous cliff linear shape, it is required to pass anunlockAmount.cliff > 0
; otherwise, the second scenario shape will be achieved. This is also the reason I needed to change the tests from warping toWARP_26_PERCENT
instead ofCLIFF_TIME,
as many tests were failing. The cliff amount has a remainder of 2534 due to a different "streamable" range.As you will see in the code, I am referring to the range that calculates the elapsed time as "streamable," which might be confusing since the entire function is called "streamed amount." However, we will eventually change this terminology to "vesting," so don’t mind the current terminology if you find it unclear.
Below you can see an useful diagram to vizualize while reviewing the new function.
New function flow