@@ -11,20 +11,23 @@ import {
11
11
Contracts as PersistentContracts,
12
12
getMainnetDeployment as getMainnetPersistentContracts,
13
13
getPolygonDeployment as getPolygonPersistentContracts,
14
- getArbitrumDeployment as getArbitrumPersistentContracts
14
+ getArbitrumDeployment as getArbitrumPersistentContracts,
15
+ getBaseChainDeployment as getBaseChainPersistentContracts
15
16
} from "tests/utils/core/deployment/PersistentContracts.sol " ;
16
17
import {ReleaseConfig} from "tests/utils/core/deployment/DeploymentUtils.sol " ;
17
18
import {
18
19
Contracts as V4ReleaseContracts,
19
20
getMainnetDeployment as getV4MainnetReleaseContracts,
20
21
getPolygonDeployment as getV4PolygonReleaseContracts,
21
- getArbitrumDeployment as getV4ArbitrumReleaseContracts
22
+ getArbitrumDeployment as getV4ArbitrumReleaseContracts,
23
+ getBaseChainDeployment as getV4BaseChainReleaseContracts
22
24
} from "tests/utils/core/deployment/V4ReleaseContracts.sol " ;
23
25
import {
24
26
Contracts as ReleaseContracts,
25
27
getMainnetDeployment as getMainnetReleaseContracts,
26
28
getPolygonDeployment as getPolygonReleaseContracts,
27
- getArbitrumDeployment as getArbitrumReleaseContracts
29
+ getArbitrumDeployment as getArbitrumReleaseContracts,
30
+ getBaseChainDeployment as getBaseReleaseContracts
28
31
} from "tests/utils/core/deployment/V5ReleaseContracts.sol " ;
29
32
30
33
import {IERC20 } from "tests/interfaces/external/IERC20.sol " ;
@@ -96,7 +99,7 @@ abstract contract IntegrationTest is CoreUtils {
96
99
}
97
100
98
101
function setUpLiveArbitrumEnvironment (uint256 _forkBlock ) internal {
99
- vm.createSelectFork ("polygon " , _forkBlock);
102
+ vm.createSelectFork ("arbitrum " , _forkBlock);
100
103
101
104
core.persistent = getArbitrumPersistentContracts ();
102
105
v4ReleaseContracts = getV4ArbitrumReleaseContracts ();
@@ -105,6 +108,16 @@ abstract contract IntegrationTest is CoreUtils {
105
108
// core.release = getArbitrumReleaseContracts();
106
109
}
107
110
111
+ function setUpLiveBaseChainEnvironment (uint256 _forkBlock ) internal {
112
+ vm.createSelectFork ("base " , _forkBlock);
113
+
114
+ core.persistent = getBaseChainPersistentContracts ();
115
+ v4ReleaseContracts = getV4BaseChainReleaseContracts ();
116
+
117
+ // No v5 release live
118
+ // core.release = getBaseReleaseContracts();
119
+ }
120
+
108
121
// Partially-live deployments (persistent layer only)
109
122
110
123
function setUpLiveMainnetEnvironmentWithNewRelease (uint256 _forkBlock ) internal {
@@ -131,6 +144,14 @@ abstract contract IntegrationTest is CoreUtils {
131
144
__setUpEnvironment ({_config: getDefaultArbitrumConfig (), _persistentContractsAlreadySet: true });
132
145
}
133
146
147
+ function setUpLiveBaseChainEnvironmentWithNewRelease (uint256 _forkBlock ) internal {
148
+ vm.createSelectFork ("base " , _forkBlock);
149
+
150
+ core.persistent = getBaseChainPersistentContracts ();
151
+
152
+ __setUpEnvironment ({_config: getDefaultBaseChainConfig (), _persistentContractsAlreadySet: true });
153
+ }
154
+
134
155
// New deployments
135
156
function setUpNetworkEnvironment (uint256 _chainId ) internal {
136
157
if (_chainId == ETHEREUM_CHAIN_ID) {
@@ -139,6 +160,8 @@ abstract contract IntegrationTest is CoreUtils {
139
160
setUpPolygonEnvironment ();
140
161
} else if (_chainId == ARBITRUM_CHAIN_ID) {
141
162
setUpArbitrumEnvironment ();
163
+ } else if (_chainId == BASE_CHAIN_ID) {
164
+ setUpBaseChainEnvironment ();
142
165
} else {
143
166
revert ("setUpNetworkEnvironment: Unsupported network " );
144
167
}
@@ -151,6 +174,8 @@ abstract contract IntegrationTest is CoreUtils {
151
174
setUpPolygonEnvironment (_forkBlock);
152
175
} else if (_chainId == ARBITRUM_CHAIN_ID) {
153
176
setUpArbitrumEnvironment (_forkBlock);
177
+ } else if (_chainId == BASE_CHAIN_ID) {
178
+ setUpBaseChainEnvironment (_forkBlock);
154
179
} else {
155
180
revert ("setUpNetworkEnvironment: Unsupported network " );
156
181
}
@@ -168,6 +193,10 @@ abstract contract IntegrationTest is CoreUtils {
168
193
setUpArbitrumEnvironment (ARBITRUM_BLOCK_LATEST);
169
194
}
170
195
196
+ function setUpBaseChainEnvironment () internal {
197
+ setUpBaseChainEnvironment (BASE_BLOCK_LATEST);
198
+ }
199
+
171
200
function setUpMainnetEnvironment (uint256 _forkBlock ) internal {
172
201
vm.createSelectFork ({urlOrAlias: "mainnet " , blockNumber: _forkBlock});
173
202
@@ -361,6 +390,49 @@ abstract contract IntegrationTest is CoreUtils {
361
390
__addCorePrimitives (corePrimitives);
362
391
}
363
392
393
+ function setUpBaseChainEnvironment (uint256 _forkBlock ) internal {
394
+ vm.createSelectFork ("base " , _forkBlock);
395
+
396
+ v4ReleaseContracts = getV4BaseChainReleaseContracts ();
397
+
398
+ ReleaseConfig memory config = getDefaultBaseChainConfig ();
399
+
400
+ __setUpEnvironment ({_config: config, _persistentContractsAlreadySet: false });
401
+
402
+ // Deploy minimal asset universe
403
+
404
+ // Treat WETH specially and directly add to coreTokens storage (does not require an aggregator)
405
+ symbolToCoreToken["WETH " ] = IERC20 (wethToken);
406
+ tokenToIsCore[IERC20 (wethToken)] = true ;
407
+
408
+ address simulatedUsdAddress = address (deployUsdEthSimulatedAggregator (config.chainlinkEthUsdAggregatorAddress));
409
+
410
+ CorePrimitiveInput[] memory corePrimitives = new CorePrimitiveInput [](2 );
411
+ // TODO: ucomment this when the real MLN aggregator address is available
412
+ // System primitives
413
+ // corePrimitives[0] = CorePrimitiveInput({
414
+ // symbol: "MLN",
415
+ // assetAddress: BASE_MLN,
416
+ // aggregatorAddress: BASE_MLN_ETH_AGGREGATOR,
417
+ // rateAsset: IChainlinkPriceFeedMixinProd.RateAsset.ETH
418
+ // });
419
+ // Extra primitives
420
+ corePrimitives[0 ] = CorePrimitiveInput ({
421
+ symbol: "USD " ,
422
+ assetAddress: simulatedUsdAddress,
423
+ aggregatorAddress: simulatedUsdAddress,
424
+ rateAsset: IChainlinkPriceFeedMixinProd.RateAsset.ETH
425
+ });
426
+ corePrimitives[1 ] = CorePrimitiveInput ({
427
+ symbol: "USDC " ,
428
+ assetAddress: BASE_USDC,
429
+ aggregatorAddress: BASE_USDC_USD_AGGREGATOR,
430
+ rateAsset: IChainlinkPriceFeedMixinProd.RateAsset.USD
431
+ });
432
+
433
+ __addCorePrimitives (corePrimitives);
434
+ }
435
+
364
436
function setUpStandaloneEnvironment () internal {
365
437
// Warp beyond Chainlink aggregator staleness threshold
366
438
uint256 chainlinkStaleRateThreshold = 3650 days ;
@@ -546,6 +618,30 @@ abstract contract IntegrationTest is CoreUtils {
546
618
});
547
619
}
548
620
621
+ function getDefaultBaseChainConfig () internal returns (ReleaseConfig memory ) {
622
+ address mlnBurner = makeAddr ("MlnBurner " );
623
+
624
+ return ReleaseConfig ({
625
+ // Chainlink
626
+ chainlinkEthUsdAggregatorAddress: BASE_ETH_USD_AGGREGATOR,
627
+ chainlinkStaleRateThreshold: 3650 days,
628
+ // Tokens
629
+ mlnTokenAddress: BASE_MLN,
630
+ wethTokenAddress: BASE_WETH,
631
+ wrappedNativeTokenAddress: BASE_WETH,
632
+ // Gas relayer
633
+ gasRelayDepositCooldown: 1 days,
634
+ gasRelayDepositMaxTotal: 1 ether,
635
+ gasRelayFeeMaxPercent: 10 ,
636
+ gasRelayHubAddress: address (0 ), // TODO: lookup real value
637
+ gasRelayRelayFeeMaxBase: 0 ,
638
+ gasRelayTrustedForwarderAddress: address (0 ), // TODO: lookup real value
639
+ // Vault settings
640
+ vaultMlnBurner: mlnBurner,
641
+ vaultPositionsLimit: 20
642
+ });
643
+ }
644
+
549
645
// ASSET UNIVERSE
550
646
551
647
/// @dev Keep private to avoid accidental use
0 commit comments