Skip to content

Mainnet WETH Deployment#587

Merged
jflatow merged 17 commits intomainfrom
jflatow/mainnet-eth
Jan 24, 2023
Merged

Mainnet WETH Deployment#587
jflatow merged 17 commits intomainfrom
jflatow/mainnet-eth

Conversation

@jflatow
Copy link
Copy Markdown
Contributor

@jflatow jflatow commented Sep 23, 2022

WIP Ready for review now.

Changes made in preparation for launching a mainnet/ETHmainnet/WETH deployment.

  • adds mainnet-weth scenario base
  • adds configuration for mainnet/weth deploy with wstETH and cbETH as collateral assets
  • adds a WstETHPriceFeed.sol contract that calculates the wstETH / USD price using the stETH / USD price feed and the value of wstETH:stETH
  • updates scenarios to work with ETH-based markets, where possible
  • adds a matchesDeployment filter to allow for scenarios that specifically target (or avoid) the mainnet-weth deploy
  • adds a getRewardToken fn to context, to allow retrieving the reward token even when it is not a collateral asset

Remaining todos before we can launch:

  • set the supply caps back to 0
  • replace the cbETH price feed with the actual Chainlink cbETH / USD price feed (when it's available)
  • decide on actual configuration params
  • get OZ audit on WstETHPriceFeed.sol
  • launch a new version of the Liquidator Bot for mainnet/eth
  • deploy new Bulker (Mainnet WETH Bulker #611)

@scott-silver scott-silver requested a review from hayesgm October 21, 2022 19:41
Copy link
Copy Markdown
Contributor Author

@jflatow jflatow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great, couple comments/questions 💪

@scott-silver scott-silver mentioned this pull request Oct 26, 2022
7 tasks
@jflatow
Copy link
Copy Markdown
Contributor Author

jflatow commented Oct 27, 2022

For setting the supply caps from 0, we need a separate migration w/ a proposal. For USDC we also seeded reserves, not sure if we want to try to do that here. Doing rewards after I think makes sense

@jflatow
Copy link
Copy Markdown
Contributor Author

jflatow commented Oct 27, 2022

  • We also need to make the name consistent everywhere (cWETHv3)

@scott-silver scott-silver changed the title Mainnet ETH Deployment Mainnet WETH Deployment Oct 27, 2022
Copy link
Copy Markdown
Contributor

@kevincheng96 kevincheng96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great so far!

@jflatow jflatow force-pushed the jflatow/mainnet-eth branch from b4ccfec to f3bd071 Compare November 2, 2022 18:20
Copy link
Copy Markdown
Contributor

@kevincheng96 kevincheng96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I think everything looks good now. Just waiting on params to be finalized

@jflatow jflatow force-pushed the jflatow/mainnet-eth branch from 76b7375 to cc7e500 Compare November 3, 2022 21:20
@jflatow jflatow added the ready for audit This pull request is ready / waiting to be audited label Nov 3, 2022
@scott-silver scott-silver mentioned this pull request Nov 4, 2022
18 tasks
@jflatow jflatow force-pushed the jflatow/mainnet-eth branch from 6723f1a to a929c76 Compare December 15, 2022 23:43
@jflatow jflatow force-pushed the jflatow/mainnet-eth branch 2 times, most recently from 4db8aca to 233f53f Compare December 23, 2022 01:34
@jflatow jflatow force-pushed the jflatow/mainnet-eth branch from bf72cea to a9f9584 Compare January 4, 2023 17:28
@jflatow jflatow added deployment This PR contains a new deployment audited These changes have been audited and removed ready for audit This pull request is ready / waiting to be audited labels Jan 5, 2023
@jflatow jflatow force-pushed the jflatow/mainnet-eth branch from 21eb2ab to 6f0fd81 Compare January 5, 2023 18:21
jflatow and others added 10 commits January 6, 2023 13:16
* Update Github Actions to include mainnet-eth
* ETH-base bulker scenario
* WstETHPriceFeed + tests (#600)
* Non-ETH and ETH bulker scenarios (all actions in one txn)
* Mainnet WETH Bulker (#611)
* Add a supply cap constraint and set initial caps to 0 for cWETHv3
* Update the collateral params based on Gauntlet recommendations (#628)
 https://hackmd.io/wncIvkFTReWUe2AMMK2ezA?view
* Price feeds for WETH deployment + Bulker changes for OZ audit (#625)
 This PR implements and modifies price feeds to support the upcoming WETH deployment. The favored plan so far is to use ETH-denominated price feeds as opposed to USD price feeds, but stick with using 8 decimals for prices to avoid having to change the `Comet` and `Configurator` implementations.
 This would require:
  - A new wrapper price feed (`ScalingPriceFeed.sol`) that scales prices up or down to 8 decimals
  - A new `ConstantPriceFeed` that always returns 1e8 for the `WETH` base asset, since should always hold a 1:1 value with ETH
  - Modifications to the `WstETHPriceFeed` to return prices in terms of ETH instead of USD

 This is an alternative approach to #626, which is a more complex change but could be a better long-term solution.
 *Note: This PR also now contains the changes from #634 and #635, which address some suggestions made by OZ for their audit of `WstETHPriceFeed` and `Bulker`.*
* Refactor deploy to support second markets

* Add a fromDep to deployment manager which can be used for sharing dependency contracts from another deployment
* Always attempt to initialize storage if needed, and not necessarily as gov
* Always deploy an initial implementation contract instead of using the factory marker
* Only take gov admin actions if we own the cometAdmin
* Expose the primitives necessary for a proposal to configurate later, if/when admin cannot

* Add an env flag for migration constraint to skip non-migration scenarios
* Defer reading current config in modern constraint (bugfix)

* Add recipient to token sourcing blacklist
These are changes in response to the WETH deployment [audit](https://gist.github.com/andresbach/a01686b1ef8bdf51d46046f2cfc93307) conducted by OZ:

- **L01 - Lack of input validation** - We originally avoided zero address checks because there are a vast amount of accidental addresses that can be set here and checking for a specific one seems unnecessary. However, we have reconsidered that position after seeing the reasons for including a zero address check listed in this [post](https://forum.openzeppelin.com/t/removing-address-0x0-checks-from-openzeppelin-contracts/2222/13).
- **L02 - Improper implementation of Chainlink AggregatorV3Interface** - We updated the hard-coded return values for `roundId` and `answeredInRound` to be 1 to comply with the Chainlink specification.
- **L04 - Incomplete/confusing documentation** - We updated the documentation based on the provided suggestions.

Our full audit responses are [here](https://docs.google.com/document/d/1A8TrUdTtD7DXr1U5HOqSS1Xl81rjBZdlDC7LS4No4Bw).
We need to spider the `USDC` deployment before calling `fromDep` on it so all the aliases are populated in the cache. Otherwise, `fromDep` may try to import an `undefined` contract. 

There are many approaches to this and this PR takes the simplest approach of spidering in the deploy script. Another approach could be to handle the spidering directly in `fromDep`.
This PR adds a new `ScientificNotation` string type to `NetworkConfiguration` that is required for certain fields (e.g. `supplyCap`, `baseMinForRewards`). The configuration parser will safely convert these values into bigints without losing precision; with one caveat, scientific notations that use decimals in the coefficient still run the risk of precision loss because those are converted directly to javascript numbers.
Update the reference liquidator to source from more pools and generally be more robust
@jflatow jflatow force-pushed the jflatow/mainnet-eth branch from 98d5312 to 396b68b Compare January 6, 2023 21:16
scott-silver and others added 7 commits January 6, 2023 14:10
* Add tests for supply native token; clean up
* Change supplyStETH to use stETH amount instead of wstETH amount; add scenarios
* Tweak comments
* Supplying uint256.max collateral reverts in WETH deposit not Comet
* Proposal to enable cWETHv3 market

* Modify proposal to add rewards
* Update the supply caps based on Gauntlet recommendations (#629)
 https://hackmd.io/wncIvkFTReWUe2AMMK2ezA?view
* Refactor proposal to make market live (#640)

* If there are migrations, don't run the non-migrations

This allows a proposal branch to pass CI if the migration is required and is generally the intention for migration branches.

However an env var is still supported to override and force running the non-migration, too.

* Final changes to supply caps; proposal text; WETH transfer amt (#662)

Also copy bulker to usdc roots and fix scen test fixes

* Deploy cWETHv3 to Goerli (#646)

This PR adds a new `goerli-weth` base and deploy script for the Goerli cWETHv3 deploy.

The deploy script is very similar to the mainnet cWETHv3 script. The main differences are:
- Deploying price feeds for stETH / ETH and cbETH / ETH
- Pulling in extra testnet/cross-chain contracts such as `fauceteer` and `fxRoot` using `fromDep`
- Cloning over `cbETH` from mainnet
- Minting `cbETH` to `fauceteer`

* Modified migration from GitHub Actions

Co-authored-by: Kevin Cheng <kevincheng96@hotmail.com>
Co-authored-by: GitHub Actions Bot <>
@jflatow jflatow merged commit 63e98e5 into main Jan 24, 2023
uses: hayesgm/seacrest@v1
with:
ethereum_url: "${{ fromJSON('{\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"kovan\":\"https://kovan-eth.compound.finance\",\"mainnet\":\"https://mainnet-eth.compound.finance\",\"goerli\":\"https://goerli.infura.io/v3/$INFURA_KEY\",\"mumbai\":\"https://polygon-mumbai.infura.io/v3/$INFURA_KEY\"}')[inputs.network] }}"
ethereum_url: "${{ fromJSON('{\"fuji\":\"https://api.avax-test.network/ext/bc/C/rpc\",\"kovan\":\"https://kovan.infura.io/v3/$INFURA_KEY\",\"mainnet\":\"https://mainnet.infura.io/v3/$INFURA_KEY\",\"goerli\":\"https://goerli.infura.io/v3/$INFURA_KEY\",\"mumbai\":\"https://polygon-mumbai.infura.io/v3/$INFURA_KEY\"}')[inputs.network] }}"
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@atahualpaesmiamigofiel31011988-bot
Copy link
Copy Markdown

0x4200000000000000000000000000000000000042

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

audited These changes have been audited deployment This PR contains a new deployment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants