Fee Escrow is an opt-in feature. Orders without fee authorization work exactly as before.
Endpoints Quick Reference
How It Works
Prerequisites
@dome-api/sdkversion 2.0.0 or later- USDC.e approval for the escrow contract on Polygon
- Platform integration with Dome’s fee system
Quick Start
Using the SDK
UsePolymarketRouterWithEscrow instead of PolymarketRouter:
Skip Escrow for Specific Orders
REST Endpoint
If using the REST API directly, includefeeAuth in your request:
Request with Fee Authorization
Response with Escrow Info
Fee Authorization Structure
ThefeeAuth object contains:
Additional Required Fields
WhenfeeAuth is present, these fields are also required:
EIP-712 Signing
The fee authorization uses EIP-712 typed structured data:SDK Utilities
The SDK provides utilities for working with fee escrow:Generate Order ID
Create Fee Authorization
Sign Fee Authorization
Escrow Configuration
Configure escrow settings when initializing the router:Affiliate Configuration
Affiliates can earn a share of fees collected through the escrow system. There are two ways to configure affiliate addresses:Option 1: Per-Request (SDK)
Pass the affiliate address when initializing the router or per-order:Option 2: Server-Side (API Key Config)
For a persistent affiliate address tied to your API key, use the User Settings API. This ensures all orders from your API key automatically use your affiliate address, regardless of what the SDK sends.Priority Order
When resolving the affiliate address, the system uses this priority:- Server-side config (from API key settings) - highest priority
- Client-provided (from
params.affiliatein request) - Default affiliate (environment variable)
- Zero address (all fees go to Dome)
Error Codes
Fee escrow-specific error codes:Error Response Example
Escrow Contract
The fee escrow contract is deployed on Polygon mainnet: Address:0x989876083eD929BE583b8138e40D469ea3E53a37
Contract Functions
USDC Approval
Users must approve the escrow contract to spend their USDC.e:Fee Distribution
After an order is placed with fee escrow, the Dome server automatically handles fee distribution and refunds based on order status.How Distribution Works
The server runs a background process that:- Monitors order status - Checks Polymarket for fill status every 5 minutes
- Distributes on fill - Calls
distribute()when orders are fully or partially filled - Refunds on cancel - Calls
refund()when orders are cancelled
Distribution Timing
Partial Fills
For partially filled orders, fees are distributed proportionally:- If 50% of an order fills → 50% of fee is distributed
- Remaining fee stays in escrow until fill or cancel
- On cancel, remaining fee is refunded to user
Distribution and refund transactions are executed by the Dome operator wallet. Users don’t need to take any action after order placement.
Order Management Endpoints
The following REST endpoints are available for managing escrow orders.Get Escrow Order
Retrieve details of a specific escrow order by ID (escrowOrderId or polymarketOrderId).List Escrow Orders
Retrieve a list of escrow orders with optional filters.
Response:
Cancel Escrow Order
Cancel an escrow order and initiate a refund. Only callable for orders inpending or open status.
The
POST /orders/:orderId/cancel endpoint is also available for backward compatibility but DELETE /orders/:orderId is preferred.Order Status Values
Error Responses
Backward Compatibility
Orders withoutfeeAuth work exactly as before:
FAQ
Q: Is fee escrow required? No, it’s opt-in. Orders withoutfeeAuth work normally.
Q: What happens if the order is cancelled?
The fee is refunded to the payer via the escrow contract.
Q: What’s the minimum fee?
Fees must meet both requirements:
- At least 0.01% of order size (to prevent dust)
- At least $0.01 USDC minimum
- Server-side config - Affiliate address set via API key settings (
POST /v1/polymarket/affiliate) - Client-provided -
affiliateAddressparameter in the order request - Default affiliate - Environment-configured default (if any)
- Zero address - If none of the above, all fees go to Dome