From 71cef57b5d9932879d0b9d0ba8502d25d5ef6ab0 Mon Sep 17 00:00:00 2001 From: Taylor Brent Date: Mon, 6 May 2024 12:08:57 -0400 Subject: [PATCH] Trust metamorpho mitigations (#1129) --- contracts/plugins/assets/ERC4626FiatCollateral.sol | 4 ---- .../meta-morpho/MetaMorphoSelfReferentialCollateral.sol | 2 +- .../morpho-aave/MorphoSelfReferentialCollateral.sol | 2 +- .../addresses/mainnet-3.4.0/1-tmp-assets-collateral.json | 8 ++++---- .../deployment/phase2-assets/collaterals/deploy_bbusdt.ts | 2 +- .../phase2-assets/collaterals/deploy_re7weth.ts | 2 +- .../phase2-assets/collaterals/deploy_steakpyusd.ts | 2 +- .../phase2-assets/collaterals/deploy_steakusdc.ts | 2 +- scripts/verification/collateral-plugins/verify_re7weth.ts | 2 +- .../verification/collateral-plugins/verify_steakusdc.ts | 2 +- 10 files changed, 12 insertions(+), 16 deletions(-) diff --git a/contracts/plugins/assets/ERC4626FiatCollateral.sol b/contracts/plugins/assets/ERC4626FiatCollateral.sol index c1a527e527..b2ce03a4e4 100644 --- a/contracts/plugins/assets/ERC4626FiatCollateral.sol +++ b/contracts/plugins/assets/ERC4626FiatCollateral.sol @@ -26,10 +26,6 @@ contract ERC4626FiatCollateral is AppreciatingFiatCollateral { constructor(CollateralConfig memory config, uint192 revenueHiding) AppreciatingFiatCollateral(config, revenueHiding) { - require(address(config.erc20) != address(0), "missing erc20"); - if (config.defaultThreshold != 0) { - require(config.delayUntilDefault != 0, "delayUntilDefault zero"); - } IERC4626 vault = IERC4626(address(config.erc20)); oneShare = 10**vault.decimals(); refDecimals = int8(uint8(IERC20Metadata(vault.asset()).decimals())); diff --git a/contracts/plugins/assets/meta-morpho/MetaMorphoSelfReferentialCollateral.sol b/contracts/plugins/assets/meta-morpho/MetaMorphoSelfReferentialCollateral.sol index 90ed8f0a88..8db21fd6fe 100644 --- a/contracts/plugins/assets/meta-morpho/MetaMorphoSelfReferentialCollateral.sol +++ b/contracts/plugins/assets/meta-morpho/MetaMorphoSelfReferentialCollateral.sol @@ -11,7 +11,7 @@ import { ERC4626FiatCollateral } from "../ERC4626FiatCollateral.sol"; /** * @title MetaMorphoSelfReferentialCollateral * @notice Collateral plugin for a MetaMorpho vault with self referential collateral, like WETH - * Expected: {tok} == {ref}, {ref} == {target}, {target} != {UoA} + * Expected: {tok} != {ref}, {ref} == {target}, {target} != {UoA} * * For example: Re7WETH */ diff --git a/contracts/plugins/assets/morpho-aave/MorphoSelfReferentialCollateral.sol b/contracts/plugins/assets/morpho-aave/MorphoSelfReferentialCollateral.sol index 2c61150119..c12f2c2547 100644 --- a/contracts/plugins/assets/morpho-aave/MorphoSelfReferentialCollateral.sol +++ b/contracts/plugins/assets/morpho-aave/MorphoSelfReferentialCollateral.sol @@ -13,7 +13,7 @@ import { shiftl_toFix, FIX_ONE, FixLib, CEIL } from "../../../libraries/Fixed.so /** * @title MorphoSelfReferentialCollateral * @notice Collateral plugin for a Morpho pool with self referential collateral, like WETH - * Expected: {tok} == {ref}, {ref} == {target}, {target} != {UoA} + * Expected: {tok} != {ref}, {ref} == {target}, {target} != {UoA} */ contract MorphoSelfReferentialCollateral is AppreciatingFiatCollateral { using OracleLib for AggregatorV3Interface; diff --git a/scripts/addresses/mainnet-3.4.0/1-tmp-assets-collateral.json b/scripts/addresses/mainnet-3.4.0/1-tmp-assets-collateral.json index b7d3762111..8fec0d8289 100644 --- a/scripts/addresses/mainnet-3.4.0/1-tmp-assets-collateral.json +++ b/scripts/addresses/mainnet-3.4.0/1-tmp-assets-collateral.json @@ -52,10 +52,10 @@ "sFRAX": "0x0b7DcCBceA6f985301506D575E2661bf858CdEcC", "saEthUSDC": "0x00F820794Bda3fb01E5f159ee1fF7c8409fca5AB", "saEthPyUSD": "0x58a41c87f8C65cf21f961b570540b176e408Cf2E", - "bbUSDT": "0x3017d881724D93783e7f065Cc5F62c81C62c36A0", - "steakUSDC": "0x4895b9aee383b5dec499F54172Ccc7Ee05FC8Bbc", - "steakPYUSD": "0xBd01C789Be742688fb73F6aE46f1320196B6c973", - "Re7WETH": "0x3421d2cB19c8E69c6FA642C43e60cD943e75Ca8b", + "bbUSDT": "0x01355C7439982c57cF89CA9785d211806f866224", + "steakUSDC": "0x565CBc99EE04667581c7f3459561fCaf1CF68602", + "steakPYUSD": "0x23f06D5Fe858B18CD064A5D95054e8ae8536094a", + "Re7WETH": "0xa0a6C06e45437d4Ae1D778AaeB4605AC2B62A870", "cvxCrvUSDUSDC": "0x9Fc0F31e2D26C437461a9eEBfe858d17e2611Ea5", "cvxCrvUSDUSDT": "0x69c6597690B8Df61D15F201519C03725bdec40c1", "sfrxETH": "0x4c891fCa6319d492866672E3D2AfdAAA5bDcfF67" diff --git a/scripts/deployment/phase2-assets/collaterals/deploy_bbusdt.ts b/scripts/deployment/phase2-assets/collaterals/deploy_bbusdt.ts index 034a22aa52..8da827002e 100644 --- a/scripts/deployment/phase2-assets/collaterals/deploy_bbusdt.ts +++ b/scripts/deployment/phase2-assets/collaterals/deploy_bbusdt.ts @@ -66,7 +66,7 @@ async function main() { defaultThreshold: USDT_ORACLE_ERROR.add(fp('0.01')).toString(), // +1% buffer rule delayUntilDefault: DELAY_UNTIL_DEFAULT.toString(), }, - fp('1e-6') // small admin fee uncertainty + fp('1e-4') // can have small drawdowns ) await collateral.deployed() diff --git a/scripts/deployment/phase2-assets/collaterals/deploy_re7weth.ts b/scripts/deployment/phase2-assets/collaterals/deploy_re7weth.ts index 0902cc5520..efe39efbc9 100644 --- a/scripts/deployment/phase2-assets/collaterals/deploy_re7weth.ts +++ b/scripts/deployment/phase2-assets/collaterals/deploy_re7weth.ts @@ -65,7 +65,7 @@ async function main() { defaultThreshold: '0', // WETH delayUntilDefault: DELAY_UNTIL_DEFAULT.toString(), }, - fp('1e-6') // small admin fee uncertainty + fp('1e-3') // can have large drawdowns ) ) await collateral.deployed() diff --git a/scripts/deployment/phase2-assets/collaterals/deploy_steakpyusd.ts b/scripts/deployment/phase2-assets/collaterals/deploy_steakpyusd.ts index f796086e9d..6100f1012d 100644 --- a/scripts/deployment/phase2-assets/collaterals/deploy_steakpyusd.ts +++ b/scripts/deployment/phase2-assets/collaterals/deploy_steakpyusd.ts @@ -66,7 +66,7 @@ async function main() { defaultThreshold: PYUSD_ORACLE_ERROR.add(fp('0.01')).toString(), // +1% buffer rule delayUntilDefault: DELAY_UNTIL_DEFAULT.toString(), }, - fp('1e-6') // small admin fee uncertainty + fp('1e-4') // can have small drawdowns ) await collateral.deployed() diff --git a/scripts/deployment/phase2-assets/collaterals/deploy_steakusdc.ts b/scripts/deployment/phase2-assets/collaterals/deploy_steakusdc.ts index 5d8ae1a02a..53f46681e2 100644 --- a/scripts/deployment/phase2-assets/collaterals/deploy_steakusdc.ts +++ b/scripts/deployment/phase2-assets/collaterals/deploy_steakusdc.ts @@ -66,7 +66,7 @@ async function main() { defaultThreshold: USDC_ORACLE_ERROR.add(fp('0.01')).toString(), // +1% buffer rule delayUntilDefault: DELAY_UNTIL_DEFAULT.toString(), }, - fp('1e-6') // small admin fee uncertainty + fp('1e-4') // can have mild drawdowns ) await collateral.deployed() diff --git a/scripts/verification/collateral-plugins/verify_re7weth.ts b/scripts/verification/collateral-plugins/verify_re7weth.ts index 3d80cfff29..c000046cf6 100644 --- a/scripts/verification/collateral-plugins/verify_re7weth.ts +++ b/scripts/verification/collateral-plugins/verify_re7weth.ts @@ -48,7 +48,7 @@ async function main() { defaultThreshold: '0', // WETH delayUntilDefault: DELAY_UNTIL_DEFAULT.toString(), }, - fp('1e-6'), // small admin fee uncertainty + fp('1e-3'), // can have large drawdowns ], 'contracts/plugins/assets/meta-morpho/MetaMorphoSelfReferentialCollateral.sol:MetaMorphoSelfReferentialCollateral' ) diff --git a/scripts/verification/collateral-plugins/verify_steakusdc.ts b/scripts/verification/collateral-plugins/verify_steakusdc.ts index 277f30b6af..af67aec4ec 100644 --- a/scripts/verification/collateral-plugins/verify_steakusdc.ts +++ b/scripts/verification/collateral-plugins/verify_steakusdc.ts @@ -48,7 +48,7 @@ async function main() { defaultThreshold: USDC_ORACLE_ERROR.add(fp('0.01')).toString(), // +1% buffer rule delayUntilDefault: DELAY_UNTIL_DEFAULT.toString(), }, - fp('1e-6'), // small admin fee uncertainty + fp('1e-4'), // can have small drawdowns ], 'contracts/plugins/assets/meta-morpho/MetaMorphoFiatCollateral.sol:MetaMorphoFiatCollateral' )