Skip to content

Commit

Permalink
working mainnet deploy with instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
zfogg committed Oct 21, 2022
1 parent 7d5048d commit 4bb2c15
Show file tree
Hide file tree
Showing 100 changed files with 27,120 additions and 52 deletions.
3 changes: 3 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ export ETHERSCAN_API_KEY=
# String of 12 or 24 words
export MNEMONIC_LOCALHOST=''
export MNEMONIC_GOERLI=''
export MNEMONIC_SEPOLIA=''

# Private key starting with 0x
export DEPLOY_KEY_MAINNET=

export TREASURY=0x3dFc49e5112005179Da613BdE5973229082dAc35
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ reports/
mnemonic*.txt
.env
.rgignore
artifacts/build-info
artifacts/**/*.dbg.json
deployments/localhost
87 changes: 87 additions & 0 deletions DEPLOY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
## How to deploy and setup veBAO


## Setup

Copy .env.example to .env and fix it up.

Install the *hh* -- hardhat-shorthand executable to your path.

1. `npm install --global hardhat-shorthand`
1. `hardhat-completion install`, then `exec $SHELL` and now you can tab-complete the `hh` command


## Tutorial

Run an anvil fork of mainnet to give hardhat a working `--network localhost`!


### Step 1 - Deploy all the contracts:

* Run `hh --network localhost deploy` and confirm all contracts get deployed to your mainnet fork.


### Step 2 - Fund the distribution and swapper contracts

The Distribution contract gets the total amount of locked BAO in BAOv2 tokens,
reduced by a factor of 1000. The Swapper contract gets the circulating supply
of BAO as BAOv2 tokens, reduced by a factor of 1000.

TODO: these numbers are rough estimates :).

1. `hh bao:ERC20BAO:transfer --from deployer --to BaoDistribution --amount 922240000000000000000000000`
2. `hh bao:ERC20BAO:transfer --from deployer --to Swapper --amount 168740000000000000000000000`


### Step 3 - Setup the BAOv2 token

Set the minter as the minter contract and change the admin.

1. `hh bao:ERC20BAO:changeOwner --admin $TREASURY # calls set_minter and then set_admin`


### Step 4 - Setup the Voting Escrow token

Commit then apply the smart wallet checker, the distribution contract, and
the ownership of the VE token.

1. `hh bao:VotingEscrow:changeOwner --admin $TREASURY`


### Step 5 - Setup the GaugeController:

Add new gauge types (one for crypto, one for stable), add existing gauges to
controller, and transfer ownership to admin.

TODO: figure out the weights forreal. I think the numbers are wrong!

1. `hh bao:GaugeController:addGaugeType --name 'Ethereum Stable' --weight 500 # This becomes "--type 0"`
2. `hh bao:GaugeController:addGaugeType --name 'Ethereum Crypto' --weight 500 # This becomes "--type 1"`
3. `hh bao:GaugeController:addGauge --type 0 --weight 500 --gauge baoUSD-3CRV`
4. `hh bao:GaugeController:addGauge --type 0 --weight 375 --gauge bSTBL-DAI`
5. `hh bao:GaugeController:addGauge --type 1 --weight 125 --gauge BAO-ETH`
6. `hh bao:GaugeController:changeOwner --admin $TREASURY`


### Step 6 - Setup the FeeDistributor

Transfer ownership from the deployer to the treasury. commit_admin and
apply_admin.

1. `hh bao:FeeDistributor:changeOwner --admin $TREASURY`


### Step 7 - Setup the BaseBurner

Transfer ownership from deployer to treasury, set emergency recovery address.

1. `hh bao:BaseBurner:changeOwner --admin $TREASURY --emergency $TREASURY --recovery $TREASURY`


### Step 8 - Setup the Gauges (LiquidityGaugeV3)

Transfer ownership from the deployer to the treasury.

1. `hh bao:LiquidityGaugeV3:changeOwner --admin $TREASURY --gauge bSTBL-DAI`
2. `hh bao:LiquidityGaugeV3:changeOwner --admin $TREASURY --gauge BAO-ETH`
3. `hh bao:LiquidityGaugeV3:changeOwner --admin $TREASURY --gauge baoUSD-3CRV`
Loading

0 comments on commit 4bb2c15

Please sign in to comment.