Skip to content

Commit

Permalink
test: change expect
Browse files Browse the repository at this point in the history
  • Loading branch information
xenide committed Dec 10, 2024
1 parent 17ba62d commit dd6ca5e
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 16 deletions.
2 changes: 1 addition & 1 deletion script/optimized-deployer-meta
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"constant_product_hash": "0xe174de1f7ab5f7c871f23787d956a8d1b4ebbb3b195eb2d6af27fb3a8c9e812e",
"factory_hash": "0x87b0f73fafcf4bb41e013c8423dc679f6885527007d6c3f1e1834a670cbaadc5",
"stable_hash": "0x37118cc4f3b41471e6e52968fd506b80bbb1395764db8498cb3f4c4cfb8ab35c"
"stable_hash": "0x3ae886aee24fa2cc0144d24306033a7ed47e91bc0f962e4bffcef5922ae175f5"
}
8 changes: 5 additions & 3 deletions src/ReservoirDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ contract ReservoirDeployer {
error DeployFactoryFailed();
error ConstantProductHash();
error StableHash();
error Threshold();
error NotOwner();

// Steps.
uint256 public constant TERMINAL_STEP = 3;
Expand All @@ -26,7 +28,7 @@ contract ReservoirDeployer {
bytes32 public constant FACTORY_HASH = bytes32(0x87b0f73fafcf4bb41e013c8423dc679f6885527007d6c3f1e1834a670cbaadc5);
bytes32 public constant CONSTANT_PRODUCT_HASH =
bytes32(0xe174de1f7ab5f7c871f23787d956a8d1b4ebbb3b195eb2d6af27fb3a8c9e812e);
bytes32 public constant STABLE_HASH = bytes32(0x37118cc4f3b41471e6e52968fd506b80bbb1395764db8498cb3f4c4cfb8ab35c);
bytes32 public constant STABLE_HASH = bytes32(0x3ae886aee24fa2cc0144d24306033a7ed47e91bc0f962e4bffcef5922ae175f5);

// Deployment addresses.
GenericFactory public factory;
Expand Down Expand Up @@ -129,7 +131,7 @@ contract ReservoirDeployer {
uint256 lGuardian3Support = proposals[guardian3][msg.sender];

uint256 lSupport = lGuardian1Support + lGuardian2Support + lGuardian3Support;
require(lSupport >= GUARDIAN_THRESHOLD, "DEPLOYER: THRESHOLD");
require(lSupport >= GUARDIAN_THRESHOLD, Threshold());

owner = msg.sender;
}
Expand All @@ -141,7 +143,7 @@ contract ReservoirDeployer {
address public owner = address(0);

modifier onlyOwner() {
require(msg.sender == owner, "DEPLOYER: NOT_OWNER");
require(msg.sender == owner, NotOwner());
_;
}

Expand Down
6 changes: 3 additions & 3 deletions src/libraries/StableOracleMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ library StableOracleMath {
// dy = a.x.y.2 + a.x^2 - b.x
uint256 derivativeY = axy2 + ((a * reserve0).mulWad(reserve0)) - (b.mulWad(reserve0));

// if (derivativeY == 0 || derivativeX == 0) {
// return 1e18;
// }
if (derivativeY == 0 || derivativeX == 0) {
return 1e18;
}

// The rounding direction is irrelevant as we're about to introduce a much larger error when converting to log
// space. We use `divWadUp` as it prevents the result from being zero, which would make the logarithm revert. A
Expand Down
8 changes: 4 additions & 4 deletions test/unit/GenericFactory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ contract GenericFactoryTest is BaseTest {
uint256 lCurveId = bound(aCurveId, 0, 1);

// act & assert
vm.expectRevert("_factory.DeployFailed.selector");
vm.expectRevert(GenericFactory.DeployFailed.selector);
_createPair(address(_tokenE), address(_tokenA), lCurveId);
}

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

// act & assert
// vm.expectRevert(_factory.ZeroAddress.selector);
vm.expectRevert(GenericFactory.ZeroAddress.selector);
_createPair(address(0), address(_tokenA), lCurveId);
}

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

// act & assert
vm.expectRevert("_factory.IdenticalAddresses.selector");
vm.expectRevert(GenericFactory.IdenticalAddresses.selector);
_createPair(address(_tokenD), address(_tokenD), lCurveId);
}

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

// act & assert
vm.expectRevert("PairExists()");
vm.expectRevert(GenericFactory.PairExists.selector);
_createPair(address(_tokenA), address(_tokenB), lCurveId);
}

Expand Down
6 changes: 3 additions & 3 deletions test/unit/ReservoirTimelock.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ contract ReservoirTimelockTest is BaseTest {
function testSetCustomSwapFee_NotAdmin() external allPairs {
// act & assert
vm.prank(_alice);
vm.expectRevert(_timelock.Unauthorized.selector);
vm.expectRevert(ReservoirTimelock.Unauthorized.selector);
_timelock.setCustomSwapFee(_factory, address(_pair), 500);
}

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

Expand All @@ -82,7 +82,7 @@ contract ReservoirTimelockTest is BaseTest {
function testRampA_NotAdmin() external {
// act & assert
vm.prank(_alice);
vm.expectRevert(_timelock.Unauthorized.selector);
vm.expectRevert(ReservoirTimelock.Unauthorized.selector);
_timelock.rampA(_factory, address(_stablePair), 500, 500);
}
}
4 changes: 2 additions & 2 deletions test/unit/StablePair.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ contract StablePairTest is BaseTest {
_factory.write("SP::amplificationCoefficient", StableMath.MIN_A - 1);

// act & assert
vm.expectRevert("_factory.DeployFailed.selector");
vm.expectRevert(GenericFactory.DeployFailed.selector);
_createPair(address(_tokenC), address(_tokenD), 1);
}

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

// act & assert
vm.expectRevert("_factory.DeployFailed.selector");
vm.expectRevert(GenericFactory.DeployFailed.selector);
_createPair(address(_tokenC), address(_tokenD), 1);
}

Expand Down

0 comments on commit dd6ca5e

Please sign in to comment.