Overview

Copra aims to create the first ‘corporate bond’ market in DeFi where

High Level Architecture

Screenshot 2024-03-18 at 3.14.37 PM.png

  1. Borrowers and lenders can deposit and withdraw into the LiquidityWarehouse contract by calling the relevant functions.
    1. Borrowers can call depositBorrower to deposit assets and withdrawBorrower to withdraw assets
    2. Lenders can call depositLender to deposit assets and withdrawLender to withdraw assets.
  2. An automated Chainlink Automation contract named DebtCovenant monitors the net asset values of both the borrower and lender deposits. This contract can call deactivate to deactivate the LiquidityWarehouse if the liquidation threshold has been breached as well as activate to reactivate the LiquidityWarehouse if the liquidation threshold is fulfilled. A full description on how the liquidation threshold is calculated is outlined here.
  3. Assets in the LiquidityWarehouse are periodically deployed to the borrower’s smart contracts in exchange for shares on the borrower’s protocol. These assets are withdrawn to the LiquidityWarehouse in two cases namely
    1. When a lender calls withdrawLender and there is insufficient liquidity in the LiquidityWarehouse
    2. When deactivate is called to automatically withdraw all deployed assets from the borrower’s smart contracts.

Mechanisms

Roles

There are two privileged roles

  1. PAUSER_ROLE: this will be owned by a 2 out of 3 multisig contract, and has the ability to pause (and unpause) the Liquidity Warehouse contract
    1. when the Liquidity Warehouse is paused, both lender and borrower deposit functions i.e depositLender and depositBorrower cannot be called
  2. DEFAULT_ADMIN_ROLE: The DEFAULT_ADMIN will be able to update the terms of the LiquidityWarehouse and interact with the underlying borrower protocol to deploy and withdraw assets. This introduces a degree of centralization risk as a malicious DEFAULT_ADMIN will be able to steal user funds. In order to mitigate this risk, all LiquidityWarehouses will be owned by a Timelock contract so that there is a delay period before sensitive transactions are executed. A Gnosis Multisig requiring 2 out of 3 signer addresses will be granted the PROPOSER, EXECUTOR and CANCELLER roles on the Timelock contract so that the the multisig can propose, execute or cancel operations.