Skip to content

Commit e1ce7a9

Browse files
JMSBPPclaude
andcommitted
feat: add CreateX submodule and initial create facet implementation
- Add createx submodule for deterministic deployments - Add CreateXMod and CreateXFacet source files - Add test scaffolding for CreateX functionality - Document ERC1155 interface issue 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent b26eeba commit e1ce7a9

9 files changed

Lines changed: 61 additions & 0 deletions

File tree

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[submodule "lib/forge-std"]
22
path = lib/forge-std
33
url = https://github.com/foundry-rs/forge-std
4+
[submodule "lib/createx"]
5+
path = lib/createx
6+
url = https://github.com/pcaversaccio/createx

erc1155IncorrectInterfaceIssue.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
2+
Missplaced mappign keys on [ERC1155Mod]() balance of [ERC1155](https://github.com/ethereum/ERCs/blob/8bd6ba5c237b4fa4f6218469794459c445e881e7/ERCS/erc-1155.md?plain=1#L122) not compliant cause [..](BuggyERC1155.sol:L100)
3+
4+
5+
6+
7+
8+

foundry.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
11
{
2+
"lib/createx": {
3+
"tag": {
4+
"name": "v1.0.0",
5+
"rev": "cbac803268835138f86a69bfe01fcf05a50e0447"
6+
}
7+
},
28
"lib/forge-std": {
39
"tag": {
410
"name": "v1.11.0",

lib/createx

Submodule createx added at 87f7998

src/create/CreateXFacet.sol

Whitespace-only changes.

src/create/CreateXMod.sol

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity >=0.8.30;
3+
4+
5+
error FailedContractCreation(address emitter);
6+
error FailedContractInitialisation(address emitter, bytes revertData);
7+
event ContractCreation(address indexed newContract, bytes32 indexed salt);
8+
event ContractCreation(address indexed newContract);
9+
10+
function deployCreateClone(address implementation, bytes memory data) returns (address proxy) {
11+
bytes20 implementationInBytes = bytes20(implementation);
12+
assembly ("memory-safe") {
13+
let clone := mload(0x40)
14+
mstore(
15+
clone,
16+
hex"3d_60_2d_80_60_0a_3d_39_81_f3_36_3d_3d_37_3d_3d_3d_36_3d_73_00_00_00_00_00_00_00_00_00_00_00_00"
17+
)
18+
mstore(add(clone, 0x14), implementationInBytes)
19+
mstore(
20+
add(clone, 0x28),
21+
hex"5a_f4_3d_82_80_3e_90_3d_91_60_2b_57_fd_5b_f3_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00_00"
22+
)
23+
proxy := create(0, clone, 0x37)
24+
}
25+
address delegator;
26+
assembly("memory-safe") {
27+
delegator := address()
28+
}
29+
if (proxy == address(0)) {
30+
31+
revert FailedContractCreation({emitter: delegator});
32+
}
33+
34+
emit ContractCreation({newContract: proxy});
35+
36+
(bool success, bytes memory returnData) = proxy.call{value: msg.value}(data);
37+
{
38+
if (!success || implementation.code.length == 0){
39+
revert FailedContractInitialisation({emitter: delegator, revertData: returnData});
40+
}
41+
}
42+
43+
}

test/create/CreateX.t.sol

Whitespace-only changes.

test/create/CreateXFacet.t.sol

Whitespace-only changes.

test/create/harness/CreateXHarness.sol

Whitespace-only changes.

0 commit comments

Comments
 (0)