> For the complete documentation index, see [llms.txt](https://hot-labs.gitbook.io/hex/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hot-labs.gitbook.io/hex/concepts-and-systems/interactive-blocks.md).

# GONKA OTC Market

Gonka is a decentralized AI infrastructure designed to optimize computational power specifically for AI model training and inference. HEX provides OTC Market for native GNK tokens.

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="https://2240066228-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPyQ6gjOkeLafaVHtXKP0%2Fuploads%2FRl7XLEDzYPYSwcCYFcEI%2Ftg_image_3578707731.png?alt=media&amp;token=60efee0c-d385-41e7-baed-f1b84158cfaa" alt=""><figcaption></figcaption></figure>
3. Ensure your wallets are correctly connected to view your balance.\ <br>

   <figure><img src="https://2240066228-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPyQ6gjOkeLafaVHtXKP0%2Fuploads%2FrT2p9IzWsslcJvqevgKF%2Ftg_image_1357786992.png?alt=media&amp;token=e1a0b5c1-fd1d-466d-a0d1-cced1fda2bf5" 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="https://2240066228-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPyQ6gjOkeLafaVHtXKP0%2Fuploads%2FYSZS4G7LW0I9m1uM5DaD%2Ftg_image_1793245207.png?alt=media&amp;token=38045c7d-af53-4472-93aa-8091a2912bbe" 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="https://2240066228-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPyQ6gjOkeLafaVHtXKP0%2Fuploads%2FTlt6hqn7oXwTR266gVwO%2Ftg_image_3816276764.png?alt=media&amp;token=81c16d10-f24f-4f0f-86c8-2ded51bb1cf5" 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="https://2240066228-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPyQ6gjOkeLafaVHtXKP0%2Fuploads%2FiMhMDu5uFJIaeUIiFUkt%2Ftg_image_2655557224.png?alt=media&amp;token=89a76c35-de5a-497b-9e15-daf691b22ae0" 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.
