Rubicon RFQ System
Subject to Change
NOTICE: The details of the Rubicon RFQ System are subject to change. Please check back regularly for updates.
The Rubicon RFQ System exists to make our market maker's liquidity more accessible for price discovery. This system is designed to facilitate aggregators and traders seeking the best price by providing real-time quotes and streamlined execution. The RFQ System will evolve over time, adapting to the needs of the market and feedback from users.
1. Authentication
To obtain an API key for authentication, clients need to create a nickname, which will be used in the tag
field. Then, contact Rubicon to obtain an API key. The API key will be assigned to the tag
to authenticate requests.
With a valid API key, all RFQ queries should be sent to the base URL of https://rfq.rubicon.finance
while targetting the relevant endpoint, as described below.
Note: in the authentication process we also approve a specific address that is permitted to transact with RubiconRFQ
; please coordinate with the team to arrange this.
2. Price discovery and market data
There are several endpoints for discovering price levels and querying market data.
2.1. /markets
Returns all active markets for a specified chain.
GET https://rfq.rubicon.finance/markets
?chainId=<int>
&tag=<string> # "nickname" of a client
# OPTIONAL:
&deadline=<string> # returns markets with orders valid until the provided deadline.
--header "X-API-KEY: obtained_key"
Each market contains two sorted arrays, "asks"
and "bids"
, where each entry is represented as an array in the format ["price", "quantity"]
. Price levels are aggregated and may internally consist of multiple orders.
{
"status": "success",
"chainId": "42161",
"markets": {
"0x82af49447d8a07e3bd95bd0d56f35241523fbab1_0xaf88d065e77c8cc2239327c5edb3a432268e5831": {
"asks": [
[
"2670.084613",
"0.003824848452"
]
],
"bids": [
[
"2661.557342",
"0.03029119972"
],
[
"2659.959768",
"0.03030939263"
]
]
}
}
}
2.2. /price-levels
To query price levels, use the following endpoint:
GET https://rfq.rubicon.finance/price-levels
?chainId=<int>
&tag=<string> # "nickname" of a client
&sellToken=<string> # address of a token to sell
&buyToken=<string> # address of a token to buy
&deadline=<string> # unix timestamp - a deadline of a quote, used to return orders that will be valid until it
--header "X-API-KEY: obtained_key"
The response contains an array of price levels for the requested side, where "q"
represents the quantity at each level, and "p"
represents the price at each level.
{
"status": "success|fail",
"chainId": "100",
"pair": {
"sellToken": "0x0000000000000000000000000000000000000000",
"buyToken": "0x0000000000000000000000000000000000000000"
},
"levels": [
{
"q": "1000.10",
"p": "250.50"
}
]
}
2.3. /liquidity
Returns resting USD liquidity in active markets for a specified chain.
GET https://rfq.rubicon.finance/liquidity
?chainId=<int>
&tag=<string> # "nickname" of a client
&deadline=<string> # optional: returns orders valid until provided deadline.
--header "X-API-KEY: obtained_key"
Each market will contain a USD value of a resting liquidity.
{
"status": "success",
"chainId": "42161",
"liquidityUsd": {
"0x82af49447d8a07e3bd95bd0d56f35241523fbab1_0xaf88d065e77c8cc2239327c5edb3a432268e5831": "450.6459247259843"
}
}
3. Sending a Quote for a Match
To match a quote against the off-chain book, you can use following endpoints.
3.1. /match
Get a match for a quote with strict buyAmt
and sellAmt
.
GET https://rfq.rubicon.finance/match
?chainId=<int>
&tag=<string> # "nickname" of a client
&sellToken=<string> # address of token to sell
&buyToken=<string> # address of token to sell
&sellAmt=<string> # amount of 'sellToken'
&buyAmt=<string> # amount of 'buyToken'
&deadline=<string> # unix timestamp - a deadline of a quote, used to return orders that will be valid until it
--header "X-API-KEY: obtained_key"
3.2. /market-match
Get a match for a quote with either buyAmt
or sellAmt
specified. Conceptually, this works similarly to a market sell or market buy.
GET https://rfq.rubicon.finance/match
?chainId=<int>
&tag=<string> # "nickname" of a client
&sellToken=<string> # address of token to sell
&buyToken=<string> # address of token to sell
# provide either 'sellAmt' or 'buyAmt'.
&sellAmt=<string> # amount of 'sellToken'. Use for "market sell"
OR
&buyAmt=<string> # amount of 'buyToken'. Use for "market buy"
# OPTIONAL:
&deadline=<string> # unix timestamp - a deadline of a quote, used to return orders that will be valid until it
--header "X-API-KEY: obtained_key"
3.3. Getting Match Response
Regardless of the /*match
endpoint you query, the server response will have the following structure.
{
"status": "success",
"chainId": "100",
"response": {
"orders": [
{
"encodedOrder": "0x...",
"signature": "0x..."
}
],
"quantities": [
"35219063485254110"
],
"deadline": "1230940800"
},
"pair": {
"sellToken": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"buyToken": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"
},
"amounts": {
"sellAmt": "92399753",
"buyAmt": "35219063485254110"
},
"fillType": "full | partial",
"rfqsig": "0x..."
}
4. Executing Response Data On-Chain
Note: to execute the response data on-chain, first, approve sell tokens to the RubiconRFQ
contract. This is a very important step and approvals must be in place or else the trade will fail.
Then, call the fill
function on the contract for the relevant network you are targetting. Please see below for the deployments on each chain.
The fill function signature:
function fill(Quote calldata q, Response calldata r, bytes calldata signature) external;
Where Quote
is:
struct Quote {
address sellToken;
address buyToken;
uint256 sellAmt;
uint256 buyAmt;
}
And Response
is:
struct Response {
SignedOrder[] orders;
uint256[] quantities;
uint256 deadline;
}
And SignedOrder
is:
struct SignedOrer {
bytes order;
bytes sig;
}
And the signature
is the value of the "rfqsig"
field from the /*match
response.
4.1. RFQ Contract Addresses
Below are the RFQ contract addresses per network:
Network | Contract Address |
---|---|
OP | 0x0218D22B2f134C5b3000DBcB768f71693238c856 |
BASE | 0x6B49A0bD2744ACbDB2a4A901A3D5655323BD567E |
ARB | 0x7988F58d6708AD5FA7597e0d19Be59Ed75027555 |
5. WebSocket connection (optional)
It's possible to establish a WebSocket
connection with the server via the endpoint wss://rfq.rubicon.finance/ws
to receive price updates more efficiently.
The request for connection establishment should include the tag
parameter and the x-api-key
header, filled with the obtained key:
wss://rfq.rubicon.finance/ws
?tag=<string>
--header "X-API-KEY: obtained_key"
Once the connection is open, you can subscribe to a price-levels data feed by sending a subscribe message:
{
"event": "subscribe",
"params": {
"chainId": "42161",
"sellToken": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
"buyToken": "0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"
}
}
The messages sent from the server will follow the same schema as the /price-levels
endpoint.
Contact Information
For any questions or additional information, feel free to reach out:
- Email: contact@rubicon.finance
- Discord: Rubicon Finance Discord
Important Notes
The details of the system are subject to change at any time. The Rubicon Team can exclude addresses at will for any reason. This would likely be due to perceived malicious behavior. Updates and changes to the system will be communicated through our official channels and reflected on this page. This page will be updated regularly to reflect any changes to the Rubicon RFQ System. Please ensure you are referring to the latest version.