-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploy and initialize native USDC market on Arbitrum (#769)
* initial gen * remove files * rename directory * add scenario * upadte deploy script * renamde to usdc.n * added relations for scenario test * add scenario test to CI * add migration scrtips, but just changed the USDC reference address * update migration script * since it's native, we shouldn't need usdc bridge things in migration * try to fix the liquidator scenario errors * intent * change those to be 0 initially * FINALLY scneario passed :D * don't re-deploy bulker * set a number in configuration to make bulker tests pass * set configuration to 0 supply cap for initialization, although it will fail the bulker test * update liquidity pool to use the one with better liquidity * after new pool use better liquidity, now able to bump up the volume * remove v2 rewards config step, crank down borrowMin * update migration description * remove trailing newline * ok need to referencing existing rewards in deploy script to share the rewards' * naming changes * added cctp contracts address to roots and update relayArbitrummessage * add l2 cctp * depositForBurn() to use CCTP to send native USDC to arbitrum comet * finally relayArbitrum works with CCTP * format * update to turn off bridge market's reward speed * fix scenarios and slightly reduced volume in liquidator scenarios (somehow during testing the pool the bot uses to flashloan have been withdrew and don't have full liquidity to cover tests * now it has just enough liquidity to pass the test, reverted the liquidation scenario back to usual amount * address comments: remove network prefixes, move contract import from deploy to migration scripts, move relay specific contracts to relay script * remove network prefixes, and rename bridgeComet to usdceComet * rename/refactor usdc -> usdc.e, and usdc.n -> usdc. Also rename deplyoment name for to and to * luckily by the time of testing now Jul 6th 1:40PM PST, we have enough liquidity in the uniswap USDC.e:USDC pool to cover the unchanged volume liquidation scenarios test * rename usdc.n to usdc * make yarn lint happy * change default supply reward speed on new comet to be 0 * hardat confit resolve conflicts * removed migration script, and set supply cap to 0 on configuration * set reward speed to zero * set borrow min to 1 wer * Update deployments/arbitrum/usdc/deploy.ts Co-authored-by: Kevin Cheng <[email protected]> * Modified deployment roots from GitHub Actions * Migrate and initialize Arbitrum Native USDC market (#789) * Revert "move migration files to separate PR, and keep this original one to be 'deploy' PR" This reverts commit f1f9808. * update configurate to meet with the feedback from testnet * fix scenario test error and udpate migration to meet the latest official market list and prepare for the official launch * update speed to 10COMP/day and update migration description * uncommented state change verify, since comet has been deployed * 10/86400 is irrationale number so it is 0.000115740740740 to be the closest value that falls within e15 limit * fix migrations * fix typo * update description * Modified migration from GitHub Actions * Update deployments/arbitrum/usdc/migrations/1686953660_configurate_and_ens.ts Co-authored-by: Kevin Cheng <[email protected]> * removed comments --------- Co-authored-by: GitHub Actions Bot <> Co-authored-by: Kevin Cheng <[email protected]> * add arb mainnet messagetransmitter --------- Co-authored-by: Kevin Cheng <[email protected]> Co-authored-by: GitHub Actions Bot <>
- Loading branch information
1 parent
658f451
commit 22cf923
Showing
19 changed files
with
669 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"name": "Compound USDC", | ||
"symbol": "cUSDCv3", | ||
"baseToken": "USDC.e", | ||
"baseTokenAddress": "0xff970a61a04b1ca14834a43f5de4533ebddb5cc8", | ||
"baseTokenPriceFeed": "0x50834F3163758fcC1Df9973b6e91f0F0F0434aD3", | ||
"borrowMin": "100e6", | ||
"pauseGuardian": "0x78E6317DD6D43DdbDa00Dce32C2CbaFc99361a9d", | ||
"storeFrontPriceFactor": 0.8, | ||
"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": "0.000402083333333e15", | ||
"baseBorrowSpeed": "0e15", | ||
"baseMinForRewards": "10000e6" | ||
}, | ||
"assets": { | ||
"ARB": { | ||
"address": "0x912ce59144191c1204e64559fe8253a0e49e6548", | ||
"priceFeed": "0xb2A824043730FE05F3DA2efaFa1CBbe83fa548D6", | ||
"decimals": "18", | ||
"borrowCF": 0.55, | ||
"liquidateCF": 0.60, | ||
"liquidationFactor": 0.93, | ||
"supplyCap": "4000000e18" | ||
}, | ||
"GMX": { | ||
"address": "0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a", | ||
"priceFeed": "0xDB98056FecFff59D032aB628337A4887110df3dB", | ||
"decimals": "18", | ||
"borrowCF": 0.40, | ||
"liquidateCF": 0.45, | ||
"liquidationFactor": 0.93, | ||
"supplyCap": "50000e18" | ||
}, | ||
"WETH": { | ||
"address": "0x82af49447d8a07e3bd95bd0d56f35241523fbab1", | ||
"priceFeed": "0x639Fe6ab55C921f74e7fac1ee960C0B6293ba612", | ||
"decimals": "18", | ||
"borrowCF": 0.78, | ||
"liquidateCF": 0.85, | ||
"liquidationFactor": 0.95, | ||
"supplyCap": "5000e18" | ||
}, | ||
"WBTC": { | ||
"address": "0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f", | ||
"priceFeed": "0xd0C7101eACbB49F3deCcCc166d238410D6D46d57", | ||
"decimals": "8", | ||
"borrowCF": 0.70, | ||
"liquidateCF": 0.77, | ||
"liquidationFactor": 0.95, | ||
"supplyCap": "300e8" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
import { Deployed, DeploymentManager } from '../../../plugins/deployment_manager'; | ||
import { DeploySpec, deployComet } from '../../../src/deploy'; | ||
|
||
const HOUR = 60 * 60; | ||
const DAY = 24 * HOUR; | ||
|
||
const MAINNET_TIMELOCK = '0x6d903f6003cca6255d85cca4d3b5e5146dc33925'; | ||
|
||
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', '0xff970a61a04b1ca14834a43f5de4533ebddb5cc8', 'arbitrum'); | ||
const ARB = await deploymentManager.existing('ARB', '0x912ce59144191c1204e64559fe8253a0e49e6548', 'arbitrum'); | ||
const GMX = await deploymentManager.existing('GMX', '0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a', 'arbitrum'); | ||
const WETH = await deploymentManager.existing('WETH', '0x82af49447d8a07e3bd95bd0d56f35241523fbab1', 'arbitrum'); | ||
const WBTC = await deploymentManager.existing('WBTC', '0x2f2a2543b76a4166549f7aab2e75bef0aefc5b0f', 'arbitrum'); | ||
|
||
// 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 | ||
1 * DAY, // delay | ||
14 * DAY, // grace period | ||
12 * HOUR, // minimum delay | ||
30 * DAY // maxiumum delay | ||
] | ||
); | ||
|
||
// Initialize ArbitrumBridgeReceiver | ||
await deploymentManager.idempotent( | ||
async () => !(await bridgeReceiver.initialized()), | ||
async () => { | ||
trace(`Initializing BridgeReceiver`); | ||
await bridgeReceiver.initialize( | ||
MAINNET_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 | ||
}; | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import baseRelationConfig from '../../relations'; | ||
|
||
export default { | ||
...baseRelationConfig, | ||
governor: { | ||
artifact: 'contracts/bridges/arbitrum/ArbitrumBridgeReceiver.sol:ArbitrumBridgeReceiver' | ||
}, | ||
ClonableBeaconProxy: { | ||
artifact: 'contracts/ERC20.sol:ERC20' | ||
}, | ||
// USDC | ||
'0xff970a61a04b1ca14834a43f5de4533ebddb5cc8': { | ||
artifact: 'contracts/ERC20.sol:ERC20', | ||
delegates: { | ||
field: { | ||
slot: '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc' | ||
} | ||
} | ||
}, | ||
// ARB | ||
'0x912ce59144191c1204e64559fe8253a0e49e6548': { | ||
artifact: 'contracts/ERC20.sol:ERC20', | ||
delegates: { | ||
field: { | ||
slot: '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc' | ||
} | ||
} | ||
}, | ||
// WETH | ||
'0x82af49447d8a07e3bd95bd0d56f35241523fbab1': { | ||
artifact: 'contracts/ERC20.sol:ERC20', | ||
delegates: { | ||
field: { | ||
slot: '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc' | ||
} | ||
} | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"comet": "0xA5EDBDD9646f8dFF606d7448e414884C7d905dCA", | ||
"configurator": "0xb21b06D71c75973babdE35b49fFDAc3F82Ad3775", | ||
"rewards": "0x88730d254A2f7e6AC8388c3198aFd694bA9f7fae", | ||
"bridgeReceiver": "0x42480C37B249e33aABaf4c22B20235656bd38068", | ||
"bulker": "0xbdE8F31D2DdDA895264e27DD990faB3DC87b372d" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.