-
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
Place SablierBatchLockup
and core contracts into src
directory
#1073
Comments
for simplicity, i would recommend doing something: function createWithTimestampsLLMultiple(Params[] memory params) public returns (uint256 memory streamIds) {
streamIds = new uint256[](params.length);
for (uint256 i = 0; i < params.length; ++i) {
streamIds[i] = createWithTimestampsLL(params[i]);
} also, to have less logic, i.e. smaller bytecode size, wdyt? |
Interesting idea — though I'd name this like so:
|
Looks great @andreivladbrg |
From a private discussion with @smol-ninja on Slack What if we completely remove the This way, it will be better for two reasons:
@PaulRBerg cc @razgraf will there be a problem in terms of backwards compatibility? |
In favor. |
In favour.
fyi the contract contract is |
We can lower it to 800,700; it won't affect the gas too much, right? |
I think so. But I don't know how much size would create functions add. New selectors add significant to the bytecode size. And this will be adding 6 new selectors. We will have try it to see how it plays out. |
There are 2 advantages of the Batch contract I would be looking to retain if we go with this refactor:
If number 1 is not a problem due to size and number 2 becomes a non-problem when we implement #1064, then I'm in favor of this refactor as well. Will think of any other quirks as we go. |
I hope I didn't misunderstand your point.
My point is to keep the same UX of having the function signatures in etherscan, but not in a separate contract; instead, in the core contract itself (if contract size is not a problem): // Same contract
function createLL(Params memory params) public returns (uint256 streamId);
function createLLMultiple(Params[] memory params) public returns (uint256[] memory streamId);
there will be one entry point for allowance, |
I think @razgraf's point is valid about having the same entry point for all lockups since Batch can talk to all the variations of Lockup, which in @andreivladbrg's proposal would not be the case. For each lockup deployment, the user would have to On second thought today, I find including In the future, if we plan to add new functionalities without exceeding the contract size, I am afraid we might then decide to remove create multiple functions again. |
we deploy a new version of
re, the size, yes, that's a valid point, but let's first see what is the size increase, and then decide.
i believe we can't know this for sure in advance |
Agree with you on this. My point was that if it comes to us removing multiple functions again from the core due to size constraints in the future, then we should avoid adding them now, even if the contract size is within limits. It's very likely that we will add new functionalities or new code to the Lockup contract next year, and as a consequence, we can reach a point where we decide to refactor again by removing create multiple functions. But as you said, let's see the size increase because of create functions first. |
Just tested, and adding all the create multiple functions in the Functions placed in SablierLockup
function createWithDurationsLDMultiple(
Lockup.CreateWithDurations[] calldata params,
LockupDynamic.SegmentWithDuration[][] calldata segmentsWithDuration
)
external
returns (uint256 streamId)
{
if (params.length != segmentsWithDuration.length) {
revert Errors.SablierLockup_CreateMultipleInvalidArrayLengths(params.length, segmentsWithDuration.length);
}
for (uint256 i = 0; i < params.length; ++i) {
streamId = createWithDurationsLD(params[i], segmentsWithDuration[i]);
}
}
function createWithDurationsLLMultiple(
Lockup.CreateWithDurations[] calldata params,
LockupLinear.Durations[] calldata durations
)
external
returns (uint256 streamId)
{
if (params.length != durations.length) {
revert Errors.SablierLockup_CreateMultipleInvalidArrayLengths(params.length, durations.length);
}
for (uint256 i = 0; i < params.length; ++i) {
streamId = createWithDurationsLL(params[i], durations[i]);
}
}
function createWithDurationsLTMultiple(
Lockup.CreateWithDurations[] calldata params,
LockupTranched.TrancheWithDuration[][] calldata tranchesWithDuration
)
external
returns (uint256 streamId)
{
if (params.length != tranchesWithDuration.length) {
revert Errors.SablierLockup_CreateMultipleInvalidArrayLengths(params.length, tranchesWithDuration.length);
}
for (uint256 i = 0; i < params.length; ++i) {
streamId = createWithDurationsLT(params[i], tranchesWithDuration[i]);
}
}
function createWithTimestampsLDMultiple(
Lockup.CreateWithTimestamps[] calldata params,
LockupDynamic.Segment[][] calldata segments
)
external
returns (uint256 streamId)
{
if (params.length != segments.length) {
revert Errors.SablierLockup_CreateMultipleInvalidArrayLengths(params.length, segments.length);
}
for (uint256 i = 0; i < segments.length; ++i) {
streamId = createWithTimestampsLD(params[i], segments[i]);
}
}
function createWithTimestampsLLMultiple(
Lockup.CreateWithTimestamps[] calldata params,
uint40[] calldata cliffTime
)
external
returns (uint256 streamId)
{
if (params.length != cliffTime.length) {
revert Errors.SablierLockup_CreateMultipleInvalidArrayLengths(params.length, cliffTime.length);
}
for (uint256 i = 0; i < cliffTime.length; ++i) {
streamId = createWithTimestampsLL(params[i], cliffTime[i]);
}
}
function createWithTimestampsLTMultiple(
Lockup.CreateWithTimestamps[] calldata params,
LockupTranched.Tranche[][] calldata tranches
)
external
returns (uint256 streamId)
{
if (params.length != tranches.length) {
revert Errors.SablierLockup_CreateMultipleInvalidArrayLengths(params.length, tranches.length);
}
for (uint256 i = 0; i < tranches.length; ++i) {
streamId = createWithTimestampsLT(params[i], tranches[i]);
}
} |
Originally discussed in #1068
SablierBatchLockup
intocore
directorycore
directory upstream and deletecore
directoryThe text was updated successfully, but these errors were encountered: