Skip to content

Latest commit

 

History

History
113 lines (73 loc) · 5.51 KB

DEPLOYMENT.md

File metadata and controls

113 lines (73 loc) · 5.51 KB

Deployment

Vanilla v1.1 contracts have been deployed already in following public networks:

Mainnet

Contracts in mainnet are owned by the Vanilla DAO, a Gnosis Safe multi-sig, deployed at 0xa135f339B5acd1f4eCB1C6eEd69a31482f878545.

Rinkeby

Contracts in Rinkeby are owned by a Gnosis Safe multi-sig, deployed at 0xEA7E95b1A49Fbb472Ad2c0a3000DFF9e40Ec5184

Configuration

Deployment is configured by the network config in hardhat.config.ts. However, it is parametrized by environment variables via .secrets.env file, so usually that's the only place which needs changes if deploying to pre-configured networks (including the local mainnet fork).

  1. Copy .secrets.env.example to .secrets.env and add in your keys. Never commit your keys to version control, which is why .secrets.env is .gitignored.
  2. Alternatively, you can override the .secrets.env environment variables the way you prefer.

We use dotenv-package for reading the environment variables from the file.

Deploy contracts to a local mainnet fork

Set the ALCHEMY_MAINNET_APIKEY in .secrets.env and execute:

pnpm run node:mainnet-fork

which starts a localhost node, which acts like a mainnet node during deployment. Other archive node providers for mainnet forks (Infura etc) are not currently supported.

Be aware that while mainnet fork lets you freely modify the mainnet state locally, the state-changing operations in mainnet VanillaV1Safelist01- and VanillaV1MigrationState -contracts require multisig approval which cannot currently be done fully locally because they rely on publicly available Gnosis Safe Transaction services. Therefore they should not be attempted.

Running the local mainnet fork in a Docker container

There is Dockerfile to build an image to run a containerized Hardhat testnet with Vanilla contracts deployed on it.

To build and run it, execute the following commands (podman works too):

docker build -t local-vanilla-mainnet-fork .
docker run --rm -d --env-file .secrets.env -p 8545:8545 local-vanilla-mainnet-fork

Alternatively, you can use docker-compose (see docker-compose.yml):

docker-compose up -d

Get a list of local test accounts

By default, Hardhat creates a list of accounts with Ether for local testing. To import them into Metamask the private keys are needed, and there's a helper command for fetching them:

pnpm run node:test-accounts

Deploy contracts to Goerli

Set the ALCHEMY_GOERLI_APIKEY and GOERLI_DEPLOYER_PRIVATE_KEY in .secrets.env and execute:

pnpm run deploy:goerli

Deploy contracts to Ropsten

Set the ALCHEMY_ROPSTEN_APIKEY and ROPSTEN_DEPLOYER_PRIVATE_KEY in .secrets.env and execute:

pnpm run deploy:ropsten

Deploy contracts to Rinkeby

Set the ALCHEMY_RINKEBY_APIKEY, RINKEBY_DEPLOYER_HDPATH and RINKEBY_DEPLOYER_ADDRESS in .secrets.env and execute:

pnpm run deploy:rinkeby

Sign the transactions locally in your wallet, then proceed to gather required signatures and execute the transactions using multi-sig in RINKEBY_DEPLOYER_ADDRESS. Meanwhile, do not abort the above command - once the multi-sig executes the deployment transaction, the command will save the deployment artifacts to deployments/rinkeby- directory and exit normally.

Deploy contracts to Mainnet

Set the ALCHEMY_MAINNET_APIKEY, MAINNET_DEPLOYER_HDPATH and MAINNET_DEPLOYER_ADDRESS in .secrets.env and execute:

pnpx hardhat --network mainnet deploy

Sign the transactions locally in your wallet, then proceed to gather required signatures and execute the transactions using multi-sig in MAINNET_DEPLOYER_ADDRESS. Meanwhile, do not abort the above command - once the multi-sig executes the deployment transaction, the command will save the deployment artifacts to deployments/mainnet- directory and exit normally.

Deployment verification

Quickest way to sanity-test the deployment is to execute the following Hardhat task in the network, and compare it to the block number of the deployment transaction:

pnpx hardhat --network <network_name> check-epoch