Solvers

API docs for connecting to Liquorice to use it as a liquidity source

What is Liquorice for those who seeking liquidity

From the perspective of an entity seeking liquidity, Liquorice can be treated as a system that aggregates Private Market Makers. For this reason, API is made almost identical to the Makers' API of ours with the exception of a few details.

Getting Started

1. Connecting to the Liquorice API*

*WebSocket API endpoint is available upon request

Provide following headers in the WebSocket request

  • solver - name of the Solver

  • authorization - authorization token

WebSocket server sends Ping message every 30 seconds.

2. Sending RFQ

Whenever solver scans it's liquidity sources, it may send RFQ to the Liquorice system using following message

{
  "messageType": "rfq";
  "message": {
    /// UUID of the RFQ
    rfqId: string;
    /// Chain ID, e.g for ArbitrumOne chainId = 42161
    chainId: number;
    /// Address of the Liquorice market contract
    market: string;
    /// RFQ expiry UNIX timestamp (seconds)
    expiry: number,
    /// Base token address
    baseToken: string;
    /// Quote token address
    quoteToken: string;
    /// Address of the account receiving quoteToken   
    trader: string;
    /// Address of the account performing trade
    effectiveTrader: string;
    // (Exactly one of the following two fields will be present.)
    /// Rational number with up to 18 decimal places, i.e. "1000.55" or "1000.000000000000000001"
    baseTokenAmount?: string;
    /// Rational number with up to 18 decimal places, i.e. "1000.55" or "1000.000000000000000001"
    quoteTokenAmount?: string;
  };
}

Exactly one of the baseTokenAmount/quoteTokenAmount fields must be present. Having baseTokenAmount present equals to asking "How much ETH would I get if I pay 1000 USDC?" and having quoteTokenAmount equals to asking "How much USDC do I need to pay to get 1 ETH?"

3. Receiving signed Quote

Quote message will sent within the same WebSocket connection that received the RFQ using following format:

{
  "messageType": "rfqQuote",
  "message": {
    /// UUID of the RFQ
    rfqId: string;
    /// Quote expiry UNIX timestamp (seconds)
    quoteExpiry: number;
    /// Address of the Liquorice market 
    market: string,
    /// HEX encoded calldata of the function within Liquorice `market` Contract
    settlementCalldata: string;
    /// Base token address
    baseToken: string;
    /// Quote token address
    quoteToken: string;
    /// Rational number with up to 18 decimal places, i.e. "1000.55" or "1000.000000000000000001"
    baseTokenAmount: string;
    /// Rational number with up to 18 decimal places, i.e. "1000.55" or "1000.000000000000000001"
    quoteTokenAmount: string;
    /// HEX encoded quote signature
    signature: string;
  }
}

3.1 Quote message signature schema

// TBD

Last updated