API Reference
Complete reference for LiquidCore's smart contract functions.
Contract Addresses
USDT0/WHYPE Pool: 0xA7478A5ff7cB27A8008D6D90785db10223bc6087
USDC/WHYPE Pool: 0xD3994A6CF46cA91536376f89aCDadf92eD289a9F
Functions
Liquidity Management
deposit
function deposit(uint256 amount0, uint256 amount1) external nonReentrant returns (uint256 lpTokens)Adds liquidity to the pool and mints LP tokens.
amount0
uint256
Amount of token0 to deposit (can be 0)
amount1
uint256
Amount of token1 to deposit (can be 0)
Returns: lpTokens - Number of LP tokens minted (non-transferable)
Requirements:
At least one amount must be > 0
Sufficient token approvals
Tokens transferred successfully
withdraw
Removes liquidity from pool and burns LP tokens.
lpTokens
uint256
Number of LP tokens to burn
Returns:
amount0- Amount of token0 receivedamount1- Amount of token1 received
Requirements:
lpTokens> 0Sufficient LP token balance
Cannot withdraw in same block as deposit
Automatically claims fees before withdrawal
Trading
swap
Executes token swap with slippage protection.
tokenIn
address
Input token address
tokenOut
address
Output token address
amountIn
uint256
Amount of input tokens
minAmountOut
uint256
Minimum output amount (slippage protection)
Returns: amountOut - Actual amount of output tokens received
Requirements:
Valid token pair for the specific pool (USDT0/WHYPE or USDC/WHYPE)
amountIn> 0Sufficient reserves
Output >=
minAmountOut
Fee Management
claimUserFees
Claims accumulated trading fees for the caller.
Returns:
amount0- Token0 fees claimedamount1- Token1 fees claimed
Requirements:
User has LP tokens
Unclaimed fees available
compoundFees
Compounds accumulated fees into additional LP tokens.
Returns: lpTokens - New LP tokens minted from fees
Requirements:
User has LP tokens
Unclaimed fees available
View Functions
Pool Information
getTokens
Returns the two token addresses supported by the pool.
getReserves
Returns current token reserves in the pool.
getSpotPrices
Returns current spot prices.
forwardPrice: token0/token1 priceinversePrice: token1/token0 price
Fee Information
getUserPosition
Returns complete user position information.
Note: LP tokens are non-transferable and cannot be moved between addresses.
lpBalance
User's LP token balance
claimableFee0
Claimable token0 fees
claimableFee1
Claimable token1 fees
shareOfPool
Pool ownership percentage
withdrawAmount0
Token0 from withdrawing all LP
withdrawAmount1
Token1 from withdrawing all LP
getPoolFees
Returns current dynamic fees for each trading direction.
Estimation Functions
estimateDeposit
Estimates LP tokens that would be minted for a deposit.
estimateWithdraw
Estimates tokens that would be received for withdrawing LP tokens.
estimateSwap
Estimates output amount for a swap.
Events
Deposit
Emitted when liquidity is added.
Withdraw
Emitted when liquidity is removed.
Swap
Emitted when a swap is executed.
UserFeesClaimed
Emitted when user claims trading fees.
CompoundFees
Emitted when fees are compounded into LP tokens.
Error Types
Last updated