Skip to content
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

Return amount in cancel and withdraw functions #1130

Open
4 tasks
smol-ninja opened this issue Dec 25, 2024 · 3 comments
Open
4 tasks

Return amount in cancel and withdraw functions #1130

smol-ninja opened this issue Dec 25, 2024 · 3 comments
Labels
effort: low Easy or tiny task that takes less than a day. priority: 1 This is important. It should be dealt with shortly. type: feature New feature or request. work: clear Sense-categorize-respond. The relationship between cause and effect is clear.

Comments

@smol-ninja
Copy link
Member

smol-ninja commented Dec 25, 2024

While brainstorming https://github.com/sablier-labs/company-discussions/discussions/85, I came to realize that its super useful to return amounts in functions which transfer tokens:

  • cancel
  • cancelMultiple
  • withdrawMax
  • withdrawMaxAndTransfer

Currently, it requires making two calls such as refundableAmountOf followed by cancel.

cc @sablier-labs/solidity in case you have any objection.

@smol-ninja smol-ninja added effort: low Easy or tiny task that takes less than a day. priority: 1 This is important. It should be dealt with shortly. type: feature New feature or request. work: clear Sense-categorize-respond. The relationship between cause and effect is clear. labels Dec 25, 2024
@andreivladbrg
Copy link
Member

Re the withdraw functions, we already have return values for the "Max" functions (which is what matters—this was also added after this finding). As for withdraw and withdrawMultiple, I don’t think it’s relevant, as we already have the amount parameters:

//                            ↓ integrators are already in control of the amount that is being withdrawn
lockup.withdraw(streamId, to, amount);

As for the cancel and cancelMultiple functions, I remember talking about this before, but I can’t find where exactly, so I’m not sure what arguments were raised back then. The question now is: what amount should be returned—the refunded amount to the sender or the recipient’s withdrawable amount? Should we return one, or both?

@smol-ninja
Copy link
Member Author

Agree with your argument with withdraw and withdrawMultiple.

Re. cancel and cancelMultiple, I would suggest to return the amount transferred to the sender. Its the sender who is calling these functions and should be returned the amount transferred to him.

@PaulRBerg
Copy link
Member

Agree with the plan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: low Easy or tiny task that takes less than a day. priority: 1 This is important. It should be dealt with shortly. type: feature New feature or request. work: clear Sense-categorize-respond. The relationship between cause and effect is clear.
Projects
Status: No status
Development

No branches or pull requests

3 participants