Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add mainnet, testnet, dev migrations #842

Merged
merged 17 commits into from
Dec 4, 2023
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/coverage-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ jobs:
"*scripts*" \
"src/dollar/mocks/*" \
"src/dollar/utils/*" \
"src/old/*" \
rndquu marked this conversation as resolved.
Show resolved Hide resolved
"test/*" \

# Generate summary
Expand Down Expand Up @@ -92,6 +93,7 @@ jobs:
"*scripts*" \
"src/dollar/mocks/*" \
"src/dollar/utils/*" \
"src/old/*" \
rndquu marked this conversation as resolved.
Show resolved Hide resolved
"test/*" \

# Generate summary
Expand Down
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,15 @@ contracts/dollar/tasks/library/distributor/fixtures/operators.json
fixtures/abi/types/
dist/
fixtures/contracts-addresses/*

# Ignore all transaction logs except:
# - latest development log
# - mainnet logs
# - sepolia testnet logs
packages/contracts/broadcast/*/*/*
!packages/contracts/broadcast/**/run-latest.json
!packages/contracts/broadcast/**/1/*
!packages/contracts/broadcast/**/11155111/*

.yarn
.yarn/*
Expand Down
31 changes: 23 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,28 @@ yarn workspace @ubiquity/dapp start # Run the application at http://localhost:30

## Deploying Contracts (Ubiquity Dollar Core)

In two separate terminals run the following commands:
You need to create a new `.env` file and set all necessary env variables, example:
```
# Admin private key (grants access to restricted contracts methods).
# By default set to the private key from the 0x70997970c51812dc3a010c7d01b50e0d17dc79c8 address
# which is the 2nd address derived from test mnemonic "test test test test test test test test test test test junk".
ADMIN_PRIVATE_KEY="0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"

# Owner private key (grants access to updating Diamond facets and setting TWAP oracle address).
# By default set to the private key from the 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 address
# which is the 1st address derived from test mnemonic "test test test test test test test test test test test junk".
OWNER_PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"

# RPC URL (used in contract migrations)
# - anvil: http://127.0.0.1:8545
# - testnet: https://ethereum-sepolia.publicnode.com
# - mainnet: https://eth.ubq.fi/v1/mainnet
RPC_URL="http://127.0.0.1:8545"
```

The `.env.example` file is pre-populated with the recommend environment variables.

Then in two separate terminals run the following commands:

```sh
yarn workspace @ubiquity/contracts start:anvil # starts the anvil testnet
Expand All @@ -70,13 +91,7 @@ yarn workspace @ubiquity/contracts start:anvil # starts the anvil testnet
yarn workspace @ubiquity/contracts deploy:development # deploys the contracts to the anvil testnet
```

You need to create `.env` file inside the contracts folder with `PRIVATE_KEY`, `PUBLIC_KEY`, `MNEMONIC`, and `CURVE_WHALE` all filled. `PRIVATE_KEY` will be used to deploy locally and the matching `PUBLIC_KEY` will be the admin on all the smart contracts. `MNEMONIC` is used when launching Anvil and will ensure your `PUBLIC_KEY` account is funded.

The `.env.example` is pre-populated with the recommend test `MNEMONIC`, test `PRIVATE_KEY`, and test `PUBLIC_KEY`.

If successful it will show a readout of accounts generated from `MNEMONIC` and the port it's listening on.

This will first impersonate the `CURVE_WHALE` and transfer some tokens so we can create a UbiquityDollar/3CRV pool, and then it will deploy the Ubiquity Dollar core protocol via a series of Solidity scripts via Forge.
If successful it will show a readout of accounts generated from the test mnemonic (`test test test test test test test test test test test junk`) and the port it's listening on.

## MetaMask Development Wallet Setup
### Shared Private Keys for Development
Expand Down
15 changes: 14 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
{
"version": "0.2",
"ignorePaths": ["**/*.json", "**/*.log", "**/*.svg", "**/*.lock", "**/lib/*", "**/interfaces/*", "**/dist/*", "**/cspell.json", "**/node_modules/**"],
"ignorePaths": [
"**/*.json",
"**/*.log",
"**/*.svg",
"**/*.lock",
"**/lib/*",
"**/interfaces/*",
"**/dist/*",
"**/cspell.json",
"**/node_modules/**",
"packages/contracts/src/old/*",
"packages/contracts/migrations/development/Deploy002_Governance.s.sol",
"packages/contracts/migrations/mainnet/Deploy002_Governance.s.sol"
],
"readonly": true,
"useGitignore": true,
"enableFiletypes": ["solidity"],
Expand Down
32 changes: 15 additions & 17 deletions packages/contracts/.env.example
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
# Private key for deployer account
PRIVATE_KEY= "0x4454691749f69f1224e443731757b75005d0335d38cd3900d7f74e64625c6091"

# Public key for deployer account
PUBLIC_KEY= "0xa18E35a6E821AaDC80AFD132FFa72879f999F2fc"

# Used to verify contracts on etherscan. This is optional
ETHERSCAN_API_KEY=

# Mnemonic for deployer account
MNEMONIC = "upset concert service toy elephant spoil gun yellow girl provide click beauty"

# Holder of 3CRV tokens
CURVE_WHALE = "0x4486083589A063ddEF47EE2E4467B5236C508fDe"

# 3CRV Token address
USD3CRV_TOKEN = "0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490"
# Admin private key (grants access to restricted contracts methods).
# By default set to the private key from the 0x70997970c51812dc3a010c7d01b50e0d17dc79c8 address
# which is the 2nd address derived from test mnemonic "test test test test test test test test test test test junk".
ADMIN_PRIVATE_KEY="0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d"

# Owner private key (grants access to updating Diamond facets and setting TWAP oracle address).
# By default set to the private key from the 0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 address
# which is the 1st address derived from test mnemonic "test test test test test test test test test test test junk".
OWNER_PRIVATE_KEY="0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"

# RPC URL (used in contract migrations)
# - anvil: http://127.0.0.1:8545
# - testnet: https://ethereum-sepolia.publicnode.com
# - mainnet: https://eth.ubq.fi/v1/mainnet
RPC_URL="http://127.0.0.1:8545"
Loading
Loading