https://etherscan.io/tx/0x4c6e3c832a41f67ca361268ed528cb9de29192bc3c3535dce57332baa57b79fe
gm or gn.
We are gearing up for many of our final deployments.
We heard the enthusiasm about external lending pools and wanted to shed some light on how those will work, and why we think they will be so valuable to the X7 Ecosystem.
Below find the interface for getting a quote and originating a loan:
interface IX7LendingPool {
function getQuote(
// This is the borrower for the purposes of calculating discounts
// When the loan is originated, it will be msg.sender
address borrower,
// This is the address to the loan term NFT contract
// It determines the terms of the loan, such as the origination fee,
// premium periods, payback periods, etc.
IX7InitialLiquidityLoanTerm loanTerm,
// This is the desired loan amount.
// It will be returned as a rounded amount
// to the nearest GWEI.
// There will be a discount that scales linearly
// with this amount. The more that is borrowed,
// the larger the discount.
uint256 loanAmount,
// This is the desired loan duration.
// There will be a discount that scales inversely
// so that the shorter the loan, the large the
// discount that is applied.
uint256 loanDurationSeconds
// This returns an array of values:
// roundedLoanAmount
// originationFee
// totalPremium
// premiumFeeModifier
// originationFeeModifier
//
// These values are then used to fill in the required fields
// for getting an initial liquidity loan. They also allow for
// end user interfaces to display the discount that will be applied
// by the protocol.
) external view returns (uint256[5] memory);
function getInitialLiquidityLoan(
// The token to be paired with WETH in the liquidity pair
address tokenAddress,
// The amount of the token to add to the liquidity pair
uint256 amount,
// The loanTerm contract that was used to generate the quote
IX7InitialLiquidityLoanTerm loanTerm,
// The rounded loan amount from the quote
uint256 loanAmount,
// The duration that was used in the quote
uint256 loanDurationSeconds,
// The address to receive the pair LP tokens
address liquidityReceiver,
// The deadline for the transaction, similar to what would be in
// the uniswapV2Router addLiquidityETH
uint256 deadline
// Additionally the borrower must send in the correct amount of ETH
// to originate the loan as well as an escrowed liquidation fee (that
// will be returned to the borrower when the loan liability is satisfied)
) external payable returns (uint256 loanID);
}
