#
Get Initial Liquidity Loan
getInitialLiquidityLoan
To take out a Initial Liquidity Loan, call the getInitialLiquidityLoan function on the Lending Pool contract. If executed correctly, this function will return the loanID, which can then be used to manage and track your loan, and a XchangePair will be created with the Tokens paired amount of tokens in the loan request. Else, the function reverts.
It's the primary method to originate a loan on the platform. Requires an on-chain execution.
#
Approve Lending Pool to move tokens
First approve the token to be spent by the Lending Pool.
address tokenAddress = 0xTOKENADDRESS000000000000000000000000000000; // change me!
unint256 amountOfTokenForInitialLiquidityLoanPool = 100000000000000000000; // change me!
address lendingPoolAddress = 0x740015c39da5d148fca25a467399d00bce10c001;
IERC20 token = IERC20(tokenAddress);
token.approve(lendingPoolAddress, amountOfTokenForInitialLiquidityLoanPool)
#
Create the Loan
#
Required Parameters
To successfully execute the function and take out a loan, the following parameters must be provided:
This function should be called after getting a quote using getDiscountedQuote to understand the terms.
address tokenAddress = 0xTOKENADDRESS000000000000000000000000000000; // change me!
uint256 amount = 1000; // change me!
address loanTermContract = 0xLOANTERMADDRESS0000000000000000000000000000; // change me!
uint256 loanAmount = 50000000000000000000; // in gwei change me!
uint256 loanDurationSeconds = 604800; // change me! (7 days in seconds)
address liquidityReceiver = msg.sender; // usually the borrower's address
uint256 deadline = block.timestamp + 1200; // change me! (add 20 minutes from now)
IX7LendingPoolV1 lendingPool = IX7LendingPoolV1(0x740015c39da5d148fca25a467399d00bce10c001);
uint256 loanID = lendingPool.getInitialLiquidityLoan(
tokenAddress,
amount,
loanTermContract,
loanAmount,
loanDurationSeconds,
liquidityReceiver,
deadline
);