Sandbox: Permissionless Compound v3

Compound Finance

published on Feb 24, 2025

Compound Mega Case Study

Sandbox

Outline:

  1. TL;DR;
  2. Why Sandbox
  3. Innovations
  4. Why Us
  5. Monetization
  6. Fee Distribution
  7. Architecture and Flows
  8. Costs
  9. Tech stack
  10. Conclusion

TLDR - One-liner

This is a proposal of WOOF! to create Compound Sandbox – a Compound v3-based permissionless money-market platform, an extension of Compound Finance.

Compound Sandbox:

  • Will bring in $1 Billion TVL
  • Will purchases $5 Million a year in COMP
    • $3 Million a year for Compound Treasury Growth
    • $2 Million a year for Market Creators.

The WOOF! team asks 600,000 USD in COMP to develop and deploy a fully functional product in 24 weeks from receiving a grant.

Why Sandbox?

The Ultimate goal of Compound Sandbox is to create infrastructure that allows the creation of permissionless money markets.

We believe that being present in a money market is just as critical for any token as being listed on a DEX. While anyone can set up a Uniswap pool, finding a strong foothold in lending markets remains a challenge.

Many projects will not be the right fit for Compound, but will gladly prove their worth in a Testing Ground. Compound Sandbox empowers projects to run their own market, with the potential to grow, and eventually be featured on the main Compound interface.

Each separate market creator will drive the growth of their own market – driven through a combination of utility for their own token, as well as a unique COMP incentivization system which is built into Sandbox.

Our ultimate goals are to:

  • Increase Compound TVL
  • Grow the Compound Treasury
  • Strengthen COMP.

Innovations

Compound Sandbox advances DeFi by building new, and open-source mechanism designs.

Purchasing Fees with COMP

Purchasing liquidated assets along with assets generated by market performance is one of the most competitive areas of activity in Compound III. Sandbox allows the purchase of assets with COMP at a 5% discount.

Integrating COMP into generated fee purchases creates positive effects:

  1. The Compound Treasury is built by steady inflows of COMP.
  2. COMP buybacks are subsidized by fees purchases.
  3. COMP incentives are distributed to support Creators.
  4. The Treasury is protected from MEV, due to not needing to swap tokens into COMP on a DEX.

Fees are also converted to COMP as well.

New chains

Compound Sandbox allows the deployment of markets on new EVM-compatible chains like Linea, Blast and etc. that were not present on Compound Finance before. Those markets might be listed on the main Compound Finance front-end as well.

PID Controller to Manage Risk

The PID Controller provides boundaries for new markets to grow within, and is meant to be replaced when that market matures, and is handed off to Compound DAO.

Market Creation Factory

Building out a Market can be complex, which is why Sandbox uses a Template for Risk Configuration Parameters.

Sandbox Community Pool

The SCP absorbs 40% of COMP gained from liquidations and fees, and vests that out as incentives to Creators for maintaining and growing markets. Absorbing COMP tokens via liquidations and fees is an awesome innovation in and of itself – but using 40% for incentives is a solid flywheel design.

Position Migration

Another innovation cooked up by WOOF! is Position Migration. With so many markets soon to be deployed, there are going to be opportunities to optimize for Supply Rates.

  1. Imagine you’ve deposited ETH in one market for 5%, but another market offers 7%.
  2. Imagine you’ve deposited USDT in one market for 5%, but another market offers USDC for 8%

Sandbox allows you to migrate that position to earn the best yield available.

Why us

The WOOF! team has supported Compound development continuously during the last 9 months. Our team was contracted by the DAO under the Compound Growth Program to provide development services.

We deployed 70 new assets, including 12 new markets and 2 new Optimism and Mantle chains that led to $524M TVL growth. Also, WOOF! supports new integrations, developed various dune dashboards, and wrappers like ERC-4626, updated rewards system, etc. WOOF! posts development updates regularly on the forum, as well as host and attend Compound Developer Community Calls.

WOOF! actively votes on the DAO, pushed 13 proposals, and helped various delegators as well. WOOF! is a signer at Compound Community Multisig and admin at Compound Forum.

We have a dedicated team of smart contract, back-end and front-end developers working on Compound exclusively, as well as additional internal resources for design, QA, and DevOps.

