Deploy Compound III on Optimism

Deploy Compound V3 on Optimism

Preamble:

Type: Multichain Deployment
Title: Deploy Compound III on Optimism
Authors: @markg from Optimism Foundation, @bryancolligan & @sharp (Compound Growth Program)

Proposal Introduction

Point of contact(POC): @bryancolligan @Sharp

Overview of Proposal:

The Compound Growth Program, after conversations with various stakeholders and community members, identified Compound deployment on Optimism as one of the top priorities for the program. A further conversation with community members from Optimism validated our argument to expand Compound to Optimism. In line with our priorities, we propose deploying Compound V3 on Optimism Mainnet.
Note: A proposal with similar scope was also posted a year ago, but it could not be completed due to multiple factors. You can find the earlier proposal here Deploy Compound v3 on Optimism

Motivation:

Optimism is a Layer 2 scaling solution for Ethereum, designed to enhance the network’s capacity and speed while significantly reducing transaction costs. It operates on the principle of Optimistic Rollups, a technology that allows for the execution of smart contracts and transactions off the main Ethereum blockchain (Layer 1), but with the same level of security and decentralization. This is achieved by assuming transactions are valid by default and only running computations in the event of a dispute. This method drastically increases throughput and efficiency, making it an attractive option for decentralized applications (dApps) looking to scale without sacrificing Ethereum’s robust security model.

Optimism is EVM Compatible, in line with Compound’s requirements for deploying on new chains. Additionally, Optimism has introduced a novel funding mechanism known as Retroactive Public Goods Funding, which aims to sustainably fund projects contributing to the public good, leveraging a portion of transaction fees generated on the network.

Launching Compound on Optimism mainnet represents a strategic move to leverage these benefits. Compound stands to gain enhanced efficiency, reduced gas fees, and faster transactions, thereby providing more avenues for Compound users. Optimism users to gain services of the oldest, largest and most secure defi protocol. This integration demonstrates Compound’s commitment to scalability and cost-effective operations and aligns with the community’s efforts to address network congestion and high transaction fees. It positions Compound favorably in the competitive DeFi landscape, opening new avenues for growth and innovation on a platform designed for the future of decentralized finance.

Grant Application:

A developer team planned to apply to Grants for this deployment, but L2 deployment is left out of the scope of the Compound Grants program. Due to this CGP won’t be able to fund this project. The Compound Growth program will be activating its own developer fund to finance the development of this integration. In this case, the team initially applying for CGP has been enabled to move forward with the deployment. The total grant awarded to the team is $23,800 for this development.

Non-Technical Evaluation

