What happens with debt when a stream is canceled? #58
-
Say I have a stream of 1000$/month, I keep it open for 3 months but only fund it with 1000$. At the end of the period, I have 2000$ in debt. What happens when I cancel/stop the payment?
Follow-up questions: based on the answers for the above, should we have utilities like "payDebtAndCancelStream" to be able do do everything in one tx? |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 22 replies
-
In the current design, the sender will be able to cancel. The consequence of not allowing them to cancel when there is a debt is that they can just ignore it. There is an assumption that there will a mutual understanding between the sender and the recipient. One party can, of course, rug another party by not fulfilling his debt obligations.
Yeah, we can. I like the idea. |
Beta Was this translation helpful? Give feedback.
-
great idea @razgraf 🫡 |
Beta Was this translation helpful? Give feedback.
-
@razgraf wanted to hear your opinion on this approach? Should it continue to remain the same or should it not reset debt to 0? |
Beta Was this translation helpful? Give feedback.
-
I like the approach of designing core APIs such that each of them does just one job. i.e. It can make them more composable, easier to implement a new API without re-deploying the core contract. Now to achieve complex interactions such as cancel and refund or restart and deposit, there could be 3 ways (or more):
And I think the 3rd point gives us a really good food for thought. I have shared it before and it was discarded for the following reason:
But I would like to pick it again because I think I agreed easily with what @razgraf pointed out earlier. function batch(bytes[] calldata calls, bool revertOnFail) external payable {
for (uint256 i = 0; i < calls.length; i++) {
(bool success, bytes memory result) = address(this).delegatecall(calls[i]);
if (!success && revertOnFail) {
_getRevertMsg(result);
}
}
}
Can you please explain why would you have to deal with raw bytes directly? In the UI, isn't it possible to use the function named parameters to construct the calls array?
The above function does not make it efficient at all. And yes it acts similarly to The above function is so useful that it wouldn't even require us to deploy periphery contract (until they offer some benefits) and we can absolutely expose any API through the user interface. I would like to hear criticism against this approach again. Tagging @sablier-labs/solidity for comments. FWIW Uniswap also has a similar function. |
Beta Was this translation helpful? Give feedback.
-
To avoid having to read all comments here, could you guys confirm that this discussion has effectively been deprecated in favor of @smol-ninja's proposal to carry forward the debt? If yes, we should close this as outdated. |
Beta Was this translation helpful? Give feedback.
You can refer to the "Table" in this discussion.
To summarize:
pause()
will pause the stream by settingratePerSecond
to zero. It will also store debt accumulated until then. It can only be called by the sender.void()
will also pause the stream but it will setdebt
to zero. It can only be called by the recipient.cc @andreivladbrg.