Debt Repayment¶
Overview¶
Interface containing required methods for performing collateral top ups on a lending protocol
This needs to be implemented by each protocol-specific top up handler (e.g. Aave Handler, Compound Handler)
Overview¶
LP token holders can register a position on a supported protocol for debt repayment
Positions can get updated or removed at any time
Keepers can execute debt repayments
Debt Repayments are executed through pre-registered top-up handlers
Overview¶
Handles fees charged on debt repayment amount
Integrating Protocols for Debt Repayment¶
There is a number of protocols for which Mero supports debt repayments.
Currently the following protocols are supported:
We aim to add support to various other protocols. Please reach out if you are interested in integrating with Mero by emailing info@mero.finance
.
This section outlines how protocols can be integrated with Mero. Note that in the future integration will be subject to approval from the Mero DAO.
Getting Started: Top Up Handlers¶
Integrating a new protocol can be relatively straightforward. The top up logic is mostly abstracted away and handled by the TopUpAction
contract. This contract handles the registration/deletion/updating of positions, while also containing a list of all supported Top up handlers. A top up handler is a contract which contains the top up logic for a specific protocol. Hence, integrating a new protocol requires to create a new top up handler for it.
A top up handler contains the following interface.
-
function topUp(bytes32 account, address underlying, uint256 amount, bytes memory extra) external payable
Tops up the account for the protocol
account
: Account to be topped upunderlying
: Underlying currency to be used for top upamount
: Amount to be topped upextra
: Arbitrary data that can be passed to the handler
-
TopUpHandler.
getUserFactor
(address account, bytes memory extra) external returns (uint256)¶ Returns a factor for the user which should always be >= 1 for sufficiently colletaralized positions and should get closer to 1 when collaterization level decreases
account
: Account for which to get the factorextra
: Arbitrary data that can be passed to the handler
An example implementation of a top up handler is given by the Top Up Handler for Compound.
Adding A Top Up Handler¶
Once a new protocol top up handler has been implemented it only needs to be added to the TopUpAction
contract. This can be done via the following method:
-
updateTopUpHandler(bytes32 protocol, address handlerAddress) external
Update an existing or add a new top up handler.
protocol
: Name of the protocol asbytes32
handlerAddress
: Address of the handler