Market Making API
API documentation for private market makers
Getting Started
1. Connecting to the Maker API
Production:
wss://api.liquorice.tech/v1/maker/ws
Provide the following headers in the WebSocket request
maker
- name of the Market Makerauthorization
- authorization token
The WebSocket server sends Ping
message every 30 seconds.
2. Receiving RFQ
Whenever a trader requests a quote, the Liquorice system forwards it to the chosen Market Makers using the following message
Exactly one of the baseTokenAmount
or quoteTokenAmount
fields will be present.
Having baseTokenAmount
present is equivalent to asking "How much ETH would I get if I pay 1000 USDC?"
Having quoteTokenAmount
is equivalent to asking "How much USDC do I need to pay to get 1 ETH?"
3. Providing signed Quote
The quote message should be sent within the same WebSocket connection that received the RFQ, using following format:
Market makers are free to provide multiple price levels with different sizes in their quote. E.g.
Level 0 - 1 ETH / 3000 USDT
Level 1 - 0.5 ETH / 1502 USDT
Level 2 - 0.1 ETH / 310 USDT
3.1 Quote level signature schema
Each quote level corresponds to it's own Liquorice Order and represented by a standalone transaction
Solidity code that generates signing payload looks as follows:
address(this)
refers to the address of the selected Liquorice market (corresponding to the market
field in the rfqQuote
)
Contracts use the EIP-191 standard, which prepends hash with the string \x19Ethereum Signed Message:\n32
before verifying the signature. Most signing libraries handle this automatically (e.g. hashMessage
function in ethers.js
does this)
Full form of the payload to be verified:
The above code results in a 32-byte keccak hash. This hash must be signed with the Private Key that corresponds to the signer
address in rfqQuote
.
Below is an example of how to generate the hash in TypeScript using ethers.js v6
4. Getting info on settled trades
Whenever trade occurs onchain, Liquorice settlement contracts will issue an event called traderOrder which can be used to gain info on transfered voluems.
Important note on token approvals
The market maker should grant token approval solely to the Balance Manager Liquorice smart contract address. Providing approval to any other Liquorice address may compromise the security of your funds, as it does not guarantee the same level of protection.
Last updated