sablier-labs / v2-core

⏳ Core smart contracts of the Sablier V2 token distribution protocol
https://sablier.com
Other
307 stars 43 forks source link

Add return value in withdrawMax and withdrawMaxAndTransfer #955

Closed andreivladbrg closed 3 months ago

andreivladbrg commented 3 months ago

Recommendations made on the latest audit: https://cantina.xyz/code/9566f0dd-9be2-4f02-8135-aed3411902ba/findings/3

Pasting here OP:

Description

withdrawMax and withdrawMaxAndTransfer do not return the withdrawn amount. In light of the need for improved integration with other Defi contracts it would be useful for them to have the withdrawn amount returned so as to not need an upfront call to withdrawableAmountOf in order for internal accounting to be correctly processed. In case Defi projects would stream to recipients the same applies to cancelMultiple and cancel where the amount refunded has to be queried with refundableAmountOf upfront.

Recommendation

Consider returning the withdrawn amount for withdrawMax and withdrawMaxAndTransfer . The other withdraw don't need this as the amounts are specified as input. Also consider returning the refunded amount for cancelMultiple and cancel


@PaulRBerg tagging to ask for objections before starting working on this

PaulRBerg commented 3 months ago

It's a good proposal.