Skip to content

Commit

Permalink
fix mog aero and add verify script
Browse files Browse the repository at this point in the history
  • Loading branch information
tbrent committed Nov 5, 2024
1 parent f036340 commit fd016d1
Show file tree
Hide file tree
Showing 4 changed files with 108 additions and 6 deletions.
6 changes: 3 additions & 3 deletions scripts/addresses/8453-tmp-assets-collateral.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"wstETH": "0x8b4374005291B8FCD14C4E947604b2FB3C660A73",
"aeroUSDCeUSD": "0x9216CD5cA133aBBd23cc6F873bB4a95A78032db0",
"aeroWETHAERO": "0x5f053DbcF37E31250F15787E1577F7A6A07d486B",
"aeroMOGWETH": "0xb05e15145655eF793f5Ebf8389D3974729889fC0",
"aeroMOGWETH": "0xf8cC32E8159C0bED61f947251d6D07E577D21314",
"meUSD": "0x0f1e10871e6a2D3A5Aa696b85b39d61a22A9e8C3"
},
"erc20s": {
Expand All @@ -31,8 +31,8 @@
"wstETH": "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452",
"aeroUSDCeUSD": "0xDB5b8cead52f77De0f6B5255f73F348AAf2CBb8D",
"aeroWETHAERO": "0x0DefA46e5e7258c9a776ADd56e6875a9323B9998",
"aeroMOGWETH": "0x6816CeeA904dDC412E4fB6937B0849A991bd249e",
"aeroMOGWETH": "0x7600cDA692679dF4928A883a8F1c5687b2991DF4",
"meUSD": "0xbb819D845b573B5D7C538F5b85057160cfb5f313",
"AERO": "0x940181a94A35A4569E4529A3CDfB74e38FD98631"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ async function main() {
{
pool: AERO_MOG_WETH_POOL,
poolType: AerodromePoolType.Volatile,
feeds: [[ETH_USD_FEED], [MOG_USD_FEED]],
oracleTimeouts: [[ETH_ORACLE_TIMEOUT], [MOG_ORACLE_TIMEOUT]],
oracleErrors: [[ETH_ORACLE_ERROR], [MOG_ORACLE_ERROR]],
feeds: [[MOG_USD_FEED], [ETH_USD_FEED]],
oracleTimeouts: [[MOG_ORACLE_TIMEOUT], [ETH_ORACLE_TIMEOUT]],
oracleErrors: [[MOG_ORACLE_ERROR], [ETH_ORACLE_ERROR]],
}
)
} else {
Expand Down
101 changes: 101 additions & 0 deletions scripts/verification/collateral-plugins/verify_aerodrome_mog_weth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import hre, { ethers } from 'hardhat'
import { getChainId } from '../../../common/blockchain-utils'
import { baseL2Chains, developmentChains, networkConfig } from '../../../common/configuration'
import { ONE_ADDRESS } from '../../../common/constants'
import {
getDeploymentFile,
getAssetCollDeploymentFilename,
IAssetCollDeployments,
} from '../../deployment/common'
import { verifyContract } from '../../deployment/utils'
import { combinedError } from '../../deployment/utils'
import { IAeroPool } from '@typechain/IAeroPool'
import {
AerodromePoolType,
MAX_TRADE_VOL,
PRICE_TIMEOUT,
AERO_MOG_WETH_POOL,
AERO_MOG_WETH_GAUGE,
AERO,
MOG_ORACLE_TIMEOUT,
MOG_ORACLE_ERROR,
MOG_USD_FEED,
AERO_ORACLE_ERROR,
ETH_USD_FEED,
ETH_ORACLE_TIMEOUT,
ETH_ORACLE_ERROR,
} from '../../../test/plugins/individual-collateral/aerodrome/constants'

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

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

// Only on base, aways use wrapper
if (baseL2Chains.includes(hre.network.name)) {
const aeroMOGWETHPoolCollateral = await ethers.getContractAt(
'AerodromeVolatileCollateral',
deployments.collateral.aeroMOGWETH as string
)

/******** Verify Gauge Wrapper **************************/

const pool = <IAeroPool>await ethers.getContractAt('IAeroPool', AERO_MOG_WETH_POOL)
await verifyContract(
chainId,
await aeroMOGWETHPoolCollateral.erc20(),
[
pool.address,
'w' + (await pool.name()),
'w' + (await pool.symbol()),
AERO,
AERO_MOG_WETH_GAUGE,
],
'contracts/plugins/assets/aerodrome/AerodromeGaugeWrapper.sol:AerodromeGaugeWrapper'
)

/******** Verify WETH-AERO plugin **************************/
const oracleError = combinedError(AERO_ORACLE_ERROR, ETH_ORACLE_ERROR) // 0.5% & 0.15%
await verifyContract(
chainId,
deployments.collateral.aeroMOGWETH,
[
{
erc20: await aeroMOGWETHPoolCollateral.erc20(),
targetName: await aeroMOGWETHPoolCollateral.targetName(),
priceTimeout: PRICE_TIMEOUT,
chainlinkFeed: ONE_ADDRESS, // unused but cannot be zero
oracleError: oracleError.toString(),
oracleTimeout: MOG_ORACLE_TIMEOUT, // max of oracleTimeouts
maxTradeVolume: MAX_TRADE_VOL,
defaultThreshold: '0',
delayUntilDefault: '86400',
},
{
pool: AERO_MOG_WETH_POOL,
poolType: AerodromePoolType.Volatile,
feeds: [[MOG_USD_FEED], [ETH_USD_FEED]],
oracleTimeouts: [[MOG_ORACLE_TIMEOUT], [ETH_ORACLE_TIMEOUT]],
oracleErrors: [[MOG_ORACLE_ERROR], [ETH_ORACLE_ERROR]],
},
],
'contracts/plugins/assets/aerodrome/AerodromeVolatileCollateral.sol:AerodromeVolatileCollateral'
)
}
}

main().catch((error) => {
console.error(error)
process.exitCode = 1
})
1 change: 1 addition & 0 deletions scripts/verify_etherscan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ async function main() {
'assets/verify_stg.ts',
'collateral-plugins/verify_aerodrome_usdc_eusd.ts',
'collateral-plugins/verify_aerodrome_weth_aero.ts',
'collateral-plugins/verify_aerodrome_mog_weth.ts',
'collateral-plugins/verify_morphoeUSD.ts'
)
} else if (chainId == '42161' || chainId == '421614') {
Expand Down

0 comments on commit fd016d1

Please sign in to comment.