Partner Codes
Partner codes are a powerful feature introduced in Odos Smart Order Routing (SOR) V2. As Odos continues to get integrated into more applications as a vital piece of DeFi infrastructure, partner codes will allow for tracking and attribution of volume through the Odos platform.
Partner codes will also allow for platforms such as wallets or exchanges to monetize the swap volume from their user base by registering a partner fee connected to their referral code. The fee will then be charged by the Odos router and deposited into the specified beneficiary address, allowing for a simple and easy monetization process.
Register A Code
Codes are registered on the router via the registerReferralCode
function. You will need to register your code on each chain that you wish to use it on. We have created a frontend for transacting with this function and registering codes. Anyone integrating or using the Odos API can use this frontend to register a referral code for inclusion in all API quote requests they make.
Setting Fees
When registering a referral code, there is an option to add an additional fee. This additional fee will be removed from the output amount of the swap by the router when the registered referral code is used. Of the removed fee, 20% will be retained by the router as protocol revenue while the other 80% will be sent to the specified beneficiary address at the time of the transaction. This mechanism provides an easy way for partners to monetize their swap volume without making, auditing, or, maintaining any of their own smart contracts.
Function | Owner Take | Referrer Take |
---|---|---|
Swap | Positive Slippage + 20% of fee | 80% of fee |
SwapMulti | 0.01% + 20% of fee | 80% of fee |
Code Types
For the purposes of smart contract optimization, referral codes are split into two ranges/types. Codes with no additional fees (tracking/attribution only) are restricted to the range from 0 to 2147483648 (highest bit of uint32 is 0), while codes with an additional fee are restricted to the range from 2147483648 to 4294967296 (highest bit of uint32 is 1). This allows for the router contract to only make an additional storage read when the code used charges an additional fee.
Codes | Use |
---|---|
0 - 2147483648 | Tracking and Attribution |
2147483649 - 4294967296 | Additional Fee |
Referral Codes
Partners that integrate Odos Smart Order Routing are able to register a referral code, which can be included in their quote API requests in order to track volume and enable partner monetization. If partners wish, they can monetize their volume by registering an additional fee with this referral code - 80% of this fee will be sent to the specified partner address at the time of the swap, while the other 20% will be retained by the protocol. Partners that do not wish to monetize this way can still register a referral code in order to be eligible for any other partner benefits that Odos may offer in the future.
Need Help?
- For a deeper dive, the Endpoints page is your go-to resource, providing an extensive look at all available endpoints, parameters, and more.
- For technical assistance, visit our Support Page.
- Join the Odos Discord Community to connect with other developers and our team.