> For the complete documentation index, see [llms.txt](https://docs.pearprotocol.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.pearprotocol.io/api-integration/access-management/builder-code.md).

# Builder Code

All trades on Pear Protocol are routed through the Pear Protocol builder address:

```
0xA47D4d99191db54A4829cdf3de2417E527c3b042
```

Before making any trades, users must approve the Pear Protocol builder address to charge fees. This is a one-time approval per wallet done directly on Hyperliquid.

#### How It Works

Hyperliquid's builder fee system allows builders (like Pear Protocol) to charge a fee on each order routed through their address. Users must explicitly approve a maximum fee rate for each builder they interact with.

#### Approving the Builder Fee

Send an `approveBuilderFee` action to the Hyperliquid exchange endpoint. This requires an EIP-712 signature from the user's wallet.

Payload to sign:

```json
{
  "type": "approveBuilderFee",
  "hyperliquidChain": "Mainnet",
  "signatureChainId": "0xa4b1",
  "maxFeeRate": "0.01%",
  "builder": "0xA47D4d99191db54A4829cdf3de2417E527c3b042",
  "nonce": 1234567890
}
```

| Field              | Description                                              |
| ------------------ | -------------------------------------------------------- |
| `type`             | Must be `"approveBuilderFee"`                            |
| `hyperliquidChain` | `"Mainnet"` or `"Testnet"`                               |
| `signatureChainId` | `"0xa4b1"` (Arbitrum)                                    |
| `maxFeeRate`       | Maximum fee rate the builder can charge (e.g. `"0.01%"`) |
| `builder`          | Pear Protocol builder address                            |
| `nonce`            | Current timestamp in milliseconds                        |

#### Reference

See the Hyperliquid docs for full details on the exchange endpoint and builder fee approval: <https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#approve-a-builder-fee>
