Skip to content

Commit

Permalink
test: fix wrong changes in refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
MathisGD committed May 13, 2024
1 parent ccac0bf commit 13c711f
Show file tree
Hide file tree
Showing 8 changed files with 54 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/forge/BaseBundlerLocalTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ import {ErrorsLib} from "src/libraries/ErrorsLib.sol";

import "./helpers/LocalTest.sol";

contract BaseBundlerMock is BaseBundler {}

contract BaseBundlerLocalTest is LocalTest {
function setUp() public override {
super.setUp();

bundler = new BaseBundlerMock();
}

function testMulticallEmpty() public {
bundler.multicall(bundle);
}
Expand Down
4 changes: 4 additions & 0 deletions test/forge/ERC20WrapperBundlerLocalTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ import {ERC20WrapperMock, ERC20Wrapper} from "../../src/mocks/ERC20WrapperMock.s

import "./helpers/LocalTest.sol";

contract ERC20WrapperBundlerMock is ERC20WrapperBundler, TransferBundler {}

contract ERC20WrapperBundlerBundlerLocalTest is LocalTest {
ERC20WrapperMock internal loanWrapper;

function setUp() public override {
super.setUp();

bundler = new ERC20WrapperBundlerMock();

loanWrapper = new ERC20WrapperMock(loanToken, "Wrapped Loan Token", "WLT");
}

Expand Down
4 changes: 4 additions & 0 deletions test/forge/ERC4626BundlerLocalTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ import {ERC4626Mock} from "../../src/mocks/ERC4626Mock.sol";

import "./helpers/LocalTest.sol";

contract ERC4626BundlerMock is ERC4626Bundler, TransferBundler {}

contract ERC4626BundlerLocalTest is LocalTest {
ERC4626Mock internal vault;

function setUp() public override {
super.setUp();

bundler = new ERC4626BundlerMock();

vault = new ERC4626Mock(address(loanToken), "LoanToken Vault", "BV");

vm.startPrank(USER);
Expand Down
10 changes: 10 additions & 0 deletions test/forge/MorphoBundlerLocalTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,14 @@ import {MarketParamsLib} from "../../lib/morpho-blue/src/libraries/MarketParamsL

import "./helpers/MetaMorphoLocalTest.sol";

contract MorphoBundlerMock is MorphoBundler, TransferBundler {
constructor(address morpho) MorphoBundler(morpho) {}

function _isSenderAuthorized() internal view override(BaseBundler, MorphoBundler) returns (bool) {
return MorphoBundler._isSenderAuthorized();
}
}

contract MorphoBundlerLocalTest is MetaMorphoLocalTest {
using MathLib for uint256;
using MorphoLib for IMorpho;
Expand All @@ -25,6 +33,8 @@ contract MorphoBundlerLocalTest is MetaMorphoLocalTest {
function setUp() public override {
super.setUp();

bundler = new MorphoBundlerMock(address(morpho));

vm.startPrank(USER);
loanToken.approve(address(morpho), type(uint256).max);
collateralToken.approve(address(morpho), type(uint256).max);
Expand Down
4 changes: 4 additions & 0 deletions test/forge/PermitBundlerLocalTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ import {ERC20PermitMock} from "../../src/mocks/ERC20PermitMock.sol";

import "./helpers/LocalTest.sol";

contract PermitBundlerMock is TransferBundler, PermitBundler {}

contract PermitBundlerLocalTest is LocalTest {
ERC20PermitMock internal permitToken;

function setUp() public override {
super.setUp();

bundler = new PermitBundlerMock();

permitToken = new ERC20PermitMock("Permit Token", "PT");
}

Expand Down
8 changes: 8 additions & 0 deletions test/forge/TransferBundlerLocalTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,15 @@ import {ErrorsLib} from "../../src/libraries/ErrorsLib.sol";

import "./helpers/LocalTest.sol";

contract TransferBundlerMock is TransferBundler {}

contract TransferBundlerLocalTest is LocalTest {
function setUp() public override {
super.setUp();

bundler = new TransferBundlerMock();
}

function testTransfer(uint256 amount) public {
amount = bound(amount, 0, MAX_AMOUNT);

Expand Down
4 changes: 4 additions & 0 deletions test/forge/UrdBundlerLocalTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ interface IUrdFactory {
function createUrd(address, uint256, bytes32, bytes32, bytes32) external returns (address);
}

contract UrdBundlerMock is UrdBundler {}

contract UrdBundlerLocalTest is LocalTest {
IUrdFactory internal urdFactory;
Merkle internal merkle;
Expand All @@ -24,6 +26,8 @@ contract UrdBundlerLocalTest is LocalTest {
function setUp() public override {
super.setUp();

bundler = new UrdBundlerMock();

urdFactory = IUrdFactory(deployCode("UrdFactory.sol", ""));
vm.label(address(urdFactory), "UrdFactory");
merkle = new Merkle();
Expand Down
12 changes: 12 additions & 0 deletions test/forge/fork/StEthBundlerForkTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,25 @@ import {IAllowanceTransfer} from "../../../lib/permit2/src/interfaces/IAllowance

import {ErrorsLib} from "../../../src/libraries/ErrorsLib.sol";

import "../../../src/ethereum/EthereumStEthBundler.sol";

import "./helpers/ForkTest.sol";

bytes32 constant BEACON_BALANCE_POSITION = 0xa66d35f054e68143c18f32c990ed5cb972bb68a68f500cd2dd3a16bbf3686483; // keccak256("lido.Lido.beaconBalance");

contract EthereumStEthBundlerMock is TransferBundler, Permit2Bundler, EthereumStEthBundler {}

contract EthereumStEthBundlerForkTest is ForkTest {
using SafeTransferLib for ERC20;

function setUp() public override {
if (block.chainid != 1) return;

super.setUp();

bundler = new EthereumStEthBundlerMock();
}

function testStakeEthZeroAmount() public onlyEthereum {
bundle.push(abi.encodeCall(StEthBundler.stakeEth, (0, 0, address(0))));

Expand Down

0 comments on commit 13c711f

Please sign in to comment.