forked from vanshwassan/comet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
234b5b3
commit 78411f5
Showing
19 changed files
with
466 additions
and
41 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
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,23 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
const config = JSON.parse(fs.readFileSync('config.json', 'utf8')); | ||
|
||
const networkName = config.network.name; | ||
|
||
const dirPath = path.join(__dirname, '..', 'deployments', networkName); | ||
|
||
if (!fs.existsSync(dirPath)) { | ||
fs.mkdirSync(dirPath, { recursive: true }); | ||
} | ||
|
||
const sourceDir = path.join(__dirname, 'protocol-deployment-scripts'); | ||
const destDir = path.join(dirPath, 'usdc'); | ||
|
||
if (!fs.existsSync(destDir)) { | ||
fs.mkdirSync(destDir, { recursive: true }); | ||
} | ||
|
||
fs.readdirSync(sourceDir).forEach(file => { | ||
fs.copyFileSync(path.join(sourceDir, file), path.join(destDir, file)); | ||
}); |
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
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,82 @@ | ||
import { Deployed, DeploymentManager } from '../../../plugins/deployment_manager'; | ||
import { DeploySpec, cloneGov, deployComet, exp, sameAddress, wait } from '../../../src/deploy'; | ||
|
||
const clone = { | ||
wbtc: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', | ||
weth: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2' | ||
}; | ||
|
||
export default async function deploy(deploymentManager: DeploymentManager, deploySpec: DeploySpec): Promise<Deployed> { | ||
const deployed = await deployContracts(deploymentManager, deploySpec); | ||
await mintTokens(deploymentManager); | ||
return deployed; | ||
} | ||
|
||
async function deployContracts(deploymentManager: DeploymentManager, deploySpec: DeploySpec): Promise<Deployed> { | ||
const trace = deploymentManager.tracer() | ||
const signer = await deploymentManager.getSigner(); | ||
|
||
// Deploy governance contracts | ||
const { COMP, fauceteer, timelock } = await cloneGov(deploymentManager); | ||
|
||
// Clone collateral assets from mainnet | ||
const WBTC = await deploymentManager.clone('WBTC', clone.wbtc, []); | ||
const WETH = await deploymentManager.clone('WETH', clone.weth, []); | ||
|
||
// // ADD CUSTOM TOKENS | ||
// const ARB = await deploymentManager.existing('ARB', '0x117e85D7FA75fFd5Af908E952bAE62b74613eD82', 'sepolia', 'contracts/ERC20.sol:ERC20'); | ||
|
||
// Deploy all Comet-related contracts | ||
const deployed = await deployComet(deploymentManager, deploySpec); | ||
const { rewards } = deployed; | ||
|
||
// Deploy Bulker | ||
const bulker = await deploymentManager.deploy( | ||
'bulker', | ||
'bulkers/BaseBulker.sol', | ||
[timelock.address, WETH.address] | ||
); | ||
|
||
await deploymentManager.idempotent( | ||
async () => (await COMP.balanceOf(rewards.address)).eq(0), | ||
async () => { | ||
trace(`Sending some COMP to CometRewards`); | ||
const amount = exp(1_000_000, 18); | ||
trace(await wait(COMP.connect(signer).transfer(rewards.address, amount))); | ||
trace(`COMP.balanceOf(${rewards.address}): ${await COMP.balanceOf(rewards.address)}`); | ||
trace(`COMP.balanceOf(${signer.address}): ${await COMP.balanceOf(signer.address)}`); | ||
} | ||
); | ||
|
||
return { ...deployed, fauceteer, bulker }; | ||
} | ||
|
||
async function mintTokens(deploymentManager: DeploymentManager) { | ||
const trace = deploymentManager.tracer(); | ||
const signer = await deploymentManager.getSigner(); | ||
const contracts = await deploymentManager.contracts(); | ||
const fauceteer = contracts.get('fauceteer'); | ||
|
||
trace(`Attempting to mint as ${signer.address}...`); | ||
|
||
const WETH = contracts.get('WETH'); | ||
await deploymentManager.idempotent( | ||
async () => (await WETH.balanceOf(signer.address)).lt(exp(0.01, 18)), | ||
async () => { | ||
trace(`Minting 0.01 WETH for signer (this is a precious resource!)`); | ||
trace(await wait(WETH.connect(signer).deposit({ value: exp(0.01, 18) }))); | ||
trace(`WETH.balanceOf(${signer.address}): ${await WETH.balanceOf(signer.address)}`); | ||
} | ||
); | ||
|
||
const WBTC = contracts.get('WBTC'); | ||
await deploymentManager.idempotent( | ||
async () => (await WBTC.balanceOf(fauceteer.address)).eq(0), | ||
async () => { | ||
trace(`Minting 20 WBTC to fauceteer`); | ||
const amount = exp(20, await WBTC.decimals()); | ||
trace(await wait(WBTC.connect(signer).mint(fauceteer.address, amount))); | ||
trace(`WBTC.balanceOf(${fauceteer.address}): ${await WBTC.balanceOf(fauceteer.address)}`); | ||
} | ||
); | ||
} |
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,79 @@ | ||
import baseRelationConfig from '../../relations'; | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
const configuration = JSON.parse(fs.readFileSync(path.join(__dirname, 'configuration.json'), 'utf8')); | ||
|
||
let priceFeeds = {}; | ||
|
||
for (let assetName in configuration.assets) { | ||
priceFeeds[configuration.assets[assetName].priceFeed] = { | ||
artifact: 'contracts/IPriceFeed.sol:IPriceFeed' | ||
}; | ||
} | ||
|
||
export default { | ||
...baseRelationConfig, | ||
...priceFeeds, | ||
fxRoot: { | ||
relations: { | ||
stateSender: { | ||
field: async fxRoot => fxRoot.stateSender() | ||
} | ||
} | ||
}, | ||
arbitrumInbox: { | ||
delegates: { | ||
field: { | ||
slot: '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc' | ||
} | ||
}, | ||
relations: { | ||
arbitrumBridge: { | ||
field: async inbox => inbox.bridge() | ||
} | ||
} | ||
}, | ||
arbitrumL1GatewayRouter: { | ||
delegates: { | ||
field: { | ||
slot: '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc' | ||
} | ||
} | ||
}, | ||
baseL1CrossDomainMessenger: { | ||
delegates: { | ||
// Not great, but this address shouldn't change and is very difficult to grab on-chain (private methods) | ||
field: async () => '0xa042e16781484716c1Ef448c919af7BCd9607467' | ||
} | ||
}, | ||
baseL1StandardBridge: { | ||
delegates: { | ||
field: { | ||
slot: '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc' | ||
} | ||
} | ||
}, | ||
lineaMessageService: { | ||
artifact: 'contracts/bridges/linea/IMessageService.sol:IMessageService', | ||
// delegates: { | ||
// field: { | ||
// slot: '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc' | ||
// } | ||
// } | ||
}, | ||
lineaL1TokenBridge: { | ||
delegates: { | ||
field: { | ||
slot: '0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc' | ||
} | ||
} | ||
}, | ||
lineaL1usdcBridge: { | ||
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 @@ | ||
{} |
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,54 @@ | ||
{ | ||
"name": "Compound USDC", | ||
"symbol": "cUSDCv3", | ||
"baseToken": "USDC", | ||
"baseTokenAddress": "0x01c3a1E1494ca453aBD19Bbf9f91a25f91264686", | ||
"baseTokenPriceFeed": "0xBc2f0b462D4B43A4ee452f26635EC582844a3C13", | ||
"pauseGuardian": "0x008a4C5448ac1Df676d6F39A0C6F13b21b189389", | ||
"borrowMin": "1e0", | ||
"storeFrontPriceFactor": 0.5, | ||
"targetReserves": "5000000e6", | ||
"rates": { | ||
"supplyKink": 0.85, | ||
"supplySlopeLow": 0.048, | ||
"supplySlopeHigh": 1.6, | ||
"supplyBase": 0, | ||
"borrowKink": 0.85, | ||
"borrowSlopeLow": 0.053, | ||
"borrowSlopeHigh": 1.7, | ||
"borrowBase": 0.015 | ||
}, | ||
"tracking": { | ||
"indexScale": "1e15", | ||
"baseSupplySpeed": "0.000011574074074074073e15", | ||
"baseBorrowSpeed": "0.0011458333333333333e15", | ||
"baseMinForRewards": "100e6" | ||
}, | ||
"rewardToken": "COMP", | ||
"assets": { | ||
"COMP": { | ||
"priceFeed": "0xF834eA717d70B7BC1E0e385CB9DcdD7385AA6acA", | ||
"decimals": 18, | ||
"borrowCF": 0.75, | ||
"liquidateCF": 0.81, | ||
"liquidationFactor": 0.93, | ||
"supplyCap": "500000e18" | ||
}, | ||
"WBTC": { | ||
"priceFeed": "0xBcdc2e9381376AC54b5484CA213fbA266A5Da15C", | ||
"decimals": 8, | ||
"borrowCF": 0.75, | ||
"liquidateCF": 0.81, | ||
"liquidationFactor": 0.93, | ||
"supplyCap": "35000e8" | ||
}, | ||
"WETH": { | ||
"priceFeed": "0xFBD69fC0120Ed460E70C637Acd31f68AF8ecaB7b", | ||
"decimals": 18, | ||
"borrowCF": 0.75, | ||
"liquidateCF": 0.81, | ||
"liquidationFactor": 0.93, | ||
"supplyCap": "1000000e18" | ||
} | ||
} | ||
} |
Oops, something went wrong.