Skip to content

Commit

Permalink
Deploy compound v3 usdt market (compound-finance#848)
Browse files Browse the repository at this point in the history
Forum thread -
https://www.comp.xyz/t/deploy-compound-iii-on-optimism/4975

---------

Co-authored-by: Mikhailo Shabodyash <67977488+EviLord032@users.noreply.github.com>
Co-authored-by: GitHub Actions Bot <>
  • Loading branch information
dmitriy-woof-software and EviLord032 authored Jun 21, 2024
1 parent 3ed7bbf commit caa66a3
Show file tree
Hide file tree
Showing 9 changed files with 516 additions and 4 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/enact-migration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ on:
description: Run ID for Artifact
eth_pk:
description: Ignore if you plan to use WalletConnect, otherwise, you can paste in a Ethereum private key
impersonateAccount:
description: Impersonate Account
required: false
default: ''
jobs:
enact-migration:
name: Enact Migration
Expand Down Expand Up @@ -114,7 +118,18 @@ jobs:
GOV_NETWORK_PROVIDER: ${{ fromJSON('["", "http://localhost:8685"]')[github.event.inputs.eth_pk == '' && env.GOV_NETWORK != ''] }}
GOV_NETWORK: ${{ env.GOV_NETWORK }}
REMOTE_ACCOUNTS: ${{ fromJSON('["", "true"]')[github.event.inputs.eth_pk == ''] }}

if: github.event.inputs.impersonateAccount == ''
- name: Run Enact Migration (impersonate)
run: |
yarn hardhat migrate --network ${{ github.event.inputs.network }} --deployment ${{ github.event.inputs.deployment }} --enact --overwrite ${{ fromJSON('["", "--simulate"]')[github.event.inputs.simulate == 'true'] }} ${{ fromJSON('["", "--no-enacted"]')[github.event.inputs.no_enacted == 'true'] }} ${{ github.event.inputs.migration }} --impersonate ${{ github.event.inputs.impersonateAccount }}
env:
DEBUG: true
ETH_PK: "${{ inputs.eth_pk }}"
NETWORK_PROVIDER: ${{ fromJSON('["", "http://localhost:8585"]')[github.event.inputs.eth_pk == ''] }}
GOV_NETWORK_PROVIDER: ${{ fromJSON('["", "http://localhost:8685"]')[github.event.inputs.eth_pk == '' && env.GOV_NETWORK != ''] }}
GOV_NETWORK: ${{ env.GOV_NETWORK }}
REMOTE_ACCOUNTS: ${{ fromJSON('["", "true"]')[github.event.inputs.eth_pk == ''] }}
if: github.event.inputs.impersonateAccount != ''
- name: Commit changes
if: ${{ github.event.inputs.simulate == 'false' }}
run: |
Expand Down
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, sepolia-usdc, sepolia-weth, fuji, mumbai, polygon, arbitrum-usdc.e, arbitrum-usdc, arbitrum-goerli-usdc, arbitrum-goerli-usdc.e, base-usdbc, base-weth, base-usdc, base-goerli, base-goerli-weth, linea-goerli, optimism-usdc, scroll-goerli, scroll-usdc]
bases: [ development, mainnet, mainnet-weth, goerli, goerli-weth, sepolia-usdc, sepolia-weth, fuji, mumbai, polygon, arbitrum-usdc.e, arbitrum-usdc, arbitrum-goerli-usdc, arbitrum-goerli-usdc.e, base-usdbc, base-weth, base-usdc, base-goerli, base-goerli-weth, linea-goerli, optimism-usdc, optimism-usdt, scroll-goerli, scroll-usdc]
name: Run scenarios
env:
ETHERSCAN_KEY: ${{ secrets.ETHERSCAN_KEY }}
Expand Down
57 changes: 57 additions & 0 deletions deployments/optimism/usdt/configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "Compound USDT",
"symbol": "cUSDTv3",
"baseToken": "USDT",
"baseTokenAddress": "0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",
"baseTokenPriceFeed": "0xECef79E109e997bCA29c1c0897ec9d7b03647F5E",
"pauseGuardian": "0x3fFd6c073a4ba24a113B18C8F373569640916A45",
"borrowMin": "1e5",
"storeFrontPriceFactor": 0.6,
"targetReserves": "20000000e6",
"rates": {
"supplyKink": 0.9,
"supplySlopeLow": 0.059,
"supplySlopeHigh": 2.9,
"supplyBase": 0,
"borrowKink": 0.9,
"borrowSlopeLow": 0.061,
"borrowSlopeHigh": 3.2,
"borrowBase": 0.015
},
"tracking": {
"indexScale": "1e15",
"baseSupplySpeed": "0e15",
"baseBorrowSpeed": "0e15",
"baseMinForRewards": "1000e6"
},
"assets": {
"OP": {
"address": "0x4200000000000000000000000000000000000042",
"priceFeed": "0x0D276FC14719f9292D5C1eA2198673d1f4269246",
"decimals": "18",
"borrowCF": 0.65,
"liquidateCF": 0.7,
"liquidationFactor": 0.8,
"supplyCap": "0e18"
},
"WETH": {
"address": "0x4200000000000000000000000000000000000006",
"priceFeed": "0x13e3Ee699D1909E989722E753853AE30b17e08c5",
"decimals": "18",
"borrowCF": 0.83,
"liquidateCF": 0.9,
"liquidationFactor": 0.95,
"supplyCap": "0e18"
},
"WBTC": {
"address": "0x68f180fcCe6836688e9084f035309E29Bf0A2095",
"priceFeed": "0x718A5788b89454aAE3A028AE9c111A29Be6c2a6F",
"decimals": "8",
"borrowCF": 0.8,
"liquidateCF": 0.85,
"liquidationFactor": 0.95,
"supplyCap": "0e8"
}
}
}

