Should we move the checks from the "createInternal" to the "create" function? #98
Replies: 2 comments
-
Sorry, I don't understand this proposal. You know that the batch contracts (which, for the sake of completeness, will be a PRBProxy-powered target contract) cannot call the internal functions of the SablierV2 contracts, right? In general, no contract A can access the internal functions of another contract B, unless A inherits from B. Though you have implicitly asked a good question by creation this discussion: How should we implement the target contract in such a way that it is possible to batch-create streams without reverting the entire tx if a subset of the streams failed to be created? I have opened a discussion for that: https://github.com/sablierhq/v2-core/discussions/100 |
Beta Was this translation helpful? Give feedback.
-
Locking since there was a misconception in the original proposal. I have extracted the good out of this post in a separate discussion #100. |
Beta Was this translation helpful? Give feedback.
-
The way how it works now is like this: the UI calls the external create function and it calls an internal function
createInternal
which has all the logic.Knowing that we plan to create a periphery that will implement a stream batch with a non blocking behaviour (if one fails it will not influence the others), I suggest to move all the logic that checks the stream creation requirements from the internal function to the external function to have a non reverting function. This way will be more efficient because it will not check twice for the requirements on batch.
I think the best solution for the batch contracts would be to have a method
checkRequirements
which returns true/false, and if it returnstrue
it will call the internal function from the core contracts.Beta Was this translation helpful? Give feedback.
All reactions