The following statistics were recorded on Feb 6th 2024

  1. TVL on the Chain: $775M

  2. Amount of protocols on the chain: 181+

  3. (#) of unique addresses on the chain: 110M

  4. Active Addresses: Nansen

  5. 1 Day: 97K

  6. 7 Day: 534k

  7. 30 Day: 1.23M

Rationale

Optimism is one of the top L2s, it has considerable activity and Liquidity as a chain.

Additionally, the Optimism Grants programs provide an opportunity for Compound to apply and get some incentives to promote activity on Compound V3 which will be on Optimism. Currently Optimism has two funding mechanisms, the Optimism Grants which happen in cycles and also the RetroPGF funding for projects on Optimism. An additional Partner Fund also exists that Compound can tap into.

Proposed Markets

  • Native USDC (64 Million)
  • USDT (341 Million)

For collateral assets, we propose LINK, OP, WBTC, Wrapped ETH(wETH), LDO. We will be looking forward to the community to give more feedback in this direction.

Security Considerations

Some of the risks that should be taken into consideration:

  1. OP sequencer is centralized. There are plans to incorporate decentralized sequencing with teams such as Espresso in the future. However, a core security goal of Optimism is that despite the current centralization, the Sequencer should not be able to prevent users from submitting transactions to the L2 chain. Users of OP Stack chains can always bypass the sequencer and include transactions in the L2 chain by sending their L2 transactions directly to the OptimismPortal contract on L1.
  2. The Fault proof system is live on OP Goerli, currently at Stage 0 of fault proofs. Stage 0 means L2 state roots are posted to Ethereum L1, inputs for the state transition function are posted to L1, and a source-available node exists that can recreate the state from L1 data.
  3. Further risk analysis can be found here: Optimism – L2BEAT

Copyright Waiver

Copyright and related rights waived via CC0 2

10 Likes

Optimism is currently at the center of a lot of growth, with many chains utilizing the OP stack and the superchain narrative becoming more prevalent. We support the launch of Compound on Optimism and expect that it will be welcomed by users looking for reliable alternatives to the current lending and borrowing options. We see this as a deployment that will necessarily drive growth and bring more revenue to the bottom line.

6 Likes

Adding USDT market makes perfect sense. Its massive presence on Optimism dwarfs both USDC and USDC.e combined. Launching with wETH, wBTC, and OP as collateral seems like a solid first step.

5 Likes

Hello, Compound community. Me and my team are working on the technical implementation of Comets deployment on Optimism. A brief intro about us: we are a team of 12 independent developers gathered under the Bergman Software willing to bring value to the Compound community and protocol.

After discussions with community members, we have started the development of USDT and USDC markets.

With the following collateral for both markets:

  • LINK
  • OP
  • wBTC
  • wETH
  • LIDO

If the community would like to change or add any suggestions we are more than open to consider them.

1 Like

Thanks for starting the work on those markets. It definitely will be exciting to have Comet on Optimism.

In terms of collateral assets, tokens like LIDO and LINK have very low liquidity on Optimism right now and probably aren’t ready to be used as collateral there. Currently, there is around $1.8mn of LIDO and $7.2mn of LINK on Optimism. Alternatively, an asset like wstETH has $120mn of liquidity on Optimism and would make more sense IMO.

6 Likes

[Gauntlet] Optimism v3 USDT & USDC Initial Asset Listing Recommendations

Simple Summary

Gauntlet is excited for the Compound community to expand into Optimism. We recommend the following initial parameter recommendations for the USDT and USDC Comets on Optimism.

Asset Recommendation

USDT Risk Parameters

Asset Collateral Factor Liquidation Factor Liquidation Penalty Supply Cap
WETH 83% 90% 5% 1,600 ($5.1M)
WBTC 80% 85% 5% 60 ($3.3M)
OP 65% 70% 20% 400,000 ($1.5M)
wstETH 75% 80% 10% 300 ($1.1M)

USDC Risk Parameters

Asset Collateral Factor Liquidation Factor Liquidation Penalty Supply Cap
WETH 83% 90% 5% 1,600 ($5.1M)
WBTC 80% 85% 5% 60 ($3.3M)
OP 65% 70% 20% 700,000 ($2.7M)
wstETH 75% 80% 10% 500 ($1.8M)

Gauntlet recommends against listing LDO and LINK based on their liquidity on decentralized exchanges (DEX). Presently, exchanging 4,000 LDO (valued at $12,000) for USDT results in a 32% slippage, while swapping 20,000 LINK (worth $389,000) incurs a 15% slippage. USDC cap recommendations are higher than USDT, reflecting the higher liquidity paths to USDC relative to USDT within decentralized exchange liquidity.

Storefront Price Factor: 60%

Gauntlet recommends keeping the storefront price factor at 60% for both Comets.

Target Reserves: 20,000,000

After Gauntlet’s forum post analyzing Target Reserves, Gauntlet recommends a target reserve of 20M for both Comets.

IR Curve Parameters

Gauntlet recommends the following IR parameters for USDC and USDT Comets:

IR Parameter Value
borrow per year interest rate base 0.015
borrow per year interest rate slope low 0.061
borrow kink 0.90
borrow per year interest rate slope high 3.2
supply per year interest rate base 0
supply per year interest rate slope low 0.059
supply kink 0.90
supply per year interest rate slope high 2.9

The chart above demonstrates that the generation of Comet USDT reserves will be positive when utilization exceeds 72%.

Considering the market equilibrium assumption of reaching 90% utilization, the following chart forecasts annualized reserves corresponding to various borrowing amounts. At $10M borrows, the Comets would generate annual reserves of $98k.

Incentive Parameters

Our COMP rewards recommendations are designed to offer appealing distribution APRs when the comets are first launched and when supply caps are highly utilized.

Gauntlet is recommending supply rewards to incentivize a more significant inflow of supply tokens into the protocol. This is important in the early stages of protocol growth since USDT and USDC supply are required before borrowers can join. Daily COMP rewards are subject to change as TVL rises and the markets evolve.

USDT Comet Incentives

Daily COMP Supply Rewards Daily COMP Borrow Rewards
5 5

Here’s an update on the current COMP rewards structure in Optimism v3 USDT:

  • Daily COMP Supply Rewards: 5 COMP
  • Daily COMP Borrow Rewards: 5 COMP

Assuming full usage of supply caps and current liquidation factors, the total borrowing power would be $9.3M.

Here’s a breakdown based on our assumptions:

  • Borrow Usage (60%): This leads to a borrowing volume of $5.5M.
  • Utilization (90%): Corresponding to a supply volume of $6.2M.

With the above utilization and the present Interest Rate curve:

  • Supply APR: 5.31%
  • Borrow APR: 6.99%

Given the current COMP price of $78:

  • Supply Distribution APR: 2.29%
  • Borrow Distribution APR: 2.54%

This results in the following Net APRs:

  • Net Supply APR: 7.60%
  • Net Borrow APR: 4.45%

USDC Comet Incentives

Daily COMP Supply Rewards Daily COMP Borrow Rewards
5 5

Here’s an update on the current COMP rewards structure in Optimism v3 USDC:

  • Daily COMP Supply Rewards: 5 COMP
  • Daily COMP Borrow Rewards: 5 COMP

Assuming full usage of supply caps and current liquidation factors, the total borrowing power would be $10.7M.

Here’s a breakdown based on our assumptions:

  • Borrow Usage (60%): This leads to a borrowing volume of $6.4M.
  • Utilization (90%): Corresponding to a supply volume of $7.1M.

With the above utilization and the present Interest Rate curve:

  • Supply APR: 5.31%
  • Borrow APR: 6.99%

Given the current COMP price of $78:

  • Supply Distribution APR: 1.99%
  • Borrow Distribution APR: 2.21%

This results in the following Net APRs:

  • Net Supply APR: 7.30%
  • Net Borrow APR: 4.78%

The chart above illustrates the Distribution Annual Percentage Rates (APRs) across various supply levels, assuming a 90% utilization rate. It’s noteworthy that APRs exceeding 2% will persist until the market’s supply reaches $8M. These incentive distributions are strategically designed to accelerate the USDT and USDC Comets. The current projected net APRs are within reasonable ranges.

Gauntlet welcomes any community feedback.

3 Likes

Dear Compounders! Our team just pushed a PR with USDC and USDT Markets on Optimism network: Deploy Compound III on Optimism by dmitriy-bergman-works · Pull Request #833 · compound-finance/comet · GitHub

Looking forward to OpenZeppeling audit and community feedback to push on-chain proposal!

2 Likes

Optimism Comet Deployment Assessment

Updated April 10, 2024

Initially we reviewed pull request Deploy Compound III on Optimism by dmitriy-bergman-works · Pull Request #833 · compound-finance/comet · GitHub of the compound-finance/comet repository at commit b329070. This was a set of deployment and migration scripts that deployed Comet USDC and USDT on the Optimism network. After the first review of the scripts, with new changes after the initial stage of the audit, the scope was reduced to only USDC scripts on commit 2abd324, the changes can be found here.

In scope were the following files:

deployments
└── optimism
    ├── usdc
    │   ├── configuration.json
    │   ├── deploy.ts
    │   └── migrations
    │       └── 1707394874_configurate_and_ens.ts
    └── usdt
        ├── configuration.json
        ├── deploy.ts
        └── migrations
            └── 1707399040_configurate_and_ens.ts

Low Severity

Outdated verification of state changes

Changes of the migration script up to commit 874052 contain code changes including:

  • Setting baseSupplySpeed and baseBorrowSpeed to zero.
  • Setting supplyCap for all collateral assets to zero.
  • Removing wstETH as collateral form the USDC Comet.

However, these changes are not reflected in the verify function. Consider the following changes:

  • Change the expected values of baseTrackingBorrowSpeed and baseTrackingSupplySpeed to zero.
  • Change the expected supplyCap values to zero.
  • Remove wstETH from the list of expected changes.

Notes & Additional Information

Inaccurate Proposal Description

The description of the proposal states that there will be an emission of 5 COMP/day for both borrowing and lending on the upcoming USDC market. However, in recent changes to the migration script, the baseSupplySpeed and baseBorrowSpeed were set to zero.

Consider adapting the proposal description to reflect recent changes.

Update: Resolved in commit 05a1f00

Conclusion

In this audit, our initial focus was on the deployment of Compound V3 USDC and USDT markets on Optimism. After the first phase of the audit, the OpenZeppelin team concluded that under normal conditions, the contracts are likely to be deployed successfully without issues. However, it is important to highlight a concern regarding the initialization of the BridgeReceiver contract which was also noted in a previous audit: this contract can be initialized by any address. Although the BridgeReceiver is deployed and initialized within the same script, these actions occur in different transaction contexts which can be modified by the block proposer. This means that verifying the deployment after the script is run is also important. In such scenarios where the contract is initialized by an unexpected address, we recommend restarting the deployment process in a more secure and controlled environment.

Later on, the scope was reduced to only include the USDC market. Our team at OpenZeppelin has carefully reviewed the new changes to the deployment scripts and is confident that the initial deployment of the contracts will proceed without issue. However, the verify function fails to check the appropriate values, leading to failure in the verifying step of the deployed contract.

To sum up, the scripts are fundamentally correct, and the deployment process is expected to go through successfully while minor fixes need to be implemented.

2 Likes

After consideration of OpenZeppelin audit, community feedback and Compound Labs comments, we created an on-chain proposal.

2 Likes

Proposal 238 Review

OpenZeppelin reviewed the proposal Initialize cUSDCv3 on Optimism and confirmed the Inaccurate Proposal Description note from the assessment was addressed before proposing to the community. The assessment was updated with the commit that resolved the issue.

2 Likes

The onchain proposal has reached quorum and majority support. We thank all the community members, service providers and delegates that helped in deploying the protocol to Optimism.

A note, the USDC Market is deployed on Compound, we will also be aiming to deploy the USDT market on Optimism as well, but this will be alsongside a larger effort to launch USDT markets on other chains Including Mainnet and Arbitrum. We will keep the Community updated.

2 Likes

Hi Compounders. We are glad to inform that we passed Optimism USDT repository to OpenZeppelin team for auditing.

3 Likes

[Gauntlet] OP Supply Cap Adjustment to USDT Comet

The OP token’s liquidity to USDT has improved since our initial recommendation on February 27th. Gauntlet recommends increasing OP’s supply cap from 400k to 500k for the initial Comet listing.

Asset Collateral Factor Liquidation Factor Liquidation Penalty Supply Cap
OP 65% 70% 20% 500,000 ($1.25M)
1 Like

Optimism USDT Migration Review

June 4, 2024

Summary

Total Issues
: 0 (0 resolved)

Scope

OpenZeppelin reviewed Pull Request 852 of the compound-finance/comet repository at commit 11a4bc4 which will submit a governance proposal to create a USDT Comet market on Optimism using the official Comet Migration process.

In scope was the governance proposal created by the simulated Enact Workflow output using the migration files:

.github/workflows/enact-migration.yaml
deployments/optimism/usdt/migrations/1713012100_configurate_and_ens.ts

Overview

The recent Compound Community Forum Proposal identified a USDT Comet Market on Optimism as one of the top priorities of the Compound Growth Program. The community largely agreed and the motivation was to begin servicing users on Optimism as well as begin making inroads for new users.

To deploy an official market on Optimism, a series of specific Compound Governance steps must be taken. Dependencies must be accurately and securely deployed after which an official governance proposal is to be proposed on-chain. The focus of OpenZeppelin’s review was Pull Request 852 which includes the deployed dependencies, the official migration governance proposal, and all the security concerns that may arise during execution of the proposal. Specifically we checked:

  • That the simulation workflow created the same proposal as the deployment workflow.
  • That the proposal description was accurate and descriptive of its effects.
  • That proposal dependencies were verified as deployed with correct configurations.
  • That proposal instructions were decoded and verified as complete.
  • That proposal instructions were simulated and executed successfully without errors on both Mainnet and Optimism.
  • That the eventual market configuration was verified to match the latest parameter values provided by Gauntlet and accepted by the community.

Security Model and Trust Assumptions

Before proposal enactment to incorporate the USDT market on Optimism, it is assumed that there will not be any upgrades or changes to the implementations of the proposal or Comet ecosystem at large.

Notes & Additional Information

Comet Version

USDT on Mainnet exhibits non-standard ERC20 behaviors and indeed development has been done in Comet to handle this token. USDT on Optimism, however, is not the same and does not exhibit this non-standard behavior. Therefore, this deployment utilizes the “standard” Comet implementation and not the newer version meant for handling USDT on Mainnet. We have no compatibility concerns with the token and market contracts deployed.

Conclusion

Upon reviewing the migration, our team at OpenZeppelin is confident that the proposal has been correctly created and follows all the recommendations. During our evaluation of this migration there were no issues found and we confirmed that the new market should function with USDT as its base asset seamlessly on Optimism.

3 Likes

I am in favour of this proposal

Hello Compounders. The first USDT market on Compound V3 started its on-chain pipeline.

  1. Proposal - Compound
  2. Migration run - Enact Migration · woof-software/comet@11a4bc4 · GitHub
  3. On-chain transaction - Ethereum Transaction Hash (Txhash) Details | Etherscan

We are looking forward to your support in voting!

5 Likes

We’ve confirmed that the governance proposal matches the proposal in the scope we reviewed.

4 Likes

Hello Compounders again! The first USDT market on Compound V3 started its on-chain pipeline on the second try.

  1. Proposal - Compound
  2. Migration run - Enact Migration · woof-software/comet@11a4bc4 · GitHub
  3. On-chain transaction - Ethereum Transaction Hash (Txhash) Details | Etherscan

We are looking forward to your support in voting!

4 Likes

OpenZeppelin confirmed that the Governance Proposal 258 matches the proposal in the scope we reviewed.

3 Likes

:warning: There is another active proposal that may overwrite ENS record changes of this proposal. Please see details in Concurrent Proposals with ENS Updates.