EcosystemNFTsDocs

Footer

Xchange

  • Swap
  • Liquidity
  • Loans
  • Fund
  • Vote

Tokens

  • X7R
  • X7DAO
  • X7D
  • X7101-X7105

Explore

  • Dashboard
  • Guides
  • Integration
  • Whitepaper
  • Breakdowns
  • Onchains
  • FAQs

Community

  • Telegram
  • Twitter
  • Discord
  • Warpcast
  • Blog
  • Links

Permissionless Trustless Decentralized Exchange

Launch your project on Xchange with 10-1000x the initial liquidity across multiple blockchains where anyone can Swap, Borrow and Lend!

X7 Finance·Trust No One. Trust Code. Long Live DeFi.
  • Telegram
  • Twitter
  • Discordś
  • Warpcast
  • YouTube
  • Reddit
  • GitHub
  • Pioneer 1488 avatar
    Guides
    View
  • Pioneer 1488 avatar
    Integration
    View
  • Pioneer 1488 avatar
    Whitepaper
    View
  • Pioneer 1488 avatar
    Breakdowns
    View
  • Pioneer 1488 avatar
    Onchains
    View
  • Pioneer 1488 avatar
    FAQ
    View
    • Intro

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:

ParameterDescription
tokenAddressThe address of the token intended to be used as collateral.
amountAmount of collateral you're putting up.
loanTermContractThe address of the chosen loan term contract.
loanAmountThe amount of money you wish to borrow.
loanDurationSecondsThe time duration (in seconds) for which the loan will be active.
liquidityReceiverAddress where the loan amount will be received (generally the borrower's address).
deadlineThe timestamp after which the loan request will expire.

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 );
Next
Intro →

-

  • Pioneer 1488 avatar
    Guides
    View
  • Pioneer 1488 avatar
    Integration
    View
  • Pioneer 1488 avatar
    Whitepaper
    View
  • Pioneer 1488 avatar
    Breakdowns
    View
  • Pioneer 1488 avatar
    Onchains
    View
  • Pioneer 1488 avatar
    FAQ
    View

On this page

  1. Approve Lending Pool to move tokens

  2. Create the Loan

    1. Required Parameters