Skip to content

Commit

Permalink
deployed STG asset on Base (#996)
Browse files Browse the repository at this point in the history
  • Loading branch information
pmckelvy1 authored Nov 2, 2023
1 parent c7e65a3 commit 5a9069e
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 6 deletions.
1 change: 1 addition & 0 deletions common/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -543,6 +543,7 @@ export const networkConfig: { [key: string]: INetworkConfig } = {
RSR: '0xAa98aE504658766Dfe11F31c5D95a0bdcABDe0b1', // 2%, 24hr
wstETHstETHexr: '0xB88BAc61a4Ca37C43a3725912B1f472c9A5bc061', // 0.5%, 24hr
cbETHETHexr: '0x868a501e68F3D1E89CfC0D22F6b22E8dabce5F04', // 0.5%, 24hr
STG: '0x63Af8341b62E683B87bB540896bF283D96B4D385'
},
GNOSIS_EASY_AUCTION: '0xb1875Feaeea32Bbb02DE83D81772e07E37A40f02', // mock
COMET_REWARDS: '0x123964802e6ABabBE1Bc9547D72Ef1B69B00A6b1',
Expand Down
12 changes: 8 additions & 4 deletions scripts/addresses/base-3.0.1/8453-tmp-assets-collateral.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
{
"assets": {
"COMP": "0x277FD5f51fE53a9B3707a0383bF930B149C74ABf"
"COMP": "0x277FD5f51fE53a9B3707a0383bF930B149C74ABf",
"STG": "0xf37adF141BD754e9C9E645de88bB28B5e4a6Db96"
},
"collateral": {
"DAI": "0x5EBE8927e5495e0A7731888C81AF463cD63602fb",
"WETH": "0x42D0fA25d6d5bff01aC050c0F5aB0B2C9D01b4a3",
"USDbC": "0x6490D66B17A1E9a460Ab54131165C8F921aCcDeB",
"cbETH": "0x5fE248625aC2AB0e17A115fef288f17AF1952402",
"cUSDbCv3": "0xa372EC846131FBf9AE8b589efa3D041D9a94dF41",
"aBasUSDbC": "0x1DdB7dfdC5D26FE1f2aD02d9972f12481346Ae9b"
"aBasUSDbC": "0x1DdB7dfdC5D26FE1f2aD02d9972f12481346Ae9b",
"wsgUSDbC": "0x15395aCCbF8c6b28671fe41624D599624709a2D6"
},
"erc20s": {
"COMP": "0x9e1028F5F1D5eDE59748FFceE5532509976840E0",
Expand All @@ -17,6 +19,8 @@
"USDbC": "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA",
"cbETH": "0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22",
"cUSDbCv3": "0xbC0033679AEf41Fb9FeB553Fdf55a8Bb2fC5B29e",
"aBasUSDbC": "0x308447562442Cc43978f8274fA722C9C14BafF8b"
"aBasUSDbC": "0x308447562442Cc43978f8274fA722C9C14BafF8b",
"wsgUSDbC": "0x073F98792ef4c00bB5f11B1F64f13cB25Cde0d8D",
"STG": "0xE3B53AF74a4BF62Ae5511055290838050bf764Df"
}
}
}
4 changes: 3 additions & 1 deletion scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ async function main() {
'phase2-assets/2_deploy_collateral.ts',
'phase2-assets/collaterals/deploy_cbeth_collateral.ts',
'phase2-assets/collaterals/deploy_ctokenv3_usdbc_collateral.ts',
'phase2-assets/collaterals/deploy_aave_v3_usdbc.ts'
'phase2-assets/collaterals/deploy_aave_v3_usdbc.ts',
'phase2-assets/collaterals/deploy_stargate_usdc_collateral.ts',
'phase2-assets/assets/deploy_stg.ts',
)
}

Expand Down
66 changes: 66 additions & 0 deletions scripts/deployment/phase2-assets/assets/deploy_stg.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import fs from 'fs'
import hre, { ethers } from 'hardhat'
import { getChainId } from '../../../../common/blockchain-utils'
import { networkConfig } from '../../../../common/configuration'
import { fp } from '../../../../common/numbers'
import {
getDeploymentFile,
getDeploymentFilename,
getAssetCollDeploymentFilename,
IAssetCollDeployments,
fileExists,
} from '../../../deployment/common'
import { priceTimeout, oracleTimeout } from '../../../deployment/utils'
import { Asset } from '../../../../typechain'

