sablier-labs / v2-periphery

🎛 Peripheral smart contracts for interacting with Sablier V2
https://docs.sablier.com
GNU General Public License v3.0
24 stars 7 forks source link

Contract for batch creating streams without proxy #168

Closed PaulRBerg closed 1 year ago

PaulRBerg commented 1 year ago

Problem

As discussed here, it is not possible to abstract away the proxy deployment in the UI because the proxy owner is an immutable variable in PRBProxy:

https://github.com/PaulRBerg/prb-proxy/blob/84ae9671d64023c0c21316392e11e33a2eaa2511/src/PRBProxy.sol#L27

Immutable variables don't exist during construction, so any attempt to read the owner when using deployAndExecute will revert.

Solution

Implement a contract that can batch-create streams without relying on the proxy.

andreivladbrg commented 1 year ago

Given that we fixed the proxy abstraction with SablierV2ProxyTargetPush, can we close this issue? @PaulRBerg

PaulRBerg commented 1 year ago

No, @andreivladbrg. We still want to implement this contract to make the integration easier for those users not interested in the proxy architecture (or for whom the proxy deployment would be a chore).

andreivladbrg commented 1 year ago

Ok, should it be a push system or a classic pull?

What license should it have?

PaulRBerg commented 1 year ago

It has to be a classic pull because the batch contract would be the same contract for all users. The push model works only when the user is in control of the contract (as is the case with PRBProxies).

The license: GPL-3.0-or-later.

andreivladbrg commented 1 year ago

The push model works only when the user is in control of the contract

Yeah, wanted to make sure in case I was missing something out.

andreivladbrg commented 1 year ago

I currently wrote the following implementation: https://github.com/sablier-labs/v2-periphery/tree/feat/batch-create

I feel the naming might be a bit repetitive(contract + functions). Especially when:

https://github.com/sablier-labs/v2-periphery/blob/ec58ee142ed2650e063e76b5fee89b7d865fdee9/test/integration/batch-create/batch-create-with-durations/batchCreateWithDurations.t.sol#L41

I was thinking of renaming all functions and contract name like this but I think it would be misleading:

@PaulRBerg What do you think? Should we keep it as it is, or do you have better suggestions?

PaulRBerg commented 1 year ago

SablierV2Batch is cool.

And removing the batch prefix from all those functions is cool, too.