From 5a9069ec227446815c901a4fe517bfc51d8546c2 Mon Sep 17 00:00:00 2001 From: pmckelvy1 Date: Thu, 2 Nov 2023 11:18:54 -0400 Subject: [PATCH] deployed STG asset on Base (#996) --- common/configuration.ts | 1 + .../8453-tmp-assets-collateral.json | 12 ++-- scripts/deploy.ts | 4 +- .../phase2-assets/assets/deploy_stg.ts | 66 +++++++++++++++++++ scripts/verification/assets/verify_stg.ts | 45 +++++++++++++ scripts/verify_etherscan.ts | 4 +- 6 files changed, 126 insertions(+), 6 deletions(-) create mode 100644 scripts/deployment/phase2-assets/assets/deploy_stg.ts create mode 100644 scripts/verification/assets/verify_stg.ts diff --git a/common/configuration.ts b/common/configuration.ts index e6e1f846e3..2276396baf 100644 --- a/common/configuration.ts +++ b/common/configuration.ts @@ -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', diff --git a/scripts/addresses/base-3.0.1/8453-tmp-assets-collateral.json b/scripts/addresses/base-3.0.1/8453-tmp-assets-collateral.json index ec42edd113..9373fafb6b 100644 --- a/scripts/addresses/base-3.0.1/8453-tmp-assets-collateral.json +++ b/scripts/addresses/base-3.0.1/8453-tmp-assets-collateral.json @@ -1,6 +1,7 @@ { "assets": { - "COMP": "0x277FD5f51fE53a9B3707a0383bF930B149C74ABf" + "COMP": "0x277FD5f51fE53a9B3707a0383bF930B149C74ABf", + "STG": "0xf37adF141BD754e9C9E645de88bB28B5e4a6Db96" }, "collateral": { "DAI": "0x5EBE8927e5495e0A7731888C81AF463cD63602fb", @@ -8,7 +9,8 @@ "USDbC": "0x6490D66B17A1E9a460Ab54131165C8F921aCcDeB", "cbETH": "0x5fE248625aC2AB0e17A115fef288f17AF1952402", "cUSDbCv3": "0xa372EC846131FBf9AE8b589efa3D041D9a94dF41", - "aBasUSDbC": "0x1DdB7dfdC5D26FE1f2aD02d9972f12481346Ae9b" + "aBasUSDbC": "0x1DdB7dfdC5D26FE1f2aD02d9972f12481346Ae9b", + "wsgUSDbC": "0x15395aCCbF8c6b28671fe41624D599624709a2D6" }, "erc20s": { "COMP": "0x9e1028F5F1D5eDE59748FFceE5532509976840E0", @@ -17,6 +19,8 @@ "USDbC": "0xd9aAEc86B65D86f6A7B5B1b0c42FFA531710b6CA", "cbETH": "0x2ae3f1ec7f1f5012cfeab0185bfc7aa3cf0dec22", "cUSDbCv3": "0xbC0033679AEf41Fb9FeB553Fdf55a8Bb2fC5B29e", - "aBasUSDbC": "0x308447562442Cc43978f8274fA722C9C14BafF8b" + "aBasUSDbC": "0x308447562442Cc43978f8274fA722C9C14BafF8b", + "wsgUSDbC": "0x073F98792ef4c00bB5f11B1F64f13cB25Cde0d8D", + "STG": "0xE3B53AF74a4BF62Ae5511055290838050bf764Df" } -} +} \ No newline at end of file diff --git a/scripts/deploy.ts b/scripts/deploy.ts index db067c3362..37166ba82a 100644 --- a/scripts/deploy.ts +++ b/scripts/deploy.ts @@ -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', ) } diff --git a/scripts/deployment/phase2-assets/assets/deploy_stg.ts b/scripts/deployment/phase2-assets/assets/deploy_stg.ts new file mode 100644 index 0000000000..98c81e2be1 --- /dev/null +++ b/scripts/deployment/phase2-assets/assets/deploy_stg.ts @@ -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 = 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 (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 +}) diff --git a/scripts/verification/assets/verify_stg.ts b/scripts/verification/assets/verify_stg.ts new file mode 100644 index 0000000000..794d417834 --- /dev/null +++ b/scripts/verification/assets/verify_stg.ts @@ -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 = 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 +}) diff --git a/scripts/verify_etherscan.ts b/scripts/verify_etherscan.ts index b32aac2776..f9b9d28265 100644 --- a/scripts/verify_etherscan.ts +++ b/scripts/verify_etherscan.ts @@ -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' ) }