Development Overview
CommissionRoad offers multiple ways to integrate commissions into your dApp, catering to different complexity needs and use cases.
Integration Methods
| Method | Best For | Key Feature |
|---|---|---|
| Standard Calls | Simple interactions (Swap, Deposit) | Easiest to implement. Works for 90% of use cases. |
| Weiroll VM | Complex, multi-step transactions | Chain outputs to inputs (e.g. Swap result -> Lending Deposit). |
| EIP-7702 | Gasless / Relayer flows | User "becomes" the executor. No approvals needed. |
Which one should I choose?
- Start with Standard Calls. It handles the basics: executing a transaction and collecting a fee.
- If you find yourself needing to know the exact output amount of a swap to construct the next transaction data before the transaction is mined, you need Weiroll.
- If you are building a wallet or an advanced "Smart Account" experience where you want to sponsor gas usage or avoid
approve()transactions entirely, look at EIP-7702.
HANDLING APPROVALS
Dealing with token approvals is a common friction point:
- Standard: The prescribed method is Permit2. Users sign a message off-chain, avoiding a gas transaction. (Classic
approveis also supported). - Weiroll: Can also leverage Permit2 for efficient execution.
- EIP-7702: No approvals needed at all. The user is the executor.
For a deep dive on when to use each method and code examples, see Approval Flows.
NFT Ownership & Claiming
CLAIM BEFORE SELLING
If you sell your CommissionRoad NFT, you are selling the right to claim all accrued but unclaimed fees.
- Claiming: Commissions are claimed by the current owner of the NFT.
- Transferring: Unclaimed commissions in the Vault act as if they "follow" the NFT. They remain in the Vault, but only the new owner can claim them.
- Minting: Use
CommissionRoad.mint()to create a new NFT. This ID will be used to accrue your commissions.