We are committed to the long-term success of the Compound along with Sandbox and will do our best to make it happen.

Monetization

9d0b980b130ea3c996ab7f695b8fb5c7d6fa271e_2_690x310.png Nota bene: please, read the full post, we are describing most of the questions below

Sandbox will generate fees from market performance and liquidations. Those fees initially go to the reserves of each market. Surplus reserves are redirected to a separate pool where any user can swap listed assets for COMP with a discount, similar to liquidations.

Sandbox Fees to TVL ratio is 0.61% c5030950e24d3525a3c0adc9226f50ed86520fd9.png Let’s break down how we got to this number.

Performance fees

Compound generates a 0.51% performance fee from Earning TVL. Usually, Earning TVL is 0.45% of the total TVL. So, we could say that Compound generates 0.23% on TVL.

Those fees are based on the delta between lending and borrowing APR with utilization on a kink level.

Sandbox will have a higher 0.6% delta to keep main Compound markets more competitive. This leads us to the 0.27% fees from TVL on Compound Sandbox.

Liquidation fees

Liquidators receive a discount of 5% to 15% on assets in order to incentivize their purchase. Compound Sandbox takes 50% of these profits, and deposits them into Market Reserves, and then converts the surplus into COMP.

At the moment of writing in early October, liquidation profits for 2024 were $9.56M with an average TVL of $1.41Bn.

Sandbox Liquidation Charge is 50%.

Fees distribution

  1. Fees go to market reserves.
  2. Surplus reserves will be withdrawn regularly and converted into COMP.
  3. COMP will be distributed between the Compound Treasury and Market Creators.

Surplus Reserves

All generated fees will go to reserves of the specific market. The market will have a function to withdraw surplus fees. Historically, the ratio between TVL and reserves varies from 0.5% for new markets (1-2 years) to 1.5% for old markets (2+ years), we will take 0.5% for the current calculation.

Let’s make a calculation of Required Reserves for $1 Billion TVL:

Borrow TVL historically is 40.9% of TVL.

Market Creator will need to seed $25K into reserves to create the market. Morpho Blue has 1.1Bn TVL and 50 markets. Let’s do an example based on Morpho Blue:

As we remember, Annual Sandbox Total Fees are $6,050,00. Let’s calculate Surplus Reserves.

COMP Conversion

Anyone can call the withdraw function, which deposits surplus reserves into the Community Pool. Similarly, anyone can purchase any available amount of assets for COMP with a 5% discount – just like liquidations.

The outcomes are:

  • Markets with Full Reserves
  • A Compound Treasury which holds a ton of COMP

60% of COMP will go to the Compound Treasury, and 40% of COMP will remain in the Sandbox Community Pool to incentivize Market Creators.

Conclusion

$1 Billion TVL, purchases $5 Million a year in COMP, which is composed of:

  • $3 Million a year for Compound Treasury Growth
  • $2 Million a year for Market Creators.


Architecture and Flows

Terminology

  • Creator: The address that created the market. Creator holds Fees and Market Ownership until he transfers it.
  • PID Controller: On-chain automated risk-management controller for collateral configurations.
  • Sandbox Fees: fees generated from market performance and liquidations.
  • Sandbox Community Pool(SCP): pool designed for incentivization of Creators
  • Market Ownership: transferable permission that identifies the owner of a specific market
  • Fees Ownership: transferable permission to claim incentivization from SCP.
  • Sandbox Factory: smart contract that deploys all the infrastructure for the markets
  • Sandbox Multi-sig: a multi-sig wallet that updates the whitelist of oracles, updates the whitelist of markets visible on UI, and manages incentives for Creators.

Price feeds

Price feeds are crucial for setting up markets and ensuring accurate liquidations. Sandbox will utilize whitelisted price feeds from trusted oracle providers like Chainlink and RedStone. Initially, all supported price feeds from these providers will be whitelisted. Over time, the whitelist can be updated with new price feeds and providers to protect the markets from unreliable data.

Whitelist Updates: The whitelisted price feeds will be updated regularly. Changes will be governed by the DAO or initiated by Sandbox Multi-sig, if such access is granted.

Seeded reserves

