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

Support for Diamond-like contract patterns #815

Open
alcuadrado opened this issue Sep 23, 2024 · 1 comment
Open

Support for Diamond-like contract patterns #815

alcuadrado opened this issue Sep 23, 2024 · 1 comment
Assignees
Labels
type:feature Fetaure request

Comments

@alcuadrado
Copy link
Member

alcuadrado commented Sep 23, 2024

Describe the feature

Some contracts use a pattern similar to an upgradeable proxy, but where the implementation doesn't exist in a single contract but in multiple contracts instead. One of the reasons for doing this is to avoid the contract size limit.

The most well-known pattern that does this is the Diamond pattern, but there are systems with their implementation of something similar (e.g., The Graph and Synthetix).

You can now deploy such a system with Ignition, but you can't express a contractAt that combines all the different implementations.

I think this snippet illustrates the problem:

const proxy = m.contract('DiamondLikeProxy');
const implementation1 = m.contract('Implementation1');
const implementation2 = m.contract('Implementation2');

// Somehow set the implementations

const proxyWithCombinedAbi = m.contractAt(?????, proxy) // Which contract name do we use?

As a workaround, you can do multiple contractAts, depending on how you need to interact with the contact, but that's really inconvenient.

Search terms

modules, diamond, proxy

@alcuadrado
Copy link
Member Author

Note that the main thing here would be combining the ABIs of the different implementations.

We'd also need to validate that that combination is safe.

@kanej kanej moved this to Todo in Hardhat Ignition Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature Fetaure request
Projects
Status: Todo
Development

No branches or pull requests

2 participants