# Market Maker

Any market maker willing to register with Dfyn Exchange RFQ module, needs to expose an endpoint that has the following structure:

### Get Quote

## Get a quote from the market maker for the base token

<mark style="color:blue;">`GET`</mark> `https://api.marketmaker.com/v1/getQuote`

This endpoint should return a calldata that includes the quote price and the signature. As a market maker, you need to call Dfyn's RFQ contract to fetch the nonce. Nonce has to be included in the signed data.

**Note:** The deadline should be in ***seconds**.*

#### Query Parameters

| Name                                      | Type   | Description                  |
| ----------------------------------------- | ------ | ---------------------------- |
| token0<mark style="color:red;">\*</mark>  | String | token0 (base token) address  |
| token1<mark style="color:red;">\*</mark>  | String | token1 (quote token) address |
| amount0<mark style="color:red;">\*</mark> | String | token0 (base token) amount   |
| chainId<mark style="color:red;">\*</mark> | String | chain ID                     |
| user<mark style="color:red;">\*</mark>    | String | address of the user          |

{% tabs %}
{% tab title="200 Quote received" %}

```javascript
{
    "data": {
        "message": "0xb8c67dde023728dba425a51f58fff315f77b6ab0ef407adba297659fc9607ecd",
        "messageHash": "0x9c824e2411f333c3b95daa07a30df99e0ce0ab65e39581a7521c80c1db2594f1",
        "v": "0x1c",
        "r": "0x217bb9c6040df7b0d8e453cd7f9b2ff7370cdaabc9773a2c97a218cc7bc280de",
        "s": "0x0449bc077ef2d2ac607b9430ac5460bd61abbe76777932461bdac6bd5b771ce7",
        "signature": "0x217bb9c6040df7b0d8e453cd7f9b2ff7370cdaabc9773a2c97a218cc7bc280de0449bc077ef2d2ac607b9430ac5460bd61abbe76777932461bdac6bd5b771ce71c",
        "messageObject": {
            "user": "0xD6F89B2b2c5386c2FFcA62da13B342e630cC4eC8",
            "marketMaker": "0xDF012A32BA54C30e89913E231011AA13f0cE3369",
            "token0": "0xc2132D05D31c914a87C6611C10748AEb04B58e8F",
            "token1": "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174",
            "amount0": "1000000",
            "amount1": "994391", //token1 (quote token) amount
            "deadline": 1655450917,
            "nonce": "0"
        },
    }
}
```

{% endtab %}

{% tab title="400: Bad Request Permission denied" %}

{% endtab %}
{% endtabs %}

### Example API Server

You can fork the following GitHub repo to create your own API server: <https://github.com/dfyn/rfq-api>. For access, please contact us on [Telegram](https://t.me/sajalgupta23).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.dfyn.network/dfyn-exchange-rfq-module/api-reference/market-maker.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
