Pool Factory
In the following sections we elaborate the PoolFactory.sol specification.
Pool Factory is used to create pools that allows a borrower to borrow from a group of lenders. Pool Factory stores the various global parameters to manage pools. Borrowers need to be verified to be able to create a pool.
- by deploying the contract
- gaining ownership from previous owner
- Can transfer ownership to another admin
- Can update logic contract implementation addresses
- Can update thresholds for parameters
- Users verified by one of the supported Verifiers
- Can call the createPool() to create new pools for loan requests
A verified user can create a lending pool to borrow from a group of lenders. The following function is used to create a pool.
function createPool(
uint256 _poolSize,
uint256 _borrowRate,
address _borrowToken,
address _collateralToken,
uint256 _collateralRatio,
uint256 _volatilityThreshold,
uint256 _repaymentInterval,
uint256 _noOfRepaymentIntervals,
address _poolSavingsStrategy,
uint256 _collateralAmount,
bool _transferFromSavingsAccount,
bytes32 _salt,
address _verifier,
address _lenderVerifier
)
msg.sender
should approve collateral tokens to the pool to be created, by pre-generating the pool address.
msg.sender
: verified users onlymsg.value
: Only ifcollateralToken
is address(0) (Ether) should be ==_collateralAmount
- Note: All the parameters might be subject to range specified by admin. We threshold the following parameters:
_collateralRatio
[collateralRatioLimit.min, collateralRatioLimit.max]
_borrowRate
[borrowRateLimit.min, borrowRateLimit.max]
_noOfRepaymentIntervals
[noOfRepaymentIntervalsLimit.min, noOfRepaymentIntervalsLimit.max]
_repaymentInterval
[repaymentIntervalLimit.min, repaymentIntervalLimit.max]
These ranges have been defined purely to better manage risks, especially during the early stages. This thresholding can be removed at a later stage.
_poolSize
: loan amount requested_borrowRate
: Interest rate per annum for borrowing. The interest rate fraction should be multiplied by10**30
. e.g. interest rate of 10% should be converted to10**29
_borrowToken
: Borrow Asset requested. If Ether, address(0) to be used_collateralToken
: Asset posted as collateral for the loan. If Ether, address(0) to be used_collateralRatio
: Limit on the ratio of collateral to the debt (principal + interest), which if falls below a threshold, results in liquidation (Refer to Broken link). The _collateralRatio should be multiplied by10**30
_repaymentInterval
: Interval in seconds after which 1 instalment of interest repayment for loan should be repaid_noOfRepaymentIntervals
: Number of instalments in which interest of loan will be repaid_poolSavingsStrategy
: Whitelisted strategy in which the collateral tokens should be invested in Savings Account_collateralAmount
: Amount of asset to be deposited as collateral for the loan_transferFromSavingsAccount
: Flag to determine if collateral will be added from the Savings Account or directly transferred from the borrower's wallet_salt
: random and unique initial seed used in pre-generation of the pool address_verifier
: Verifier that the borrower chooses to represent their identity for this pool. A modifer (onlyBorrower()
) is passed this parameter to check whether they've actually been verified by_verifier
or not_lenderVerifier
: Verifier that lenders that wish to participate in the pool need to be verified by
Last modified 1yr ago