Skip to content

Commit

Permalink
Add Base WETH base
Browse files Browse the repository at this point in the history
  • Loading branch information
kevincheng96 committed Aug 8, 2023
1 parent d43f263 commit f0808d0
Show file tree
Hide file tree
Showing 5 changed files with 131 additions and 1 deletion.
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, arbitrum-goerli-usdc, arbitrum-goerli-usdc.e, base-usdbc, base-goerli, base-goerli-weth, linea-goerli]
bases: [ development, mainnet, mainnet-weth, goerli, goerli-weth, fuji, mumbai, polygon, arbitrum, arbitrum-goerli-usdc, arbitrum-goerli-usdc.e, base-usdbc, base-weth, base-goerli, base-goerli-weth, linea-goerli]
name: Run scenarios
env:
ETHERSCAN_KEY: ${{ secrets.ETHERSCAN_KEY }}
Expand Down
37 changes: 37 additions & 0 deletions deployments/base/weth/configuration.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"name": "Compound WETH",
"symbol": "cWETHv3",
"baseToken": "WETH",
"baseTokenAddress": "0x4200000000000000000000000000000000000006",
"borrowMin": "0.000001e18",
"pauseGuardian": "0xBA5e81fD6811E2699b478d1Bcde62a585bC9b6f7", todo
"storeFrontPriceFactor": 0.5, todo
"targetReserves": "5000e18",
"rates": {
"supplyKink": 0.9,
"supplySlopeLow": 0.0283824,
"supplySlopeHigh": 0.6066567706,
"supplyBase": 0,
"borrowKink": 0.9,
"borrowSlopeLow": 0.05171500002,
"borrowSlopeHigh": 0.5171500339,
"borrowBase": 0.009945209674
},
"tracking": {
"indexScale": "1e15",
"baseSupplySpeed": "0e15",
"baseBorrowSpeed": "0e15",
"baseMinForRewards": "100e18" todo
},
"assets": {
"cbETH": { todo
"address": "0x7c6b91D9Be155A6Db01f749217d76fF02A7227F2",
"priceFeed": "0xcD2A119bD1F7DF95d706DE6F2057fDD45A0503E2",
"decimals": "18",
"borrowCF": 0.90,
"liquidateCF": 0.93,
"liquidationFactor": 0.95,
"supplyCap": "1000e18"
}
}
}
61 changes: 61 additions & 0 deletions deployments/base/weth/deploy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
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 deployed = await deployContracts(deploymentManager, deploySpec);
return deployed;
}

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

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

// Deploy scaling price feed for cbETH
// TODO update price feed address
const cbETHScalingPriceFeed = await deploymentManager.deploy(
'cbETH:priceFeed',
'ScalingPriceFeed.sol',
[
'0xcD2A119bD1F7DF95d706DE6F2057fDD45A0503E2', // TODO // cbETH / ETH price feed
8 // decimals
]
);

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

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

// XXX We will need to deploy a new bulker only if need to support wstETH

return {
...deployed,
bridgeReceiver,
l2CrossDomainMessenger, // TODO: don't have to part of roots. can be pulled via relations
l2StandardBridge,
bulker
};
}
24 changes: 24 additions & 0 deletions deployments/base/weth/relations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import baseRelationConfig from '../../relations';

export default {
...baseRelationConfig,
governor: {
artifact: 'contracts/bridges/optimism/OptimismBridgeReceiver.sol:OptimismBridgeReceiver'
},

l2CrossDomainMessenger: {
delegates: {
field: {
slot: '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc'
}
}
},

l2StandardBridge: {
delegates: {
field: {
slot: '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc'
}
}
}
};
8 changes: 8 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import arbitrumRelationConfigMap from './deployments/arbitrum/usdc/relations';
import arbitrumBridgedUsdcGoerliRelationConfigMap from './deployments/arbitrum-goerli/usdc.e/relations';
import arbitrumGoerliNativeUsdcRelationConfigMap from './deployments/arbitrum-goerli/usdc/relations';
import baseUsdbcRelationConfigMap from './deployments/base/usdbc/relations';
import baseWethRelationConfigMap from './deployments/base/weth/relations';
import baseGoerliRelationConfigMap from './deployments/base-goerli/usdc/relations';
import baseGoerliWethRelationConfigMap from './deployments/base-goerli/weth/relations';
import lineaGoerliRelationConfigMap from './deployments/linea-goerli/usdc/relations';
Expand Down Expand Up @@ -308,6 +309,7 @@ const config: HardhatUserConfig = {
},
'base': {
usdbc: baseUsdbcRelationConfigMap,
weth: baseWethRelationConfigMap
},
'base-goerli': {
usdc: baseGoerliRelationConfigMap,
Expand Down Expand Up @@ -388,6 +390,12 @@ const config: HardhatUserConfig = {
deployment: 'usdbc',
auxiliaryBase: 'mainnet'
},
{
name: 'base-weth',
network: 'base',
deployment: 'weth',
auxiliaryBase: 'mainnet'
},
{
name: 'base-goerli',
network: 'base-goerli',
Expand Down

0 comments on commit f0808d0

Please sign in to comment.