Builder codes allow for third-parties to permissionlessly integrators to earn fees on orders they submit on behalf of users. This enables trading platforms, referral programs, and white-label solutions to monetize their user traffic for providing to the Aftermath ecosystem.
Overview
Builder codes provide a flexible fee-sharing mechanism for integrators building on Aftermath Perpetuals. The system works as follows:
User Authorization: Users approve specific integrators and set a maximum fee they're willing to pay
Order Submission: Integrators submit orders on behalf of users, specifying their fee (up to the approved maximum)
Fee Accumulation: Fees accumulate in per-market vaults as orders execute
Fee Collection: Integrators claim accumulated fees at any time
Unlike referral codes, builder codes are applied in real time as part of the onchain fee logic.
How It Works
For Users
Users maintain full control over which integrators can earn fees on their orders:
Approve integrators with a maximum fee cap per integrator
Revoke permissions at any time
Set different fee limits for different integrators
For Integrators
Integrators must complete a one-time setup before earning fees:
Create a fee vault for each market they want to support
Get users to approve them as integrators
Submit orders with their address and fee amount
Claim accumulated fees when desired
Fee Structure
Fees are proportional to taker volume generated by user orders
Integrators specify their fee when submitting orders (must not exceed user-approved maximum)
For Developers
TypeScript. We've integrated all required builder code functionality into our TypeScript SDK and detailed all functions in our docs.