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

Move shared utilities to separate repository #1125

Open
6 tasks
PaulRBerg opened this issue Dec 21, 2024 · 6 comments
Open
6 tasks

Move shared utilities to separate repository #1125

PaulRBerg opened this issue Dec 21, 2024 · 6 comments
Assignees
Labels
effort: epic Multi-stage task that may require multiple PRs. priority: 2 We will do our best to deal with this. type: refactor Change that neither fixes a bug nor adds a feature. work: complicated Sense-analyze-respond. The relationship between cause and effect requires analysis or expertise.

Comments

@PaulRBerg
Copy link
Member

PaulRBerg commented Dec 21, 2024

As discussed here.

The task is to move the following logic to a separate @sablier/solidity-utils package/ repo (name TBD):

@PaulRBerg PaulRBerg added effort: epic Multi-stage task that may require multiple PRs. priority: 2 We will do our best to deal with this. type: refactor Change that neither fixes a bug nor adds a feature. work: complicated Sense-analyze-respond. The relationship between cause and effect requires analysis or expertise. labels Dec 21, 2024
@PaulRBerg
Copy link
Member Author

PaulRBerg commented Jan 6, 2025

Idea: create an abstract contract that implements the collectFee logic that is currently duplicated across the Lockup and Flow repos.

@andreivladbrg
Copy link
Member

Similar to your idea, we could also:

  1. Add a contract that inherits ERC721 and implements the _update function. (it would require a virtual function isTransferable)
  2. Declare the MAX_BROKER_FEE and nextStreamId.

Though I don't have a strong opinion about these, I am not sure where we should draw the line on what to move there or not. 🤔

@smol-ninja
Copy link
Member

The contracts mentioned in the OP are already abstract contracts. So moving them to the Utilities repo sounded like a good plan. On the other hand, _update, MAX_BROKER_FEE, and nextStreamId are contract-specific functions and variables, and we should keep them where they belong.

collectFee technically is a part of admin-related functions, so it makes sense to move it to a new abstract contract, along with other admin-related functions if there are any.

@andreivladbrg
Copy link
Member

The contracts mentioned in the OP are already abstract contracts. So moving them to the Utilities repo sounded like a good plan. On the other hand, _update, MAX_BROKER_FEE, and nextStreamId are contract-specific functions and variables, and we should keep them where they belong

I could argue that _update function is a part of the abstract ERC721 contract.

collectFee technically is a part of admin-related functions, so it makes sense to move it to a new abstract contract, along with other admin-related functions if there are any

the transfer is made to the admin address, is not necessarily callable only by him

@smol-ninja
Copy link
Member

I could argue that _update function is a part of the abstract ERC721 contract.

Yes it is but so what?

Another argument against it is that it is not necessary that Flow and Lockup will share the same requirements for the implementation of _update. For example, see this discussion which would have required a different implementation in Lockup.

The contracts in Utilities should be very generic and should not depend on protocol specific requirements.

the transfer is made to the admin address, is not necessarily callable only by him

Fair point.

@andreivladbrg
Copy link
Member

Another argument against it is that it is not necessary that Flow and Lockup will share the same requirements for the implementation of _update. For example, see this discussion which would have required a different implementation in Lockup

good point

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort: epic Multi-stage task that may require multiple PRs. priority: 2 We will do our best to deal with this. type: refactor Change that neither fixes a bug nor adds a feature. work: complicated Sense-analyze-respond. The relationship between cause and effect requires analysis or expertise.
Projects
Status: No status
Development

No branches or pull requests

3 participants