sablier-labs / v2-core

⏳ Core smart contracts of the Sablier V2 token distribution protocol
https://sablier.com
Other
292 stars 40 forks source link

LockupTranched: a new Lockup contract with sharply delineated chunks #787

Closed PaulRBerg closed 4 months ago

PaulRBerg commented 6 months ago

As discussed here: https://github.com/sablier-labs/company-discussions/discussions/19

Tasks:

Note: we will keep using the same terminology, i.e., streams and streamedAmountOf. Related: https://github.com/sablier-labs/v2-core/discussions/708#discussioncomment-8082942

andreivladbrg commented 6 months ago

Just wanted to let you know that I've implemented the POC and did benchmarks (see README file). You can see the work here: https://github.com/andreivladbrg/v2-tranched/

Now it is up to decide if it worth implementing here.

PaulRBerg commented 6 months ago

Awesome, thanks @andreivladbrg, will review later.

PaulRBerg commented 6 months ago

Kudos, @andreivladbrg, for the benchmark you have prepared here.

I think it is as clear as day that we should move forward with LockupTranched.

These gas optimizations are due to LT making it possible to have half as many segments as LD. But LT is more efficient even when the number of segments is equal.

Screenshot 2024-01-23 at 11 14 33 AM

@razgraf could you give us the green light?

razgraf commented 6 months ago

Sounds good!

PaulRBerg commented 6 months ago

Great, thanks.

@andreivladbrg, you can move forward with implementing LockupTranched properly. The contract should be added in V2 Core.

Note: we should first merge https://github.com/sablier-labs/v2-core/pull/798

andreivladbrg commented 6 months ago

@andreivladbrg, you can move forward with implementing LockupTranched properly. The contract should be added in V2 Core.

I will, but currently I am working on making a huge refactor for core, that it would be very beneficial as the Lockup contracts are increasing

https://github.com/andreivladbrg/refactor-core/

saying it now, it may take a while

PaulRBerg commented 6 months ago

That's fine but please create a discussion/ proposal prior to a PR

andreivladbrg commented 4 months ago

https://github.com/sablier-labs/v2-core/commit/34fee6bc128f2219538056cdf920ccb12e84945c