Skip to content

Commit 6ea7687

Browse files
authored
Deploy temp v1.9 ERC20Factory (#164)
1 parent da64ba9 commit 6ea7687

File tree

21 files changed

+313
-0
lines changed

21 files changed

+313
-0
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ To add new incident response scripts:
7373
This template is used for deploying the L1 contracts in the OP stack to set up a new network.
7474

7575
1. Ensure you have followed the instructions above in `setup`
76+
1. Rename the folder to something more descriptive
7677
1. Specify the commit of [Optimism code](https://github.com/ethereum-optimism/optimism) and [Base contracts code](https://github.com/base-org/contracts) you intend to use in the `.env` file
7778
1. Run `make deps`
7879
1. Fill in the `inputs/deploy-config.json` and `inputs/misc-config.json` files with the input variables for the deployment.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
OP_COMMIT=e6ef3a900c42c8722e72c2e2314027f85d12ced5
2+
BASE_CONTRACTS_COMMIT=c8e14388e478471411abb10f3a99ab3bd9206a95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
include ../../Makefile
2+
include ../.env
3+
include .env
4+
5+
##
6+
# Deploy command
7+
##
8+
.PHONY: deploy
9+
deploy:
10+
forge script RunERC20FactoryDeploy --rpc-url $(L2_RPC_URL) --broadcast --verify
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[profile.default]
2+
src = 'src'
3+
out = 'out'
4+
libs = ['lib']
5+
broadcast = 'records'
6+
fs_permissions = [ {access = "read-write", path = "./"} ]
7+
optimizer = true
8+
optimizer_runs = 999999
9+
solc_version = "0.8.15"
10+
11+
# note 'src/universal=lib/optimism/packages/contracts-bedrock/src/universal' is needed
12+
# for relative paths in optimism repo to work
13+
remappings = [
14+
'@eth-optimism-bedrock/=lib/optimism/packages/contracts-bedrock/',
15+
'@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts',
16+
'@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts',
17+
'@rari-capital/solmate/=lib/solmate/',
18+
'@base-contracts/=lib/base-contracts',
19+
'solady/=lib/solady/src/',
20+
'src/universal=lib/optimism/packages/contracts-bedrock/src/universal'
21+
]
22+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
DEPLOY_FIELDS='"baseFeeVaultRecipient","batchSenderAddress","controller","deployerAddress","finalSystemOwner","finalizationPeriodSeconds","gasPriceOracleOverhead","gasPriceOracleScalar","l1ChainID","l1FeeVaultRecipient","l2BlockTime","l2ChainID","l2OutputOracleChallenger","l2OutputOracleProposer","l2OutputOracleStartingBlockNumber","l2OutputOracleStartingTimestamp","l2OutputOracleSubmissionInterval","p2pSequencerAddress","portalGuardian","proxyAdminOwnerL2","sequencerFeeVaultRecipient"'
4+
5+
DEPLOY_CONFIG_FILE="inputs/deploy-config.json"
6+
MISC_CONFIG_FILE="inputs/misc-config.json"
7+
FOUNDRY_CONFIG_FILE="inputs/foundry-config.json"
8+
9+
# Convert field from hex to decimal
10+
VALUE=$(jq -r '.l2GenesisBlockGasLimit' "$DEPLOY_CONFIG_FILE")
11+
GAS_LIMIT=$(printf %d $VALUE)
12+
13+
# Construct config file which will be the input in deploy script
14+
jq -s '.[0] * .[1]' "$DEPLOY_CONFIG_FILE" "$MISC_CONFIG_FILE" | \
15+
jq "with_entries(select([.key] | inside([$DEPLOY_FIELDS])))" | \
16+
jq --arg l2GenesisBlockGasLimit $GAS_LIMIT '. + {l2GenesisBlockGasLimit: $l2GenesisBlockGasLimit | tonumber}' | \
17+
jq --sort-keys | \
18+
jq '{"deployConfig": .}' > "$FOUNDRY_CONFIG_FILE"

mainnet/2024-04-30-deployTempERC20Factory/inputs/deploy-config.json

Whitespace-only changes.

mainnet/2024-04-30-deployTempERC20Factory/inputs/misc-config.json

Whitespace-only changes.

mainnet/2024-04-30-deployTempERC20Factory/records/RunDeployERC20Factory.sol/8453/run-1714483769.json

+79
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
// SPDX-License-Identifier: MIT
3+
pragma solidity 0.8.15;
4+
5+
import "forge-std/Script.sol";
6+
import {ERC20Factory} from "../src/ERC20Factory.sol";
7+
8+
contract RunERC20FactoryDeploy is Script {
9+
function run() public {
10+
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
11+
vm.startBroadcast(deployerPrivateKey);
12+
new ERC20Factory{salt: '0xBA5ED'}();
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.15;
3+
4+
import {OptimismMintableERC20Factory} from "@eth-optimism-bedrock/src/universal/OptimismMintableERC20Factory.sol";
5+
6+
contract ERC20Factory is OptimismMintableERC20Factory {
7+
constructor() {
8+
initialize({ _bridge: address(0x4200000000000000000000000000000000000010 ) });
9+
}
10+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
OP_COMMIT=e6ef3a900c42c8722e72c2e2314027f85d12ced5
2+
BASE_CONTRACTS_COMMIT=c8e14388e478471411abb10f3a99ab3bd9206a95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
include ../../Makefile
2+
include ../.env
3+
include .env
4+
5+
##
6+
# Deploy command
7+
##
8+
.PHONY: deploy
9+
deploy:
10+
forge script RunERC20FactoryDeploy --rpc-url $(L2_RPC_URL) --broadcast --verify
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
[profile.default]
2+
src = 'src'
3+
out = 'out'
4+
libs = ['lib']
5+
broadcast = 'records'
6+
fs_permissions = [ {access = "read-write", path = "./"} ]
7+
optimizer = true
8+
optimizer_runs = 999999
9+
solc_version = "0.8.15"
10+
11+
# note 'src/universal=lib/optimism/packages/contracts-bedrock/src/universal' is needed
12+
# for relative paths in optimism repo to work
13+
remappings = [
14+
'@eth-optimism-bedrock/=lib/optimism/packages/contracts-bedrock/',
15+
'@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts',
16+
'@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts',
17+
'@rari-capital/solmate/=lib/solmate/',
18+
'@base-contracts/=lib/base-contracts',
19+
'solady/=lib/solady/src/',
20+
'src/universal=lib/optimism/packages/contracts-bedrock/src/universal'
21+
]
22+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
DEPLOY_FIELDS='"baseFeeVaultRecipient","batchSenderAddress","controller","deployerAddress","finalSystemOwner","finalizationPeriodSeconds","gasPriceOracleOverhead","gasPriceOracleScalar","l1ChainID","l1FeeVaultRecipient","l2BlockTime","l2ChainID","l2OutputOracleChallenger","l2OutputOracleProposer","l2OutputOracleStartingBlockNumber","l2OutputOracleStartingTimestamp","l2OutputOracleSubmissionInterval","p2pSequencerAddress","portalGuardian","proxyAdminOwnerL2","sequencerFeeVaultRecipient"'
4+
5+
DEPLOY_CONFIG_FILE="inputs/deploy-config.json"
6+
MISC_CONFIG_FILE="inputs/misc-config.json"
7+
FOUNDRY_CONFIG_FILE="inputs/foundry-config.json"
8+
9+
# Convert field from hex to decimal
10+
VALUE=$(jq -r '.l2GenesisBlockGasLimit' "$DEPLOY_CONFIG_FILE")
11+
GAS_LIMIT=$(printf %d $VALUE)
12+
13+
# Construct config file which will be the input in deploy script
14+
jq -s '.[0] * .[1]' "$DEPLOY_CONFIG_FILE" "$MISC_CONFIG_FILE" | \
15+
jq "with_entries(select([.key] | inside([$DEPLOY_FIELDS])))" | \
16+
jq --arg l2GenesisBlockGasLimit $GAS_LIMIT '. + {l2GenesisBlockGasLimit: $l2GenesisBlockGasLimit | tonumber}' | \
17+
jq --sort-keys | \
18+
jq '{"deployConfig": .}' > "$FOUNDRY_CONFIG_FILE"

sepolia/2024-04-30-deployTempERC20Factory/inputs/deploy-config.json

Whitespace-only changes.

sepolia/2024-04-30-deployTempERC20Factory/inputs/misc-config.json

Whitespace-only changes.

sepolia/2024-04-30-deployTempERC20Factory/records/RunDeployERC20Factory.sol/84532/run-1714484076.json

+79
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
// SPDX-License-Identifier: MIT
3+
pragma solidity 0.8.15;
4+
5+
import "forge-std/Script.sol";
6+
import {ERC20Factory} from "../src/ERC20Factory.sol";
7+
8+
contract RunERC20FactoryDeploy is Script {
9+
function run() public {
10+
uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
11+
vm.startBroadcast(deployerPrivateKey);
12+
new ERC20Factory{salt: '0xBA5ED'}();
13+
}
14+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// SPDX-License-Identifier: MIT
2+
pragma solidity 0.8.15;
3+
4+
import {OptimismMintableERC20Factory} from "@eth-optimism-bedrock/src/universal/OptimismMintableERC20Factory.sol";
5+
6+
contract ERC20Factory is OptimismMintableERC20Factory {
7+
constructor() {
8+
initialize({ _bridge: address(0x4200000000000000000000000000000000000010 ) });
9+
}
10+
}

0 commit comments

Comments
 (0)