Creators must provide seed reserves when creating a market to cover potential bad debt. These reserves will be locked until the market deprecates to prevent malicious market creation. The minimum seed reserve is of base asset in 25K USD equivalent, with no upper limit.

Goal Reserves Ratios

Based on historical data, we figured out the required Reserves to Borrowed TVL ratio for a healthy market performance:

  • 0.5% for up to 2 y.o. markets
  • 1% for 2-3 y.o. markets
  • 1.5% for 3+ y.o. market

image|690x30

Creators

Creators play a pivotal role in Sandbox since Creators will create all of the markets and drive their growth.

Who is the Creator?

A Creator is anyone who deploys Sandbox Market via Sandbox Factory and seeds reserves.

What can a Creator do?

  • Create a market
  • Provide seed reserves
  • Initiate Market Ownership transfer
  • Transfer Fees Ownership.
  • Trigger market depreciation

Benefits for the Creator

  1. Leverage Markets allow Protocols to manage LPs using hedging strategies.
  2. Delta-Neutral Farming strategies drive Lending Yield for token holders.
  3. Creators receive incentives from Sandbox Community Pool.
  4. Creators get an opportunity to demonstrate that their token can be listed on Compound, by thriving in the Sandbox environment.

Market Ownership Transfer

A creator can transfer ownership of a market to any address. However, this ownership is largely symbolic unless it is transferred to the DAO's address.

The creator can also transfer ownership to a proxy smart contract, giving the DAO the ability to claim full ownership.

The DAO can update its address in the proxy smart contract if the DAO address needs to be changed or in other relevant situations.

Migration to the Compound Finance

The creator can transfer ownership of the market under the DAO management where DAO can accept the ownership. The key migration points are:

  1. Remove the connection with the PID controller and create a static Configuration based on the latest PID configuration for the market. This allows the market to be managed by the DAO(Gauntlet).
  2. Turn off additional functionality, such as new liquidation fee distribution(optional).

To migrate the Sandbox market into the Compound Market, DAO should create a migration script, as the migration will have several predefined steps that DAO should follow.

Incentives Ownership Transfer

The creator is eligible to receive incentives from the Sandbox Community Pool. They can transfer this right to any other wallet.

Markets UI white-list

The number of markets listed on Sandbox UI will be white-listed by the DAO.

DAO will be able to delegate white-listing functions to Sandbox Multi-sig.

SDK Toolkit

The main focus of the SDK toolkit is to provide flexibility for users to create their own front-ends or easily integrate Sandbox infrastructure into their projects. The SDK will include utilities to interact with the protocol and UI snippets for easier bootstrapping own frontends.

Front-end

Sandbox front-end will be hosted on IPFS in a decentralized manner. WOOF! Team recently developed new version of Compound Finance UI & Front-end. Adding Sandbox to the front-end is included to the scope of this proposal.

|624x687 Possible vision of market creation flow

Market Depreciation

If a created market growth is unsuccessful, the Creator can trigger Market Depreciation. This will reduce the supply caps for all collateral assets to a minimum, preventing users from adding more collateral. This process continues until the supply caps reach zero. At that point, users will only be able to repay their debt and close lending positions.

The process for withdrawing reserves is as follows:

image|690x36, 75%

Reserves will be withdrawn to SCP to the moment when Reserves will be equal to or less than Seeded Reserves. After the breakpoint, the rest of the reserves will be available to be withdrawn by the Creator. Thus, the Creator can only withdraw the seed reserves they originally provided.

|624x212

Position Migration

Crypto markets can change significantly over time, and some successful markets in the past will be less optimal for new market realities.

A unified migration approach allows users to migrate their positions from one market to another market seamlessly.

A lending position can be migrated to the new market, withdrawing lending and re-lending it into the new market in one transaction using a Migrator contract.

A borrowed position should be repaid using assets in the wallet or using a flash loan, which allows one to close the position, create a new position in another market, and borrow again the asset to close the flash loan using a Migrator contract.

|279x279

Asset Swapping

AAVE V3 interface allows the use of built-in swap logic, to migrate the position in different markets with different assets. The expanded Migrator logic with the swapping module allows migrating tokens using swap routes to create totally new positions.

|389x337

Fees

