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

Implement a "getStreamedAmount" function #255

Closed
PaulRBerg opened this issue Jan 7, 2023 · 3 comments
Closed

Implement a "getStreamedAmount" function #255

PaulRBerg opened this issue Jan 7, 2023 · 3 comments
Assignees

Comments

@PaulRBerg
Copy link
Member

The idea is to take the getWithdrawableAmount function and rename it to getStreamedAmount, and then write up a new getWithdrawableAmount that simply calls getStreamedAmount and subtracts the withdrawn amount.

Benefits:

  1. Consistency with the marketing approach. We're marketing ourselves as a streaming protocol, yet we don't have any function that returns the amount streamed so far.
  2. Solve the naming issues discussed in Idea to rename "getWithdrawableAmount" to "getRecipientAmount", and "getReturnableAmount" to "getSenderAmount" #227 (at least in part)
  3. We would be able to simplify the implementation for the getReturnableAmount function, since we could call getStreamedAmount instead of getWithdrawableAmount, and not subtract the withdrawn amount. This should save a little bit of gas.

Obviously, there's a contract size concern regarding SablierV2Pro. Thus, if we implement the proposal herein, we may have to move the _calculateWithdrawableAmountForMultipleSegments and the _calculateWithdrawableAmountForOneSegment functions in the Helpers library - but, as discussed in #220, I was open to this anyway.

@andreivladbrg
Copy link
Member

Like this idea.

This is also how I implemented the functions in the payroll contract.

@PaulRBerg
Copy link
Member Author

Glad to hear that you like it! I implemented this in #266.

@PaulRBerg
Copy link
Member Author

Closed via #266.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants