-
Notifications
You must be signed in to change notification settings - Fork 7
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
MerkleLockup for LockupTranched #297
Conversation
feat: add createMerkleLockupLT in SablierV2MerkleLockupFactory contract
docs: add requirements in createMerkleLockupLT natspec chore: improve wording in explanatory comments
test: add Merkle Lockup LT integration tests
test: add fork tests for Merkle Lockup LT
test: use pragma >=0.8.22
test: createMerkleLockupLT in factory test: update Precompiles bytecode
test: getTranchesWithPercentages function test: update Precompiles bytecode
refactor: use maxCount in DeployProtocol script
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.
Reviewed src. Made a PR to arrange imports alphabetically.
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 have reviewed the PR. Left my comments below.
I think we should find a new name for tranches percentages. tranchesWithPercentages
does not look apt to me.
test/integration/merkle-lockup/factory/create-merkle-lockup-lt/createMerkleLockupLT.tree
Outdated
Show resolved
Hide resolved
test/integration/merkle-lockup/factory/create-merkle-lockup-lt/createMerkleLockupLT.tree
Outdated
Show resolved
Hide resolved
test/integration/merkle-lockup/factory/create-merkle-lockup-lt/createMerkleLockupLT.t.sol
Outdated
Show resolved
Hide resolved
test/integration/merkle-lockup/lt/get-tranches-with-percentage/getTranchesWithPercentage.t.sol
Outdated
Show resolved
Hide resolved
Also, MerkleLockupLT fork tests are failing at |
I agree that the name is not the best, but I couldn't find something better. Do you have other suggestions? Also, should we not use plural? |
build: bump core test: dry-fy fork tests test: remove protocol fee tests in claim test: add headers in MerkleLockup test: emit the correct element in the assertEq test:
chore: improve explanatory comments test: fix fork test for MerkleLockupLT
@smol-ninja addressed all the feedback, lmk if it looks good. for some reason the ci passes, still not sure why |
Every time there is a new commit in v2-core#staging, the bun lockfile needs to be updated to fetch the latest commit. Without which, ci fails. Not sure why this behaviour though. |
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.
Looks good to me except the following comments:
Also, should we not use plural?
I thought about it. My view is that using a plural for the variable name makes more sense. Struct TrancheWithPercentage
represents single tranche while tranchesWithPercentages
represents a set of tranche. So I am good with using plural in this context. However I have the following suggestions:
- Because it leads to longer names, how about we use synonym of percentage which is Pct - see Cambridge definition? That will change
tranchesWithPercentages
totranchesWithPct
. I know it might not be super clear compared to the original name, but curious to know what your think about it.
For example,
actualTranchesWithPercentages
becomesactualTranchesWithPct
.MerkleLockupLT.TrancheWithPercentage[] tranchesWithPercentages
becomesMerkleLockupLT.TrancheWithPct[] tranchesWithPct
.SablierV2MerkleLockupFactory_PercentageSumNotEqualOneHundred
becomesSablierV2MerkleLockupFactory_TotalPctNotEqual100
- And instead of
amountsSum
andPercentagesSum
, how abouttotalAmount
andtotalPercentage
/totalPct
? But If doubles
doesn't look weird to you, feel free to ignore this and such comments.
Please review this commit: 6ad73ed
test/integration/merkle-lockup/factory/create-merkle-lockup-lt/createMerkleLockupLT.t.sol
Outdated
Show resolved
Hide resolved
test/integration/merkle-lockup/factory/create-merkle-lockup-lt/createMerkleLockupLT.t.sol
Outdated
Show resolved
Hide resolved
test: remove protocol feee branch from claim.tree
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.
LGTM except minor refactors in createMerkleLockupLT.t.sol
and createMerkleLockupLT.tree
.
048894d
to
1b49ebf
Compare
My reasoning was the same.
Interesting idea, but the name is not that long. Plus, the core structs have pretty much the same size (e.g., Also, I discussed it with Paul, and he said that it is clearer with the long form (Pct might be confusing to some individuals who are not familiar with the term).
It looks good, thanks |
forced push a commit, lmk if everything is alright, if yes, can you approve the PR? |
40f7c7f
to
f205dbd
Compare
tranches' amounts calculation
f205dbd
to
0587327
Compare
thanks for the review @smol-ninja i've pushed a commit now, lmk if it looks good |
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.
LGTM except my last reply.
Closes #273
Simillar to Lockup Dynamic, but we store in the
MerkleLockupLT
contract an array of structs with percetanges and durations (how Razvan suggested here).I used
UD2x18
instead ofUD60x18
to be more gas efficient. The sum of these percentages must be equal to 100%There is no change in the
claim
function parameters between linear and tranched. Thus, the Merkle tree would be the same.