Replies: 3 comments 5 replies
-
Interesting idea. I can see why it is useful for the users. We can do it without making any changes to our core contracts. Since the Sablier UI interacts only with the periphery to create all the streams, we can add the following additional logic to it: Click to expand code// Modify {BatchLockup.CreateWithDurationsLL} to include instant unlocked amount
struct CreateWithDurationsLL {
// --- snip ---
uint128 totalAmount;
// --- snip ---
LockupLinear.Durations durations;
Broker broker;
uint128 instantUnlockAmount;
}
// Modify the create functions to handle instant unlocked amount.
function createWithDurationsLL(
ISablierV2LockupLinear lockupLinear,
IERC20 asset,
BatchLockup.CreateWithDurationsLL[] calldata batch
) returns (uint256[] memory streamIds) {
// --- snip ---
// Perform the ERC-20 transfer and approve {SablierV2LockupLinear} to spend the amount of assets.
_handleTransfer(address(lockupLinear), asset, transferAmount);
// --- snip ---
for (i = 0; i < batchSize; ++i) {
// Transfer the instant unlocked assets to the recipient.
if (batch[i].instantUnlockAmount > 0) {
asset.safeTransfer({ to: batch[i].recipient, value: batch[i].instantUnlockAmount });
}
// Create the stream.
streamIds[i] = lockupLinear.createWithDurations(
LockupLinear.CreateWithDurations({
// --- snip ---
totalAmount: batch[i].totalAmount - batch[i].instantUnlockAmount, // deduct instant unlocked amount from total amount
asset: asset,
// --- snip ---
})
);
}
} Also, instead of transferring assets directly from flowchart LR
sender[Sender]
recipient[Recipient]
periphery[(Periphery Contract)]
core[(Core Contract)]
sender -- "total" --> periphery
periphery -- "instant unlocked" --> recipient
periphery -- "(total - instantUnlocked)" --> core
Additionally, this also makes it more gas efficient to create instantly unlocked streams without even going through the core logic at all i.e. when I am in favour of this. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your feedback @smol-ninja @andreivladbrg. It seems to me that you have overcomplicated the implementation? I'm sorry for not being clear in the OP, but my proposal was simply to modify the internals of the Doing so would encapsulate and standardize this behavior across all Sablier streams. There would NOT be two types of stream creations: (i) some which transfer immediately vested funds and (ii) some which don't. There would only be creations that transfer all immediately vested funds. Additionally, this design wouldn't complicate the lookup cost for external integrators building analytics tools because:
|
Beta Was this translation helpful? Give feedback.
-
cc @smol-ninja @andreivladbrg, it looks like you didn't follow up here? |
Beta Was this translation helpful? Give feedback.
-
Idea
There are several cases when streams are created and a portion of the deposit amount is immediately withdrawable:
What if we modified the create stream function to transfer any immediately withdrawable amount to the recipient?
Cost/ Benefit Analysis
Pros:
Cons:
Validation
We have received an explicit feature request for this from CerebrumDAO:
RFC
I'm on the fence. I posted this because I thought it was an interesting idea.
cc @sablier-labs/solidity and @sablier-labs/frontend
Beta Was this translation helpful? Give feedback.
All reactions