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

Deploy Arbitrum goerli for usdc native #778

Merged
merged 69 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
da0ad1d
initial gen
Jun 15, 2023
85d36ac
remove files
Jun 15, 2023
e99ba23
rename directory
Jun 15, 2023
fe6b3ae
add scenario
Jun 16, 2023
5408bf6
upadte deploy script
Jun 16, 2023
0bd02f6
renamde to usdc.n
Jun 16, 2023
99c818e
added relations for scenario test
Jun 16, 2023
30d466d
add scenario test to CI
Jun 16, 2023
b3a390c
add migration scrtips, but just changed the USDC reference address
Jun 16, 2023
2d235b1
update migration script
Jun 16, 2023
1280722
since it's native, we shouldn't need usdc bridge things in migration
Jun 20, 2023
d560aff
try to fix the liquidator scenario errors
Jun 21, 2023
08a59e3
intent
Jun 21, 2023
b82927f
change those to be 0 initially
Jun 21, 2023
c5aa0b1
FINALLY scneario passed :D
Jun 21, 2023
83b1fa3
don't re-deploy bulker
Jun 21, 2023
683d3e9
set a number in configuration to make bulker tests pass
Jun 22, 2023
f004ab7
set configuration to 0 supply cap for initialization, although it wil…
Jun 22, 2023
a3758d3
update liquidity pool to use the one with better liquidity
Jun 23, 2023
5fb1983
after new pool use better liquidity, now able to bump up the volume
Jun 23, 2023
ef41f19
remove v2 rewards config step, crank down borrowMin
Jun 23, 2023
73daf84
update migration description
Jun 23, 2023
c6eb45e
remove trailing newline
Jun 23, 2023
d688778
ok need to referencing existing rewards in deploy script to share the…
Jun 23, 2023
2d9799f
naming changes
Jun 23, 2023
c7edc0a
added cctp contracts address to roots and update relayArbitrummessage
Jun 28, 2023
fbe0e75
add l2 cctp
Jun 28, 2023
204752c
depositForBurn() to use CCTP to send native USDC to arbitrum comet
Jun 28, 2023
d2dce36
finally relayArbitrum works with CCTP
Jun 29, 2023
725491c
format
Jun 29, 2023
cac6f67
update to turn off bridge market's reward speed
Jun 30, 2023
a9fb9f4
fix scenarios and slightly reduced volume in liquidator scenarios (so…
Jul 3, 2023
fedabb7
now it has just enough liquidity to pass the test, reverted the liqui…
Jul 5, 2023
e458bd5
address comments: remove network prefixes, move contract import from …
Jul 6, 2023
81e4d19
remove network prefixes, and rename bridgeComet to usdceComet
Jul 6, 2023
2d9b6dc
rename/refactor usdc -> usdc.e, and usdc.n -> usdc. Also rename deply…
Jul 6, 2023
ff5ba1d
luckily by the time of testing now Jul 6th 1:40PM PST, we have enough…
Jul 6, 2023
7a9e2e4
rename usdc.n to usdc
Jul 6, 2023
9b83fc8
make yarn lint happy
Jul 6, 2023
8737d19
rename bridged version to .e to match with mainnet
Jul 11, 2023
7d1e5b4
Merge remote-tracking branch 'origin/main' into hans/arbitrum-goerli-…
Jul 11, 2023
34f7211
ported changes to testnet
Jul 12, 2023
5113ccf
Merge remote-tracking branch 'origin/main' into hans/arbitrum-usdc-na…
Jul 12, 2023
fa676f9
Merge remote-tracking branch 'origin/hans/arbitrum-usdc-native' into …
Jul 12, 2023
d58faf5
update on workflow
Jul 12, 2023
87f96e1
hmm the error is gone
Jul 12, 2023
34807af
change default supply reward speed on new comet to be 0
Jul 12, 2023
e440e65
Merge remote-tracking branch 'origin/hans/arbitrum-usdc-native' into …
Jul 12, 2023
7c36a3e
move migration steps out of this branch
Jul 12, 2023
6e5f7ce
add readme.md to corner cases when deploy new market on the chain wit…
Jul 13, 2023
d7e9c68
add line
Jul 13, 2023
820ca61
removed USDC in relations
Jul 13, 2023
53abdcf
update version to unblock deploy workerflow for now
Jul 13, 2023
a19b2e8
use dummy requested_network id
Jul 13, 2023
38283c4
try arbitrum goerli network id right away
Jul 13, 2023
2c30300
change a bit on how it locates the hardhat config base
Jul 13, 2023
c7c0730
remove hardcoded network chain-id
Jul 13, 2023
8ed6cdb
no more manual wallet project id input
Jul 13, 2023
b1a44d0
use env.GOV_NETWORK
Jul 13, 2023
960ecf2
GOV_NETWORK got some errors :[
Jul 13, 2023
fcfc0ab
try this seacrest with fixes
Jul 14, 2023
3e4029a
try new seacrest :D
Jul 14, 2023
55c38eb
Modified deployment roots from GitHub Actions
Jul 14, 2023
f91789b
Migrate Arbitrum Goerli Native usdc (#779)
cwang25 Jul 18, 2023
9991a99
Merge remote-tracking branch 'origin' into hans/arbitrum-goerli-nativ…
Jul 18, 2023
14507ab
Merge remote-tracking branch 'origin/hans/arbitrum-goerli-native-usdc…
Jul 18, 2023
c2924e9
Merge remote-tracking branch 'origin/hans/arbitrum-usdc-native' into …
Jul 18, 2023
6d84f7e
removed asdf config file that should've been ignored
Jul 18, 2023
416ad10
add native usdc whale for arbitrum goerli
Jul 18, 2023
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: 1 addition & 1 deletion .github/workflows/run-scenarios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
strategy:
fail-fast: false
matrix:
bases: [ development, mainnet, mainnet-weth, goerli, goerli-weth, fuji, mumbai, polygon, arbitrum-usdc.e, arbitrum-usdc, arbitrum-goerli, base-goerli, base-goerli-weth, linea-goerli]
bases: [ development, mainnet, mainnet-weth, goerli, goerli-weth, fuji, mumbai, polygon, arbitrum-usdc.e, arbitrum-usdc, arbitrum-goerli-usdc, arbitrum-goerli-usdc.e, base-goerli, base-goerli-weth, linea-goerli]
name: Run scenarios
env:
ETHERSCAN_KEY: ${{ secrets.ETHERSCAN_KEY }}
Expand Down
15 changes: 10 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,11 +232,16 @@ These simulations are extremely useful for testing deployments before actually c

#### Deploy Workflow

0. Create the deployment script and configuration file, and test locally
1. Open a PR containing the new deployment directory files
2. Trigger the `deploy-market` workflow action through the GitHub UI
3. Inspect the new `roots.json` which the workflow automatically commited to your PR
4. Start using the new protocol deployment and/or create further migrations to modify it
1. Create the deployment script and configuration file, and test locally
2. Open a PR containing the new deployment directory files
3. Trigger the `deploy-market` workflow action through the GitHub UI
4. Inspect the new `roots.json` which the workflow automatically commited to your PR
5. Start using the new protocol deployment and/or create further migrations to modify it

##### Deploy Script Gotchas and Tips

- If the deploy script is for a new market on a chain with an existing market, make sure to call 'setFactory(address,address)' in the initialization migration script.
(TODO: Scenarios will fail prior to running the migration script because the factory will not be set during deployment, will need to figure out a better way)

##### Verifying Deployments

Expand Down
56 changes: 56 additions & 0 deletions deployments/arbitrum-goerli/usdc.e/configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
{
"name": "Compound USDC",
"symbol": "cUSDCv3",
"baseToken": "USDC.e",
"baseTokenAddress": "0x8FB1E3fC51F3b789dED7557E680551d93Ea9d892",
"baseTokenPriceFeed": "0x1692Bdd32F31b831caAc1b0c9fAF68613682813b",
"borrowMin": "100e6",
"pauseGuardian": "0x6C2fD6738e43ce0cc4A6f23a37e3a733516794A0",
"storeFrontPriceFactor": 0.5,
"targetReserves": "5000000e6",
"rates": {
"supplyKink": 0.8,
"supplySlopeLow": 0.0325,
"supplySlopeHigh": 0.4,
"supplyBase": 0,
"borrowKink": 0.8,
"borrowSlopeLow": 0.035,
"borrowSlopeHigh": 0.25,
"borrowBase": 0.015
},
"tracking": {
"indexScale": "1e15",
"baseSupplySpeed": "0e15",
"baseBorrowSpeed": "0e15",
"baseMinForRewards": "10000e6"
},
"assets": {
"LINK": {
"address": "0xbb7303602be1b9149b097aafb094ffce1860e532",
"priceFeed": "0xd28Ba6CA3bB72bF371b80a2a0a33cBcf9073C954",
"decimals": "18",
"borrowCF": 0.775,
"liquidateCF": 0.825,
"liquidationFactor": 0.95,
"supplyCap": "5000000e18"
},
"WETH": {
"address": "0xe39ab88f8a4777030a534146a9ca3b52bd5d43a3",
"priceFeed": "0x62CAe0FA2da220f43a51F86Db2EDb36DcA9A5A08",
"decimals": "18",
"borrowCF": 0.775,
"liquidateCF": 0.825,
"liquidationFactor": 0.95,
"supplyCap": "5000e18"
},
"WBTC": {
"address": "0x22d5e2dE578677791f6c90e0110Ec629be9d5Fb5",
"priceFeed": "0x6550bc2301936011c1334555e62A87705A81C12C",
"decimals": "8",
"borrowCF": 0.7,
"liquidateCF": 0.75,
"liquidationFactor": 0.93,
"supplyCap": "300e8"
}
}
}
70 changes: 70 additions & 0 deletions deployments/arbitrum-goerli/usdc.e/deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { Deployed, DeploymentManager } from '../../../plugins/deployment_manager';
import { DeploySpec, deployComet } from '../../../src/deploy';

const SECONDS_PER_DAY = 24 * 60 * 60;

const GOERLI_TIMELOCK = '0x8Fa336EB4bF58Cfc508dEA1B0aeC7336f55B1399';

export default async function deploy(deploymentManager: DeploymentManager, deploySpec: DeploySpec): Promise<Deployed> {
const trace = deploymentManager.tracer()
const ethers = deploymentManager.hre.ethers;

// pull in existing assets
const USDC = await deploymentManager.existing('USDC', '0x8FB1E3fC51F3b789dED7557E680551d93Ea9d892', 'arbitrum-goerli');
const LINK = await deploymentManager.existing('LINK', '0xbb7303602be1b9149b097aafb094ffce1860e532', 'arbitrum-goerli');
const WETH = await deploymentManager.existing('WETH', '0xe39ab88f8a4777030a534146a9ca3b52bd5d43a3', 'arbitrum-goerli');
const WBTC = await deploymentManager.existing('WBTC', '0x22d5e2dE578677791f6c90e0110Ec629be9d5Fb5', 'arbitrum-goerli');

// Deploy ArbitrumBridgeReceiver
const bridgeReceiver = await deploymentManager.deploy(
'bridgeReceiver',
'bridges/arbitrum/ArbitrumBridgeReceiver.sol',
[]
);

// Deploy Local Timelock
const localTimelock = await deploymentManager.deploy(
'timelock',
'vendor/Timelock.sol',
[
bridgeReceiver.address, // admin
10 * 60, // delay
14 * SECONDS_PER_DAY, // grace period
10 * 60, // minimum delay
30 * SECONDS_PER_DAY // maximum delay
]
);

// Initialize ArbitrumBridgeReceiver
await deploymentManager.idempotent(
async () => !(await bridgeReceiver.initialized()),
async () => {
trace(`Initializing BridgeReceiver`);
await bridgeReceiver.initialize(
GOERLI_TIMELOCK, // govTimelock
localTimelock.address // localTimelock
);
trace(`BridgeReceiver initialized`);
}
);

// Deploy Comet
const deployed = await deployComet(deploymentManager, deploySpec);
const { comet } = deployed;

// Deploy Bulker
const bulker = await deploymentManager.deploy(
'bulker',
'bulkers/BaseBulker.sol',
[
await comet.governor(), // admin
WETH.address // weth
]
);

return {
...deployed,
bridgeReceiver,
bulker
};
}
29 changes: 29 additions & 0 deletions deployments/arbitrum-goerli/usdc.e/relations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import baseRelationConfig from '../../relations';

export default {
...baseRelationConfig,
governor: {
artifact: 'contracts/bridges/arbitrum/ArbitrumBridgeReceiver.sol:ArbitrumBridgeReceiver'
},
ClonableBeaconProxy: {
artifact: 'contracts/ERC20.sol:ERC20'
},
// USDC
'0x8FB1E3fC51F3b789dED7557E680551d93Ea9d892': {
artifact: 'contracts/ERC20.sol:ERC20',
delegates: {
field: {
slot: '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc'
}
}
},
// WETH
'0xe39ab88f8a4777030a534146a9ca3b52bd5d43a3': {
artifact: 'contracts/ERC20.sol:ERC20',
delegates: {
field: {
slot: '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc'
}
}
}
};
7 changes: 7 additions & 0 deletions deployments/arbitrum-goerli/usdc.e/roots.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"comet": "0x1d573274E19174260c5aCE3f2251598959d24456",
"configurator": "0x1Ead344570F0f0a0cD86d95d8adDC7855C8723Fb",
"rewards": "0x8DA65F8E3Aa22A498211fc4204C498ae9050DAE4",
"bridgeReceiver": "0xAC9fC1a9532BC92a9f33eD4c6Ce4A7a54930F376",
"bulker": "0x987350Af5a17b6DdafeB95E6e329c178f44841d7"
}
8 changes: 4 additions & 4 deletions deployments/arbitrum-goerli/usdc/configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
"name": "Compound USDC",
"symbol": "cUSDCv3",
"baseToken": "USDC",
"baseTokenAddress": "0x8FB1E3fC51F3b789dED7557E680551d93Ea9d892",
"baseTokenAddress": "0xfd064A18f3BF249cf1f87FC203E90D8f650f2d63",
"baseTokenPriceFeed": "0x1692Bdd32F31b831caAc1b0c9fAF68613682813b",
"borrowMin": "100e6",
"borrowMin": "1e6",
"pauseGuardian": "0x6C2fD6738e43ce0cc4A6f23a37e3a733516794A0",
"storeFrontPriceFactor": 0.5,
"targetReserves": "5000000e6",
Expand All @@ -20,8 +20,8 @@
},
"tracking": {
"indexScale": "1e15",
"baseSupplySpeed": "0e15",
"baseBorrowSpeed": "0e15",
"baseSupplySpeed": "0.000402083333333e15",
"baseBorrowSpeed": "0.000402083333333e15",
"baseMinForRewards": "10000e6"
},
"assets": {
Expand Down
57 changes: 12 additions & 45 deletions deployments/arbitrum-goerli/usdc/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,61 +10,28 @@ export default async function deploy(deploymentManager: DeploymentManager, deplo
const ethers = deploymentManager.hre.ethers;

// pull in existing assets
const USDC = await deploymentManager.existing('USDC', '0x8FB1E3fC51F3b789dED7557E680551d93Ea9d892', 'arbitrum-goerli');
const USDC = await deploymentManager.existing('USDC', '0xfd064A18f3BF249cf1f87FC203E90D8f650f2d63', 'arbitrum-goerli');
const LINK = await deploymentManager.existing('LINK', '0xbb7303602be1b9149b097aafb094ffce1860e532', 'arbitrum-goerli');
const WETH = await deploymentManager.existing('WETH', '0xe39ab88f8a4777030a534146a9ca3b52bd5d43a3', 'arbitrum-goerli');
const WBTC = await deploymentManager.existing('WBTC', '0x22d5e2dE578677791f6c90e0110Ec629be9d5Fb5', 'arbitrum-goerli');

// Deploy ArbitrumBridgeReceiver
const bridgeReceiver = await deploymentManager.deploy(
'bridgeReceiver',
'bridges/arbitrum/ArbitrumBridgeReceiver.sol',
[]
);

// Deploy Local Timelock
const localTimelock = await deploymentManager.deploy(
'timelock',
'vendor/Timelock.sol',
[
bridgeReceiver.address, // admin
10 * 60, // delay
14 * SECONDS_PER_DAY, // grace period
10 * 60, // minimum delay
30 * SECONDS_PER_DAY // maximum delay
]
);

// Initialize ArbitrumBridgeReceiver
await deploymentManager.idempotent(
async () => !(await bridgeReceiver.initialized()),
async () => {
trace(`Initializing BridgeReceiver`);
await bridgeReceiver.initialize(
GOERLI_TIMELOCK, // govTimelock
localTimelock.address // localTimelock
);
trace(`BridgeReceiver initialized`);
}
);
// Import shared contracts from cUSDCv3
const cometAdmin = await deploymentManager.fromDep('cometAdmin', 'arbitrum-goerli', 'usdc.e');
const cometFactory = await deploymentManager.fromDep('cometFactory', 'arbitrum-goerli', 'usdc.e');
const $configuratorImpl = await deploymentManager.fromDep('configurator:implementation', 'arbitrum-goerli', 'usdc.e');
const configurator = await deploymentManager.fromDep('configurator', 'arbitrum-goerli', 'usdc.e');
const rewards = await deploymentManager.fromDep('rewards', 'arbitrum-goerli', 'usdc.e');
const bulker = await deploymentManager.fromDep('bulker', 'arbitrum-goerli', 'usdc.e');
const localTimelock = await deploymentManager.fromDep('timelock', 'arbitrum-goerli', 'usdc.e');
const bridgeReceiver = await deploymentManager.fromDep('bridgeReceiver', 'arbitrum-goerli', 'usdc.e');

// Deploy Comet
const deployed = await deployComet(deploymentManager, deploySpec);
const { comet } = deployed;

// Deploy Bulker
const bulker = await deploymentManager.deploy(
'bulker',
'bulkers/BaseBulker.sol',
[
await comet.governor(), // admin
WETH.address // weth
]
);

return {
...deployed,
bridgeReceiver,
bulker
bulker,
rewards,
};
}
Loading
Loading