-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(scratch deploy): mvp of local scratch deployment
- Loading branch information
Showing
21 changed files
with
356 additions
and
438 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,35 @@ | ||
# Deploy Lido protocol from scratch | ||
|
||
**NB**: at the moment the deployment from scratch scripts and manual target Lido V1 version (before Lido V2 upgrade) and is not working | ||
|
||
Video guide: [youtube](https://www.youtube.com/watch?v=dCMXcfglJv0) | ||
|
||
## Requirements | ||
|
||
* shell - bash or zsh | ||
* docker | ||
* node.js v14 | ||
* node.js v16 | ||
* yarn | ||
|
||
## Environment | ||
|
||
You will need at least: | ||
|
||
* Ethereum node | ||
* IPFS node | ||
* Aragon web client | ||
|
||
In case of local deploy this environment is set up with docker. | ||
|
||
> Note: Lido protocol is based on Aragon framework, so the entire Aragon framework environment is required for deployment. | ||
## DAO configuration | ||
|
||
Dao config is stored in `deployed-{NETWORK_NAME}.json` file, where `{NETWORK_NAME}` is network name of your choice. See the [`deployed-local-defaults.json`](deployed-local-defaults.json) for basic parameters. Please refer to [`deployed-mainnet.json`](deployed-mainnet.json) for currently deployed Mainnet version of DAO. | ||
## Local deployment | ||
|
||
Copy `deployed-local-defaults.json` to `deployed-{NETWORK_NAME}.json` (e.g. `deployed-kintsugi.json`) and update it accordingly . | ||
Deploys the DAO to local (http://127.0.0.1:8545) dev node (anvil, hardhat, ganache). | ||
The deployment is done from default test account `0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266`. | ||
The node must be configured with the default test accounts derived from mnemonic `test test test test test test test test test test test junk`. | ||
|
||
## Network configuration | ||
1. Run `yarn install` (get sure repo dependencies are installed) | ||
2. Run the node on default port 8545 (for the commands see subsections below) | ||
3. Set test account private key `0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80` to `accounts.json` under `/eth/local` like `"local": ["<private key>"]` | ||
4. Run the deploy script `bash dao-local-deploy.sh` from root repo directory | ||
5. Check out the deploy artifacts in `deployed-local.json` | ||
|
||
Add to [`hardhat.config.js`](hardhat.config.js) your network connection parameter (inside the `getNetConfig` function, use `mainnet` or `local` as reference). | ||
### Anvil | ||
|
||
## Deploy process | ||
Run the node with command: | ||
|
||
> Note: all deploy process is depend of ENS contract. If the target network has one, you can use it. In this case, write it directly to the `deployed-{NETWORK_NAME}.json` file. Otherwise, own ENS contract will be deployed. | ||
> Note: ETH2 Deposit contract is required. If the target network has one, you must use it. In this case, write it directly to the `deployed-{NETWORK_NAME}.json` file. Otherwise, own Deposit contract will be deployed. | ||
Steps for deploy: | ||
|
||
* [ ] run environment docker containers | ||
* [ ] set up network config | ||
* [ ] prepare DAO config file | ||
* [ ] deploy Aragon framework environment (including ENS) | ||
* [ ] build and deploy standard Aragon apps (contracts and frontend files) | ||
* [ ] deploy Deposit contract (if necessary) | ||
* [ ] deploy Lido DAO template contract | ||
* [ ] deploy Lido Apps contract implementations | ||
* [ ] register Lido APM name in ENS | ||
* [ ] build Lido Apps frontend files and upload it to IPFS | ||
* [ ] deploy Lido APM contract (via Lido Template) | ||
* [ ] deploy Lido Apps repo contracts (via Lido Template) | ||
* [ ] deploy Lido DAO contract (via Lido Template) | ||
* [ ] issue DAO tokens (via Lido Template) | ||
* [ ] deploy LidoExecutionLayerRewardsVault | ||
* [ ] finalize DAO setup (via Lido Template) | ||
* [ ] deploy CompositePostRebaseBeaconReceiver | ||
* [ ] deploy Burner | ||
* [ ] make final deployed DAO check via script | ||
* [ ] open and check Lido DAO web interface (via Aragon client) | ||
|
||
All steps are automated via shell script [`dao-local-deploy.sh`](dao-local-deploy.sh) for local deploy process. The script be modified for any other network: | ||
|
||
So, one-click local deploy from scratch command is: | ||
|
||
```bash | ||
./dao-local-deploy.sh | ||
```shell | ||
anvil -p 8545 --auto-impersonate --gas-price 0 --base-fee 0 --chain-id 1337 --mnemonic "test test test test test test test test test test test junk" | ||
``` | ||
|
||
> Note: some steps require manually updating some transaction hashes in the `deployed-{NETWORK_NAME}.json` file. The script will pause the process in this case, please follow the script tips. | ||
### Hardhat node | ||
|
||
## Aragon dependency issue | ||
> NB: Hardhat node is configured in `hardhat.config.js` under `hardhat: { `. | ||
`ipfs-http-client` version has been strictly pinned to `43.0.0` in [this commit](https://github.com/lidofinance/lido-dao/commit/38bf0232fbc59ec6d69d27e170e3e75cfbe1ba11) because `/scripts/multisig/04-publish-app-frontends.js` used to crash at | ||
```javascript | ||
const rootCid = await uploadDirToIpfs({ dirPath: distPath, ipfsApiUrl: ipfsAPI }) | ||
To run hardhat node execute: | ||
```shell | ||
yarn hardhat node | ||
``` | ||
|
||
It appeared that `@aragon/buidler-aragon@npm:^0.2.9` uses `ipfs-http-client`. | ||
|
||
`ipfs-http-client` has a brittle API. Neither `41.0.0` nor `50.0.0` versions of it will work with `@aragon/buidler-aragon@npm:^0.2.9`. |
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.