# OTC Endpoints

## **Contract Name**

* OTCTrade

## **Mainnet Addresses**

<table data-header-hidden><thead><tr><th width="177"></th><th></th></tr></thead><tbody><tr><td><strong>Network</strong></td><td><strong>Contract Address</strong></td></tr><tr><td>Arbitrum</td><td><code>0x597e3CbEA8f34102E0fC59775Ea62EA1dD1f56f8</code></td></tr><tr><td>Base</td><td><code>0xb4F6544fF7A4a586B47F48d06C70bB2e16B5da6f</code></td></tr><tr><td>Bitlayer</td><td><code>0xECB64314e2B7d2e1F997915E1cE4Ce89f3A9e9aa</code></td></tr><tr><td>Ethereum</td><td><code>0x7D75D2A1Fd7F57f3d9b2a47fB3C8A41523d0ba15</code></td></tr><tr><td>Polygon</td><td><code>0x7D75D2A1Fd7F57f3d9b2a47fB3C8A41523d0ba15</code></td></tr><tr><td>BSC</td><td><code>0x7D75D2A1Fd7F57f3d9b2a47fB3C8A41523d0ba15</code></td></tr><tr><td>Berachain Bartio</td><td><code>0xAD387C624bf043F33c913d9403a96b857b133381</code></td></tr></tbody></table>

***

## **Smart Contract Interface**

### **1. Get the Nonce of the User's Order**

Retrieve the nonce of a user's order, required for creating an order.

* **Function**: `nonces(address maker) returns (uint256)`

#### Request Parameter

| **Parameter Name** | **Required** | **Type**  | **Description** |
| ------------------ | ------------ | --------- | --------------- |
| `maker`            | Yes          | `address` | Creator Address |

#### Response Parameter

| **Parameter Name** | **Type**  | **Description**  |
| ------------------ | --------- | ---------------- |
| `nonce`            | `uint256` | User order nonce |

***

### **2. Calculate the Hash of the Order**

Calculate the hash of an order, necessary when creating it.

* **Function**: `hashOrder(Order memory order) returns (bytes32)`

#### Request Parameter

| **Parameter Name** | **Required** | **Type** | **Description** |
| ------------------ | ------------ | -------- | --------------- |
| `order`            | Yes          | `Order`  | Created order   |

#### Response Parameter

| **Parameter Name** | **Type**  | **Description** |
| ------------------ | --------- | --------------- |
| `orderHash`        | `bytes32` | User order hash |

***

### **3. Perform Multi-for-Multi Asset Swap**

Use the signed order information to conduct a multi-asset swap.

* **Function**: `swap(Order memory order_)`

#### Request Parameter

| **Parameter Name** | **Required** | **Type**  | **Description**                              |
| ------------------ | ------------ | --------- | -------------------------------------------- |
| `order_`           | Yes          | `Order`   | Order information from centralized interface |
| `value`            | Yes          | `uint256` | Platform currency to pay as handling fee     |

#### Order Structure

| **Parameter Name** | **Required** | **Type**  | **Description**                                  |
| ------------------ | ------------ | --------- | ------------------------------------------------ |
| `maker`            | Yes          | `address` | Address of the asset's owner (order signer)      |
| `taker`            | Yes          | `address` | Address of the person specifying the transaction |
| `asset`            | Yes          | `Asset[]` | Array of swapped assets                          |
| `currency`         | Yes          | `Asset[]` | Array of assets being swapped in                 |
| `deadline`         | Yes          | `uint256` | Deadline for the order validity period           |
| `themselves`       | Yes          | `bytes`   | Signed transaction data                          |

***

#### **Asset Structure in Order**

| **Parameter Name** | **Required** | **Type**  | **Description**                  |
| ------------------ | ------------ | --------- | -------------------------------- |
| `collection`       | Yes          | `address` | Token address                    |
| `assetClass`       | Yes          | `address` | Token type (e.g., ERC20, ERC721) |
| `amountOrID`       | Yes          | `uint256` | ERC20 quantity or ERC721 ID      |

***

### **4. Cancel Order**

Allows the order creator to cancel an order.

* **Function**: `cancelOrder(Order memory order)`

#### Request Parameter

| **Parameter Name** | **Required** | **Type** | **Description**                              |
| ------------------ | ------------ | -------- | -------------------------------------------- |
| `order`            | Yes          | `Order`  | Order information from centralized interface |

***

### **5. Cancel Multiple Orders**

Allows the order creator to cancel multiple orders in one call.

* **Function**: `cancelMultipleOrders(Order[] memory orders)`

#### Request Parameter

| **Parameter Name** | **Required** | **Type**  | **Description**                                      |
| ------------------ | ------------ | --------- | ---------------------------------------------------- |
| `orders`           | Yes          | `Order[]` | List of order information from centralized interface |

***

### **6. Cancel All Orders**

Allows the creator to cancel all of their orders.

* **Function**: `cancelAllOrders()`

#### Request Parameters

This function does not take any parameters.

***

### **7. Obtain the Minimum Native Currency Fee**

Returns the minimum platform fee charged in native currency.

* **Function**: `feeMinAmount() returns (uint256)`

#### Response Parameter

| **Parameter Name** | **Type**  | **Description**                      |
| ------------------ | --------- | ------------------------------------ |
| `feeMinAmount`     | `uint256` | Minimum native currency platform fee |


---

# 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.paddlefi.com/api-documentation/otc-endpoints.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.
