Skip to content
This repository was archived by the owner on Dec 18, 2025. It is now read-only.
2 changes: 1 addition & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sizes = true
libs = ["node_modules", "lib"]
fs_permissions = [{ access = "read", path = "./config/" }]
gas_limit = "18446744073709551615"
evm_version = "shanghai"
evm_version = "cancun"

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed because Aave v3.5 uses new opcodes

optimizer = true
optimizer_runs = 200

Expand Down
4 changes: 2 additions & 2 deletions test/integration/TestIntegrationBorrow.sol
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ contract TestIntegrationBorrow is IntegrationTest {
assertApproxEqDust(morpho.borrowBalance(market.underlying, onBehalf), amount, "borrow != amount");

// Assert Morpho's position on pool.
assertApproxEqAbs(market.variableBorrowOf(address(morpho)), amount, 2, "morphoVariableBorrow != amount");
assertApproxEqAbs(market.variableBorrowOf(address(morpho)), amount, 3, "morphoVariableBorrow != amount");

// Assert receiver's underlying balance.
assertEq(
Expand Down Expand Up @@ -97,7 +97,7 @@ contract TestIntegrationBorrow is IntegrationTest {
);

// Assert Morpho's position on pool.
assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 2, "morphoVariableBorrow != 0");
assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 3, "morphoVariableBorrow != 0");

// Assert receiver's underlying balance.
assertEq(
Expand Down
7 changes: 7 additions & 0 deletions test/integration/TestIntegrationMorphoGetters.sol
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,11 @@ contract TestIntegrationMorphoGetters is IntegrationTest {
uint256 premiumToProtocol = pool.FLASHLOAN_PREMIUM_TOTAL();
assertEq(premiumToProtocol, premiumTotal, "all premium goes to protocol");
}

function testPoolRevision() public view {
Comment thread
QGarchery marked this conversation as resolved.
(bool success, bytes memory data) = address(pool).staticcall(abi.encodeWithSignature("POOL_REVISION()", hex""));
uint256 fetchedRevision = abi.decode(data, (uint256));
assertTrue(success, "pool revision failed");
assertEq(fetchedRevision, 9, "wrong revision");
}
}
6 changes: 3 additions & 3 deletions test/integration/TestIntegrationPoolLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ contract TestIntegrationPoolLibSupply is TestIntegrationPoolLib {
pool.supplyToPool(dai, amount, pool.getReserveNormalizedIncome(dai));

assertEq(ERC20(dai).balanceOf(address(this)) + amount, balanceBefore, "balance");
assertApproxEqAbs(ERC20(aDai).balanceOf(address(this)), aBalanceBefore + amount, 1, "aBalance");
assertApproxEqAbs(ERC20(aDai).balanceOf(address(this)), aBalanceBefore + amount, 2, "aBalance");
}
}

Expand All @@ -59,7 +59,7 @@ contract TestIntegrationPoolLibBorrow is TestIntegrationPoolLib {
pool.borrowFromPool(dai, amount / 2);

assertEq(ERC20(dai).balanceOf(address(this)), balanceBefore + amount / 2, "balance");
assertApproxEqAbs(ERC20(vDai).balanceOf(address(this)), vBalanceBefore + amount / 2, 1, "vBalance");
assertApproxEqAbs(ERC20(vDai).balanceOf(address(this)), vBalanceBefore + amount / 2, 2, "vBalance");
}
}

Expand All @@ -83,7 +83,7 @@ contract TestIntegrationPoolLibRepay is TestIntegrationPoolLib {
pool.repayToPool(dai, vDai, amount / 4);

assertEq(ERC20(dai).balanceOf(address(this)) + amount / 4, balanceBefore, "balance");
assertApproxEqAbs(ERC20(vDai).balanceOf(address(this)) + amount / 4, vBalanceBefore, 1, "vBalance");
assertApproxEqAbs(ERC20(vDai).balanceOf(address(this)) + amount / 4, vBalanceBefore, 2, "vBalance");
}
}

Expand Down
8 changes: 4 additions & 4 deletions test/integration/TestIntegrationRepay.sol
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ contract TestIntegrationRepay is IntegrationTest {
assertApproxEqAbs(
market.supplyOf(address(morpho)), test.morphoSupplyBefore, 2, "morphoSupply != morphoSupplyBefore"
);
assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 1, "morphoVariableBorrow != 0");
assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 3, "morphoVariableBorrow != 0");

// Assert user's underlying balance.
assertApproxEqAbs(
Expand Down Expand Up @@ -154,7 +154,7 @@ contract TestIntegrationRepay is IntegrationTest {
3,
"morphoSupply != morphoSupplyBefore + promoted"
);
assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 2, "morphoVariableBorrow != 0");
assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 3, "morphoVariableBorrow != 0");

// Assert user's underlying balance.
assertApproxLeAbs(
Expand Down Expand Up @@ -238,7 +238,7 @@ contract TestIntegrationRepay is IntegrationTest {
1,
"morphoSupply != morphoSupplyBefore + supplyGapBefore"
);
assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 1, "morphoVariableBorrow != 0");
assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 2, "morphoVariableBorrow != 0");
assertApproxEqDust(_supplyGap(market), 0, "supplyGapAfter != 0");

