RFQ Liquidity

RFQ works when a buyer invites sellers to bid on specific amount of an asset. The buyer then uses these bids to determine the best available price and service level. The sellers use automated, programmatic response software to quote at their fair value price.

Step 1: Request for quote

To initiate a swap, first determine if the DEX has the necessary allowance to access the tokens.

API URL: https://api.expand.network/dex/createorder


Sample Request:

{
    "dexId": "1900",
    "amountIn": "100000",
    "path": [
        "0xe0C9275E44Ea80eF17579d33c55136b7DA269aEb",
        "0xdFCeA9088c8A88A76FF74892C1457C17dfeef9C1"
    ],
    "to": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "from": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
    "decayStartTime": "1707110948",
    "decayEndTime": "1707113948",
    "amountOutMin": "10000000000",
    "deadline": "1707313948"
}

Sample Response:

{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "domain": {
            "name": "Permit2",
            "chainId": "1",
            "verifyingContract": "0x000000000022d473030f116ddee9f6b43ac78ba3"
        },
        "types": {
            "PermitWitnessTransferFrom": [
                {
                    "name": "permitted",
                    "type": "TokenPermissions"
                },
                {
                    "name": "spender",
                    "type": "address"
                },
                {
                    "name": "nonce",
                    "type": "uint256"
                },
                {
                    "name": "deadline",
                    "type": "uint256"
                },
                {
                    "name": "witness",
                    "type": "ExclusiveDutchOrder"
                }
            ],
            "TokenPermissions": [
                {
                    "name": "token",
                    "type": "address"
                },
                {
                    "name": "amount",
                    "type": "uint256"
                }
            ],
            "ExclusiveDutchOrder": [
                {
                    "name": "info",
                    "type": "OrderInfo"
                },
                {
                    "name": "decayStartTime",
                    "type": "uint256"
                },
                {
                    "name": "decayEndTime",
                    "type": "uint256"
                },
                {
                    "name": "exclusiveFiller",
                    "type": "address"
                },
                {
                    "name": "exclusivityOverrideBps",
                    "type": "uint256"
                },
                {
                    "name": "inputToken",
                    "type": "address"
                },
                {
                    "name": "inputStartAmount",
                    "type": "uint256"
                },
                {
                    "name": "inputEndAmount",
                    "type": "uint256"
                },
                {
                    "name": "outputs",
                    "type": "DutchOutput[]"
                }
            ],
            "OrderInfo": [
                {
                    "name": "reactor",
                    "type": "address"
                },
                {
                    "name": "swapper",
                    "type": "address"
                },
                {
                    "name": "nonce",
                    "type": "uint256"
                },
                {
                    "name": "deadline",
                    "type": "uint256"
                },
                {
                    "name": "additionalValidationContract",
                    "type": "address"
                },
                {
                    "name": "additionalValidationData",
                    "type": "bytes"
                }
            ],
            "DutchOutput": [
                {
                    "name": "token",
                    "type": "address"
                },
                {
                    "name": "startAmount",
                    "type": "uint256"
                },
                {
                    "name": "endAmount",
                    "type": "uint256"
                },
                {
                    "name": "recipient",
                    "type": "address"
                }
            ]
        },
        "values": {
            "permitted": {
                "token": "0xe0C9275E44Ea80eF17579d33c55136b7DA269aEb",
                "amount": {
                    "type": "BigNumber",
                    "hex": "0x0186a0"
                }
            },
            "spender": "0x6000da47483062A0D734Ba3dc7576Ce6A0B645C4",
            "nonce": {
                "type": "BigNumber",
                "hex": "0x01"
            },
            "deadline": "1707313948",
            "witness": {
                "info": {
                    "reactor": "0x6000da47483062A0D734Ba3dc7576Ce6A0B645C4",
                    "swapper": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994",
                    "nonce": {
                        "type": "BigNumber",
                        "hex": "0x01"
                    },
                    "deadline": "1707313948",
                    "additionalValidationContract": "0x0000000000000000000000000000000000000000",
                    "additionalValidationData": "0x"
                },
                "decayStartTime": "1707110948",
                "decayEndTime": "1707113948",
                "exclusiveFiller": "0x0000000000000000000000000000000000000000",
                "exclusivityOverrideBps": {
                    "type": "BigNumber",
                    "hex": "0x00"
                },
                "inputToken": "0xe0C9275E44Ea80eF17579d33c55136b7DA269aEb",
                "inputStartAmount": {
                    "type": "BigNumber",
                    "hex": "0x0186a0"
                },
                "inputEndAmount": {
                    "type": "BigNumber",
                    "hex": "0x0186a0"
                },
                "outputs": [
                    {
                        "token": "0xdFCeA9088c8A88A76FF74892C1457C17dfeef9C1",
                        "startAmount": {
                            "type": "BigNumber",
                            "hex": "0x02363e7f00"
                        },
                        "endAmount": {
                            "type": "BigNumber",
                            "hex": "0x02363e7f00"
                        },
                        "recipient": "0xa67E9B68c41b0f26184D64C26e0b2B81466E5994"
                    }
                ]
            }
        },
        "serializedOrder": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000065c072240000000000000000000000000000000000000000000000000000000065c07ddc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e0c9275e44ea80ef17579d33c55136b7da269aeb00000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000006000da47483062a0d734ba3dc7576ce6a0b645c4000000000000000000000000a67e9b68c41b0f26184d64c26e0b2b81466e5994000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000a15e551c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000dfcea9088c8a88a76ff74892c1457c17dfeef9c100000000000000000000000000000000000000000000000000000002363e7f0000000000000000000000000000000000000000000000000000000002363e7f00000000000000000000000000a67e9b68c41b0f26184d64c26e0b2b81466e5994"
    }
}

