Overview
The 1st DEX uses a referrer-based fee system. Trading fees are collected by the protocol’sfeeRecipient address, and a portion of these fees can be shared with referrers who bring traders to the platform.
Every order (both maker and taker) can optionally specify a referrer address. If specified, the referrer receives a configurable percentage of the trading fees generated by that order.
Fee distribution
When a trade occurs, fees are split between:- Protocol fee recipient - The main protocol treasury (set at the BookManager level)
- Referrer - Optional address that receives a share of the fees (configurable per book/currency)
setReferrerFeeRate on the BookManager.
Using referrers
Specifying a referrer
All order structs include areferrer parameter:
No referrer
If you don’t have a referrer, useaddress(0):
Default referrer
The BookManager has a default referrer that is used whenaddress(0) is passed as the referrer parameter. This ensures fees are always distributed appropriately even when no specific referrer is provided.
Querying fee information
You can query referrer fee information using the subgraph:Becoming a referrer
To become a referrer, simply provide your address to traders. When they include your address in their orders’referrer field, you’ll automatically receive a share of the fees generated by their trades.
Track your earnings through the subgraph or by monitoring the ReferrerFeePaid events emitted by the BookManager.