diff --git a/.gas-snapshot b/.gas-snapshot index 2ec3392..f34e310 100644 --- a/.gas-snapshot +++ b/.gas-snapshot @@ -1,26 +1,26 @@ -PCSV3PoolLensTest:testFuzz_GetPositions(int24,int24) (runs: 17, μ: 1274402, ~: 1320751) -PCSV3PoolLensTest:test_GetPopulatedTicksInRange() (gas: 495259) -PCSV3PoolLensTest:test_GetPositions() (gas: 1231579) -PCSV3PoolLensTest:test_GetSlots() (gas: 148865) -PCSV3PoolLensTest:test_GetTickBitmap() (gas: 3140056) -PCSV3PositionLensTest:testFuzz_GetPosition(uint256) (runs: 17, μ: 263786, ~: 262928) -PCSV3PositionLensTest:test_AllPositions() (gas: 17634985) -PCSV3PositionLensTest:test_GetFeesOwed() (gas: 2770490) -PCSV3PositionLensTest:test_GetPositions() (gas: 1075793) -PCSV3PositionLensTest:test_GetTotalAmounts() (gas: 2774508) -PCSV3StorageLensTest:testFuzz_extsload(bytes32) (runs: 257, μ: 33505, ~: 33635) -PCSV3StorageLensTest:test_extsload() (gas: 63395) -PCSV3TickLensTest:test_GetPopulatedTicksInRange() (gas: 726747) -PoolLensTest:testFuzz_GetPositions(int24,int24) (runs: 17, μ: 1272927, ~: 1302846) -PoolLensTest:test_GetPopulatedTicksInRange() (gas: 4194371) -PoolLensTest:test_GetPositions() (gas: 1015456) -PoolLensTest:test_GetSlots() (gas: 3455641) -PoolLensTest:test_GetTickBitmap() (gas: 3155317) -PositionLensTest:testFuzz_GetPosition(uint256) (runs: 17, μ: 260687, ~: 260219) -PositionLensTest:test_AllPositions() (gas: 1027910) -PositionLensTest:test_GetFeesOwed() (gas: 2424302) -PositionLensTest:test_GetPositions() (gas: 839875) -PositionLensTest:test_GetTotalAmounts() (gas: 2436715) -StorageLensTest:testFuzz_extsload(bytes32) (runs: 17, μ: 33500, ~: 33635) -StorageLensTest:test_extsload() (gas: 63395) -TickLensTest:test_GetPopulatedTicksInRange() (gas: 10322483) \ No newline at end of file +PCSV3PoolLensTest:testFuzz_GetPositions(int24,int24) (runs: 17, μ: 1392200, ~: 1437447) +PCSV3PoolLensTest:test_GetPopulatedTicksInRange() (gas: 524480) +PCSV3PoolLensTest:test_GetPositions() (gas: 1348279) +PCSV3PoolLensTest:test_GetSlots() (gas: 151189) +PCSV3PoolLensTest:test_GetTickBitmap() (gas: 3370484) +PCSV3PositionLensTest:testFuzz_GetPosition(uint256) (runs: 17, μ: 274996, ~: 275218) +PCSV3PositionLensTest:test_AllPositions() (gas: 19719373) +PCSV3PositionLensTest:test_GetFeesOwed() (gas: 2791103) +PCSV3PositionLensTest:test_GetPositions() (gas: 1176049) +PCSV3PositionLensTest:test_GetTotalAmounts() (gas: 2794460) +PCSV3StorageLensTest:testFuzz_extsload(bytes32) (runs: 257, μ: 33810, ~: 33944) +PCSV3StorageLensTest:test_extsload() (gas: 66675) +PCSV3TickLensTest:test_GetPopulatedTicksInRange() (gas: 793601) +PoolLensTest:testFuzz_GetPositions(int24,int24) (runs: 17, μ: 1389477, ~: 1419421) +PoolLensTest:test_GetPopulatedTicksInRange() (gas: 4524074) +PoolLensTest:test_GetPositions() (gas: 1132031) +PoolLensTest:test_GetSlots() (gas: 3695636) +PoolLensTest:test_GetTickBitmap() (gas: 3385051) +PositionLensTest:testFuzz_GetPosition(uint256) (runs: 17, μ: 271318, ~: 272509) +PositionLensTest:test_AllPositions() (gas: 1137940) +PositionLensTest:test_GetFeesOwed() (gas: 2444915) +PositionLensTest:test_GetPositions() (gas: 940131) +PositionLensTest:test_GetTotalAmounts() (gas: 2456667) +StorageLensTest:testFuzz_extsload(bytes32) (runs: 17, μ: 33820, ~: 33944) +StorageLensTest:test_extsload() (gas: 66675) +TickLensTest:test_GetPopulatedTicksInRange() (gas: 11472791) \ No newline at end of file diff --git a/contracts/EphemeralStorageLens.sol b/contracts/EphemeralStorageLens.sol index bbd3302..f8a0a42 100644 --- a/contracts/EphemeralStorageLens.sol +++ b/contracts/EphemeralStorageLens.sol @@ -15,12 +15,10 @@ contract EphemeralStorageLens { let calldataptr := slots.offset // prettier-ignore for { } 1 { } { - if eq(memptr, end) { - break - } mstore(memptr, sload(calldataload(calldataptr))) memptr := add(memptr, 0x20) calldataptr := add(calldataptr, 0x20) + if iszero(lt(memptr, end)) { break } } return(0, end) } diff --git a/package.json b/package.json index abdb56b..d49f8d7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aperture-lens", - "version": "1.0.0", + "version": "1.0.1", "description": "Contains ephemeral lens contracts that can be called without deployment and their interfaces in various Web3 libraries.", "author": "Aperture Finance ", "license": "Apache-2.0", @@ -42,8 +42,8 @@ "test:hardhat": "hardhat test", "snapshot": "forge snapshot --isolate", "snapshot:diff": "forge snapshot --diff --isolate", - "prettier": "prettier -c {contracts,test}/**/*.sol ./**/*.ts", - "prettier:fix": "prettier -w {contracts,test}/**/*.sol ./**/*.ts", + "prettier": "prettier -c contracts/{*,**/*}.sol test/**/*.sol ./**/*.ts", + "prettier:fix": "prettier -w contracts/{*,**/*}.sol test/**/*.sol ./**/*.ts", "typechain": "hardhat typechain" }, "dependencies": {