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:
- Deploy new Loans.
- Perform Loan funding.
- Draw down funds.
- Manage collateral.
- Calculate payment amounts and schedules (can handle amortized and interest-only payment structures).
- Perform repossessions of collateral and remaining funds in a defaulted Loan.
- Claim interest and principal from Loans.
- Perform refinancing operations when a lender and borrower agree to new terms.
- 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.
git clone git@github.com:maple-labs/loan.git
cd loan
dapp update
- To run all tests:
make test
(runs./test.sh
) - To run a specific test function:
./test.sh -t <test_name>
(e.g.,./test.sh -t test_fundLoan
) - To run tests with a specified number of fuzz runs:
./test.sh -r <runs>
(e.g.,./test.sh -t test_makePayments -r 10000
)
This project was built using Foundry.
- 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.
For more in-depth technical documentation about these contracts, please refer to the GitHub wiki.
Auditor | Report link |
---|---|
Trail of Bits | ToB - Dec 28, 2021 |
Code 4rena | C4 - Jan 5, 2022 |
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 |
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.