Builder Codes (Front End Fee)

Build your own custom frontend and earn fees

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:

  1. User Authorization: Users approve specific integrators and set a maximum fee they're willing to pay

  2. Order Submission: Integrators submit orders on behalf of users, specifying their fee (up to the approved maximum)

  3. Fee Accumulation: Fees accumulate in per-market vaults as orders execute

  4. 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:

  1. Create a fee vault for each market they want to support

  2. Get users to approve them as integrators

  3. Submit orders with their address and fee amount

  4. 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.

API. For more information on how to interact with builder codes through our API, view our API reference.

Last updated