Skip to content

Commit

Permalink
lint: forge fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
xenide committed Nov 19, 2024
1 parent f220e79 commit 4ae78d4
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion script/BaseScript.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ contract BaseScript is Script {
lInitCode = abi.encodePacked(lInitCode, abi.encode(aGuardian1, aGuardian2, aGuardian3));
address lDeployer = Create2Lib.computeAddress(CREATE2_FACTORY, lInitCode, bytes32(0));
if (lDeployer.code.length == 0) {
_deployer = new ReservoirDeployer{salt: bytes32(0)}(aGuardian1, aGuardian2, aGuardian3);
_deployer = new ReservoirDeployer{ salt: bytes32(0) }(aGuardian1, aGuardian2, aGuardian3);
require(address(_deployer) == lDeployer, "CREATE2 ADDRESS MISMATCH");
require(address(_deployer) != address(0), "DEPLOY FACTORY FAILED");
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/GenericFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ contract GenericFactory is IGenericFactory, Owned {
StableMintBurn public immutable stableMintBurn;

constructor() Owned(msg.sender) {
stableMintBurn = new StableMintBurn{salt: bytes32(0)}();
stableMintBurn = new StableMintBurn{ salt: bytes32(0) }();
}

/*//////////////////////////////////////////////////////////////////////////
Expand Down
2 changes: 1 addition & 1 deletion src/ReservoirPair.sol
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ abstract contract ReservoirPair is IAssetManagedPair, ReservoirERC20 {
//////////////////////////////////////////////////////////////////////////*/

Slot0 internal _slot0 = Slot0({ reserve0: 0, reserve1: 0, packedTimestamp: 0, index: Buffer.SIZE - 1});
Slot0 internal _slot0 = Slot0({ reserve0: 0, reserve1: 0, packedTimestamp: 0, index: Buffer.SIZE - 1 });

function _currentTime() internal view returns (uint32) {
return uint32(block.timestamp & 0x7FFFFFFF);
Expand Down
2 changes: 0 additions & 2 deletions src/structs/Observation.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,13 @@ struct Observation {
int24 logInstantRawPrice;
// natural log (ln) of the clamped instant price
int24 logInstantClampedPrice;

// natural log (ln) of the raw accumulated price (token1/token0)
// in the case of maximum price supported by the oracle (~5.79e58 == e ** 135.3060)
// (1353060) 21 bits multiplied by 32 bits of the timestamp gives 53 bits
// which fits into int88
int88 logAccRawPrice;
// natural log (ln) of the clamped accumulated price (token1/token0)
int88 logAccClampedPrice;

// overflows every 136 years, in the year 2106
uint32 timestamp;
}
2 changes: 1 addition & 1 deletion test/__fixtures/BaseTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ abstract contract BaseTest is Test {
address lDeployer = Create2Lib.computeAddress(address(this), lInitCode, bytes32(0));

if (lDeployer.code.length == 0) {
rDeployer = new ReservoirDeployer{salt: bytes32(0)}(address(this), address(this), address(this));
rDeployer = new ReservoirDeployer{ salt: bytes32(0) }(address(this), address(this), address(this));
require(address(rDeployer) == lDeployer, "CREATE2 ADDRESS MISMATCH");
require(address(rDeployer) != address(0), "DEPLOY FACTORY FAILED");
} else {
Expand Down
2 changes: 1 addition & 1 deletion test/__mocks/ReturnAssetExploit.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ contract ReturnAssetExploit {
}

function attack(IAssetManager aAssetManager) external {
aAssetManager.returnAsset(false, 123555);
aAssetManager.returnAsset(false, 123_555);
}
}
4 changes: 2 additions & 2 deletions test/differential/LogCompression.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ contract LogCompressionTest is Test {
function testToLowResLog_MaxReturnValue() external {
// act & assert this is the maximum input that the function can take
int256 lResLargest = LogCompression.toLowResLog(2 ** 255 - 1);
assertEq(lResLargest, 1353060); // 135.3060
assertEq(lResLargest, 1_353_060); // 135.3060

// once the input exceeds the max input above, it reverts
vm.expectRevert("EM: OUT_OF_BOUNDS");
Expand All @@ -60,7 +60,7 @@ contract LogCompressionTest is Test {
function testToLowResLog_MinReturnValue() external {
// act & assert - this is the smallest input the function takes
int256 lResSmallest = LogCompression.toLowResLog(1);
assertEq(lResSmallest, -414465); // -41.4465
assertEq(lResSmallest, -414_465); // -41.4465

vm.expectRevert("EM: OUT_OF_BOUNDS");
LogCompression.toLowResLog(0);
Expand Down
11 changes: 9 additions & 2 deletions test/integration/Aave.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,13 @@ contract AaveIntegrationTest is BaseTest {
}

function setUp() external {
_networks.push(Network(getChain("avalanche").rpcUrl, 0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E, 0xB7887FED5E2f9dc1A66fBb65f76BA3731d82341A));
_networks.push(
Network(
getChain("avalanche").rpcUrl,
0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E,
0xB7887FED5E2f9dc1A66fBb65f76BA3731d82341A
)
);

vm.makePersistent(address(_tokenA));
vm.makePersistent(address(_tokenB));
Expand Down Expand Up @@ -612,7 +618,8 @@ contract AaveIntegrationTest is BaseTest {
uint256 lReserveUSDCAfter = _pair.token0() == USDC ? lReserve0After : lReserve1After;
assertTrue(
MathUtils.within1(
lNewManagedAmt, lReserveUSDCAfter.divWad(_manager.lowerThreshold() + _manager.upperThreshold()) / 2)
lNewManagedAmt, lReserveUSDCAfter.divWad(_manager.lowerThreshold() + _manager.upperThreshold()) / 2
)
);
}

Expand Down
2 changes: 1 addition & 1 deletion test/unit/StablePair.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1527,7 +1527,7 @@ contract StablePairTest is BaseTest {

// anchor expected values to a hardcoded one
assertApproxEqRel(lSpotPrice1, uint256(2.0226e18), 0.0001e18);
assertApproxEqRel(lSpotPrice2, uint256(10677e18), 0.0001e18);
assertApproxEqRel(lSpotPrice2, uint256(10_677e18), 0.0001e18);

// Price for observation window 0-1
assertApproxEqRel(
Expand Down

0 comments on commit 4ae78d4

Please sign in to comment.