From 00cfb1451a3b24ab1e535acee38758d3b3759226 Mon Sep 17 00:00:00 2001 From: truefibot Date: Thu, 9 Feb 2023 15:57:04 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9C=20Add=20documentation=20to=20Minim?= =?UTF-8?q?umDepositController=20(#660)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/README.md b/README.md index c2a3c3f..3abdf33 100644 --- a/README.md +++ b/README.md @@ -1 +1,42 @@ # 🦐 Minimum deposit controller + +## Overview +The minimum-deposit controller is built based on the default deposit controller from carbon-contracts and it is designed to give the portfolio manager the ability to set the minimum value that lenders can deposit. + +Minimum deposit value is first initialized by the manager in the `initialize` function and can be changed by calling `setMinimumDeposit` or `configure` function. + +## Affected Methods +```solidity +function onDeposit( + address, + uint256 assets, + address +) external view returns (uint256, uint256) +``` +Called by TrancheVault in the `deposit` function. Checks if deposit is greater or equal to minimum deposit value and returns number of shares that lender should get and deposit fee that lender should pay. + +```solidity +function onMint( + address, + uint256 shares, + address +) external view returns (uint256, uint256) +``` +Called by TrancheVault in the `mint` function. Checks if amount of shares converted to assets is greater or equal to minimum deposit value and returns number of assets that should be transferred and deposit fee that lender should pay. + +```solidity +function setMinimumDeposit(uint256 newMinimumDeposit) public +``` +Sets minimum deposit value and emits event with changed value. + +```solidity +function configure( + uint256 newCeiling, + uint256 newFeeRate, + uint256 newMinimumDeposit, + ILenderVerifier newLenderVerifier, + DepositAllowed memory newDepositAllowed +) external +``` +Allows the manager to change multiple parameters in the deposit controller (ceiling, fee rate, minimum deposit, lender verifier and allowance for deposit). +