The fees generated from each market will go to the market reserves.

Fees are generated from:

  • Performance fees
  • Liquidation fees

These fees will be generated in different token types.

Getting fees

Any wallet can call the market function to transfer Surplus Seed Reserves to the Sandbox Community Pool

image|690x30

Converting fees into COMP

Fees collected by the Sandbox Community Pool will come in various token forms. Selling these tokens on third-party DEXs could expose the protocol to risks like impermanent loss, sandwich attacks, etc.

To mitigate these risks, similar to the process of liquidations, the Sandbox Community Pool will offer assets at a 5% discount in exchange for COMP.

Anyone can swap their COMP for assets available in the Sandbox Community Pool with a 5% discount. The price will be based on the oracle data at the moment of transaction.

40% of COMP will stay in SCP, and 60% of COMP will go to the Treasury.

Creator Incentivization

Markets will gain or lose points daily based on factors like reserves, bad debt, TVL, liquidity on DEXes, and any additional incentives.

Every 6 months, COMP from the SCP will be distributed to markets that meet a specific point threshold.

Sandbox Multi-sig will set the threshold and may exclude malicious markets from competition. COMP will be released to the markets proportionally to the number of points gained where wallets with Fee Ownership could claim incentives over a 6-month vesting period.

Fee switch

The Compound DAO has the ability to toggle fees on or off. If the fee switch is off, fees won’t be withdrawn from the market reserves to the SCP.

Fees from Market Depreciation will still go to SCP.

Liquidations

Searchers earn profits from liquidations through a liquidation discount. Compound Sandbox will take 50% of this profit to bolster market reserves.

Public Searcher

A Public Searcher will be made available for the community's benefit. Anyone can easily deploy and set up a searcher in a few steps to start liquidating Sandbox positions for profit. All the new markets will be dynamically uploaded into the searcher system.

Market creation flow

Creator shall configure the following parameters: image|690x351

Immutable parameters

Utilization

Utilization is an immutable parameter. Sandbox allows setting up any utilization from 0 to 95%, however, markets with <80% utilization will be unpopular.

Alternatively, we would like to investigate the possible approach of the fuzzy-controlled interest rate mentioned in AAVE V4.

Interest curve

The interest curve is an immutable parameter. It prevents from making the curve vulnerable to increasing borrow APR as well as decreasing lend APR. There will be a tested and white-listed list of curves that the creator will be able to use. The list can be expanded with new curves. Such an approach should prevent protocol from vulnerable curves.

PID Controller

|439x397

PID Controller is the mechanism that updates such parameters for the market:

  1. Collaterals Supply Cap
  2. Collaterals Collateral Factor
  3. Collaterals Liquidation Factor
  4. Collaterals Liquidation Penalty

Supply caps

Supply caps are restricted in every market due to the liquidation ability of every asset. The higher the DEX volume, the higher the amount of swap with the same slippage. Sandbox should not set up the same supply cap for the same collateral in different markets, as the more markets are created, the more supply becomes diminished, relative to the available liquidity for that asset.

Supply caps calculation.

The basic approach for calculating the supply caps is to gather all on-chain metrics from the top DEXes and based on the metrics and formulas, calculate new supply caps. However, such an approach is vulnerable to flash loan attacks, thus we introduce the Time-Weighted Average (TWA) Total Value Locked (TVL) parameter. Instead of setting up supply caps based on the current DEXes TVL, the PID will accumulate the historical data, and calculate supply caps for each new market. Our formula accepts fresh market data as well as historical data.

Sandbox integrates Chainlink Automation and Chainlink Data Streams to calculate supply caps. Periodically, Chainlink Automation will trigger Chainlink Data Stream to fetch required assets data to update on-chain logic. The data that is required is aggregated DEX pools TVL.

Collateral configurations

Collateral Factor, Liquidation Factor, and Liquidation Penalty should be approached with a conservative mindset, ensuring the market's safety and stability. Any updates to these parameters should only occur in response to significant changes in the broader market conditions, to prevent unnecessary risk or disruption.

Collateral Factor

