Skip to content
This repository has been archived by the owner on Aug 9, 2021. It is now read-only.

Improve the inheritance architecture of the contracts by using overriding public variables #33

Closed
clemlak opened this issue Apr 2, 2021 · 1 comment
Assignees
Labels
enhancement Improvement for an existing feature or system

Comments

@clemlak
Copy link
Contributor

clemlak commented Apr 2, 2021

While studying Uniswap v3, I've recently discovered that public variables can override a constant function defined in an interface. For example, the function token0() defined here in the IUniswapV3PoolImmutables.sol interface is then overridden by the public variable token0 defined here in the child contract UniswapV3Pool.

This means that our current inheritance architecture could be improved by changing our current flow from:

Storage (abstract contract) -> Interface (abstract contract) -> Logic (contract)

to:

Interface (interface) -> Storage (abstract contract) -> Logic (contract)

Additionally, all the struct and enum types will have to be defined directly into the interface.

I think this change would make the architecture simpler and more logic.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement Improvement for an existing feature or system
Projects
None yet
Development

No branches or pull requests

2 participants