Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions common/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ export interface ITokens {
steakPYUSD?: string
Re7WETH?: string
meUSD?: string
AlphaWETH?: string

pxETH?: string
apxETH?: string
Expand Down Expand Up @@ -285,6 +286,7 @@ export const networkConfig: { [key: string]: INetworkConfig } = {
steakPYUSD: '0xbEEF02e5E13584ab96848af90261f0C8Ee04722a',
bbUSDT: '0x2C25f6C25770fFEC5959D34B94Bf898865e5D6b1',
Re7WETH: '0x78Fc2c2eD1A4cDb5402365934aE5648aDAd094d0',
AlphaWETH: '0x47fe8Ab9eE47DD65c24df52324181790b9F47EfC',
sdUSDCUSDCPlus: '0x9bbF31E99F30c38a5003952206C31EEa77540BeF',
USDe: '0x4c9edd5852cd905f086c759e8383e09bff1e68b3',
sUSDe: '0x9D39A5DE30e57443BfF2A8307A4256c8797A3497',
Expand Down
3 changes: 2 additions & 1 deletion scripts/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,8 @@ async function main() {
'phase2-assets/assets/deploy_cvx.ts',
'phase2-assets/collaterals/deploy_pyusd.ts',
'phase2-assets/collaterals/deploy_sky_susds.ts',
'phase2-assets/collaterals/deploy_origin_oeth.ts'
'phase2-assets/collaterals/deploy_origin_oeth.ts',
'phase2-assets/collaterals/deploy_alphaweth.ts'
)
} else if (chainId == '8453' || chainId == '84531') {
// Base L2 chains
Expand Down
91 changes: 91 additions & 0 deletions scripts/deployment/phase2-assets/collaterals/deploy_alphaweth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
import fs from 'fs'
import hre from 'hardhat'
import { getChainId } from '../../../../common/blockchain-utils'
import { networkConfig } from '../../../../common/configuration'
import { fp } from '../../../../common/numbers'
import { expect } from 'chai'
import { CollateralStatus } from '../../../../common/constants'
import {
getDeploymentFile,
getAssetCollDeploymentFilename,
IAssetCollDeployments,
getDeploymentFilename,
fileExists,
} from '../../common'
import {
ETH_ORACLE_TIMEOUT,
ETH_ORACLE_ERROR,
ETH_USD_FEED,
PRICE_TIMEOUT,
DELAY_UNTIL_DEFAULT,
} from '../../../../test/plugins/individual-collateral/meta-morpho/constants'
import { MetaMorphoSelfReferentialCollateral } from '../../../../typechain'
import { ContractFactory } from 'ethers'

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

const chainId = await getChainId(hre)

console.log(`Deploying Collateral to network ${hre.network.name} (${chainId})
with burner account: ${deployer.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 deployedCollateral: string[] = []

/******** Deploy MetaMorpho AlphaPing WETH - AlphaWETH **************************/

const MetaMorphoFiatCollateralFactory: ContractFactory = await hre.ethers.getContractFactory(
'MetaMorphoSelfReferentialCollateral'
)

const collateral = <MetaMorphoSelfReferentialCollateral>(
await MetaMorphoFiatCollateralFactory.connect(deployer).deploy(
{
priceTimeout: PRICE_TIMEOUT.toString(),
chainlinkFeed: ETH_USD_FEED,
oracleError: ETH_ORACLE_ERROR.toString(),
erc20: networkConfig[chainId].tokens.AlphaWETH,
maxTradeVolume: fp('1e6').toString(),
oracleTimeout: ETH_ORACLE_TIMEOUT.toString(),
targetName: hre.ethers.utils.formatBytes32String('ETH'),
defaultThreshold: '0', // WETH
delayUntilDefault: DELAY_UNTIL_DEFAULT.toString(),
},
fp('1e-3') // can have large drawdowns
)
)
await collateral.deployed()

console.log(`Deployed AlphaWETH to ${hre.network.name} (${chainId}): ${collateral.address}`)
await (await collateral.refresh()).wait()
expect(await collateral.status()).to.equal(CollateralStatus.SOUND)

assetCollDeployments.collateral.AlphaWETH = collateral.address
assetCollDeployments.erc20s.AlphaWETH = networkConfig[chainId].tokens.AlphaWETH
deployedCollateral.push(collateral.address.toString())

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

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

main().catch((error) => {
console.error(error)
process.exitCode = 1
})
60 changes: 60 additions & 0 deletions scripts/verification/collateral-plugins/verify_alphaweth.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import hre from 'hardhat'
import { getChainId } from '../../../common/blockchain-utils'
import { developmentChains, networkConfig } from '../../../common/configuration'
import { fp } from '../../../common/numbers'
import {
getDeploymentFile,
getAssetCollDeploymentFilename,
IAssetCollDeployments,
} from '../../deployment/common'
import {
ETH_ORACLE_TIMEOUT,
ETH_ORACLE_ERROR,
ETH_USD_FEED,
PRICE_TIMEOUT,
DELAY_UNTIL_DEFAULT,
} from '../../../test/plugins/individual-collateral/meta-morpho/constants'
import { verifyContract } 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}`)
}

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

/******** Verify AlphaWETH **************************/
await verifyContract(
chainId,
deployments.collateral.AlphaWETH,
[
{
priceTimeout: PRICE_TIMEOUT.toString(),
chainlinkFeed: ETH_USD_FEED,
oracleError: ETH_ORACLE_ERROR.toString(),
erc20: networkConfig[chainId].tokens.AlphaWETH,
maxTradeVolume: fp('1e6').toString(),
oracleTimeout: ETH_ORACLE_TIMEOUT.toString(),
targetName: hre.ethers.utils.formatBytes32String('ETH'),
defaultThreshold: '0', // WETH
delayUntilDefault: DELAY_UNTIL_DEFAULT.toString(),
},
fp('1e-3'), // can have large drawdowns
],
'contracts/plugins/assets/meta-morpho/MetaMorphoSelfReferentialCollateral.sol:MetaMorphoSelfReferentialCollateral'
)
}

