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

current BaseHook implementation makes hooks hard to combine #91

Open
ferencdg opened this issue Jan 2, 2024 · 2 comments
Open

current BaseHook implementation makes hooks hard to combine #91

ferencdg opened this issue Jan 2, 2024 · 2 comments

Comments

@ferencdg
Copy link

ferencdg commented Jan 2, 2024

Component

Pool Interaction, Hooks

Describe the suggested feature and problem it solves.

I have two hooks:
HookA, HookB and both of them derives from BaseHook and also initialize BaseHook. Now I want to create ComboHook which derives from HookA and HookB, however solidity complains that BaseHook is initialized twice (through HookA and HookB).

Describe the desired implementation.

Maybe make the BaseHook stateless and move out the _poolManager to the actual hook? Or just leave _poolManager in the BaseHook, but don't initialize it in the constructor.

Describe alternatives.

No response

Additional context.

No response

@ferencdg ferencdg changed the title BaseHook makes hook hard to combine current BaseHook implementation makes hooks hard to combine Jan 2, 2024
@ferencdg
Copy link
Author

ferencdg commented Jan 2, 2024

what I meant is this:
ethereum/solidity#4199

@saucepoint
Copy link
Collaborator

inheritance in solidity is pretty ugly so the tradeoffs are really tricky and you tend to end up in the same place again.

I see a world of multi-featured hooks, but I'm uncertain if that'll be achieved by inheriting abstract contracts. Inheriting two hook contracts means you'll need to need resolve and override function collisions

I'm under the impression that library-ifying hook logic (LimitOrder, GeomeanOracle) will provide better devex for building multi-featured hooks

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