For the complete documentation index, see llms.txt. This page is also available as Markdown.

🀝Referrals

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

LiquidCore is live on HyperEVM (999) and Robinhood Chain (4663). Use the router for the chain you are trading on β€” see the router table, or the routerAddress from the quote API. Claims must be made on the same chain where the fees accrued.

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

The core referral functions are available on the router β€” pass the token pair and the router resolves the pool automatically.

  • getRefClaimable β€” check currently claimable amounts per pool token.

  • claimRefFees β€” claim accrued fees for a specific ref code. Must be called by the configured claim wallet for that code.

  • distributeRefFees β€” batch-distributes all pending referral fees across all pools. Iterates over every registered ref code and pays out accrued fees to each code's configured claim wallet. Anyone can call this.

Via pool contracts (alternative)

getRefClaimable and claimRefFees are also available directly on pool contracts (without the tokenA/tokenB pair parameters). See the Contract Reference for pool-level signatures.

Last updated