main().catch((error) => {
console.error(error)
process.exitCode = 1
})
3 changes: 2 additions & 1 deletion scripts/verify_etherscan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ async function main() {
'collateral-plugins/verify_USDe.ts',
'collateral-plugins/verify_pyusd.ts',
'collateral-plugins/verify_susds.ts',
'collateral-plugins/verify_oeth.ts'
'collateral-plugins/verify_oeth.ts',
'collateral-plugins/verify_alphaweth.ts'
)
} else if (chainId == '8453' || chainId == '84531') {
// Base L2 chains
Expand Down
2 changes: 1 addition & 1 deletion test/integration/fork-block-numbers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const forkBlockNumber = {
'mainnet-3.4.0': 20328530, // Ethereum

// TODO add all the block numbers we fork from to benefit from caching
default: 20890018, // Ethereum
default: 21874647, // Ethereum
}

export default forkBlockNumber
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import {
ETH_ORACLE_TIMEOUT,
PRICE_TIMEOUT,
RE7WETH,
ALPHAWETH,
ETH_USD_FEED,
forkNetwork,
} from './constants'
import { mintCollateralTo } from './mintCollateralTo'

Expand Down Expand Up @@ -214,3 +214,8 @@ makeFiatCollateralTestSuite(
'MetaMorphoSelfReferentialCollateral - Re7WETH',
makeOpts(RE7WETH, ETH_USD_FEED, ETH_ORACLE_TIMEOUT, ETH_ORACLE_ERROR, 'mainnet')
)

makeFiatCollateralTestSuite(
'MetaMorphoSelfReferentialCollateral - Alpha WETH Core',
makeOpts(ALPHAWETH, ETH_USD_FEED, ETH_ORACLE_TIMEOUT, ETH_ORACLE_ERROR, 'mainnet')
)
3 changes: 2 additions & 1 deletion test/plugins/individual-collateral/meta-morpho/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const STEAKPYUSD = networkConfig[chainId].tokens.steakPYUSD!
export const BBUSDT = networkConfig[chainId].tokens.bbUSDT!
export const RE7WETH = networkConfig[chainId].tokens.Re7WETH!
export const MEUSD = networkConfig[chainId].tokens.meUSD!
export const ALPHAWETH = networkConfig[chainId].tokens.AlphaWETH!

// USDC
export const USDC_USD_FEED = networkConfig[chainId].chainlinkFeeds.USDC!
Expand Down Expand Up @@ -58,7 +59,7 @@ export const PRICE_TIMEOUT = bn(604800) // 1 week
export const DELAY_UNTIL_DEFAULT = bn(86400)

const FORK_BLOCKS: { [key: string]: number } = {
'1': 19463181,
'1': 22974224,
'8453': 20454200,
'42161': 193157126, // not used
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import { whileImpersonating } from '#/utils/impersonation'
export const whales: { [key: string]: string } = {
[networkConfig['31337'].tokens.steakUSDC!]: '0xC977d218Fde6A39c7aCE71C8243545c276B48931',
[networkConfig['31337'].tokens.steakPYUSD!]: '0x7E4B4DC22111B84594d9b7707A8DCFFd793D477A',
[networkConfig['31337'].tokens.bbUSDT!]: '0xc8E3C36a72B9AA4Af0a057eb4A11e1AFC16465bB',
[networkConfig['31337'].tokens.Re7WETH!]: '0xd553294B42bdFEb49D8f5A64E8B2D3A65fc673A9',
[networkConfig['31337'].tokens.bbUSDT!]: '0x99A1a22Cf24C86A8f1cB8583c3de4d9fC4b705C9',
[networkConfig['31337'].tokens.Re7WETH!]: '0x310D5C8EE1512D5092ee4377061aE82E48973689',
[networkConfig['31337'].tokens.AlphaWETH!]: '0x5E46884a77E0aC5F3126e30720Bd5218814dc5E2',
[networkConfig['8453'].tokens.meUSD!]: '0xF02ea73c7A3057649f09899aaE1606712758bE8b',
}

Expand Down
Loading