Skip to content

Commit

Permalink
fix: deal max USDC
Browse files Browse the repository at this point in the history
  • Loading branch information
QGarchery committed Jan 18, 2024
1 parent 6b90efa commit 082a2b1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
21 changes: 17 additions & 4 deletions test/prod/aave-v2/setup/TestSetup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import "src/aave-v2/interfaces/aave/IVariableDebtToken.sol";
import "src/aave-v2/interfaces/aave/IAToken.sol";
import "src/aave-v2/interfaces/lido/ILido.sol";

import "@forge-std/console.sol";

import {ReserveConfiguration} from "src/aave-v2/libraries/aave/ReserveConfiguration.sol";

import {InterestRatesManager} from "src/aave-v2/InterestRatesManager.sol";
Expand All @@ -19,6 +21,10 @@ import "src/aave-v2/Morpho.sol";
import {User} from "../../../aave-v2/helpers/User.sol";
import "config/aave-v2/Config.sol";

interface ERC20Black {
function isBlacklisted(address) external view returns (bool);
}

contract TestSetup is Config, ProdTest {
using ReserveConfiguration for DataTypes.ReserveConfigurationMap;
using WadRayMath for uint256;
Expand Down Expand Up @@ -77,9 +83,11 @@ contract TestSetup is Config, ProdTest {

vm.label(address(user), "User");

// Only 104 bits are used for the balance in the AAVE balance slot
deal(aave, address(this), type(uint104).max);
// Only 255 bits are used for the balance in the USDC balance slot
deal(usdc, address(this), 2**255 - 1);
deal(dai, address(this), type(uint256).max);
deal(usdc, address(this), type(uint256).max);
deal(usdt, address(this), type(uint256).max);
deal(wbtc, address(this), type(uint256).max);
deal(wEth, address(this), type(uint256).max);
Expand Down Expand Up @@ -261,11 +269,16 @@ contract TestSetup is Config, ProdTest {
address _user,
uint256 _amount
) internal {
if (_amount == 0) return;
console.log(address(this));
console.log("is blacklisted", ERC20Black(_underlying).isBlacklisted(address(this)));
console.log(address(_user));
console.log("is blacklisted", ERC20Black(_underlying).isBlacklisted(address(_user)));
console.log(block.number);
console.log(_underlying);

if (_underlying == wEth) deal(wEth, wEth.balance + _amount); // Refill wrapped Ether.
ERC20(_underlying).transfer(_user, _amount);

ERC20(_underlying).safeTransfer(_user, _amount);
console.log("after");
}

/// @dev Rolls & warps `_blocks` blocks forward the blockchain.
Expand Down
4 changes: 3 additions & 1 deletion test/prod/compound/setup/TestSetup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,11 @@ contract TestSetup is Config, ProdTest {

vm.label(address(user), "User");

// Only 104 bits are used for the balance in the AAVE balance slot
deal(aave, address(this), type(uint104).max);
// Only 255 bits are used for the balance in the USDC balance slot
deal(usdc, address(this), 2**255 - 1);
deal(dai, address(this), type(uint256).max);
deal(usdc, address(this), type(uint256).max);
deal(usdt, address(this), type(uint256).max);
deal(wbtc, address(this), type(uint256).max);
deal(wEth, address(this), type(uint256).max);
Expand Down

0 comments on commit 082a2b1

Please sign in to comment.