The Collateral Factor represents the percentage that determines the maximum borrowing capacity a user can have against their collateral. Essentially, it defines how much of the Base Asset can be borrowed for each unit of the Collateral Asset. Reducing the collateral factor makes the market safer by limiting the amount that can be borrowed against any given asset, protecting against excessive leverage and potential liquidations in volatile market conditions.

Liquidation Factor

The Liquidation Factor determines the point at which a position becomes eligible for liquidation. It’s expressed as a percentage, indicating the value threshold below which the collateral’s value no longer supports the borrowed asset, triggering a liquidation event. This factor should always be higher than the collateral factor but should remain below 100%.

Increasing the liquidation factor lowers the likelihood of liquidation by allowing more buffer for fluctuations in collateral value, while reducing the liquidation factor can make previously safe positions vulnerable to liquidation, particularly in volatile markets.

Liquidation Penalty

The Liquidation Penalty sets the discount provided to liquidators when they step in to liquidate an under-collateralized position. A higher liquidation penalty incentivizes more liquidators to act quickly when a position enters liquidation. This creates a competitive environment among liquidators, ensuring swift action to stabilize the market. However, too high of a penalty can become a burden on users, as it reduces the value they can recover from their collateral.

Potential risks and mitigations

Sandbox is permissionless and allows anyone to create a market, similar to Uniswap where anyone could create a liquidity pool. We can’t prevent bad behavior, similar to Uniswap, since we are providing a tool, not a product. But we can mitigate as many risks as possible while keeping protocol permissionless.

|Risk|Mitigation| | --- | --- | |Creators could create a market with malicious tokens|UI White-list: Sandbox Multisig will whitelist markets present on UI to limit Sandbox UI users from interacting with risky assets.| | |Risk Score: A calculated metric based on historical assets TVL, volatility, trading volume, locked DEX LPs, and seed reserves. This factor will be visible to users and will undergo ongoing improvements.| | |Seed Reserves: Creator must seed reserved and could supply more reserves to increase a Risk Score.| | |DEX LP Locking: Creators can lock DEX LP tokens to assure users that liquidity will remain in decentralized exchanges (DEXs).| | |Price feeds: Creators can’t put a token if it doesn’t have a price feed. It secures users from DEX liquidity manipulations and flash loans.| |Creators can add malicious token to successful market|Collaterals: Creators won’t be able to add more collaterals since it could increase the risk of wiping reserves out.| |Vulnerable interest curves|List of strategies: A list of tested strategies will restrict users from creating an unprofitable curve that could “eat” market reserves.|

Execution

Development phases

The development approach is iterative and could be divided into the following phases:

  1. Architecture finalization
  2. Team set up / project set up
  3. Protocol development
  4. SDK Development
  5. Front-end design creation
  6. Front-end development
  7. Migrator & asset swapping development
  8. Liquidator and buy-back searcher development
  9. Internal auditing
  10. Testnet deployment
  11. Security audit
  12. Audit fixes
  13. Testnet 2.0 deployment
  14. Beta testing
  15. Production deployment

Development phases gantt chart

|624x265

The development timeline is 24 weeks, consisting of 17 weeks for pure development and 7 weeks of audit, testing and fixes.

Deliverables

  • Protocol smart contracts source code
  • Protocol front-end source code
  • Testnet and mainnet production deployment for the whole infrastructure
  • Unit, functional and fuzzy test coverage
  • Software Development Kit for Front-end (Library)
  • Searcher (Liquidator) source code and deployed running version of it
  • Internal audit report
  • Position Migrator source code
  • Developer and community documentation

Tech Stack & Tools

  • Protocol - Solidity / Hardhat / Chainlink Automation / Chainlink Datastreams / Oracles & Wrappers
  • SDK - Typescript / ethers.js / Node.js
  • Searcher - Typescript / ethers.js / Nest.js
  • Frontend - Typescript / Next.js / Wagmi / IPFS

Conclusion

Not every token deserves its own market, but every protocol ought to have the opportunity to demonstrate their potential, and compete for the right to be listed on Compound.

Compound Sandbox is an infrastructural expansion to Compound, which allows new markets to be evaluated in a safe way, while contributing to both Compound Treasury, and TVL.

The striking innovations included for COMP tokenomics bring Sandbox into alignment with Compound, and provide a test ground for liquidation strategies which if successful could represent widespread changes in COMP stability.