Setting a swap referrer
When a swap is made on Flaunch, a portion of the swap fee is earmarked for referrer fees before being divided between the remaining allocations.
If no referrer is set, then the allocation is instead divided between other sources.
By default, all fees in Flaunch are distributed as ETH. However, for referrers they receive their referral fee in the unspecified token (ETH or Token).
This referrer fee is taken before any other fee and is given regardless of token type. The protocol is designed this way as when tokens are sent to the Internal Swap Protocol, it becomes unfeasible to map and maintain referrer allocations.
For example, if a swap buys 10 tokens using ETH, then the fee would be taken in ETH as the ETH was unspecified. Alternatively, if the swap is 0.1 ETH for tokens, then the fee would be in tokens as that is unspecified.
Direct Swap Calls
When making a swap call to our hook, which will swap (FLETH for, or from, memecoin) we will determine the optional referrer from the hookData
that is passed. This hookData
contains optional bytes passed during any hook call.
This referrer is the only hookData
that we parse in our beforeSwap
call, meaning that when calling the PoolManager.swap function the following can be passed to assign the referrer:
Using the Universal Router
Swaps can also be implemented using the Uniswap V4 Universal Router. As the documentation on the Uniswap page is extensive, it would be better to read through that approach.
Claiming Referrer Fees
Referral fees will be distributed in one of two ways:
If the
ReferralEscrow
contract is not set on the protocol, then it will instead just be directly transferred to the referrer.If a
ReferralEscrow
contract has been set up, then the tokens will be assigned by escrow to the referrer to claim.
The ReferralEscrow contract is currently enabled on the protocol
Current Referral Escrow contract addresses:
Base: 0xBD39c7Be6D98BD1a3e4Ad482baF99d738947fE55
Base Sepolia: 0x0651cadC51b6a13CB3465C134A22154a2b633779
The claim process for referral fees is called by passing an array of token addresses to claim, and the recipient of the claim. Tokens can only be claimed from the allocation of the msg.sender
.
If there is no allocation for a provided token address then it will just be skipped and the call will not revert.
If the user holds flETH in their referral fees, then when this is claimed it will automatically be unwrapped into ETH and transferred to the _recipient
.
Last updated