generated from defi-wonderland/solidity-foundry-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'audit/spearbit' into feat/symb-prop19
- Loading branch information
Showing
14 changed files
with
168 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.25; | ||
|
||
import {Script} from 'forge-std/Script.sol'; | ||
import {console} from 'forge-std/Test.sol'; | ||
import {IL1OpUSDCFactory} from 'interfaces/IL1OpUSDCFactory.sol'; | ||
import {USDCInitTxs} from 'src/contracts/utils/USDCInitTxs.sol'; | ||
|
||
contract Deploy is Script { | ||
uint32 public constant MIN_GAS_LIMIT_DEPLOY = 9_000_000; | ||
IL1OpUSDCFactory public immutable L1_FACTORY = IL1OpUSDCFactory(vm.envAddress('L1_FACTORY_MAINNET')); | ||
address public immutable BRIDGED_USDC_IMPLEMENTATION = vm.envAddress('BRIDGED_USDC_IMPLEMENTATION'); | ||
address public immutable L1_MESSENGER = vm.envAddress('L1_MESSENGER'); | ||
string public chainName = vm.envString('CHAIN_NAME'); | ||
address public owner = vm.rememberKey(vm.envUint('MAINNET_PK')); | ||
|
||
function run() public { | ||
vm.createSelectFork(vm.rpcUrl(vm.envString('MAINNET_RPC'))); | ||
vm.startBroadcast(owner); | ||
|
||
// NOTE: We have these hardcoded to default values, if used in product you will need to change them | ||
bytes[] memory _usdcInitTxs = new bytes[](3); | ||
_usdcInitTxs[0] = USDCInitTxs.INITIALIZEV2; | ||
_usdcInitTxs[1] = USDCInitTxs.INITIALIZEV2_1; | ||
_usdcInitTxs[2] = USDCInitTxs.INITIALIZEV2_2; | ||
|
||
IL1OpUSDCFactory.L2Deployments memory _l2Deployments = IL1OpUSDCFactory.L2Deployments({ | ||
l2AdapterOwner: owner, | ||
usdcImplAddr: BRIDGED_USDC_IMPLEMENTATION, | ||
usdcInitTxs: _usdcInitTxs, | ||
minGasLimitDeploy: MIN_GAS_LIMIT_DEPLOY | ||
}); | ||
|
||
// Deploy the L2 contracts | ||
(address _l1Adapter, address _l2Factory, address _l2Adapter) = | ||
L1_FACTORY.deploy(L1_MESSENGER, owner, chainName, _l2Deployments); | ||
vm.stopBroadcast(); | ||
|
||
/// NOTE: Hardcode the `L1_ADAPTER_BASE` and `L2_ADAPTER_BASE` addresses inside the `.env` file | ||
console.log('L1 Adapter:', _l1Adapter); | ||
console.log('L2 Factory:', _l2Factory); | ||
console.log('L2 Adapter:', _l2Adapter); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity 0.8.25; | ||
|
||
import {Script} from 'forge-std/Script.sol'; | ||
import {IL1OpUSDCBridgeAdapter} from 'interfaces/IL1OpUSDCBridgeAdapter.sol'; | ||
|
||
contract MigrateToNative is Script { | ||
uint32 public constant MIN_GAS_LIMIT_RECEIVE_L2 = 100_000; | ||
uint32 public constant MIN_GAS_LIMIT_SET_BURN_AMOUNT_L2 = 100_000; | ||
IL1OpUSDCBridgeAdapter public immutable L1_ADAPTER = IL1OpUSDCBridgeAdapter(vm.envAddress('L1_ADAPTER')); | ||
|
||
address public owner = vm.rememberKey(vm.envUint('MAINNET_OWNER_PK')); | ||
address public roleCaller = vm.envAddress('ROLE_CALLER'); | ||
address public burnCaller = vm.envAddress('BURN_CALLER'); | ||
|
||
function run() public { | ||
vm.createSelectFork(vm.rpcUrl(vm.envString('MAINNET_RPC'))); | ||
vm.startBroadcast(owner); | ||
L1_ADAPTER.migrateToNative(roleCaller, burnCaller, MIN_GAS_LIMIT_RECEIVE_L2, MIN_GAS_LIMIT_SET_BURN_AMOUNT_L2); | ||
vm.stopBroadcast(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.