# GONKA OTC Market

HEX provides secure and transparent over-the-counter marketplace for native GNK tokens, enables direct, trustless GNK-for-USDT trades across 20+ supported networks including TON, Stellar, Solana, BTC, NEAR, and more, without intermediaries or counterparty risk. All trades are executed fully on-chain via smart contracts, giving users institutional-grade security, multi-chain liquidity, and guaranteed settlement.

### **How it works**

1. The seller creates a GNK sell order.
2. The buyer deposits USDT from any supported chain.
3. **HOT Bridge** and **Omni Balance** handle secure multi-chain transfers.
4. The hex smart contract settles the trade automatically without manual steps, no trust assumptions.

## How to Use the OTC Market

1. Open <https://app.hex.exchange/otc/gonka>&#x20;
2. Connect Two Wallets:

   1. **Cosmos Wallet**: Deposit or withdraw $GNK
   2. **Any Other Wallet**: Deposit or withdraw $USDT&#x20;

   <figure><img src="/files/o2RmRe1SOjtiu7qin8kN" alt=""><figcaption></figcaption></figure>
3. Ensure your wallets are correctly connected to view your balance.\ <br>

   <figure><img src="/files/sh9vUMCSaHOhXkS5UkMF" alt=""><figcaption></figcaption></figure>
4. Now you can buy or sell your GNK with open OTC deals.

   1. Select the order and user you wish to trade with.
   2. Click on the "Buy" option.
   3. Enter the desired amount.
   4. Confirm the transaction using your wallet.<br>

   <div align="left"><figure><img src="/files/pSD0X0xgijM1EsKPnJ6X" alt=""><figcaption></figcaption></figure></div>
5. After completing the OTC trade, your GNK and USDT tokens will appear in your HEX Balance. You can either continue trading them without gas fees or withdraw them to the native chain. \
   \
   To withdraw tokens to your wallet, click "Withdraw" and confirm the transaction.\ <br>

   <figure><img src="/files/ishPCuj5NHCJr9BuIpXf" alt=""><figcaption></figcaption></figure>
6. To initiate a trade on your own terms, select "Create Order." Enter the quantity you wish to sell and set your preferred price.\ <br>

   <figure><img src="/files/lzPuciEPNXcYeDhQzwTQ" alt=""><figcaption></figcaption></figure>

## Fees

| Item         | Maker                                              | Taker                                              |
| ------------ | -------------------------------------------------- | -------------------------------------------------- |
| Protocol fee | 10-100 bps                                         | 0 bps                                              |
| Gas          | Paid by the solver/relayer that submits the intent | Paid by the solver/relayer that submits the intent |

## API

The frontend assembles the following payload before funding or filling an order (`escrow.fi.tg`):

| Field                              | Description                                                                                 |
| ---------------------------------- | ------------------------------------------------------------------------------------------- |
| `price`                            | 12-decimal fixed price (quoted in counter-asset terms).                                     |
| `src_token` / `dst_token`          | `OmniToken` identifiers.                                                                    |
| `decimal_from` / `decimal_to`      | Token decimals pulled from omni registry.                                                   |
| `receive_src_to` / `refund_src_to` | NEAR receiver, gas budget and memo for settlement and refunds (defaults to `intents.near`). |
| `protocol_fees`                    | Percentage fee (basis points) and collector (`intents.tg`).                                 |
| `maker`                            | Omni address of the wallet posting the order.                                               |
| `deadline`                         | Nanosecond timestamp (default `now + 30 days`).                                             |
| `partial_fills_allowed`            | Boolean flag (frontend sets `true`).                                                        |
| `taker_whitelist`                  | Optional allowlist (defaults to empty array).                                               |
| `salt`                             | UUID to ensure uniqueness.                                                                  |

### Contract Messages with \`transfer\` intent

```json
{
  "action": "Fund",
  "params": {
    "price": "100000000000",
    "src_token": "gonka.tkn",
    "dst_token": "usdt.tkn",
    "partial_fills_allowed": true,
    "receive_src_to": {
      "receiver_id": "intents.near",
      "memo": "null",
      "msg": "maker.omni",
      "min_gas": 5000000000000
    },
    "refund_src_to": {
      "receiver_id": "intents.near",
      "memo": "null",
      "msg": "maker.omni",
      "min_gas": 5000000000000
    },
    "protocol_fees": {
      "collector": "intents.tg",
      "fee": 100
    },
    "deadline": 1735689600000000000,
    "salt": "6d52c4b4-bbc4-4f8f-a29c-9f4e35a7d897"
  }
}
```

Fill messages embed the same `params` plus a `Fill` action pointing settlement receipts back to `intents.near`:

```json
{
  "params": { "...": "same as above" },
  "action": {
    "Fill": {
      "receiver_id": "intents.near",
      "memo": "null",
      "msg": "taker.omni",
      "min_gas": 4000000000000
    }
  }
}
```

## REST API (`https://api.hot-labs.org/api/v1/exchange/limit_orders/gonka`)

| Method | Path | Body                  | Notes                                                                                                              |
| ------ | ---- | --------------------- | ------------------------------------------------------------------------------------------------------------------ |
| `GET`  | `/`  | —                     | Returns `{ orders: { bid: OrderType[], ask: OrderType[] } }`. Requires `Authorization` header for privileged data. |
| `POST` | `/`  | `{ "params": { … } }` | Mirrors the payload sent on-chain to keep off-chain indexers in sync.                                              |

Each `OrderType` matches the fields from `otc.ts`: balances (`balance`, `total_balance`), `closed`, `deadline`, and the nested `params`.

### aiohttp Example

```python
import asyncio
import aiohttp


API = "https://api.hot-labs.org/api/v1/exchange/limit_orders/gonka"


async def list_orders() -> dict:
    async with aiohttp.ClientSession() as session:
        async with session.get(API) as resp:
            resp.raise_for_status()
            return await resp.json()


async def create_order(params: dict) -> None:
    payload = dict(params=params)
    async with aiohttp.ClientSession() as session:
        async with session.post(API, json=payload) as resp:
            resp.raise_for_status()


if __name__ == "__main__":
    data = asyncio.run(list_orders())
    print(f"Active asks: {len(data['orders']['ask'])}")
```

Use the same `params` structure that the Fund transaction emits to ensure on-chain and off-chain states stay aligned.


---

# 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://hot-labs.gitbook.io/hex/concepts-and-systems/interactive-blocks.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.
