Skip to content

Commit

Permalink
Morpho 1.1 tests (#4)
Browse files Browse the repository at this point in the history
Co-authored-by: João Bruno <[email protected]>
  • Loading branch information
mkflow27 and joaobrunoah authored Jan 7, 2025
1 parent 365ee17 commit c8e0278
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 11 deletions.
19 changes: 13 additions & 6 deletions test/ERC4626WrapperBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ abstract contract ERC4626WrapperBaseTest is Test {

// Variables to be defined by setUpForkTestVariables().
string internal network;
uint256 internal blockNumber;
// Use overrideBlockNumber to specify a block number in a specific test.
uint256 internal overrideBlockNumber;
IERC4626 internal wrapper;
address internal underlyingDonor;
uint256 internal amountToDonate;

// blockNumber is used by the base test. To override it, please use overrideBlockNumber.
uint256 internal blockNumber;

IBufferRouter internal bufferRouter;
IVaultForERC4626Test internal vault;
IPermit2 internal permit2;
Expand Down Expand Up @@ -77,8 +81,9 @@ abstract contract ERC4626WrapperBaseTest is Test {
}

/**
* @notice Defines network, blockNumber, wrapper, underlyingDonor and amountToDonate.
* @dev Make sure the underlyingDonor has at least amountToDonate underlying tokens.
* @notice Defines network, overrideBlockNumber, wrapper, underlyingDonor and amountToDonate.
* @dev Make sure the underlyingDonor has at least amountToDonate underlying tokens, and that the buffer was not
* initialized for the ERC4626 token in the current block number.
*/
function setUpForkTestVariables() internal virtual;

Expand Down Expand Up @@ -409,19 +414,21 @@ abstract contract ERC4626WrapperBaseTest is Test {

function _configurePermit2AndBufferToNetwork() private {
// Block Numbers are based on the deployment of BufferRouter.
// IMPORTANT: If a test requires a new blockNumber, change `overrideBlockNumber` in the test itself using the
// function `setUpForkTestVariables()`. Do not change the values below, since all tests depend on it.

if (_compareStrings(network, "mainnet")) {
blockNumber = 21339384;
blockNumber = overrideBlockNumber != 0 ? overrideBlockNumber : 21339384;
permit2 = IPermit2(0x000000000022D473030F116dDEE9F6B43aC78BA3);
bufferRouter = IBufferRouter(0x9179C06629ef7f17Cb5759F501D89997FE0E7b45);
vault = IVaultForERC4626Test(0xbA1333333333a1BA1108E8412f11850A5C319bA9);
} else if (_compareStrings(network, "gnosis")) {
blockNumber = 37377481;
blockNumber = overrideBlockNumber != 0 ? overrideBlockNumber : 37377481;
permit2 = IPermit2(0x000000000022D473030F116dDEE9F6B43aC78BA3);
bufferRouter = IBufferRouter(0x86e67E115f96DF37239E0479441303De0de7bc2b);
vault = IVaultForERC4626Test(0xbA1333333333a1BA1108E8412f11850A5C319bA9);
} else if (_compareStrings(network, "sepolia")) {
blockNumber = 7219291;
blockNumber = overrideBlockNumber != 0 ? overrideBlockNumber : 7219291;
permit2 = IPermit2(0x000000000022D473030F116dDEE9F6B43aC78BA3);
bufferRouter = IBufferRouter(0xb5F3A41515457CC6E2716c62a011D260441CcfC9);
vault = IVaultForERC4626Test(0xbA1333333333a1BA1108E8412f11850A5C319bA9);
Expand Down
7 changes: 4 additions & 3 deletions test/mainnet/ERC4626MainnetMorphoSteakhouseUSDC.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ contract ERC4626MainnetMorphoSteakhouseUsdcTest is ERC4626WrapperBaseTest {

function setUpForkTestVariables() internal override {
network = "mainnet";
overrideBlockNumber = 21537026;

// Morpho's Steakhouse USDC
wrapper = IERC4626(0xBEEF01735c132Ada46AA9aA4c54623cAA92A64CB);
wrapper = IERC4626(0x7204B7Dbf9412567835633B6F00C3Edc3a8D6330);
// Donor of USDC tokens
underlyingDonor = 0x4B16c5dE96EB2117bBE5fd171E4d203624B014aa;
amountToDonate = 1e6 * 1e6;
underlyingDonor = 0x37305B1cD40574E4C5Ce33f8e8306Be057fD7341;
amountToDonate = 10_000 * 1e6;
}
}
5 changes: 3 additions & 2 deletions test/mainnet/ERC4626MainnetMorphoSteakhouseWUSDL.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ contract ERC4626MainnetMorphoSteakhouseWUSDLTest is ERC4626WrapperBaseTest {

function setUpForkTestVariables() internal override {
network = "mainnet";
overrideBlockNumber = 21537026;

// Morpho's Steakhouse wUSDL
wrapper = IERC4626(0xbEEFC01767ed5086f35deCb6C00e6C12bc7476C1);
wrapper = IERC4626(0xbEeFc011e94f43b8B7b455eBaB290C7Ab4E216f1);
// Donor of wUSDL tokens
underlyingDonor = 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb;
amountToDonate = 1e6 * 1e18;
amountToDonate = 10_000 * 1e18;
}
}

0 comments on commit c8e0278

Please sign in to comment.