Skip to content

Commit

Permalink
Merge pull request #14 from yearn/script
Browse files Browse the repository at this point in the history
build: deployment script
  • Loading branch information
Schlagonia authored Jul 2, 2024
2 parents b0eda47 + 111d125 commit edc1d3d
Show file tree
Hide file tree
Showing 17 changed files with 38,764 additions and 8 deletions.
13 changes: 7 additions & 6 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
ETH_RPC_URL=
AVAX_RPC_URL=https://api.avax.network/ext/bc/C/rpc
FTM_RPC_URL=https://rpcapi.fantom.network
ARBI_RPC_URL=https://arb1.arbitrum.io/rpc
GC_RPC_URL=https://xdai.poanetwork.dev
BSC_RPC_URL=https://bsc-dataseed.binance.org
MATIC_RPC_URL=
L2_RPC_URL=
ROLLUP_ID=
L2_DEPLOYER=0x0000000000000000000000000000000000000000
L2_ADMIN=
L2_RISK_MANAGER=
L2_ESCROW_MANAGER=
L1_ESCROW_MANAGER=
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ out/
!/broadcast
/broadcast/*/31337/
/broadcast/**/dry-run/
broadcast/

# Docs
docs/
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ trace-contract :; forge test -vvv --match-contract $(contract) --fork-url ${FOR
test-test :; forge test -vv --match-test $(test) --fork-url ${FORK_URL}
trace-test :; forge test -vvv --match-test $(test) --fork-url ${FORK_URL}

script :; forge script script/${script} --rpc-url ${FORK_URL} --broadcast -vvv
register :; forge script scripts/RegisterRollup.s.sol:RegisterRollup --account ${account} --sender ${sender} --ffi --broadcast -vvv

coverage :; forge coverage -vv --fork-url ${FORK_URL}
snapshot :; forge snapshot --fork-url ${FORK_URL}
Expand Down
55 changes: 55 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,61 @@

- Allows for permissionless rebalance's based on the `minimumBuffer`.


# Deployments


**L1 Deployer**: `0x1316a3312CfF738aDCBF011bCE9D1e7B9C88C817`
**STB Role Manager**: `0x51b76329d2C6b8974053C9655484e231f7dcd418`


In order to integrate your Polygon CDK chain with STB you will need to

1. Deploy an `L2Deployer` on your rollup.
2. Register the rollup and the L2 Deployer address with the L1 Deployer.

Once done it is permsissionless for anyone to use the STB to bridge from mainnet to your rollup.

There is a pre-built [script](https://github.com/yearn/yearn-stb/blob/master/scripts/RegisterRollup.s.sol) that can be run from this repo in order to complete the full setup.

**NOTE**: The script assumes the rollups `admin` on the L1 is a Gnosis Safe and the private key input maps to either a singer or a delegate of that safe in order to post the txn that registers the rollup.

```shell
$ git clone --recursive https://github.com/yearn/yearn-stb

$ cd yearn-stb

$ cp .env.example .env
```

Fill in the full .env with your specific rollup RPC, Polygon CDK based rollup ID, and the desired addresses.

**NOTE**: To deploy a L2 Deployer during the script leave the `L2_DEPLOYER` variable as address(0). If one is already deployed, insert the address in that variable to not re-deploy.

To just deploy the L2 Deployer and not send the registerRollup Safe txn put 0 as the `ROLLUP_ID`.

If you have not added a keystore private key to foundry before add your address to use

```shell
$ cast wallet import --interactive <wallet_name>
```

Run the script
```shell
$ make register account=<wallet_name> sender=<wallet_address>
```

If successful the txn will both deploy the L2 Deployer on the specified rollup and post a Safe txn to register the Rollup in the L1 Deployer.


### Verification

The L2 Deployer will deploy 3 other implementation contracts with it when deployed.

You can find the flatten version of all contracts deployed on the L2 in the repo https://github.com/yearn/yearn-stb/tree/master/flat

The encoded constructor arguments used for the L2 deployer should be logged in the console on deployment as well.

## Foundry Documentation

https://book.getfoundry.sh/
Expand Down
Loading

0 comments on commit edc1d3d

Please sign in to comment.