Relayer fee notes
A relayer is never paid in public. Its fee is output slot 2 of the join-split: a note owned by the relayer’s shielded address, in the transaction’s token, worth what the relayer quotes for current gas prices. Slots 0 and 1 are yours, payment and change; slot 2 holds a zero-amount dummy when you submit the transaction yourself, and on-chain the two cases look the same. See join-splits for the slot layout. Because the fee never leaves the pool, the contract has no relayer or caller rule at all. Anyone may submit a transfer or a withdrawal for you, and the fee note goes to the key named in slot 2 whoever pays the gas. A deposit is the exception: the pool pulls it from the caller, whose own screening it carries. The relayer cannot see inside your proof, so before it spends gas it checks slot 2 itself:- the ciphertext decrypts with its key to a canonical opening: an amount below 2^248, a blinding below the field size, a uint32 asset. Poseidon reduces its inputs modulo the field, so without this check a sender could commit to 0 and encrypt the field prime, leaving the relayer paid nothing;
- that opening, under the relayer’s own spend public key, hashes to slot 2’s commitment;
- the token is one it serves, and the amount pays for the gas at the current price and is at least the token’s fixed minimum;
- on a withdrawal, the token named in
ExtDatais the fee note’s.
Withdrawal fee
Every withdrawal pays the pool a fee in basis points of what leaves the notes, rounded up to a whole note unit. The wallet shows it as the platform fee:withdrawFeeBps 35). The owner can change the rate with setWithdrawFeeBps, never above 1% (MAX_WITHDRAW_FEE_BPS, 100 basis points). A withdrawal of w note units pays its recipient w - withdrawFee and keeps the fee in protocolFees[asset], a public counter per token. Deposits, private transfers and relayer fee notes pay nothing.
A change is announced before it applies. setWithdrawFeeBps schedules a rate: it takes effect two days later (WITHDRAW_FEE_DELAY), and until then the pool shows it in nextWithdrawFeeBps and withdrawFeeChangesAt while withdrawFeeBps stays the rate in force. A scheduled rate can be replaced before it applies, which restarts the two days.
It is bound in the proof. ExtData.withdrawFee must equal withdrawFeeOf(w) at the rate in force when the transaction lands, and extDataHash binds it. For one hour after a new rate takes effect (WITHDRAW_FEE_GRACE) the pool also accepts the fee at the rate before it, and the owner cannot set another rate during that hour, so a withdrawal proven just before a change still lands at the rate it bound. A fee at any other rate reverts with WithdrawFeeMismatch and your notes stay unspent. No submitter can patch the fee, because the hash would stop matching, and the SDK and the web app re-read the rate before proving.
It is paid on top of the amount. The SDK’s withdraw({ amount }) and both web forms treat amount as what the recipient receives and spend the fee in addition, exactly like a relayer fee; withdrawFeeFor(received, bps) is the fee of the smallest withdrawal that pays out exactly that amount. A withdrawal whose fee would take all of it (one unit at any non-zero rate) reverts with ZeroPayout.
Nothing new becomes public: the fee is a function of the public amount and the public rate. The owner collects kept fees with collectFees(asset, amount, to, format), paid as eTOKEN or TOKEN through an obligation, just like a withdrawal. Fees owed to referrers are not collectable.
Referral share
A deposit can name a referrer: the address that invited the depositor. The pool credits itreferralShareBps of the withdrawal fee the deposited amount will eventually pay: 25% (2500 basis points) at deployment, which the owner can change with setReferralShareBps, up to the whole fee. The depositor pays nothing extra, because the reward comes out of the pool’s own fee.
ExtData.referrer may be non-zero only on a deposit, where the depositor’s wallet is public anyway. A withdrawal never names one, so withdrawals stay as unlinkable as before, and extDataHash binds the field, so nobody can add or change a referrer after proving. A cancelled deposit earns nothing.
Credits are computed when the deposit lands, rounded down, from the referrer’s share at that moment and the lowest fee rate a withdrawal can pay from then on:
creditFeeBps is normally the rate in force. While a change is scheduled, or still within its hour of grace, it is the lower of the two rates, so a credit never exceeds the fee its deposit pays when it is withdrawn at a rate known when it landed. Credits never change afterwards. Each deposit names its referrer again: the pool keeps no record of who referred whom, only referralCredit[referrer][asset].
Bonuses
A referrer’s effective share,referralShareOf(r), is the base referralShareBps plus whatever bonus the pool stores for that address: a fixed part, and an expiring part that counts while block.timestamp is below its expiresAt. The two parts together are capped at MAX_REFERRAL_BONUS_BPS (5000), and the resulting share at the whole fee.
Bonuses are verified off-chain by Fluton’s backend API (a bonus role on Fluton’s Discord counts for 30 days at a time, the highest one held: Moderator and Regional moderator 2500 basis points, Encrypted 2000, Fluton creator and Fluton apex 500; a voucher code adds 500 basis points for good) and arrive on-chain as an EIP-712 attestation signed by the owner-named bonusSigner. Anyone may submit it with setReferralBonus; in practice the referrer does, from the wallet. Only an attestation issued strictly later than the stored one is accepted, so a replay cannot roll a bonus back, while a newer one that gives less still lands. A bonus applies to deposits landing after it is set. The owner can revoke one with revokeReferralBonus, and setBonusSigner changes the signer or, with the zero address, stops new bonuses being set.
Claiming, and what it reveals
Referral credits are a lien on kept fees.referralLiability[X] is the sum of credits in token X, reserved inside protocolFees[X]: the owner collects only the fees above it. A referrer claims its own credit with claimReferral(asset, amount, to, format), paid through an obligation exactly like collectFees, once withdrawals have kept at least that much of the token. Until then the call reverts with InsufficientFees.
Three limits are worth stating plainly. Anyone can refer themselves from a second wallet, which is a 25% rebate on the fee, up to 55% with the largest bonus the API grants, and at most 75% under the pool’s cap. Credits are public per referrer address, as are the link between a deposit and its referrer and the referrer’s bonus. And a leaked API signing key can raise anyone’s share by at most 50 percentage points of the fee, the bonus cap, until the owner changes the signer and revokes the grants. The wallet side is invite and referrals; what each payment makes public is what stays public.
Every function named on this page is listed with its arguments and errors in Contracts; the rates in force and the fees kept per token are public state you can read from the pool.