async function main() {
// ==== Read Configuration ====
const [burner] = await hre.ethers.getSigners()
const chainId = await getChainId(hre)

console.log(`Deploying STG asset to network ${hre.network.name} (${chainId})
with burner account: ${burner.address}`)

if (!networkConfig[chainId]) {
throw new Error(`Missing network configuration for ${hre.network.name}`)
}

// Get phase1 deployment
const phase1File = getDeploymentFilename(chainId)
if (!fileExists(phase1File)) {
throw new Error(`${phase1File} doesn't exist yet. Run phase 1`)
}
// Check previous step completed
const assetCollDeploymentFilename = getAssetCollDeploymentFilename(chainId)
const assetCollDeployments = <IAssetCollDeployments>getDeploymentFile(assetCollDeploymentFilename)

const deployedAssets: string[] = []

/******** Deploy STG asset **************************/
const { asset: stgAsset } = await hre.run('deploy-asset', {
priceTimeout: priceTimeout.toString(),
priceFeed: networkConfig[chainId].chainlinkFeeds.STG,
oracleError: fp('0.02').toString(), // 2%
tokenAddress: networkConfig[chainId].tokens.STG,
maxTradeVolume: fp('1e6').toString(), // $1m,
oracleTimeout: oracleTimeout(chainId, '86400').toString(), // 24 hr
})
await (<Asset>await ethers.getContractAt('Asset', stgAsset)).refresh()

assetCollDeployments.assets.STG = stgAsset
assetCollDeployments.erc20s.STG = networkConfig[chainId].tokens.STG
deployedAssets.push(stgAsset.toString())

/**************************************************************/

fs.writeFileSync(assetCollDeploymentFilename, JSON.stringify(assetCollDeployments, null, 2))

console.log(`Deployed STG asset to ${hre.network.name} (${chainId}):
New deployments: ${deployedAssets}
Deployment file: ${assetCollDeploymentFilename}`)
}

main().catch((error) => {
console.error(error)
process.exitCode = 1
})
45 changes: 45 additions & 0 deletions scripts/verification/assets/verify_stg.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import hre from 'hardhat'

import { getChainId } from '../../../common/blockchain-utils'
import { developmentChains, networkConfig } from '../../../common/configuration'
import { getAssetCollDeploymentFilename, getDeploymentFile, getDeploymentFilename, IAssetCollDeployments, IDeployments } from '../../deployment/common'
import { verifyContract } from '../../deployment/utils'
import { fp } from '../../../common/numbers'

let deployments: IAssetCollDeployments

async function main() {
// ********** Read config **********
const chainId = await getChainId(hre)
if (!networkConfig[chainId]) {
throw new Error(`Missing network configuration for ${hre.network.name}`)
}

if (developmentChains.includes(hre.network.name)) {
throw new Error(`Cannot verify contracts for development chain ${hre.network.name}`)
}

deployments = <IAssetCollDeployments>getDeploymentFile(getAssetCollDeploymentFilename(chainId))

const asset = await hre.ethers.getContractAt('Asset', deployments.assets.STG!)

/** ******************** Verify RSR Asset ****************************************/
await verifyContract(
chainId,
deployments.assets.STG,
[
(await asset.priceTimeout()).toString(),
await asset.chainlinkFeed(),
fp('0.02').toString(),
await asset.erc20(),
(await asset.maxTradeVolume()).toString(),
(await asset.oracleTimeout()).toString(),
],
'contracts/plugins/assets/Asset.sol:Asset'
)
}

main().catch((error) => {
console.error(error)
process.exitCode = 1
})
4 changes: 3 additions & 1 deletion scripts/verify_etherscan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ async function main() {
scripts.push(
'collateral-plugins/verify_cbeth.ts',
'collateral-plugins/verify_cusdbcv3.ts',
'collateral-plugins/verify_aave_v3_usdbc'
'collateral-plugins/verify_aave_v3_usdbc',
'collateral-plugins/verify_stargate_usdc',
'assets/verify_stg.ts'
)
}

Expand Down

0 comments on commit 5a9069e

Please sign in to comment.