Skip to content

Commit

Permalink
Deploy WETH market on Optimism (#882)
Browse files Browse the repository at this point in the history
Co-authored-by: dmitriy-woof-software <[email protected]>
Co-authored-by: GitHub Actions Bot <>
Co-authored-by: Dmitriy Babenko <[email protected]>
  • Loading branch information
3 people authored Jul 22, 2024
1 parent ad5d9b5 commit 889f0a2
Show file tree
Hide file tree
Showing 9 changed files with 532 additions and 5 deletions.
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, mainnet-usdt, goerli, goerli-weth, sepolia-usdc, sepolia-weth, fuji, mumbai, polygon, polygon-usdt, arbitrum-usdc.e, arbitrum-usdc, arbitrum-weth, arbitrum-usdt, 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]
bases: [ development, mainnet, mainnet-weth, mainnet-usdt, goerli, goerli-weth, sepolia-usdc, sepolia-weth, fuji, mumbai, polygon, polygon-usdt, arbitrum-usdc.e, arbitrum-usdc, arbitrum-weth, arbitrum-usdt, arbitrum-goerli-usdc, arbitrum-goerli-usdc.e, base-usdbc, base-weth, base-usdc, base-goerli, base-goerli-weth, linea-goerli, optimism-usdc, optimism-usdt, optimism-weth, scroll-goerli, scroll-usdc]
name: Run scenarios
env:
ETHERSCAN_KEY: ${{ secrets.ETHERSCAN_KEY }}
Expand Down
52 changes: 52 additions & 0 deletions deployments/optimism/weth/configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
{
"name": "Compound WETH",
"symbol": "cWETHv3",
"baseToken": "WETH",
"baseTokenAddress": "0x4200000000000000000000000000000000000006",
"pauseGuardian": "0x3fFd6c073a4ba24a113B18C8F373569640916A45",
"borrowMin": "0.000001e18",
"storeFrontPriceFactor": 0.7,
"targetReserves": "5000e18",
"rates": {
"supplyBase": 0,
"supplySlopeLow": 0.0185,
"supplyKink": 0.85,
"supplySlopeHigh": 1,
"borrowBase": 0.01,
"borrowSlopeLow": 0.014,
"borrowKink": 0.85,
"borrowSlopeHigh": 1.15
},
"tracking": {
"indexScale": "1e15",
"baseSupplySpeed": "46296296296e0",
"baseBorrowSpeed": "34722222222e0",
"baseMinForRewards": "1e18"
},
"assets": {
"wstETH": {
"address": "0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb",
"decimals": "18",
"borrowCF": 0.88,
"liquidateCF": 0.93,
"liquidationFactor": 0.97,
"supplyCap": "1_300e18"
},
"rETH": {
"address": "0x9Bcef72be871e61ED4fBbc7630889beE758eb81D",
"decimals": "18",
"borrowCF": 0.9,
"liquidateCF": 0.93,
"liquidationFactor": 0.97,
"supplyCap": "470e18"
},
"WBTC": {
"address": "0x68f180fcCe6836688e9084f035309E29Bf0A2095",
"decimals": "8",
"borrowCF": 0.8,
"liquidateCF": 0.85,
"liquidationFactor": 0.90,
"supplyCap": "60e8"
}
}
}
98 changes: 98 additions & 0 deletions deployments/optimism/weth/deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
import { Deployed, DeploymentManager } from '../../../plugins/deployment_manager';
import { DeploySpec, deployComet, exp } from '../../../src/deploy';

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

const WETH = await deploymentManager.existing(
'WETH',
'0x4200000000000000000000000000000000000006',
'optimism'
);
const rETH = await deploymentManager.existing(
'rETH',
'0x9Bcef72be871e61ED4fBbc7630889beE758eb81D',
'optimism'
);
const wstETH = await deploymentManager.existing(
'wstETH',
'0x1F32b1c2345538c0c6f582fCB022739c4A194Ebb',
'optimism'
);
const WBTC = await deploymentManager.existing(
'WBTC',
'0x68f180fcCe6836688e9084f035309E29Bf0A2095',
'optimism'
);

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

const wethConstantPriceFeed = await deploymentManager.deploy(
'WETH:priceFeed',
'pricefeeds/ConstantPriceFeed.sol',
[
8, // decimals
exp(1, 8) // constantPrice
]
);

const rETHPriceFeed = await deploymentManager.deploy(
'rETH:priceFeed',
'pricefeeds/ScalingPriceFeed.sol',
[
'0x22F3727be377781d1579B7C9222382b21c9d1a8f', // rETH / ETH price feed
8 // decimals
]
);

const wstETHPriceFeed = await deploymentManager.deploy(
'wstETH:priceFeed',
'pricefeeds/MultiplicativePriceFeed.sol',
[
'0xe59EBa0D492cA53C6f46015EEa00517F2707dc77', // wstETH / stETH price feed
'0x14d2d3a82AeD4019FddDfe07E8bdc485fb0d2249', // stETH / ETH price feed
8, // decimals
'wstETH / ETH price feed' // description
]
);

const wbtcETHPriceFeed = await deploymentManager.deploy(
'WBTC:priceFeed',
'pricefeeds/ReverseMultiplicativePriceFeed.sol',
[
'0x718A5788b89454aAE3A028AE9c111A29Be6c2a6F', // WBTC / USD price feed
'0x13e3Ee699D1909E989722E753853AE30b17e08c5', // ETH / USD price feed (reversed)
8, // decimals
'WBTC / ETH price feed' // description
]
);

// Import shared contracts from cUSDCv3 and cUSDTv3 deployments
const cometAdmin = await deploymentManager.fromDep('cometAdmin', 'optimism', 'usdc');
// we use cometFactory from usdc deployment, because usdt deployment use the same one.
// the factory is not the latest version of comet (update for USDT on Mainnet)
// for this market it works perfectly
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 889f0a2

Please sign in to comment.