Skip to content

maple-labs/debt-locker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e5d74d8 · Dec 14, 2021

History

45 Commits
Oct 7, 2021
Aug 12, 2021
Dec 1, 2021
Dec 14, 2021
Dec 13, 2021
Jul 22, 2021
Aug 12, 2021
Nov 14, 2021
Dec 1, 2021
Aug 12, 2021
Nov 11, 2021
Oct 7, 2021
Dec 1, 2021
Aug 12, 2021
Oct 7, 2021

Repository files navigation

DebtLocker

CircleCI 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.

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 git@github.com: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.

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.