Skip to content

maple-labs/open-term-loan

Repository files navigation

Open Term Maple Loan

Foundry CI GitBook - Documentation Foundry License: BUSL 1.1

Overview

This repo contains a set of contracts to facilitate on-chain Loans between Maple Finance Pools and institutional borrowers. These contracts contain logic to:

  1. Deploy new Loans.
  2. Perform Loan funding.
  3. Draw down funds.
  4. Manage collateral.
  5. Calculate payment amounts and schedules (can handle amortized and interest-only payment structures).
  6. Perform repossessions of collateral and remaining funds in a defaulted Loan.
  7. Claim interest and principal from Loans.
  8. Perform refinancing operations when a lender and borrower agree to new terms.
  9. Upgrade Loan logic using upgradeability patterns.

Dependencies/Inheritance

Contracts in this repo inherit and import code from:

Contracts inherit and import code in the following ways:

  • MapleLoan and MapleLoanFeeManager use IERC20 and ERC20Helper for token interactions.
  • MapleLoan inherits MapleProxiedInternals for proxy logic.
  • MapleLoanFactory inherits MapleProxyFactory for proxy deployment and management.

Versions of dependencies can be checked with git submodule status.

Setup

This project was built using Foundry. Refer to installation instructions here.

git clone [email protected]:maple-labs/open-term-loan.git
cd open-term-loan
forge install

Running Tests

  • To run all tests: forge test
  • To run specific tests: forge test --match <test_name>

./scripts/test.sh is used to enable Foundry profile usage with the -p flag. Profiles are used to specify the number of fuzz runs.

Audit Reports

December 2022 Release

Auditor Report Link
Trail of Bits 2022-08-24 - Trail of Bits Report
Spearbit 2022-10-17 - Spearbit Report
Three Sigma 2022-10-24 - Three Sigma Report

June 2023 Release

Auditor Report Link
Spearbit Auditors via Cantina 2023-06-05 - Cantina Report
Three Sigma 2023-04-10 - Three Sigma Report

August 2024 Release

Auditor Report Link
0xMacro 2024-08-14 - 0xMacro Report
Three Sigma 2024-08-23 - Three Sigma Report

Bug Bounty

For all information related to the ongoing bug bounty for these contracts run by Immunefi, please visit this site.

About Maple

Maple Finance is a decentralized corporate credit market. Maple provides capital to institutional borrowers through globally accessible fixed-income yield opportunities.