Skip to content

Commit dd6ca5e

Browse files
committed
test: change expect
1 parent 17ba62d commit dd6ca5e

File tree

6 files changed

+18
-16
lines changed

6 files changed

+18
-16
lines changed

script/optimized-deployer-meta

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"constant_product_hash": "0xe174de1f7ab5f7c871f23787d956a8d1b4ebbb3b195eb2d6af27fb3a8c9e812e",
33
"factory_hash": "0x87b0f73fafcf4bb41e013c8423dc679f6885527007d6c3f1e1834a670cbaadc5",
4-
"stable_hash": "0x37118cc4f3b41471e6e52968fd506b80bbb1395764db8498cb3f4c4cfb8ab35c"
4+
"stable_hash": "0x3ae886aee24fa2cc0144d24306033a7ed47e91bc0f962e4bffcef5922ae175f5"
55
}

src/ReservoirDeployer.sol

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ contract ReservoirDeployer {
1717
error DeployFactoryFailed();
1818
error ConstantProductHash();
1919
error StableHash();
20+
error Threshold();
21+
error NotOwner();
2022

2123
// Steps.
2224
uint256 public constant TERMINAL_STEP = 3;
@@ -26,7 +28,7 @@ contract ReservoirDeployer {
2628
bytes32 public constant FACTORY_HASH = bytes32(0x87b0f73fafcf4bb41e013c8423dc679f6885527007d6c3f1e1834a670cbaadc5);
2729
bytes32 public constant CONSTANT_PRODUCT_HASH =
2830
bytes32(0xe174de1f7ab5f7c871f23787d956a8d1b4ebbb3b195eb2d6af27fb3a8c9e812e);
29-
bytes32 public constant STABLE_HASH = bytes32(0x37118cc4f3b41471e6e52968fd506b80bbb1395764db8498cb3f4c4cfb8ab35c);
31+
bytes32 public constant STABLE_HASH = bytes32(0x3ae886aee24fa2cc0144d24306033a7ed47e91bc0f962e4bffcef5922ae175f5);
3032

3133
// Deployment addresses.
3234
GenericFactory public factory;
@@ -129,7 +131,7 @@ contract ReservoirDeployer {
129131
uint256 lGuardian3Support = proposals[guardian3][msg.sender];
130132

131133
uint256 lSupport = lGuardian1Support + lGuardian2Support + lGuardian3Support;
132-
require(lSupport >= GUARDIAN_THRESHOLD, "DEPLOYER: THRESHOLD");
134+
require(lSupport >= GUARDIAN_THRESHOLD, Threshold());
133135

134136
owner = msg.sender;
135137
}
@@ -141,7 +143,7 @@ contract ReservoirDeployer {
141143
address public owner = address(0);
142144

143145
modifier onlyOwner() {
144-
require(msg.sender == owner, "DEPLOYER: NOT_OWNER");
146+
require(msg.sender == owner, NotOwner());
145147
_;
146148
}
147149

src/libraries/StableOracleMath.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ library StableOracleMath {
6161
// dy = a.x.y.2 + a.x^2 - b.x
6262
uint256 derivativeY = axy2 + ((a * reserve0).mulWad(reserve0)) - (b.mulWad(reserve0));
6363

64-
// if (derivativeY == 0 || derivativeX == 0) {
65-
// return 1e18;
66-
// }
64+
if (derivativeY == 0 || derivativeX == 0) {
65+
return 1e18;
66+
}
6767

6868
// The rounding direction is irrelevant as we're about to introduce a much larger error when converting to log
6969
// space. We use `divWadUp` as it prevents the result from being zero, which would make the logarithm revert. A

test/unit/GenericFactory.t.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ contract GenericFactoryTest is BaseTest {
2424
uint256 lCurveId = bound(aCurveId, 0, 1);
2525

2626
// act & assert
27-
vm.expectRevert("_factory.DeployFailed.selector");
27+
vm.expectRevert(GenericFactory.DeployFailed.selector);
2828
_createPair(address(_tokenE), address(_tokenA), lCurveId);
2929
}
3030

@@ -33,7 +33,7 @@ contract GenericFactoryTest is BaseTest {
3333
uint256 lCurveId = bound(aCurveId, 0, 1);
3434

3535
// act & assert
36-
// vm.expectRevert(_factory.ZeroAddress.selector);
36+
vm.expectRevert(GenericFactory.ZeroAddress.selector);
3737
_createPair(address(0), address(_tokenA), lCurveId);
3838
}
3939

@@ -51,7 +51,7 @@ contract GenericFactoryTest is BaseTest {
5151
uint256 lCurveId = bound(aCurveId, 0, 1);
5252

5353
// act & assert
54-
vm.expectRevert("_factory.IdenticalAddresses.selector");
54+
vm.expectRevert(GenericFactory.IdenticalAddresses.selector);
5555
_createPair(address(_tokenD), address(_tokenD), lCurveId);
5656
}
5757

@@ -60,7 +60,7 @@ contract GenericFactoryTest is BaseTest {
6060
uint256 lCurveId = bound(aCurveId, 0, 1);
6161

6262
// act & assert
63-
vm.expectRevert("PairExists()");
63+
vm.expectRevert(GenericFactory.PairExists.selector);
6464
_createPair(address(_tokenA), address(_tokenB), lCurveId);
6565
}
6666

test/unit/ReservoirTimelock.t.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ contract ReservoirTimelockTest is BaseTest {
4141
function testSetCustomSwapFee_NotAdmin() external allPairs {
4242
// act & assert
4343
vm.prank(_alice);
44-
vm.expectRevert(_timelock.Unauthorized.selector);
44+
vm.expectRevert(ReservoirTimelock.Unauthorized.selector);
4545
_timelock.setCustomSwapFee(_factory, address(_pair), 500);
4646
}
4747

@@ -60,7 +60,7 @@ contract ReservoirTimelockTest is BaseTest {
6060
function testSetCustomPlatformFee_NotAdmin() external allPairs {
6161
// act & assert
6262
vm.prank(_alice);
63-
vm.expectRevert(_timelock.Unauthorizedselector);
63+
vm.expectRevert(ReservoirTimelock.Unauthorized.selector);
6464
_timelock.setCustomPlatformFee(_factory, address(_pair), 500);
6565
}
6666

@@ -82,7 +82,7 @@ contract ReservoirTimelockTest is BaseTest {
8282
function testRampA_NotAdmin() external {
8383
// act & assert
8484
vm.prank(_alice);
85-
vm.expectRevert(_timelock.Unauthorized.selector);
85+
vm.expectRevert(ReservoirTimelock.Unauthorized.selector);
8686
_timelock.rampA(_factory, address(_stablePair), 500, 500);
8787
}
8888
}

test/unit/StablePair.t.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ contract StablePairTest is BaseTest {
5454
_factory.write("SP::amplificationCoefficient", StableMath.MIN_A - 1);
5555

5656
// act & assert
57-
vm.expectRevert("_factory.DeployFailed.selector");
57+
vm.expectRevert(GenericFactory.DeployFailed.selector);
5858
_createPair(address(_tokenC), address(_tokenD), 1);
5959
}
6060

@@ -63,7 +63,7 @@ contract StablePairTest is BaseTest {
6363
_factory.write("SP::amplificationCoefficient", StableMath.MAX_A + 1);
6464

6565
// act & assert
66-
vm.expectRevert("_factory.DeployFailed.selector");
66+
vm.expectRevert(GenericFactory.DeployFailed.selector);
6767
_createPair(address(_tokenC), address(_tokenD), 1);
6868
}
6969

0 commit comments

Comments
 (0)