Uniswap Hooks
Hooks for interacting with Uniswap V2 protocol on Avalanche.
Uniswap Hooks
BuilderKit provides hooks for interacting with Uniswap V2-compatible DEXs on Avalanche, such as Trader Joe.
useUniswapV2
The useUniswapV2 hook provides functions for swapping tokens and managing liquidity using Uniswap V2 protocol.
Available Functions
- getPair(chain_id: number, token_in: any, token_out: any): Get pair contract address
- getReserves(chain_id: number, pair: string): Get pair reserves
- getAmountOut(reserves: [BigNumber, BigNumber], amount_in: BigNumber, token_in: any, token_out: any, fee?: number): Calculate output amount
- getQuote(chain_id: number, token_in: any, token_out: any, amount_in: BigNumber): Get quote for swap
- getMinAmountOut(amount: BigNumber, slippage?: number): Calculate minimum output with slippage
- getSwapTransaction(chain_id: number, token_in: any, token_out: any, amount_in: BigNumber, amount_out: BigNumber, receiver: string): Generate swap transaction
Integration Example
Is this guide helpful?