Skip to content

Commit

Permalink
Merge branch 'develop' into refactor/aave-v3-origin
Browse files Browse the repository at this point in the history
  • Loading branch information
QGarchery committed Oct 31, 2024
2 parents 6057aab + 4025c0f commit 39fa6de
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
6 changes: 3 additions & 3 deletions test/extensions/TestIntegrationSupplyVault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ contract TestIntegrationSupplyVault is TestSetupVaults {

assertApproxEqAbs(daiSupplyVault.balanceOf(address(user)), 0, 1, "maDAI balance not zero");
assertApproxEqAbs(ERC20(dai).balanceOf(address(user)), balanceBefore, 5, "amount withdrawn != amount deposited");
assertApproxEqAbs(totalBalanceAfter, totalBalanceBefore, 1, "totalBalance");
assertApproxEqAbs(totalBalanceAfter, totalBalanceBefore, 2, "totalBalance");
}

function testShouldWithdrawAllUsdcAmount(uint256 amount) public {
Expand All @@ -110,7 +110,7 @@ contract TestIntegrationSupplyVault is TestSetupVaults {
assertApproxEqAbs(
ERC20(usdc).balanceOf(address(user)), balanceBeforeDeposit, 5, "amount withdrawn != amount deposited"
);
assertApproxEqAbs(totalBalanceAfter, totalBalanceBefore, 1, "totalBalance");
assertApproxEqAbs(totalBalanceAfter, totalBalanceBefore, 2, "totalBalance");
assertApproxEqAbs(ERC20(usdc).balanceOf(address(user)) - balanceBeforeWithdraw, amount, 2, "expectedWithdraw");
}

Expand All @@ -127,7 +127,7 @@ contract TestIntegrationSupplyVault is TestSetupVaults {

assertApproxEqAbs(ERC20(dai).balanceOf(address(user)), balanceBefore, 5, "amount withdrawn != amount deposited");
assertEq(daiSupplyVault.balanceOf(address(user)), 0, "maDAI balance not zero");
assertApproxEqAbs(totalBalanceAfter, totalBalanceBefore, 1, "totalBalance");
assertApproxEqAbs(totalBalanceAfter, totalBalanceBefore, 2, "totalBalance");
}

function testShouldNotRedeemWhenNotDeposited(uint256 amount) public {
Expand Down
5 changes: 4 additions & 1 deletion test/integration/TestIntegrationEModeNative.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {WETHGateway} from "src/extensions/WETHGateway.sol";
import "test/helpers/IntegrationTest.sol";

contract TestIntegrationEModeNative is IntegrationTest {
using Math for uint256;
using PercentageMath for uint256;
using TestMarketLib for TestMarket;
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
Expand Down Expand Up @@ -45,7 +46,9 @@ contract TestIntegrationEModeNative is IntegrationTest {

user.withdrawCollateral(
lsdNative,
(rawCollateral - lsdNativeMarket.minCollateral(wNativeMarket, borrowed, eModeCategoryId)) / 2,
rawCollateral.zeroFloorSub(
lsdNativeMarket.minCollateral(wNativeMarket, borrowed, eModeCategoryId).percentAdd(5)
),
onBehalf,
receiver
);
Expand Down
2 changes: 1 addition & 1 deletion test/integration/TestIntegrationLiquidate.sol
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ contract TestIntegrationLiquidate is IntegrationTest {
assertApproxEqAbs(
morpho.collateralBalance(collateralMarket.underlying, borrower) + test.seized,
test.collateralBalanceBefore,
1,
2,
"collateralBalanceAfter != collateralBalanceBefore - seized"
);
}
Expand Down
8 changes: 4 additions & 4 deletions test/integration/TestIntegrationPermit2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ contract TestIntegrationPermit2 is IntegrationTest {
vm.prank(delegator);
ERC20(market.underlying).safeApprove(address(PERMIT2), type(uint256).max);

timestamp = bound(timestamp, 0, Math.min(deadline, type(uint48).max) - block.timestamp);
timestamp = bound(timestamp, 0, Math.min(deadline, type(uint32).max) - block.timestamp);
vm.warp(block.timestamp + timestamp);

deal(market.underlying, delegator, amount);
Expand All @@ -116,7 +116,7 @@ contract TestIntegrationPermit2 is IntegrationTest {
morpho.collateralBalance(market.underlying, onBehalf),
balanceSupplyBefore + amount,
7,
"collateralBalanceAfter - collateralBalanceBefore != amouunt"
"collateralBalanceAfter - collateralBalanceBefore != amount"
);

assertEq(
Expand Down Expand Up @@ -151,7 +151,7 @@ contract TestIntegrationPermit2 is IntegrationTest {
vm.prank(delegator);
ERC20(market.underlying).safeApprove(address(PERMIT2), type(uint256).max);

timestamp = bound(timestamp, 0, Math.min(deadline, type(uint48).max) - block.timestamp);
timestamp = bound(timestamp, 0, Math.min(deadline, type(uint32).max) - block.timestamp);
vm.warp(block.timestamp + timestamp);

amount = morpho.borrowBalance(market.underlying, onBehalf) - 1;
Expand Down Expand Up @@ -193,7 +193,7 @@ contract TestIntegrationPermit2 is IntegrationTest {
vm.prank(delegator);
ERC20(market.underlying).safeApprove(address(PERMIT2), type(uint256).max);

timestamp = bound(timestamp, 0, Math.min(deadline, type(uint48).max) - block.timestamp);
timestamp = bound(timestamp, 0, Math.min(deadline, type(uint32).max) - block.timestamp);
vm.warp(block.timestamp + timestamp);

Types.Signature memory sig =
Expand Down
4 changes: 3 additions & 1 deletion test/integration/TestIntegrationWithdrawCollateral.sol
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,9 @@ contract TestIntegrationWithdrawCollateral is IntegrationTest {
);
withdrawn = bound(
withdrawn,
rawCollateral.zeroFloorSub(collateralMarket.minCollateral(borrowedMarket, borrowed, eModeCategoryId)),
rawCollateral.zeroFloorSub(
collateralMarket.minCollateral(borrowedMarket, borrowed, eModeCategoryId).percentSub(5)
),
type(uint256).max
);

Expand Down

0 comments on commit 39fa6de

Please sign in to comment.