71 changes: 71 additions & 0 deletions deployments/optimism/usdt/deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
import {
Deployed,
DeploymentManager,
} from '../../../plugins/deployment_manager';
import { DeploySpec, deployComet } from '../../../src/deploy';

const HOUR = 60 * 60;
const DAY = 24 * HOUR;

export default async function deploy(
deploymentManager: DeploymentManager,
deploySpec: DeploySpec
): Promise<Deployed> {
const deployed = await deployContracts(deploymentManager, deploySpec);
return deployed;
}

async function deployContracts(
deploymentManager: DeploymentManager,
deploySpec: DeploySpec
): Promise<Deployed> {
const trace = deploymentManager.tracer();

const USDT = await deploymentManager.existing(
'USDT',
'0x94b008aA00579c1307B0EF2c499aD98a8ce58e58',
'optimism'
);
const WETH = await deploymentManager.existing(
'WETH',
'0x4200000000000000000000000000000000000006',
'optimism'
);
const WBTC = await deploymentManager.existing(
'WBTC',
'0x68f180fcCe6836688e9084f035309E29Bf0A2095',
'optimism'
);
const OP = await deploymentManager.existing(
'OP',
'0x4200000000000000000000000000000000000042',
'optimism'
);

const COMP = await deploymentManager.existing(
'COMP',
'0x7e7d4467112689329f7E06571eD0E8CbAd4910eE',
'optimism'
);

// Import shared contracts from cUSDCv3
const cometAdmin = await deploymentManager.fromDep('cometAdmin', 'optimism', 'usdc');
const cometFactory = await deploymentManager.fromDep('cometFactory', 'optimism', 'usdc');
const $configuratorImpl = await deploymentManager.fromDep('configurator:implementation', 'optimism', 'usdc');
const configurator = await deploymentManager.fromDep('configurator', 'optimism', 'usdc');
const rewards = await deploymentManager.fromDep('rewards', 'optimism', 'usdc');
const bulker = await deploymentManager.fromDep('bulker', 'optimism', 'usdc');
const localTimelock = await deploymentManager.fromDep('timelock', 'optimism', 'usdc');
const bridgeReceiver = await deploymentManager.fromDep('bridgeReceiver', 'optimism', 'usdc');

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

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

0 comments on commit caa66a3

Please sign in to comment.