Liquorice
  • Intro
    • What is Liquorice
    • General flow
  • For market makers
    • Guide for PMMs
    • Basic Market Making API
    • Lending pools intro
      • Using lending pools via RFQ API
      • Onchain interactions with lending pools
  • For solvers
    • Guide for Solvers
    • WebSocket API
    • REST API
    • Settlement
      • Bebop JAM
      • CoW Protocol
  • For Liquidity Providers
    • Guide for LPs
  • LINKS
    • 🔗website
    • 👩‍💻github
    • 🐦twitter
    • Discord
    • Past audits
    • Smart contracts
Powered by GitBook
On this page
  1. For market makers
  2. Lending pools intro

Using lending pools via RFQ API

This page gives an overview on how to provide quotes that utilize liquidity in Liquorice lending pools

API details

Lending pools can be utilized using QuoteLevelExt type of the quote level sent in RFQQuote message Configuration of lending token transfer and lending parameters should be done using fields in baseTokenDataand quoteTokenData

{
    ...,
    baseTokenData: {
        /// Token address
        address: string,
        /// Total amount of baseToken to take from effectiveTrader,
        /// with up to 18 decimal places
        amount: string,     
        /// Portion of the amount to transfer to the recipieint
        toRecipient?: string,
        /// Portion of the amount to repay token debt with
        toRepay?: string,
        /// Portion of the amount to supply as collateral
        toSupply?: string, 
    },
    /// Data of token to be received by trader
    quoteTokenData: {
        /// Token address
        address: string,
        /// Total amount of quoteToken to take from signer,
        /// with up to 18 decimal places
        amount: string,
        /// Minimum amount of quoteToken to take for partial fills,
        minAmount: string,     
        /// Portion of the amount to be transferred from `signer`,
        toTrader?: string,
        /// Portion of the amount to be filled by withdrawing collateral
        toWithdraw?: string,
        /// Portion of the amount to be filled by borrowing
        toBorrow?: string,
    },
}

Lending Parameters Explained

Essentially, the Liquorice RFQ allows market makers to define how they would like to handle the base and quote amounts in any proportions they desire. The Liquorice smart contract will accept these parameters and execute the necessary token transfers and borrowing.

Base Token Data

  • toRecipient – The amount of the base token to be transferred to the recipient's address.

    • After settlement, this amount will be transferred directly to the recipient's address.

  • toRepay – The amount of the base token to be used to repay the market maker's debt (if applicable).

    • After settlement, this amount will reduce the maker's debt for the given token (if applicable).

  • toSupply – The amount of the base token to be supplied to the lending pool as the market maker's collateral, which is used to facilitate any borrowing.

    • After settlement, this amount will be locked as collateral in the lending pool to facilitate any borrowing.

Note: The sum of the values in toRecipient, toRepay, and toSupply must equal the amount.

Quote Token Data

  • toTrader – The amount of the quote token to be transferred from the signer’s address to the trader.

    • After settlement, this amount will be transferred to the order originator’s address directly from signer's address.

  • toWithdraw – The amount of the quote token to be withdrawn from the lending pool and transferred to the trader.

    • After settlement, the market maker will have less collateral locked in the lending pool.

  • toBorrow – The amount of the quote token to be borrowed from the lending pool and transferred to the trader.

    • After settlement, the maker will have an outstanding debt that needs to be repaid.

Note: The sum of the values in toTrader, toWithdraw, and toBorrow must equal the amount.

PreviousLending pools introNextOnchain interactions with lending pools

Last updated 3 months ago