Skip to content

Commit 5c941d4

Browse files
check that all used EVC addresses are the same
1 parent cc0bfcf commit 5c941d4

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

TODO

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@
99
* ConstantSum: incorporate price multipliers in quote methods
1010
* natspec
1111
* permit2 instead of regular approval: measure gas savings
12-
* in constructor, check the two vaults have the correct EVC() return value
13-
* maybe even that they were created by the EVK factory?
1412
? a really small swap could fail because deposit() results in 0 shares, which EVK fails on. call convertToShares() first? Seems like overkill
1513
? pause guardian
1614
? how should aggregators find instances

src/MaglevBase.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ abstract contract MaglevBase is IMaglevBase, EVCUtil {
2727
error BadFee();
2828
error InsufficientReserves();
2929
error InsufficientCash();
30+
error DifferentEVC();
3031

3132
modifier nonReentrant() {
3233
require(locked == 0, Locked());
@@ -48,6 +49,10 @@ abstract contract MaglevBase is IMaglevBase, EVCUtil {
4849
constructor(BaseParams memory params) EVCUtil(params.evc) {
4950
require(params.fee < 1e18, BadFee());
5051

52+
address vault0Evc = IEVault(params.vault0).EVC();
53+
require(vault0Evc == IEVault(params.vault1).EVC(), DifferentEVC());
54+
require(vault0Evc == params.evc, DifferentEVC());
55+
5156
vault0 = params.vault0;
5257
vault1 = params.vault1;
5358
asset0 = IEVault(vault0).asset();

0 commit comments

Comments
 (0)