Skip to content

Commit 75e5770

Browse files
VectorizedAmxx
andauthored
Update contracts/proxy/Clones.sol
Co-authored-by: Hadrien Croubois <hadrien.croubois@gmail.com>
1 parent 29d68b3 commit 75e5770

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

contracts/proxy/Clones.sol

+5-6
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,11 @@ library Clones {
2525
function clone(address implementation) internal returns (address instance) {
2626
/// @solidity memory-safe-assembly
2727
assembly {
28-
// Cleans the upper 96 bits of the `implementation` word, then packs the first 3 bytes
29-
// of the `implementation` address with the bytecode before the address.
30-
mstore(0x00, or(0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000, shr(0xe8, shl(0x60, implementation))))
31-
// Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
32-
mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
33-
instance := create(0, 0x09, 0x37)
28+
// Packs the size 3 bytes of `implementation` with the bytecode before the address.
29+
mstore(0x00, or(shr(0x88, implementation), 0x3d602d80600a3d3981f3363d3d373d3d3d363d73000000))
30+
// Packs the remaining 17 bytes of `implementation` with the bytecode after the address.
31+
mstore(0x20, or(shl(0x78, implementation), 0x5af43d82803e903d91602b57fd5bf3))
32+
instance := create(0, 0x00, 0x37)
3433
}
3534
require(instance != address(0), "ERC1167: create failed");
3635
}

0 commit comments

Comments
 (0)