Skip to content

maple-labs/debt-locker

Repository files navigation

DebtLocker

CircleCI License: AGPL v3

DebtLocker is a smart contract that allows Pools to interact with different versions of Loans.

This contract has the following capabilities:

  1. Claim funds from a loan, accounting for interest and principal respectively.
  2. Accept terms of refinancing.
  3. Perform repossession of funds and collateral from a Loan that is in default, transferring the funds to a Liquidator contract.
  4. Set the allowed slippage and minimum price of collateral to be used by the liquidator contract.
  5. Claim recovered funds from a liquidation, accounting for the amount that was recovered as principal in the context of the Pool, and registering the shortfall.

Dependencies/Inheritance

The DebtLocker 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

Setup

git clone [email protected]:maple-labs/debt-locker.git
cd debt-locker
dapp update

Running Tests

  • 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_setAllowedSlippage)
  • To run tests with a specified number of fuzz runs: ./test.sh -r <runs> (e.g., ./test.sh -t test_setAllowedSlippage -r 10000)

This project was built using dapptools.

Roles and Permissions

  • Governor: Controls all implementation-related logic in the DebtLocker, allowing for new versions of proxies to be deployed from the same factory and upgrade paths between versions to be allowed.
  • Pool Delegate: Can perform the following actions:
  • Claim funds
  • Set allowed slippage and minimum price for liquidations
  • Trigger default
  • Set the auctioneer (dictates price for liquidations) to another contract
  • Accept refinance terms
  • Set fundsToCapture, a variable that represents extra funds in the DebtLocker that should be sent to the Pool and registered as interest.

Audit Reports

Release Version Auditor Report Link Date
v2.0.0 Trail of Bits ToB Report 2021-12-28
v2.0.0 Code 4rena C4 Report 2022-01-05
v3.0.0 Trail of Bits ToB Report 2022-04-12
v3.0.0 Code 4rena C4 Report 2022-04-12
v4.0.0 Trail of Bits Trail of Bits Report 2022-08-24
v4.0.0 Spearbit Spearbit Report 2022-10-17
v4.0.0 Three Sigma Three Sigma Report 2022-10-24

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.