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

Resolve Cyclical Dependencies in Contract Deployment Using CREATE3 #106

Closed
kingster-will opened this issue Apr 15, 2024 · 0 comments · Fixed by #124
Closed

Resolve Cyclical Dependencies in Contract Deployment Using CREATE3 #106

kingster-will opened this issue Apr 15, 2024 · 0 comments · Fixed by #124
Assignees

Comments

@kingster-will
Copy link

Issue Description

We are currently facing challenges with cyclical dependencies among our smart contracts. The ideal approach to address this issue would be to pass the dependent contract addresses directly to the constructors during deployment, allowing us to store these addresses as immutable state variables. However, due to the existing cyclical dependencies, this straightforward approach is not feasible with our current deployment method.

Proposed Solution

To resolve the cyclical dependencies during the deployment of our smart contracts, it is proposed to utilize CREATE3. CREATE3 allows for deploying contracts to deterministic addresses using only a salt. This method would enable us to:

  • Deploy all contracts with cyclical dependencies to known, deterministic addresses.
  • Directly pass these addresses to constructors, thereby storing them as immutable variables within the contract.
  • Remove the need for governance functions previously used to set these addresses, thereby simplifying our protocol.

Benefits

  • Immutable Storage: By deploying using CREATE3, the addresses of dependent contracts can be hardcoded as immutable
  • Simplification of Protocol: Eliminates the need for governance actions to set contract addresses post-deployment, which simplifies interaction and reduces potential errors.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants