Skip to content

Commit

Permalink
Lower default thresholds (#1185)
Browse files Browse the repository at this point in the history
Co-authored-by: Akshat Mittal <[email protected]>
Co-authored-by: Taylor Brent <[email protected]>
  • Loading branch information
3 people authored Aug 20, 2024
1 parent a3c7b0f commit 72a1ef5
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 25 deletions.
4 changes: 2 additions & 2 deletions scripts/deployment/phase2-assets/2_deploy_collateral.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ async function main() {
oracleTimeout: '86400', // 24 hr
targetUnitOracleTimeout: '3600', // 1 hr
targetName: hre.ethers.utils.formatBytes32String('BTC'),
defaultThreshold: fp('0.01').add(combinedBTCWBTCError).toString(), // ~3.5%
defaultThreshold: fp('0.01').add(wbtcOracleError).toString(), // 3%
delayUntilDefault: bn('86400').toString(), // 24h
revenueHiding: revenueHiding.toString(),
})
Expand Down Expand Up @@ -591,7 +591,7 @@ async function main() {
oracleTimeout: '86400', // 24 hr
targetUnitOracleTimeout: '3600', // 1 hr
targetName: ethers.utils.formatBytes32String('BTC'),
defaultThreshold: fp('0.01').add(combinedBTCWBTCError).toString(), // ~3.5%
defaultThreshold: fp('0.01').add(wbtcOracleError).toString(), // 3%
delayUntilDefault: bn('86400').toString(), // 24h
})
collateral = <ICollateral>await ethers.getContractAt('ICollateral', wBTCCollateral)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ async function main() {
'CBEthCollateral'
)) as CBEthCollateral__factory

const oracleError = combinedError(fp('0.005'), fp('0.02')) // 0.5% & 2%
const CBETH_ORACLE_ERROR = fp('0.01') // 1%
const oracleError = combinedError(fp('0.005'), CBETH_ORACLE_ERROR) // 0.5% & 1%

collateral = await CBETHCollateralFactory.connect(deployer).deploy(
{
Expand All @@ -64,7 +65,7 @@ async function main() {
maxTradeVolume: fp('1e6').toString(), // $1m,
oracleTimeout: '3600', // 1 hr,
targetName: hre.ethers.utils.formatBytes32String('ETH'),
defaultThreshold: fp('0.02').add(oracleError).toString(), // ~4.5%
defaultThreshold: fp('0.02').add(CBETH_ORACLE_ERROR).toString(), // 3%
delayUntilDefault: bn('86400').toString(), // 24h
},
fp('1e-4').toString(), // revenueHiding = 0.01%
Expand All @@ -80,7 +81,8 @@ async function main() {
'CBEthCollateralL2'
)) as CBEthCollateralL2__factory

const oracleError = combinedError(fp('0.0015'), fp('0.005')) // 0.15% & 0.5%
const CBETH_ORACLE_ERROR = fp('0.005') // 0.5%
const oracleError = combinedError(fp('0.0015'), CBETH_ORACLE_ERROR) // 0.15% & 0.5%

collateral = await CBETHCollateralFactory.connect(deployer).deploy(
{
Expand All @@ -91,7 +93,7 @@ async function main() {
maxTradeVolume: fp('1e6').toString(), // $1m,
oracleTimeout: '1200', // 20 min
targetName: hre.ethers.utils.formatBytes32String('ETH'),
defaultThreshold: fp('0.02').add(oracleError).toString(), // ~2.5%
defaultThreshold: fp('0.02').add(CBETH_ORACLE_ERROR).toString(), // 2.5%
delayUntilDefault: bn('86400').toString(), // 24h
},
fp('1e-4').toString(), // revenueHiding = 0.01%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ async function main() {
maxTradeVolume: fp('1e6'), // $1m,
oracleTimeout: '86400', // 24 hr
targetName: ethers.utils.formatBytes32String('BTC'),
defaultThreshold: fp('0.01').add(combinedBTCWBTCError), // ~3.5%
defaultThreshold: fp('0.01').add(wbtcOracleError), // 3%
delayUntilDefault: bn('86400'), // 24h
chainlinkFeed: networkConfig[chainId].chainlinkFeeds.WBTC!, // {target/ref}
erc20: maWBTC.address,
Expand Down Expand Up @@ -233,7 +233,7 @@ async function main() {
maxTradeVolume: fp('1e6'), // $1m,
oracleTimeout: '86400', // 24 hr
targetName: ethers.utils.formatBytes32String('ETH'),
defaultThreshold: fp('0.01').add(combinedOracleErrors), // ~1.5%
defaultThreshold: fp('0.01').add(ethStEthOracleError), // 1.5%
delayUntilDefault: bn('86400'), // 24h
chainlinkFeed: networkConfig[chainId].chainlinkFeeds.stETHETH!, // {target/ref}
erc20: maStETH.address,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ async function main() {
'RethCollateral'
)

const oracleError = combinedError(fp('0.005'), fp('0.02')) // 0.5% & 2%
const RETH_ORACLE_ERROR = fp('0.02')
const oracleError = combinedError(fp('0.005'), RETH_ORACLE_ERROR) // 0.5% & 2%

const collateral = <RethCollateral>await RethCollateralFactory.connect(deployer).deploy(
{
Expand All @@ -72,7 +73,7 @@ async function main() {
maxTradeVolume: fp('1e6').toString(), // $1m,
oracleTimeout: '3600', // 1 hr,
targetName: hre.ethers.utils.formatBytes32String('ETH'),
defaultThreshold: fp('0.02').add(oracleError).toString(), // ~4.5%
defaultThreshold: fp('0.02').add(RETH_ORACLE_ERROR).toString(), // 4%
delayUntilDefault: bn('86400').toString(), // 24h
},
fp('1e-4').toString(), // revenueHiding = 0.01%
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ async function main() {
'SFraxEthCollateral'
)

const oracleError = combinedError(fp('0.005'), fp('0.0002')) // 0.5% & 0.02%
const SFRAXETH_ORACLE_ERROR = fp('0.0002')
const oracleError = combinedError(fp('0.005'), SFRAXETH_ORACLE_ERROR) // 0.5% & 0.02%

const collateral = <SFraxEthCollateral>await SFraxEthCollateralFactory.connect(deployer).deploy(
{
Expand All @@ -57,7 +58,7 @@ async function main() {
maxTradeVolume: fp('1e6').toString(), // $1m,
oracleTimeout: '3600', // 1 hr
targetName: hre.ethers.utils.formatBytes32String('ETH'),
defaultThreshold: fp('0.02').add(oracleError).toString(), // ~2.5%
defaultThreshold: fp('0.02').add(SFRAXETH_ORACLE_ERROR).toString(), // 2.02%
delayUntilDefault: bn('86400').toString(), // 24h
},
fp('1e-4').toString(), // revenueHiding = 0.01%
Expand Down
4 changes: 2 additions & 2 deletions scripts/verification/6_verify_collateral.ts
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ async function main() {
maxTradeVolume: fp('1e6').toString(), // $1m,
oracleTimeout: '86400', // 24 hr
targetName: hre.ethers.utils.formatBytes32String('BTC'),
defaultThreshold: fp('0.01').add(combinedBTCWBTCError).toString(), // ~3.5%
defaultThreshold: fp('0.01').add(wbtcOracleError).toString(), // 3%
delayUntilDefault: bn('86400').toString(), // 24h
},
networkConfig[chainId].chainlinkFeeds.BTC,
Expand Down Expand Up @@ -208,7 +208,7 @@ async function main() {
maxTradeVolume: fp('1e6').toString(), // $1m,
oracleTimeout: '86400', // 24h
targetName: ethers.utils.formatBytes32String('BTC'),
defaultThreshold: fp('0.01').add(combinedBTCWBTCError).toString(), // ~3.5%
defaultThreshold: fp('0.01').add(wbtcOracleError).toString(), // 3%
delayUntilDefault: bn('86400').toString(), // 24h
},
networkConfig[chainId].chainlinkFeeds.BTC,
Expand Down
11 changes: 6 additions & 5 deletions scripts/verification/collateral-plugins/verify_cbeth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ async function main() {
deployments = <IAssetCollDeployments>getDeploymentFile(assetCollDeploymentFilename)

/******** Verify Coinbase staked ETH - CBETH **************************/

if (!baseL2Chains.includes(hre.network.name)) {
const oracleError = combinedError(fp('0.005'), fp('0.02')) // 0.5% & 2%
const CBETH_ORACLE_ERROR = fp('0.01')
const oracleError = combinedError(fp('0.005'), CBETH_ORACLE_ERROR) // 0.5% & 1%

await verifyContract(
chainId,
Expand All @@ -42,7 +42,7 @@ async function main() {
maxTradeVolume: fp('1e6').toString(), // $1m,
oracleTimeout: '3600', // 1 hr
targetName: hre.ethers.utils.formatBytes32String('ETH'),
defaultThreshold: fp('0.02').add(oracleError).toString(), // ~4.5%
defaultThreshold: fp('0.02').add(CBETH_ORACLE_ERROR).toString(), // 3%
delayUntilDefault: bn('86400').toString(), // 24h
},
fp('1e-4'), // revenueHiding = 0.01%
Expand All @@ -52,7 +52,8 @@ async function main() {
'contracts/plugins/assets/cbeth/CBETHCollateral.sol:CBEthCollateral'
)
} else if (chainId == '8453' || chainId == '84531') {
const oracleError = combinedError(fp('0.0015'), fp('0.005')) // 0.15% & 0.5%
const CBETH_ORACLE_ERROR = fp('0.005')
const oracleError = combinedError(fp('0.0015'), CBETH_ORACLE_ERROR) // 0.15% & 0.5%
await verifyContract(
chainId,
deployments.collateral.cbETH,
Expand All @@ -65,7 +66,7 @@ async function main() {
maxTradeVolume: fp('1e6').toString(), // $1m,
oracleTimeout: '1200', // 20 min
targetName: hre.ethers.utils.formatBytes32String('ETH'),
defaultThreshold: fp('0.02').add(oracleError).toString(), // ~2.5%
defaultThreshold: fp('0.02').add(CBETH_ORACLE_ERROR).toString(), // 2.5%
delayUntilDefault: bn('86400').toString(), // 24h
},
fp('1e-4'), // revenueHiding = 0.01%
Expand Down
5 changes: 3 additions & 2 deletions scripts/verification/collateral-plugins/verify_morpho.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ async function main() {
'MorphoNonFiatCollateral',
deployments.collateral.maWBTC as string
)
const combinedBTCWBTCError = combinedError(fp('0.02'), fp('0.005'))
const wbtcOracleError = fp('0.02') // 2%
const combinedBTCWBTCError = combinedError(wbtcOracleError, fp('0.005'))

await verifyContract(
chainId,
Expand All @@ -88,7 +89,7 @@ async function main() {
maxTradeVolume: fp('1e6'), // $1m,
oracleTimeout: '86400', // 24 hr
targetName: ethers.utils.formatBytes32String('BTC'),
defaultThreshold: fp('0.01').add(combinedBTCWBTCError), // ~3.5%
defaultThreshold: fp('0.01').add(wbtcOracleError), // 3%
delayUntilDefault: bn('86400'), // 24h
chainlinkFeed: networkConfig[chainId].chainlinkFeeds.WBTC!,
erc20: await maWBTC.erc20(),
Expand Down
5 changes: 3 additions & 2 deletions scripts/verification/collateral-plugins/verify_reth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ async function main() {
deployments = <IAssetCollDeployments>getDeploymentFile(assetCollDeploymentFilename)

/******** Verify Rocket-Pool ETH - rETH **************************/
const oracleError = combinedError(fp('0.005'), fp('0.02')) // 0.5% & 2%
const RETH_ORACLE_ERROR = fp('0.02')
const oracleError = combinedError(fp('0.005'), RETH_ORACLE_ERROR) // 0.5% & 2%
await verifyContract(
chainId,
deployments.collateral.rETH,
Expand All @@ -39,7 +40,7 @@ async function main() {
maxTradeVolume: fp('1e6').toString(), // $1m,
oracleTimeout: '3600', // 1 hr,
targetName: hre.ethers.utils.formatBytes32String('ETH'),
defaultThreshold: fp('0.02').add(oracleError).toString(), // ~4.5%
defaultThreshold: fp('0.02').add(RETH_ORACLE_ERROR).toString(), // 4%
delayUntilDefault: bn('86400').toString(), // 24h
},
fp('1e-4'), // revenueHiding = 0.01%
Expand Down
5 changes: 3 additions & 2 deletions scripts/verification/collateral-plugins/verify_sfrax_eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ async function main() {
deployments = <IAssetCollDeployments>getDeploymentFile(assetCollDeploymentFilename)

/******** Verify sFRAX **************************/
const oracleError = combinedError(fp('0.005'), fp('0.0002')) // 0.5% & 0.02%
const SFRAXETH_ORACLE_ERROR = fp('0.0002')
const oracleError = combinedError(fp('0.005'), SFRAXETH_ORACLE_ERROR) // 0.5% & 0.02%

await verifyContract(
chainId,
Expand All @@ -40,7 +41,7 @@ async function main() {
maxTradeVolume: fp('1e6').toString(), // $1m,
oracleTimeout: '3600', // 1 hr
targetName: hre.ethers.utils.formatBytes32String('ETH'),
defaultThreshold: fp('0.02').add(oracleError).toString(), // ~2.5%
defaultThreshold: fp('0.02').add(SFRAXETH_ORACLE_ERROR).toString(), // 2.02%
delayUntilDefault: bn('86400').toString(), // 24h
},
fp('1e-4').toString(),
Expand Down

0 comments on commit 72a1ef5

Please sign in to comment.