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

Getters for stream struct members #31

Merged
merged 2 commits into from
Jun 13, 2022
Merged

Getters for stream struct members #31

merged 2 commits into from
Jun 13, 2022

Conversation

PaulRBerg
Copy link
Member

Adds 7 new getters in the ISablierV2 interface:

  1. getDepositAmount
  2. getRecipient
  3. getReturnableAmount
  4. getSender
  5. getStartTime
  6. getStopTime
  7. isCancelable

These getters make it easier for third-party devs and integrating partners to read data from Sablier.

See related discussion in #25

@razgraf
Copy link
Member

razgraf commented Jun 9, 2022

This will be amazing for the lite version of the app or any utility that relies on multicall architecture for data querying (not middleware like the graph). Especially from a DX (dev experience) perspective.

One suggestion would be to build a "data aggregation contract" that includes all these extra methods. The core might not need complex interfaces for its logic, so we could just move them in a separate contract as utilities. Might also save us gas on deployments.

A thing to keep in mind: we should also measure the gas consumption of these read methods. RPC nodes have a "read-only" gas limit which might break multicall. This is a research task but I wanna find out what this limit is and then figure out how many stream interfaces we can "multicall" at once.

@PaulRBerg
Copy link
Member Author

One suggestion would be to build a "data aggregation contract" that includes all these extra methods

Great idea!

The core might not need complex interfaces for its logic, so we could just move them in a separate contract as utilities.

Yes we should move this to a v2-periphery repo once we create that. For the moment though I'd keep the logic in this repo in the main branch, it'd be easier to maintain it that way rather than creating a dedicated branch for it (that branch may become stale).

Might also save us gas on deployments.

Yes, indeed!

@andreivladbrg
Copy link
Member

Excellent suggestions from both of you.

docs: document return variable in natspec for "getAuthorization"
docs: improve wording in natspec comments
docs: specify the amount units in the natspec comments
test: remove "amount" suffix in authorization test trees
test: speed up array "assertEq" functions by adding "unchecked"
docs: document "getStream" function in all contracts
@andreivladbrg
Copy link
Member

andreivladbrg commented Jun 12, 2022

One suggestion would be to build a "data aggregation contract" that includes all these extra methods

Great idea!

The core might not need complex interfaces for its logic, so we could just move them in a separate contract as utilities.

Yes we should move this to a v2-periphery repo once we create that. For the moment though I'd keep the logic in this repo in the main branch, it'd be easier to maintain it that way rather than creating a dedicated branch for it (that branch may become stale).

Might also save us gas on deployments.

Yes, indeed!

I wouldn't merge it to main branch, there will be a lot of extra code. I don't think there is something to maintain, they're just getters functions.

About the code you've written I have nothing to say. Waiting for the special pro functions getSegmentAmounts, getSegmentExponents and getSegmentMilestones.

@PaulRBerg
Copy link
Member Author

I wouldn't merge it to main branch, there will be a lot of extra code. I don't think there is something to maintain, they're just getters functions.

Well they're not just that, they're a holistic part of the repository. E.g. if we implement #29, we should also rename the test contracts for the getters.

Waiting for the special pro functions getSegmentAmounts, getSegmentExponents and getSegmentMilestones.

You can leave a comment about that in #34.

Copy link
Member

@andreivladbrg andreivladbrg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM

@PaulRBerg PaulRBerg merged commit 5331ac4 into main Jun 13, 2022
@PaulRBerg PaulRBerg deleted the feat/getters branch June 13, 2022 10:46
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

Successfully merging this pull request may close these issues.

3 participants