project screenshot 1
project screenshot 2
project screenshot 3
project screenshot 4
project screenshot 5
project screenshot 6

Earth Protocol

Earth is a permissionless interest rate swap protocol. It allows conservative investors looking for fixed-income products to share their liquidity with seasoned market-makers looking for enhanced yield.

Earth Protocol

Created At

Superhack

Winner of

🏊 Mode — Prize Pool

Project Description

Motivation: The fundamental components of DeFi like AMMs, PoS Staking Pools, and collateralized debt vaults, are all designed to incentivize decentralization by offering variable rewards to depositors. The lack of fixed-yield products in DeFi discourages larger institutions and conservative individuals from participating in the DeFi market.

Introduction: Earth is a permissionless interest rate swap protocol that facilitates risk-shared market-making for DeFi liquidity pools. The protocol allows risk-off (conservative / low-risk) investors looking for “fixed yield” to share (or lend) liquidity to risk-on (leveraged farmers / high-risk) investors looking for “enhanced yield”.

Product: We have deployed our prototype on BASE Goreli with the Uniswap V2 forked Cloudbase Finance ETH-CLOUD LP. Our prototype provides three independent DeFi vaults for different risk profiles.

  1. ETH Vault: A fixed-yield product for investors seeking stable returns on ETH.
  2. CLOUD Vault: A fixed-yield product for investors seeking stable returns on CLOUD.
  3. ETH-CLOUD LP Boosted Vault: Leveraged product for market-makers looking to boost their liquidity mining yield on ETH-CLOUD LP position.

How it works: Earth Protocol allows risk-on and risk-off investors to become counterparties for one another while adding liquidity to an LP pool. We do this by splitting a yield-bearing position into two different kinds of risk tranches (1) Fixed tranches for risk-off investors looking for stable yield, and (2) Variable tranches for risk-on investors seeking enhanced (leveraged) yield.

The fixed-return vaults hold the underlying assets without using any strategies to generate yield. Instead, leverage is applied to the boosted LP vault by borrowing funds from the fixed-return vaults. Therefore, the ratio among the TVL of these vaults determines the leverage available to the boosted vault.

The strategies are operated in epochs of 7 days. When the strategy is not running, users can deposit & withdraw their assets. Once the strategies are in operating mode, deposits & withdrawals are locked and any new request will be processed at the end of the ongoing epoch.

At the start of the epoch: Leverage available for the boosted vault is calculated, promised APRs of the fixed vaults are recorded, and funds are borrowed from the fixed vault contract. LP strategy is implemented with market-making collateral + borrowed funds.

Strategy running mode: Keep a check on the generated profit/loss of the epoch. Liquidate collateral and exit the strategy if the loss in the epoch is close to the supplied collateral value. Else keep compounding generated yield.

At the end of the epoch: Borrowed funds with interest are first fully returned to the fixed-income vaults. Post that, all the remaining funds are sent to the boosted vault.

How it's Made

We coded the project in Solidity. We built it using Foundry and Hardhat templates. We used OpenZepplin libraries for erc20, erc4626 extension, token transfer, safeerc, ownable, and pausable to write our vault and strategy contracts.

Vault contracts are built at ERC-4626 standard and interface with the end user. They hold vault-related functions such as share management, access management, deposit, and withdrawal. Strategy contracts hold the fund strategies related function to their respective vaults. We also built a frontend interface for users and administrators to use the product. We built the web application on React JS. It is using Prime React libraries for web components, wagmi for Blockchain interaction, Rainbow Kit for wallet integration, and Covalent services for fetching Blockchain history.

We deployed the project on Base Goreli. Base is powered by Coinbase which is bringing a large wave of retail and institutional users to DeFi. Our product is best suited for the user base coming from CeFi and TradFi backgrounds. Also, Base is built on an OP-stack super chain enabling easy interoperability among different networks and realizing our vision of risk-shared liquidity for all.

Epoch Strategy Contract: https://goerli.basescan.org/address/0x25adf247ac836d35be924f4b701a0787a30d46a9 ETH Vault Contract: https://goerli.basescan.org/address/0x74c5e75798b33d38abee64f7ec63698b7e0a10f1 CLOUD Vault Contract: https://goerli.basescan.org/address/0xe8d223328543Cc10Edaa3292CE12C320CE43A099 ETH-CLOUD LP Boosted Vault Contract: https://goerli.basescan.org/address/0x6AB8c9590bD89cBF9DCC90d5efEC4F45D5d219be

We are using LayerZero to enable direct access to liquidity pools available on Base Network. Users on Optimism Network can add liquidity in Optimism as well as Base Network without needing to leave the Optimism Network. LayerZero helps us to send & receive messages across networks. It enables us to merge liquidity pools and perform vault functions seamlessly cross-chain. We are using Stargate integration with LayerZero to transfer assets across networks. The implementation is yet to be fully done. Bridge contracts are deployed here: https://goerli-optimism.etherscan.io/address/0x33e47fe37fef6ab1d83e54aad6c8d01c048171e1 https://goerli.basescan.org/address/0x2760394D2103f799A678C555009c1E94e5Eb217A

We have used OP-stack for building and the contracts are fully compatible with Mode Testnet. We couldn’t deploy our contracts on Mode Testnet as we couldn’t find any AMM pools on the network currently. We can deploy on Mode once a compatible liquidity pool is available there. We can also deploy our LayerZero contracts on Mode enabling seamless cross-chain liquidity across Optimism, Base, and Mode.

We are using Covalent for enhancing the user experience on the front end. It is enabling us with services that let us fetch vault and strategy contracts-related information in real-time and enable features like transaction history.

We implement the project with Cloudbase Finance WETH-CLOUD liquidity pool. We used the AMM’s factory, masterchef, and router contracts. We used Cloudbase Finance as they are Uniswap V2 based and have a functional liquidity pool available on the Base Testnet. This made the implementation and testing of our product a lot easier.

background image mobile

Join the mailing list

Get the latest news and updates