Maple Loan Artifacts and ABIs

npm install @maplelabs/loan@4.0.1



Foundry CI License: AGPL v3

DISCLAIMER: This code has NOT been externally audited and is actively being developed. Please do not use in production without taking the appropriate steps to ensure maximum security.

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.


The MapleLoan contract is deployed using the MapleProxyFactory, which can be found in the modules or on GitHub here.

MapleProxyFactory inherits from the generic ProxyFactory contract which can be found here.

Testing and Development


git clone
cd loan
dapp update

Running Tests

  • To run all tests: make test (runs ./
  • To run a specific test function: ./ -t <test_name> (e.g., ./ -t test_fundLoan)
  • To run tests with a specified number of fuzz runs: ./ -r <runs> (e.g., ./ -t test_makePayments -r 10000)

This project was built using Foundry.

Roles and Permissions

  • Governor: Controls all implementation-related logic in the MapleLoanFactory, allowing for new versions of Loans to be deployed from the same factory and upgrade paths between versions to be allowed.
  • Borrower: Account that is declared on instantiation of the Loan and has the ability to draw down funds and manage collateral. It should be noted that payments can be made from any account on behalf of a borrower.
  • Lender: Account that is declared on Loan funding. Has the ability to claim all interest and principal that accrues from payments. Also has the ability to repossess a Loan once it is in default.

Technical Documentation

For more in-depth technical documentation about these contracts, please refer to the GitHub wiki.

Audit Reports

Auditor Report link
Trail of Bits ToB - Dec 28, 2021
Code 4rena C4 - Jan 5, 2022

Bug Bounty

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

Severity of Finding Payout
Critical $50,000
High $25,000
Medium $1,000

About Maple

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

For all technical documentation related to the currently deployed Maple protocol, please refer to the maple-core GitHub wiki.