Replies: 4 comments 11 replies
-
Great feedback, thanks.
|
Beta Was this translation helpful? Give feedback.
-
@razgraf what option do you like more:
My worry with the 1st is that it may easily mistaken for the standard segments (with milestones), but the 2nd option is a bit verbose. WDYT? |
Beta Was this translation helpful? Give feedback.
-
The 1st and the 2nd suggestions made by @razgraf have been implemented by me in #334. I have also opted for naming the However, I didn't implement the 3rd suggestion, the one about the name of the create functions. After further consideration, I continue to be against using the same name across the two lockup streaming contracts.
|
Beta Was this translation helpful? Give feedback.
-
Going to close this since we settled upon the current API. |
Beta Was this translation helpful? Give feedback.
-
We'll start with a comparison of the current
create
methods in our contractsv2-core/src/interfaces/ISablierV2LockupLinear.sol
Lines 64 to 72 in b23b065
v2-core/src/interfaces/ISablierV2LockupLinear.sol
Lines 102 to 110 in b23b065
v2-core/src/interfaces/ISablierV2LockupPro.sol
Lines 74 to 83 in b23b065
v2-core/src/interfaces/ISablierV2LockupPro.sol
Lines 115 to 124 in b23b065
Problem no. 1 -
LockupDynamic.Segment
Context
The same segment is being used in both
create
variants. The milestones flavor uses the segment properly, by accessing all variables, including milestones. The deltas flavor won't use milestones at all. Instead, it will make use of an additional method argument calleddeltas[]
where it will source its durations from.Problem
By reusing the segment struct we're causing a few headaches to any developer reading the interface:
milestones
isn't being used at all in the delta variant (we ask for a redundant value)I propose we implement two separate structs, one including a milestone, the other a duration.
As an alternative (although I hope we can have distinct structs), we can discuss the possibility of having a single struct that either re-uses a time dimension (e.g.
lifetime
) but means different things based on the variant chosen -- which is still bad UX but might save up on gas.As a second alternative, we revert back to the separate arrays, although I think that was more gas/storage intensive.
Problem no. 2 - Order of arguments
The linear methods follow an order:
sender, recipient, total, asset, cancelable, [...special...], broker
The dynamic methods have:
sender, recipient, total, [...special...], asset, cancelable, [...special...], broker
Wouldn't it be best to group these similar arguments together, by moving asset and cancelable after the total amount?
Problem no. 3 - Deltas vs Durations and Milestones vs Ranges
For consistency, why don't we use durations and ranges for both contracts? At least with milestones I can understand that we're naming the method after the specific
milestone
field of the segment struct, that's driving the temporal logic here. Instead of range, which would work too.But deltas vs. durations feels a bit redundant. Was this made so we have the names completely split between contracts?
Beta Was this translation helpful? Give feedback.
All reactions