Search…
⌃K

# Pool Factory

In the following sections we elaborate the PoolFactory.sol specification.

## Purpose

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.

## Roles

#### Assignment

• by deploying the contract
• gaining ownership from previous owner

#### Permissions

• Can transfer ownership to another admin
• Can update logic contract implementation addresses
• Can update thresholds for parameters

### Borrower

#### Assignment

• Users verified by one of the supported Verifiers

#### Permissions

• Can call the createPool() to create new pools for loan requests

## Functionality

### Create Pool

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

function createPool(
uint256 _poolSize,
uint256 _borrowRate,
uint256 _collateralRatio,
uint256 _volatilityThreshold,
uint256 _repaymentInterval,
uint256 _noOfRepaymentIntervals,
uint256 _collateralAmount,
bool _transferFromSavingsAccount,
bytes32 _salt,
)

#### Approvals

• msg.sender should approve collateral tokens to the pool to be created, by pre-generating the pool address.

#### Restrictions

• msg.sender: verified users only
• msg.value: Only if collateralToken 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
$\in$
[collateralRatioLimit.min, collateralRatioLimit.max]
• _borrowRate
$\in$
[borrowRateLimit.min, borrowRateLimit.max]
• _noOfRepaymentIntervals
$\in$
[noOfRepaymentIntervalsLimit.min, noOfRepaymentIntervalsLimit.max]
• _repaymentInterval
$\in$
[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.

#### Arguments

• _poolSize: loan amount requested
• _borrowRate: Interest rate per annum for borrowing. The interest rate fraction should be multiplied by 10**30. e.g. interest rate of 10% should be converted to 10**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 by 10**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