Skip to content

Commit

Permalink
verification scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
julianmrodri committed Sep 26, 2024
1 parent ba27567 commit f02fe98
Show file tree
Hide file tree
Showing 4 changed files with 95 additions and 2 deletions.
4 changes: 3 additions & 1 deletion scripts/verification/collateral-plugins/verify_cusdbcv3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ async function main() {
networkConfig[chainId].tokens.cUSDbCv3,
networkConfig[chainId].COMET_REWARDS,
networkConfig[chainId].tokens.COMP,
'Wrapped cUSDCv3',
'wcUSDCv3',
],
'contracts/plugins/assets/compoundv3/CusdcV3Wrapper.sol:CusdcV3Wrapper'
'contracts/plugins/assets/compoundv3/CFiatV3Wrapper.sol:CFiatV3Wrapper'
)

/******** Verify Collateral - wcUSDbCv3 **************************/
Expand Down
4 changes: 3 additions & 1 deletion scripts/verification/collateral-plugins/verify_cusdcv3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ async function main() {
networkConfig[chainId].tokens.cUSDCv3,
networkConfig[chainId].COMET_REWARDS,
networkConfig[chainId].tokens.COMP,
'Wrapped cUSDCv3',
'wcUSDCv3',
],
'contracts/plugins/assets/compoundv3/CusdcV3Wrapper.sol:CusdcV3Wrapper'
'contracts/plugins/assets/compoundv3/CFiatV3Wrapper.sol:CFiatV3Wrapper'
)

/******** Verify Collateral - wcUSDCv3 **************************/
Expand Down
87 changes: 87 additions & 0 deletions scripts/verification/collateral-plugins/verify_cusdtv3.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import hre, { ethers } from 'hardhat'
import { getChainId } from '../../../common/blockchain-utils'
import { baseL2Chains, developmentChains, networkConfig } from '../../../common/configuration'
import { fp, bn } from '../../../common/numbers'
import {
getDeploymentFile,
getAssetCollDeploymentFilename,
IAssetCollDeployments,
} from '../../deployment/common'
import {
getUsdtOracleError,
priceTimeout,
verifyContract,
revenueHiding,
} from '../../deployment/utils'

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}`)
}

// Does not exist on Base L2
if (baseL2Chains.includes(hre.network.name)) {
throw new Error(`Invalid network ${hre.network.name} - Not available on Base`)
}

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

const collateral = await ethers.getContractAt(
'CTokenV3Collateral',
deployments.collateral.cUSDTv3 as string
)

/******** Verify Wrapper token - wcUSDTv3 **************************/

await verifyContract(
chainId,
await collateral.erc20(),
[
networkConfig[chainId].tokens.cUSDTv3,
networkConfig[chainId].COMET_REWARDS,
networkConfig[chainId].tokens.COMP,
'Wrapped cUSDTv3',
'wcUSDTv3',
],
'contracts/plugins/assets/compoundv3/CFiatV3Wrapper.sol:CFiatV3Wrapper'
)

/******** Verify Collateral - wcUSDTv3 **************************/

const usdtOracleTimeout = '86400' // 24 hr
const usdtOracleError = getUsdtOracleError(hre.network.name)

await verifyContract(
chainId,
deployments.collateral.cUSDTv3,
[
{
priceTimeout: priceTimeout.toString(),
chainlinkFeed: networkConfig[chainId].chainlinkFeeds.USDT,
oracleError: usdtOracleError.toString(),
erc20: await collateral.erc20(),
maxTradeVolume: fp('1e6').toString(), // $1m,
oracleTimeout: usdtOracleTimeout, // 24h hr,
targetName: hre.ethers.utils.formatBytes32String('USD'),
defaultThreshold: fp('0.01').add(usdtOracleError).toString(),
delayUntilDefault: bn('86400').toString(), // 24h
},
revenueHiding,
],
'contracts/plugins/assets/compoundv3/CTokenV3Collateral.sol:CTokenV3Collateral'
)
}

main().catch((error) => {
console.error(error)
process.exitCode = 1
})
2 changes: 2 additions & 0 deletions scripts/verify_etherscan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ async function main() {
'collateral-plugins/verify_curve_stable_rtoken_metapool.ts',
'collateral-plugins/verify_stakedao_usdc_usdcplus.ts',
'collateral-plugins/verify_cusdcv3.ts',
'collateral-plugins/verify_cusdtv3.ts',
'collateral-plugins/verify_reth.ts',
'collateral-plugins/verify_wsteth.ts',
'collateral-plugins/verify_cbeth.ts',
Expand Down Expand Up @@ -95,6 +96,7 @@ async function main() {
scripts.push(
'collateral-plugins/verify_aave_v3_usdc.ts',
'collateral-plugins/verify_cusdcv3.ts',
'collateral-plugins/verify_cusdtv3.ts',
'collateral-plugins/verify_convex_crvusd_usdc.ts',
'collateral-plugins/verify_convex_crvusd_usdt.ts',
'collateral-plugins/verify_usdm.ts'
Expand Down

0 comments on commit f02fe98

Please sign in to comment.