Skip to content

Commit

Permalink
build: deploy scripts added
Browse files Browse the repository at this point in the history
  • Loading branch information
0xCooki committed Oct 22, 2024
1 parent 8c64750 commit f63dd65
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 5 deletions.
10 changes: 5 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ GAS_LIMIT_FOR_PUSHING=300000
L2_PROXY_ADMIN_ADDRESS=
L2_OPTIMISM_MESSENGER=0x4200000000000000000000000000000000000007
GUARDIAN_ADDRESS=0x0000000000000000000000000000000000000000
TOKEN_RATE_OUTDATED_DELAY=86400
MAX_ALLOWED_L2_TO_L1_CLOCK_LAG=172800
MAX_ALLOWED_TOKEN_RATE_DEVIATION_PER_DAY_BP=500
OLDEST_RATE_ALLOWED_IN_PAUSE_TIME_SPAN=86400
MIN_TIME_BETWEEN_TOKEN_RATE_UPDATES=3600
RATE_OUTDATED_DELAY=86400
MAX_L2_TO_L1_CLOCK_LAG=172800
MAX_TOKEN_RATE_DEVIATION_PER_DAY_BP=500
OLDEST_RATE_IN_PAUSE_TIME_SPAN=86400
MIN_TIME_BETWEEN_RATE_UPDATES=3600
TOKEN_RATE=1000368694572477596000000000
DELAY=0
GRACE_PERIOD=86400
Expand Down
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,38 @@ To run the deployment of the ERC20 token gateway for the Ethereum <-> Optimism c
npm run optimism:deploy
```

### Deploying all L1 and L2 Contracts with Foundry

Follow these steps to deploy both the wstETH and stETH Lido bridges from scratch to a new Optimism L2.

1. Run forge build:

```bash
npm run forge:build
```

2. Enter the env variables under `Forge Deployment Scripts`

Note: there are some duplicates to the scripts provided for the Hardhat test, but have been collated for ease of use.

3. Run local tests

```bash
npm run forge:test
```

4. Deploy L1 contracts

```bash
npm run forge:deployL1
```

4. Deploy L2 contracts

```bash
npm run forge:deployL2
```

## Tests running

### Unit tests
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
"compile:force": "hardhat compile --force",
"coverage": "hardhat coverage --testfiles './test/**/*.unit.test.ts'",
"forge:build": "forge build --ast",
"forge:test": "forge test -vvv",
"forge:deployL1": "node scripts/forge/node/deployL1.js",
"forge:deployL2": "node scripts/forge/node/deployL2.js",
"fork:eth:mainnet": "hardhat node:fork eth_mainnet 8545",
"fork:eth:sepolia": "hardhat node:fork eth_sepolia 8545",
"fork:opt:sepolia": "hardhat node:fork opt_sepolia 9545",
Expand Down
9 changes: 9 additions & 0 deletions scripts/forge/node/deployL1.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require("dotenv").config();
const { execSync } = require("child_process");

const privateKey = process.env.DEPLOYER_PRIVATE_KEY;
const rpcUrl = process.env.L1_RPC_URL;
const etherscanApiKey = process.env.ETHERSCAN_API_KEY_ETH;

const command = `forge script scripts/forge/DeployL1Contracts.s.sol:DeployL1Contracts --private-key ${privateKey} --rpc-url ${rpcUrl} --broadcast --verify --etherscan-api-key ${etherscanApiKey} -vvvv`;
execSync(command, { stdio: "inherit" });
9 changes: 9 additions & 0 deletions scripts/forge/node/deployL2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
require("dotenv").config();
const { execSync } = require("child_process");

const privateKey = process.env.DEPLOYER_PRIVATE_KEY;
const rpcUrl = process.env.L2_RPC_URL;
const etherscanApiKey = process.env.OPTIMISM_API_KEY_ETH;

const command = `forge script scripts/forge/DeployL2Contracts.s.sol:DeployL2Contracts --private-key ${privateKey} --rpc-url ${rpcUrl} --broadcast --verify --etherscan-api-key ${etherscanApiKey} -vvvv`;
execSync(command, { stdio: "inherit" });

0 comments on commit f63dd65

Please sign in to comment.