Referrals

Integrator guide for using a referral code and checking/claiming referral fees.

Get a code

Referral codes are issued by Liquid Labs. Request your code from the team on Discord.

Ref code format

refCode is a bytes32 hash, not a plain text string.

It should be the keccak256 hash of your issued code text (for example, hash "mycode" and pass that bytes32 value on-chain).

Example in ethers:

import { keccak256, toUtf8Bytes } from "ethers";

const refCode = keccak256(toUtf8Bytes("your-issued-code"));

Use your code in swaps

Router and pool both support the referral swap overload:

swap(tokenIn, tokenOut, amountIn, minAmountOut, refCode)
  • Keep your normal execution flow the same (minAmountOut, approvals, quote/estimate checks).

  • Use your issued refCode as the 5th parameter.

Check and claim referral fees

Use pool functions to inspect and claim accrued fees:

  • getRefCodeOwner lets you verify which wallet can claim for a code.

  • getRefClaimable returns currently claimable amounts per pool token.

  • claimRefFees must be called by the configured claim wallet.

Last updated