Skip to content

Commit 59a0f83

Browse files
committed
combining eulerAccount with salt is no longer necessary
1 parent e093dee commit 59a0f83

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/EulerSwapFactory.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ contract EulerSwapFactory is IEulerSwapFactory, EVCUtil, ProtocolFee {
6262

6363
EulerSwap pool = EulerSwap(
6464
MetaProxyDeployer.deployMetaProxy(
65-
eulerSwapImpl, abi.encode(params), keccak256(abi.encode(params.eulerAccount, salt))
65+
eulerSwapImpl, abi.encode(params), salt
6666
)
6767
);
6868

@@ -91,7 +91,7 @@ contract EulerSwapFactory is IEulerSwapFactory, EVCUtil, ProtocolFee {
9191
abi.encodePacked(
9292
bytes1(0xff),
9393
address(this),
94-
keccak256(abi.encode(poolParams.eulerAccount, salt)),
94+
salt,
9595
keccak256(MetaProxyDeployer.creationCodeMetaProxy(eulerSwapImpl, abi.encode(poolParams)))
9696
)
9797
)

test/FactoryTest.t.sol

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ contract FactoryTest is EulerSwapTestBase {
5353
(hookAddress, salt) = HookMiner.find(address(eulerSwapFactory), holder, flags, creationCode);
5454
}
5555

56+
function testDifferingAddressesSameSalt() public view {
57+
(IEulerSwap.Params memory poolParams,) = getBasicParams();
58+
59+
address a1 = eulerSwapFactory.computePoolAddress(poolParams, bytes32(0));
60+
61+
poolParams.eulerAccount = address(123);
62+
63+
address a2 = eulerSwapFactory.computePoolAddress(poolParams, bytes32(0));
64+
65+
assert(a1 != a2);
66+
}
67+
5668
function testDeployPool() public {
5769
uint256 allPoolsLengthBefore = eulerSwapFactory.poolsLength();
5870

test/utils/HookMiner.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ library HookMiner {
5353
uint256(
5454
keccak256(
5555
abi.encodePacked(
56-
bytes1(0xFF), deployer, keccak256(abi.encode(account, salt)), keccak256(creationCode)
56+
bytes1(0xFF), deployer, salt, keccak256(creationCode)
5757
)
5858
)
5959
)

0 commit comments

Comments
 (0)