-
Notifications
You must be signed in to change notification settings - Fork 2
feat: deterministic clone (ICloneableFactoryV3.cloneDeterministic) #41
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
db0ecb3
feat: deterministic clone (ICloneableFactoryV3.cloneDeterministic)
thedavidmeister 758e616
fix(ci): static one-contract-per-file [3b-attempt]
thedavidmeister 50a3a1f
merge main into deterministic-clone-v3 (adopt generated-pin paradigm)
thedavidmeister 8a0a840
feat(pins): generate 0.1.4 deploy pin for deterministic-clone bytecode
thedavidmeister f6976d5
ci: re-run prod-pin test after on-chain deploy
thedavidmeister 0913ba9
feat!: remove non-deterministic clone(), deterministic clones only
thedavidmeister 0681ca1
ci: re-run prod-pin test after deterministic-only deploy
thedavidmeister 25261a2
docs: update CLAUDE.md for deterministic-only CloneFactory
thedavidmeister 9ce8bd8
docs: fix stale CLAUDE.md (soldeer deps, 5 networks, test path)
thedavidmeister 9e3712c
perf: compute effective salt in scratch space (no abi.encode alloc)
thedavidmeister da180f8
chore(release): move deterministic clone to 0.1.5 (append-only snapsh…
thedavidmeister c3d7b84
ci: re-run prod-pin test after 0.1.5 deploy
thedavidmeister 04328c2
feat: NewClone carries salt + init data (self-describing deterministi…
thedavidmeister 7263403
ci: re-run prod-pin test after NewClone(salt,data) deploy
thedavidmeister f8785d2
docs: fix license name — DCL is DecentraLicense, not Dark Matter Council
thedavidmeister File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| // SPDX-License-Identifier: LicenseRef-DCL-1.0 | ||
| // SPDX-FileCopyrightText: Copyright (c) 2020 Rain Open Source Software Ltd | ||
| pragma solidity ^0.8.18; | ||
|
|
||
| import {ICloneableFactoryV2} from "./ICloneableFactoryV2.sol"; | ||
|
|
||
| /// @title ICloneableFactoryV3 | ||
| /// @notice Extends `ICloneableFactoryV2` with a deterministic clone whose address | ||
| /// is pre-computable. `clone` (inherited) deploys via `CREATE`, so the address is | ||
| /// nonce-dependent and only knowable after the fact; `cloneDeterministic` deploys | ||
| /// via `CREATE2`, so the address is a pure function of `(implementation, salt, | ||
| /// caller, factory)` and can be computed — and pinned — before deploying. | ||
| /// | ||
| /// Cross-network determinism is inherited from the factory: when the factory is | ||
| /// itself deployed at the same address on every chain (a Zoltu deterministic | ||
| /// deploy), a `cloneDeterministic` address is identical on every chain for the | ||
| /// same caller, implementation and salt. | ||
| interface ICloneableFactoryV3 is ICloneableFactoryV2 { | ||
| /// Deterministic variant of `clone`: deploys the EIP-1167 proxy via `CREATE2`. | ||
| /// The factory MUST namespace `salt` by `msg.sender` before deriving the | ||
| /// `CREATE2` salt, so a caller's `(implementation, salt)` address cannot be | ||
| /// squatted or front-run by another account. Distinct salts from one caller | ||
| /// yield distinct clones of the same implementation (many clones per impl). | ||
| /// | ||
| /// Same `initialize`/`NewClone` contract as `clone`: MUST emit `NewClone` and | ||
| /// MUST only succeed if `ICloneableV2.initialize` returns | ||
| /// `keccak256("ICloneableV2.initialize")`. | ||
| /// | ||
| /// @param implementation The contract to clone. | ||
| /// @param data As per `ICloneableV2`. | ||
| /// @param salt Caller-chosen salt; distinct salts yield distinct clones. | ||
| /// @return New child contract address. | ||
| function cloneDeterministic(address implementation, bytes calldata data, bytes32 salt) external returns (address); | ||
|
|
||
| /// The address `cloneDeterministic(implementation, _, salt)` deploys to when | ||
| /// called by `deployer`. A pure function of its inputs and this factory, so it | ||
| /// is computable (and pinnable) before deploying, and identical on every chain | ||
| /// this factory exists at the same address on. | ||
| /// @param implementation The contract to clone. | ||
| /// @param salt The caller-chosen salt. | ||
| /// @param deployer The account that will call `cloneDeterministic`. | ||
| /// @return The predicted clone address. | ||
| function predictDeterministicAddress(address implementation, bytes32 salt, address deployer) | ||
| external | ||
| view | ||
| returns (address); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.