Builder codes
Build your own frontend on trade everything and earn up to 1% of your users' winnings. Nothing on losing trades.
Anyone can build a frontend on trade everything and earn a fee on the trades it sends: sign with the user's session key, send to our relayer, name yourself as builder.
How it works for traders
Builders can charge up to 1% of your winnings, only on closes in profit (your own closes, take profit, stop loss, partial closes). It's a share of what you won after our win fee, on top of our fees. Nothing on opens, losing closes or liquidations.
A builder charges nothing until you approve it with one gasless signature setting its max, for example 0.5% of winnings. A position remembers the builder that opened it, which gets the lower of the order's fee and your current approval. Revoke any time in account settings and it earns nothing more, even on positions it opened.
Attaching a builder code
An order with a builder is signed as OpenPositionWithBuilder in the exchange EIP-712 domain, adding builder and builderFeeBps to OpenPosition.
OpenPositionWithBuilder(address user,uint32 instrumentId,bool isLong,uint128 size,uint32 leverage,bool useDebt,uint64 triggerPrice,bool triggerAbove,uint64 takeProfit,uint64 stopLoss,uint256 nonce,uint64 deadline,address builder,uint16 builderFeeBps)
Send it to POST /intents with action: "openPosition" and the two extra fields in signed. builderFeeBps is basis points of winnings, 1 to 100 (1%), at or below the user's approved max, or the relayer rejects it (builderNotApproved, builderFeeAboveApproval, builderFeeAboveCap) and the contract checks again. Market orders only: trigger orders, BTC and ETH, and Price Promise don't take one yet.
Approval flow
The user signs ApproveBuilder with their wallet; a session key can't.
ApproveBuilder(address user,address builder,uint16 maxFeeBps,uint256 nonce,uint64 deadline)
Send it to POST /intents with action: "approveBuilder". maxFeeBps is at most 100; signing again replaces it, and 0 revokes.
Once approved, a session key's feeAddress can be your builder address.
Show the builder address and fee in plain words in your prompt, for example "This app takes 0.5% of your winnings on profitable closes. Nothing on losing trades."
Getting paid
Each close moves the fee from the trader's available balance to yours; withdraw like any user. It can be smaller if their win is still in the payout queue.
Stats
GET /builders?window=24h|7d|30d|allranks builders by fees earned, with volume routed, order count and trader count.GET /builders/<address>gives one builder's totals, the users who approve it and its recent fees.- On chain the Exchange emits
BuilderApproved(user, builder, maxFeeBps),BuilderOrder(positionId, user, builder, feeBps, notional)andBuilderFeePaid(positionId, user, builder, fee, feeBps).