// Assert user's underlying balance.
Expand Down Expand Up @@ -325,7 +325,7 @@ contract TestIntegrationRepay is IntegrationTest {
assertApproxEqAbs(
morphoSupply, test.morphoSupplyBefore + test.borrowed, 2, "morphoSupply != morphoSupplyBefore + borrowed"
);
assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 1, "morphoVariableBorrow != 0");
assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 2, "morphoVariableBorrow != 0");

// Assert user's underlying balance.
assertApproxEqAbs(
Expand Down
6 changes: 3 additions & 3 deletions test/integration/TestIntegrationSupply.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ contract TestIntegrationSupply is IntegrationTest {
assertApproxEqAbs(
market.supplyOf(address(morpho)),
test.morphoSupplyBefore + amount,
1,
2,
"morphoSupply != morphoSupplyBefore + amount"
);

Expand Down Expand Up @@ -105,7 +105,7 @@ contract TestIntegrationSupply is IntegrationTest {
assertApproxGeAbs(
market.supplyOf(address(morpho)), test.morphoSupplyBefore, 3, "morphoSupplyAfter != morphoSupplyBefore"
);
assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 1, "morphoVariableBorrow != 0");
assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 4, "morphoVariableBorrow != 0");

// Assert user's underlying balance.
assertApproxEqAbs(
Expand Down Expand Up @@ -212,7 +212,7 @@ contract TestIntegrationSupply is IntegrationTest {

test = _assertSupplyPool(market, amount, onBehalf, test);

assertApproxEqAbs(market.variableBorrowOf(address(morpho)), amount, 1, "morphoVariableBorrow != amount");
assertApproxEqAbs(market.variableBorrowOf(address(morpho)), amount, 2, "morphoVariableBorrow != amount");

_assertMarketAccountingZero(test.morphoMarket);
}
Expand Down
8 changes: 4 additions & 4 deletions test/integration/TestIntegrationWithdraw.sol
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ contract TestIntegrationWithdraw is IntegrationTest {
assertApproxEqAbs(
market.supplyOf(address(morpho)), test.morphoSupplyBefore, 2, "morphoSupply != morphoSupplyBefore"
);
assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 2, "morphoVariableBorrow != 0");
assertApproxEqAbs(market.variableBorrowOf(address(morpho)), 0, 3, "morphoVariableBorrow != 0");

// Assert receiver's underlying balance.
assertApproxEqAbs(
Expand Down Expand Up @@ -263,7 +263,7 @@ contract TestIntegrationWithdraw is IntegrationTest {
assertApproxEqAbs(
market.supplyOf(address(morpho)), test.morphoSupplyBefore, 1, "morphoSupply != morphoSupplyBefore"
);
assertApproxGeAbs(market.variableBorrowOf(address(morpho)), 0, 3, "morphoVariableBorrow != 0");
assertApproxGeAbs(market.variableBorrowOf(address(morpho)), 0, 4, "morphoVariableBorrow != 0");

// Assert user's underlying balance.
assertApproxLeAbs(
Expand Down Expand Up @@ -363,7 +363,7 @@ contract TestIntegrationWithdraw is IntegrationTest {
assertApproxEqAbs(
market.supplyOf(address(morpho)), test.morphoSupplyBefore, 1, "morphoSupply != morphoSupplyBefore"
);
assertApproxEqAbs(morphoVariableBorrow, test.supplied, 2, "morphoVariableBorrow != supplied");
assertApproxEqAbs(morphoVariableBorrow, test.supplied, 4, "morphoVariableBorrow != supplied");

// Assert user's underlying balance.
assertApproxLeAbs(
Expand All @@ -379,7 +379,7 @@ contract TestIntegrationWithdraw is IntegrationTest {
assertApproxEqAbs(
test.morphoMarket.deltas.borrow.scaledDelta.rayMul(test.indexes.borrow.poolIndex),
morphoVariableBorrow,
2,
4,
"borrowDelta != morphoVariableBorrow"
);
assertApproxEqAbs(
Expand Down
4 changes: 2 additions & 2 deletions test/internal/TestInternalMorphoInternal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ contract TestInternalMorphoInternal is InternalTest {
this.increaseP2PDeltasTest(underlying, amount);

assertApproxEqAbs(
aTokenBalanceBefore + expectedAmount, ERC20(market.aToken).balanceOf(address(this)), 1, "aToken balance"
aTokenBalanceBefore + expectedAmount, ERC20(market.aToken).balanceOf(address(this)), 2, "aToken balance"
);
assertApproxEqAbs(
variableDebtTokenBalanceBefore + expectedAmount,
ERC20(market.variableDebtToken).balanceOf(address(this)),
1,
2,
"variable debt token balance"
);
assertEq(deltas.supply.scaledDelta, newExpectedSupplyDelta, "supply delta");
Expand Down