Skip to content

Commit d47ea30

Browse files
committed
chore: rename mock to harness and forge fmt
1 parent 823eeac commit d47ea30

File tree

4 files changed

+18
-30
lines changed

4 files changed

+18
-30
lines changed

.gitmodules

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,4 @@
1212
url = https://github.com/euler-xyz/ethereum-vault-connector
1313
[submodule "lib/lib/v4-core"]
1414
path = lib/lib/v4-core
15-
url = https://github.com/Uniswap/v4-core.git
16-
[submodule "lib/v4-core"]
17-
path = lib/v4-core
18-
url = https://github.com/Uniswap/v4-core.git
15+
url = https://github.com/Uniswap/v4-core.git

src/EulerSwapPeriphery.sol

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,5 +243,4 @@ contract EulerSwapPeriphery is IEulerSwapPeriphery {
243243
// Compute and return x = fInverse(y) using the quadratic formula
244244
return Math.mulDiv(uint256(int256(sqrt) - B), 1e18, A, Math.Rounding.Ceil);
245245
}
246-
247246
}

test/EulerSwapPeriphery.t.sol

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,22 @@
22
pragma solidity ^0.8.24;
33

44
import {EulerSwapTestBase, EulerSwap, EulerSwapPeriphery, IEulerSwap} from "./EulerSwapTestBase.t.sol";
5-
import {EulerSwapMock} from "./mocks/EulerSwapMock.sol";
5+
import {EulerSwapHarness} from "./harness/EulerSwapHarness.sol";
66

77
contract EulerSwapPeripheryTest is EulerSwapTestBase {
88
EulerSwap public eulerSwap;
9-
EulerSwapMock public eulerSwapMock;
9+
EulerSwapHarness public eulerSwapHarness;
1010

1111
function setUp() public virtual override {
1212
super.setUp();
1313

1414
eulerSwap = createEulerSwap(50e18, 50e18, 0, 1e18, 1e18, 0.4e18, 0.85e18);
1515

1616
IEulerSwap.Params memory params = getEulerSwapParams(50e18, 50e18, 0.4e18);
17-
IEulerSwap.CurveParams memory curveParams = IEulerSwap.CurveParams({
18-
priceX: 1e18,
19-
priceY: 1e18,
20-
concentrationX: 0.85e18,
21-
concentrationY: 0.85e18
22-
});
23-
24-
eulerSwapMock = new EulerSwapMock(params, curveParams); // Use the mock EulerSwap contract with a public f() function
17+
IEulerSwap.CurveParams memory curveParams =
18+
IEulerSwap.CurveParams({priceX: 1e18, priceY: 1e18, concentrationX: 0.85e18, concentrationY: 0.85e18});
19+
20+
eulerSwapHarness = new EulerSwapHarness(params, curveParams); // Use the mock EulerSwap contract with a public f() function
2521
}
2622

2723
function test_SwapExactIn() public {
@@ -82,9 +78,9 @@ contract EulerSwapPeripheryTest is EulerSwapTestBase {
8278
vm.stopPrank();
8379
}
8480

85-
function test_fInverseFuzz(uint256 x) public {
86-
x = bound(x, 2, 50e18 - 1); // it fails if 1 us used, not an issue since only used in periphery
87-
uint256 y = eulerSwapMock.exposedF(x, 1e18, 1e18, 50e18, 50e18, 0.85e18);
81+
function test_fInverseFuzz(uint256 x) public view {
82+
x = bound(x, 2, 50e18 - 1); // note that it fails if 1 used as minimum, not an issue since only used in periphery
83+
uint256 y = eulerSwapHarness.exposedF(x, 1e18, 1e18, 50e18, 50e18, 0.85e18);
8884
uint256 outX = periphery.fInverse(y, 1e18, 1e18, 50e18, 50e18, 0.85e18);
8985

9086
// Ensure x is within the expected range

test/mocks/EulerSwapMock.sol renamed to test/harness/EulerSwapHarness.sol

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,17 @@ pragma solidity ^0.8.27;
33

44
import {EulerSwap, IEulerSwap} from "../../src/EulerSwap.sol";
55

6-
contract EulerSwapMock is EulerSwap {
7-
8-
constructor(IEulerSwap.Params memory params, IEulerSwap.CurveParams memory curveParams)
9-
EulerSwap(params, curveParams)
6+
contract EulerSwapHarness is EulerSwap {
7+
constructor(IEulerSwap.Params memory params, IEulerSwap.CurveParams memory curveParams)
8+
EulerSwap(params, curveParams)
109
{}
1110

1211
/// @notice Exposes the internal f() function as a public function for testing
13-
function exposedF(
14-
uint256 x,
15-
uint256 px,
16-
uint256 py,
17-
uint256 x0,
18-
uint256 y0,
19-
uint256 c
20-
) external pure returns (uint256) {
12+
function exposedF(uint256 x, uint256 px, uint256 py, uint256 x0, uint256 y0, uint256 c)
13+
external
14+
pure
15+
returns (uint256)
16+
{
2117
return f(x, px, py, x0, y0, c);
2218
}
2319
}

0 commit comments

Comments
 (0)