Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix E2E test execution. #29

Merged
merged 1 commit into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions script/mainnet/MainnetInitialSetup.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ contract MainnetInitialSetup is Script, DeploySpool, AssetsInitial, StrategiesIn

vm.startBroadcast(deployerPrivateKey);

doSetup(deployerAddress, true);
doSetup(deployerAddress, type(uint256).max);
}

function init() public virtual {
_constantsJson = new JsonReader(vm, string.concat("deploy/mainnet.constants.json"));
_contractsJson = new JsonReadWriter(vm, string.concat("deploy/mainnet.contracts.json"));
}

function doSetup(address deployerAddress, bool extended) public {
function doSetup(address deployerAddress, uint256 extended) public {
deploySpool();

setupAssets(assetGroupRegistry, usdPriceFeedManager);
Expand Down
13 changes: 8 additions & 5 deletions script/mainnet/StrategiesInitial.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ contract StrategiesInitial {
ISwapper swapper,
address proxyAdmin,
IStrategyRegistry strategyRegistry,
bool extended
uint256 extended
) public {
StandardContracts memory contracts = StandardContracts({
accessControl: accessControl,
Expand Down Expand Up @@ -103,13 +103,16 @@ contract StrategiesInitial {

deployYearnV2(contracts);

if (extended) {
if (extended >= 1) {
deployOeth(contracts, true);

}
if (extended >= 2) {
deployConvexStFrxEth(contracts, true);

}
if (extended >= 3) {
deployGearboxV3(contracts, true);

}
if (extended >= 4) {
deployMetamorphoGauntlet(contracts, true);
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/forked/EthereumForkConstants.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ uint256 constant MAINNET_FORK_BLOCK_EXTENDED_1 = 18_963_715;
uint256 constant MAINNET_FORK_BLOCK_EXTENDED_2 = 19_610_823;

// whales
address constant USDC_WHALE = address(0x4B16c5dE96EB2117bBE5fd171E4d203624B014aa);
address constant USDC_WHALE = address(0x40ec5B33f54e0E8A33A975908C5BA1c14e5BbbDf);

// tokens
address constant USDC = address(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
Expand Down
13 changes: 7 additions & 6 deletions test/forked/ForkTestFixtureDeployment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ import "./ForkTestFixture.sol";
import "../libraries/TimeUtils.sol";
import "../libraries/VaultValueHelpers.sol";

string constant TEST_CONSTANTS_PATH = "deploy/fork-test.constants.json";
string constant TEST_CONTRACTS_PATH = "deploy/fork-test.contracts.json";
string constant TEST_CONSTANTS_PATH = "deploy/fork-test-mainnet.constants.json";
string constant TEST_CONTRACTS_PATH = "deploy/fork-test-mainnet.contracts.json";

contract TestMainnetInitialSetup is MainnetInitialSetup {
function init() public virtual override {
super.init();

_constantsJson = new JsonReader(vm, TEST_CONSTANTS_PATH);
_contractsJson = new JsonReadWriter(vm, TEST_CONTRACTS_PATH);
}
Expand Down Expand Up @@ -81,7 +79,7 @@ abstract contract ForkTestFixtureDeployment is ForkTestFixture {
config = vm.readFile("deploy/mainnet.constants.json");
}

function _deploy() internal {
function _deploy(uint256 extended) internal {
setUpForkTestFixture();
vm.selectFork(mainnetForkId);
_setConfig();
Expand All @@ -93,9 +91,12 @@ abstract contract ForkTestFixtureDeployment is ForkTestFixture {
vm.writeJson(Strings.toHexString(_feeRecipient), TEST_CONSTANTS_PATH, ".fees.ecosystemFeeReceiver");
vm.writeJson(Strings.toHexString(_feeRecipient), TEST_CONSTANTS_PATH, ".fees.treasuryFeeReceiver");

// TestMainnetInitialSetup is expecting this file to exist
vm.writeJson("{}", TEST_CONTRACTS_PATH);

_deploySpool = new TestMainnetInitialSetup();
_deploySpool.init();
_deploySpool.doSetup(address(_deploySpool), false);
_deploySpool.doSetup(address(_deploySpool), extended);

{
uint256 assetGroupId;
Expand Down
5 changes: 3 additions & 2 deletions test/forked/arbitrum/ForkTestFixtureDeployment.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ string constant TEST_CONTRACTS_PATH = "deploy/fork-test-arbitrum.contracts.json"

contract TestArbitrumInitialSetup is ArbitrumInitialSetup {
function init() public virtual override {
super.init();

_constantsJson = new JsonReader(vm, TEST_CONSTANTS_PATH);
_contractsJson = new JsonReadWriter(vm, TEST_CONTRACTS_PATH);
}
Expand Down Expand Up @@ -94,6 +92,9 @@ abstract contract ForkTestFixtureDeployment is ForkTestFixture {
vm.writeJson(Strings.toHexString(_feeRecipient), TEST_CONSTANTS_PATH, ".fees.ecosystemFeeReceiver");
vm.writeJson(Strings.toHexString(_feeRecipient), TEST_CONSTANTS_PATH, ".fees.treasuryFeeReceiver");

// TestArbitrumInitialSetup is expecting this file to exist
vm.writeJson("{}", TEST_CONTRACTS_PATH);

_deploySpool = new TestArbitrumInitialSetup();
_deploySpool.init();
_deploySpool.doSetup(address(_deploySpool));
Expand Down
2 changes: 1 addition & 1 deletion test/forked/arbitrum/e2e/E2E.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import "../../../fixtures/TestFixture.sol";
import "../../../mocks/MockAllocationProvider.sol";
import "../ForkTestFixtureDeployment.sol";

contract E2E is ForkTestFixtureDeployment {
contract E2eArbitrumTest is ForkTestFixtureDeployment {
MockAllocationProvider public mockAllocationProvider;

function _setConfig() internal override {
Expand Down
4 changes: 2 additions & 2 deletions test/forked/e2e/E2E.Metamorpho.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ import "../../fixtures/TestFixture.sol";
import "../../mocks/MockAllocationProvider.sol";
import "../ForkTestFixtureDeployment.sol";

contract E2E is ForkTestFixtureDeployment {
contract E2eMainnetMetamorphoTest is ForkTestFixtureDeployment {
MockAllocationProvider public mockAllocationProvider;

function setUpForkTestFixture() internal override {
mainnetForkId = vm.createFork(vm.rpcUrl("mainnet"), MAINNET_FORK_BLOCK_EXTENDED_2);
}

function setUp() public {
_deploy();
_deploy(4); // deploy strategies up to Metamorhpo Gauntlet

mockAllocationProvider = new MockAllocationProvider();
vm.startPrank(_spoolAdmin);
Expand Down
4 changes: 2 additions & 2 deletions test/forked/e2e/E2E.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ import "../../fixtures/TestFixture.sol";
import "../../mocks/MockAllocationProvider.sol";
import "../ForkTestFixtureDeployment.sol";

contract E2E is ForkTestFixtureDeployment {
contract E2eMainnetTest is ForkTestFixtureDeployment {
MockAllocationProvider public mockAllocationProvider;

function setUp() public {
_deploy();
_deploy(0); // deploy just initial strategies

mockAllocationProvider = new MockAllocationProvider();
vm.startPrank(_spoolAdmin);
Expand Down
Loading