Step 2: Generate the signature off-chain

This is an off-chain process that the user needs to perform at their end.


Sample Request:

const { ethers } = require('ethers');    
const provider = new ethers.providers.JsonRpcProvider("https://mainnet.infura.io/v3/<rpc key>");

const signer = new ethers.Wallet('<private key>', provider);
const signature = await signer._signTypedData(domain, types, values);

Expand.network will soon support publishing orders on Uniswap X.

Step 3: Execute the transaction

This can be done using the following API endpoint:

API URL: https://api.expand.network/dex/swap


Sample Request:

{
    "dexId": "1900",
    "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
    "gas": "173376",
    "signature": "0xc2f9557dcc27ff17ecf91211a6a0af6ead44acf6a7d7322d0f40afefca596a843b5d95698332867a11eb3a3f9984ac3639581b765138fc0cc88322a889dffd1d1b",
    "serializedOrder": "0x000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000065c072240000000000000000000000000000000000000000000000000000000065c07ddc00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e0c9275e44ea80ef17579d33c55136b7da269aeb00000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000000000000000000000000000000000000186a000000000000000000000000000000000000000000000000000000000000002000000000000000000000000006000da47483062a0d734ba3dc7576ce6a0b645c4000000000000000000000000a67e9b68c41b0f26184d64c26e0b2b81466e5994000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000a15e551c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000dfcea9088c8a88a76ff74892c1457c17dfeef9c100000000000000000000000000000000000000000000000000000002363e7f0000000000000000000000000000000000000000000000000000000002363e7f00000000000000000000000000a67e9b68c41b0f26184d64c26e0b2b81466e5994"
}

Sample Response:

{
    "status": 200,
    "msg": "success",
    "data": {
        "chainId": "1",
        "from": "0x63056E00436Da25BcF48A40dfBbDcc7089351006",
        "to": "0x6000da47483062A0D734Ba3dc7576Ce6A0B645C4",
        "gas": "173376",
        "value": "0",
        "data": "0x3f62192e00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000032000000000000000000000000000000000000000000000000000000000000002c000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000006515b768000000000000000000000000000000000000000000000000000000006516e43000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc200000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000038d7ea4c6800000000000000000000000000000000000000000000000000000000000000002000000000000000000000000006000da47483062a0d734ba3dc7576ce6a0b645c400000000000000000000000063056e00436da25bcf48a40dfbbdcc70893510060000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000006b0c82c8000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000006b175474e89094c44da98b954eedeac495271d0f0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000063056e00436da25bcf48a40dfbbdcc70893510060000000000000000000000000000000000000000000000000000000000000041c2f9557dcc27ff17ecf91211a6a0af6ead44acf6a7d7322d0f40afefca596a843b5d95698332867a11eb3a3f9984ac3639581b765138fc0cc88322a889dffd1d1b00000000000000000000000000000000000000000000000000000000000000"
    }
}

Last updated