Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
33 changes: 25 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,27 +188,44 @@ $ git add .gas-snapshot && git commit -m "commit new baseline gas snapshot"

## Deploy

To run the deploy, first, find the _Code Jar_ address, or deploy _Code Jar_ via:
### CodeJar

> [!IMPORTANT]
> Before deploying Quark, you must first deploy CodeJar. This step is crucial as the entire Quark system depends on deterministic addresses, all of which originate from CodeJar. CodeJar is the only contract deployed from an EOA, meaning the EOA's nonce determines CodeJar's deployment address. Always ensure CodeJar is deployed from the EOA's first transaction (nonce 0) to maintain address consistency.

To ensure CodeJar is deployed to the same address across all chains, follow these steps:
1. Update your Foundry to version[`nightly-36cbce7c78b56dd68359084a5d8b03f84efed8fb`](https://github.com/foundry-rs/foundry/releases/tag/nightly-36cbce7c78b56dd68359084a5d8b03f84efed8fb). This ensures consistent compiler settings, as different Foundry versions may use different settings under the hood.
2. Check out the correct release of Quark at [release-v2024-03-27+2249648](https://github.com/compound-finance/quark/releases/tag/release-v2024-03-27%2B2249648). This guarantees you're deploying a fixed version of CodeJar.
3. Set the following env variables:
```sh
./script/deploy-code-jar.sh
# Required
RPC_URL=
DEPLOYER_PK=
# Optional for verifying deployed contracts
ETHERSCAN_KEY=
```
4. Perform a dry run deployment to verify the CodeJar deployment address. Triple-check that this matches your expected address:

Then deploy Quark via:
```sh
set -a && source .env && ./script/deploy-code-jar.sh
```
5. Ensure your deployer account has sufficient gas, then execute the actual deployment:

```sh
CODE_JAR=... ./script/deploy-quark.sh
set -a && source .env && ./script/deploy-code-jar.sh --broadcast
```

To actually deploy contracts on-chain, the following env variables need to be set:
### Quark

To run the deploy, we need to ensure that Code Jar is already deployed on the chain. Once it has been, set the following env variables:

```sh
# Required
RPC_URL=
DEPLOYER_PK=
CODE_JAR=
# Optional for verifying deployed contracts
ETHERSCAN_KEY=
CODE_JAR=
```

Once the env variables are defined, run the following command:
Expand All @@ -219,15 +236,15 @@ set -a && source .env && ./script/deploy-quark.sh --broadcast

## CodeJar Deployments

Using artifacts from [release-v2024-03-27+2249648](https://github.com/compound-finance/quark/releases/tag/release-v2024-03-27%2B2249648).

| Network | CodeJar Address |
| ----------------- | ------------------------------------------ |
| Mainnet | 0x2b68764bCfE9fCD8d5a30a281F141f69b69Ae3C8 |
| Base | 0x2b68764bCfE9fCD8d5a30a281F141f69b69Ae3C8 |
| Sepolia | 0x2b68764bCfE9fCD8d5a30a281F141f69b69Ae3C8 |
| Arbitrum | 0x2b68764bCfE9fCD8d5a30a281F141f69b69Ae3C8 |
| Optimism | 0x2b68764bCfE9fCD8d5a30a281F141f69b69Ae3C8 |
| World Chain | 0x2b68764bCfE9fCD8d5a30a281F141f69b69Ae3C8 |
| Unichain | Pending |
| Polygon | Pending |
| Scroll | Pending |
| Base Sepolia | 0x2b68764bCfE9fCD8d5a30a281F141f69b69Ae3C8 |
Expand Down
3 changes: 2 additions & 1 deletion script/deploy-code-jar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ else
wallet_args="--unlocked"
fi

if [ -n "$ETHERSCAN_KEY" ]; then
# During a dry-run (without the `broadcast` flag), verification should be turned off
if [[ "$*" == *"--broadcast"* ]] && [ -n "$ETHERSCAN_KEY" ]; then
etherscan_args="--verify --etherscan-api-key $ETHERSCAN_KEY"
else
etherscan_args=""
Expand Down
Loading