Fee Integration
Hydrex positions earn trading fees continuously. This guide covers collecting LP fees, claiming gauge rewards, and understanding how fee streams flow to position holders.
Fee Tier
Hydrex uses a single default fee tier configured via INITIAL_POOL_FEE = 100 (100 = 0.01% per trade, or 1 basis point). This fee is earned by liquidity providers proportional to their share of in-range liquidity at the time of the swap.
Fee flow overview
- Swap occurs → fee accrues in the pool contract
- Fee is proportionally assigned to in-range LP positions (as token0 + token1)
- LP calls
collectto withdraw accrued fees to their wallet - LPs staked in gauges also earn HYDX emission rewards on top of trading fees
Collecting LP Trading Fees
Use NonfungiblePositionManager.collectCallParameters to claim accrued fees from a position at any time without removing liquidity.
import { NonfungiblePositionManager, CurrencyAmount } from '@hydrexfi/hydrex-sdk';
// Collect accrued trading fees from position tokenId 42
const { calldata, value } = NonfungiblePositionManager.collectCallParameters({
tokenId: '42',
recipient: '0xYourWallet',
// Use '0' to collect maximum available; or use on-chain amounts
expectedCurrencyOwed0: CurrencyAmount.fromRawAmount(USDC, '0'),
expectedCurrencyOwed1: CurrencyAmount.fromRawAmount(WETH, '0'),
});collectOptions to removeCallParameters.Claiming Gauge Rewards
Staked LP positions earn HYDX emissions via the gauge system. Use ClaimRewards to discover and claim pending rewards.
import { ClaimRewards, GaugeRewardReadInput } from '@hydrexfi/hydrex-sdk';
const gauges: GaugeRewardReadInput[] = [
{ gaugeAddress: '0xGauge1', readContract: readContractForGauge1 },
{ gaugeAddress: '0xGauge2', readContract: readContractForGauge2 },
];
// Find gauges with pending rewards
const claimable: string[] = await ClaimRewards.getClaimableGaugeAddresses('0xUser', gauges);
// Build claim calldata for specific gauges
const { calldata } = ClaimRewards.claimRewardsCallParameters({
gaugeAddresses: claimable,
});
// All reward claim transactions target VOTER_ADDRESSES[chainId]Token-Specific Claims
For gauges with multiple reward tokens, use the token-specific claim builders.
import { ClaimRewards } from '@hydrexfi/hydrex-sdk';
// Get token-specific claims ready for submission
const claims = await ClaimRewards.getClaimableRewardTokenClaims('0xUser', gauges);
// claims = [{ gaugeAddress, tokens[] }, ...]
// Claim specific reward tokens from multiple gauges
const { calldata } = ClaimRewards.claimRewardTokensCallParameters({
claims: [
{ gaugeAddress: '0xGauge1', tokens: ['0xRewardToken1'] },
{ gaugeAddress: '0xGauge2', tokens: ['0xRewardToken2'] },
],
});