HyperSwap Docs
  • 🔎| HyperSwap
  • 🔗| Official Links
  • ❓| How to Start ?
    • Create a Wallet
    • How to Bridge on HyperEVM ?
  • PROTOCOL CONCEPTS
    • 🌐| Overview
    • 🏊Liquidity Pool
      • AMM Standard Liquidity Position
      • Concentrated Liquidity Position
      • ⚡Single Asset ZAP
    • 📐| Constant Factor AMM
    • 💲| Dynamic Fees
    • ✉️| Partner Referral
  • Points
    • 💎| Point Program
  • Token Design
    • ⛏️| Liquidity Mining
    • 🔄| Conversion and Redemption
    • 🤝| Revenues Sharing Model
    • 💰| Protocol Earnings
    • 🔥| Deflationary mechanisms
  • TOKENS
    • 🪙| $SWAP
    • 🔓| $xSWAP
  • Contracts
    • 📜| Hyper EVM
      • V2
      • V3
      • 🧰Tools
    • 📜| Testnet
      • V2
      • V3
    • 🖨️| Integrations
      • ⏯️Templates & Use Cases
      • 🏃Quick Start
        • V2
          • Swap with V2
          • Add liquidity with V2
          • Functions
        • V3
          • Swap with V3
        • Single Asset ZAP
          • Provide Liquidity With V2
          • Provide Liquidity With V3
          • Functions
  • REFERENCES
    • | Audits
    • 📖| Glossary
    • 🎨| Media Kit
Powered by GitBook
On this page
  • Constructor
  • Functions
  1. Contracts
  2. | Integrations
  3. Quick Start
  4. Single Asset ZAP

Functions

This guide explains how to interact with the Hyperswap Single Asset Zap contract.

It covers the constructor setup, liquidity provisioning functions, and receiving native tokens.

📚 Notes

• Slippage values are expressed in basis points. (Example: 100 = 1%)

• The Zap contract assumes pools already exist and have enough liquidity.

• For V3 Zaps, liquidity is always provided with a max range (full range).


Constructor

constructor(_config: Config)

Initializes the contract by setting up all required external contracts and addresses.

Parameters:

• v2PoolFactory: Address of the Uniswap V2 (or equivalent) factory used to fetch V2 liquidity pools.

• v3PoolFactory: Address of the Uniswap V3 (or equivalent) factory used to fetch V3 liquidity pools.

• v3PositionManager: Address of the Non-Fungible Position Manager for managing V3 LP NFTs.

• v2Router: Address of the router used to swap and add liquidity for V2 pools.

• v3Router: Address of the router used to swap and add liquidity for V3 pools.

• v3Quoter: Address of the quoter contract used to estimate V3 swap outputs.

• wrappedNative: Address of the wrapped native token (e.g., WETH or WBNB).

Returns:

Nothing. Initializes the internal configuration.


Functions

provideLiquidityV2 (params: LiquidityParamsV2):

Provides liquidity to a V2 pool using a single token.

The contract automatically swaps and balances tokens before adding liquidity.

Parameters:

• tokenA: Address of the first token in the liquidity pair. This is the token you provide.

• tokenB: Address of the second token in the liquidity pair.

• amountA: Amount of tokenA you want to use for the liquidity provision.

• slippage: Maximum acceptable slippage, expressed in basis points (100 = 1%).

Returns:

• liquidity: Amount of liquidity tokens (LP tokens) received after the provision.

• amount0Used: Actual amount of tokenA used during the process.

• amount1Used: Actual amount of tokenB used during the process.


provideLiquidityV3 (params: LiquidityParamsV3)

Provides liquidity to a V3 pool using a single token.

The contract automatically swaps and balances tokens, then mints a V3 liquidity position NFT.

Parameters:

• tokenA: Address of the first token in the liquidity pair. This is the token you provide.

• tokenB: Address of the second token in the liquidity pair.

• amountA: Amount of tokenA you want to use for the liquidity provision.

• fee: Fee tier of the V3 pool (e.g., 500 = 0.05%, 3000 = 0.3%).

• slippage: Maximum acceptable slippage, expressed in basis points (100 = 1%).

Returns:

• tokenId: ID of the minted V3 liquidity position NFT.

• liquidity: Amount of liquidity provided (in V3-specific liquidity units).

• amount0Used: Actual amount of tokenA used during the process.

• amount1Used: Actual amount of tokenB used during the process.

PreviousProvide Liquidity With V3Next| Audits

Last updated 26 days ago

🖨️
🏃