-
Notifications
You must be signed in to change notification settings - Fork 347
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploy l2 contracts and use governance for upgrades (#441)
Signed-off-by: Danil <[email protected]>
- Loading branch information
1 parent
bffbf0a
commit 707043f
Showing
12 changed files
with
499 additions
and
47 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
3 changes: 3 additions & 0 deletions
3
l1-contracts-foundry/script-config-template/config-deploy-paymaster.toml
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,3 @@ | ||
chain_id = 215 | ||
l1_shared_bridge = "0x2ae37d8130b82c7e79b3863a39027178e073eedb" | ||
bridgehub = "0xea785a9c91a07ed69b83eb165f4ce2c30ecb4c0b" |
6 changes: 6 additions & 0 deletions
6
l1-contracts-foundry/script-config-template/config-initialize-shared-bridges.toml
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,6 @@ | ||
chain_id = 215 | ||
era_chain_id = 270 | ||
l1_shared_bridge = "0x2ae37d8130b82c7e79b3863a39027178e073eedb" | ||
bridgehub = "0xea785a9c91a07ed69b83eb165f4ce2c30ecb4c0b" | ||
governance = "0x6a08d69675af7755569a1a25ef37e795493473a1" | ||
erc20_bridge = "0x84fbda16bd5f2d66d7fbaec5e8d816e7b7014595" |
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,31 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.0; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {stdToml} from "forge-std/StdToml.sol"; | ||
|
||
import {Ownable2Step} from "@openzeppelin/contracts/access/Ownable2Step.sol"; | ||
import {Utils} from "./Utils.sol"; | ||
|
||
contract AcceptAdmin is Script { | ||
using stdToml for string; | ||
|
||
// This function should be called by the owner to accept the admin role | ||
function run() public { | ||
string memory root = vm.projectRoot(); | ||
string memory path = string.concat(root, "/script-config/config-accept-admin.toml"); | ||
string memory toml = vm.readFile(path); | ||
address admin = toml.readAddress("$.target_addr"); | ||
address governor = toml.readAddress("$.governor"); | ||
Ownable2Step adminContract = Ownable2Step(admin); | ||
|
||
Utils.executeUpgrade({ | ||
_governor: governor, | ||
_salt: bytes32(0), | ||
_target: admin, | ||
_data: abi.encodeCall(adminContract.acceptOwnership, ()), | ||
_value: 0, | ||
_delay: 0 | ||
}); | ||
} | ||
} |
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,60 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.24; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {stdToml} from "forge-std/StdToml.sol"; | ||
|
||
import {Utils} from "./Utils.sol"; | ||
|
||
contract DeployPaymaster is Script { | ||
using stdToml for string; | ||
Config config; | ||
|
||
struct Config { | ||
address bridgehubAddress; | ||
address l1SharedBridgeProxy; | ||
uint256 chainId; | ||
address paymaster; | ||
} | ||
|
||
function initializeConfig() internal { | ||
string memory root = vm.projectRoot(); | ||
string memory path = string.concat(root, "/script-config/config-deploy-paymaster.toml"); | ||
string memory toml = vm.readFile(path); | ||
config.bridgehubAddress = toml.readAddress("$.bridgehub"); | ||
config.l1SharedBridgeProxy = toml.readAddress("$.l1_shared_bridge"); | ||
config.chainId = toml.readUint("$.chain_id"); | ||
} | ||
|
||
function saveOutput() internal { | ||
string memory toml = vm.serializeAddress("root", "paymaster", config.paymaster); | ||
string memory root = vm.projectRoot(); | ||
string memory path = string.concat(root, "/script-out/output-deploy-paymaster.toml"); | ||
vm.writeToml(toml, path); | ||
} | ||
|
||
function run() external { | ||
initializeConfig(); | ||
|
||
deploy(); | ||
|
||
saveOutput(); | ||
} | ||
|
||
function deploy() internal { | ||
bytes memory testnetPaymasterBytecode = Utils.readHardhatBytecode( | ||
"/../l2-contracts/artifacts-zk/contracts/TestnetPaymaster.sol/TestnetPaymaster.json" | ||
); | ||
|
||
config.paymaster = Utils.deployThroughL1({ | ||
bytecode: testnetPaymasterBytecode, | ||
constructorargs: "", | ||
create2salt: "", | ||
l2GasLimit: Utils.MAX_PRIORITY_TX_GAS, | ||
factoryDeps: new bytes[](0), | ||
bridgehubAddress: config.bridgehubAddress, | ||
l1SharedBridgeProxy: config.l1SharedBridgeProxy, | ||
chainId: config.chainId | ||
}); | ||
} | ||
} |
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.