KyberSwap Docs
  • Introduction to KyberSwap
  • Getting Started
    • Quickstart
      • FAQ
    • Supported Exchanges And Networks
    • Foundational Topics
      • Decentralized Finance
        • Tokens
        • Stablecoins
        • DEX/DeFi Aggregator
        • Slippage
        • Price Impact
        • Zap
        • Maximal Extractable Value (MEV)
      • Decentralized Technologies
        • Wallets
        • Dapps
        • RPC
        • Oracles
        • On-Chain vs Off-Chain Data
      • Other Valuable Resources
  • KyberSwap Solutions
    • KyberSwap Interface
      • User Guides
        • Connect Your Wallet
        • Switching Networks
        • Instantly Swap At Superior Rates
        • Swap At Your Preferred Rates
        • Cross-chain Swap
        • Add Your Favourite Tokens
        • Get Crypto With Fiat
        • Bridge Your Assets Across Multiple Chains
      • Profiles
        • Profile Creation
        • Profile Customization
        • Sync Profile Across Devices
      • Notifications
        • Notification Center
    • KyberSwap Aggregator
      • Concepts
        • Dynamic Trade Routing
      • User Guides
        • Instantly Swap At Superior Rates
      • Developer Guides
        • Execute A Swap With The Aggregator API
        • Upgrading To APIv1
      • Aggregator API Specification
        • EVM Swaps
        • Permit
      • Contracts
        • Aggregator Contract Addresses
      • DEX IDs
      • Subgraphs
      • FAQ
    • KyberSwap Zap as a Service
      • KyberSwap Zap as a Service (ZaaS) API
        • ZaaS HTTP API
        • ZaaS GRPC API
      • KyberSwap Zap Liquidity Widget
      • Zap Fee Model
      • Zap's Supported Chains/Dexes
      • Zap's Deployed Contract Addresses
      • Zap's DEX IDs
    • KyberSwap Widget
      • Developer Guides
        • Integrating The KyberSwap Widget
        • Customizing The KyberSwap Widget
      • iFrame Alternative
      • Widget/iFrame Fee
    • KyberSwap Liquidity Widget
      • Integrating The KyberSwap Liquidity Widget
    • Limit Order
      • Concepts
        • Off-Chain Relay, On-Chain Settlement
        • Gasless Cancellation
      • User Guides
        • Swap At Your Preferred Rates
        • Update Limit Orders
        • Cancel Limit Orders
      • Developer Guides
        • Create Limit Order
        • Gasless Cancel
        • Hard Cancel
        • Fill Limit Order
      • Contracts
        • Limit Order Contract Addresses
      • Limit Order API Specification
        • General APIs
        • Maker APIs
        • Taker APIs
      • FAQ
    • KyberSwap OnChain Price Service
    • Fee Schedule
  • Governance
    • KyberDAO
      • User Guides
        • Participating in KyberDAO
        • Staking
        • Voting
        • Stake KNC And Enjoy Gas Savings
      • Fees to KyberDAO
      • KyberDAO Operator MultiSig
      • Contracts
        • KyberDAO Contract Repo
        • KyberDAO Contract Addresses
      • FAQ - Others
    • KNC Token
      • KNC Tokenomics & Utility
      • Gas Refund Program
      • KNC Contract Addresses
  • Security
    • Audits
  • Reference
    • Legacy
      • KyberSwap Classic
        • Concepts
          • Programmable Pricing Curves
          • Dynamic Auto-Adjusting Fees
          • Virtual Balances
          • Protocol Fees
        • Contracts
          • Classic Contract Repo
          • Classic Contract Addresses
          • Classic Contract Farming Addresses
      • KyberSwap Elastic
        • Concepts
          • Concentrated Liquidity
          • Reinvestment Curve
          • Tick-Range Mechanism
          • Pool Process Flows
          • Anti-Sniping Mechanism
          • Tick-Based Farming
          • Elastic Zap
          • TWAP Oracle
          • Elastic APR Calculations
        • Contracts
          • Elastic Contract Repo
          • Elastic Contract Addresses
          • Elastic Farming Contract Addresses
          • Elastic Zap Contract Addresses
          • Elastic Core Contracts
          • Elastic Core Libraries
          • Elastic Periphery Core Contracts
          • Elastic Peripheral Library Contracts
          • Elastic Peripheral Base Contracts
        • Subgraphs
      • Whitepapers
      • Audits
      • KyberAI
        • KyberScore
        • Concepts
        • On-Chain Indicators
          • Number Of Trades
          • Trading Volume
          • Netflow To Whale Wallets
          • Netflow To CEX
          • Number Of Transfers
          • Volume Of Transfers
          • Number Of Holders
          • Top Holders
        • Technical Indicators
          • Live Charts
          • Support & Resistance Levels
          • Live Trades
          • Funding Rate On CEX
          • Liquidations On CEX
        • Liquidity Analysis
      • Elastic Legacy
        • Elastic Legacy Contract Repo
        • Elastic Legacy Contract Addresses
        • Elastic Legacy Farming Contract Addresses
        • Remove Elastic Legacy Liquidity
      • Protocol
        • Overview
        • Smart Contract Architecture
        • Trust and Security Model
      • Integrations
        • Getting Started
        • Use Cases
        • Integration Types
        • Smart Contracts
        • Ethers JS
        • RESTful API
        • Slippage Rate Protection
        • Price Feed Security
        • Contract Events
        • Platform Fees
      • Reserves
        • Getting Started
          • Overview
          • Why Develop On Kyber
          • Create New Reserve
          • Existing Reserves
          • Customising Existing Reserves
        • Development Guides
          • Fed Price Reserve
          • Automated Price Reserve
          • Reserves with Ganache
          • Orderbook Reserve
        • Operations
          • Listing Policies
          • Reserve IDs
          • Reserve Rebates
          • Sanity Rates
      • Addresses
        • Introduction
        • Mainnet
        • Kovan
        • Rinkeby
        • Ropsten
      • API/ABI
        • Introduction
        • RESTful API
          • RESTful API Overview
          • RESTful API
        • Core Smart Contracts
          • IKyberNetworkProxy
          • KyberNetworkProxy
          • IKyberNetwork
          • ISimpleKyberProxy
          • IKyberMatchingEngine
          • KyberMatchingEngine
          • IKyberHint
          • KyberHintHandler
          • IKyberHintHandler
          • IKyberFeeHandler
          • IKyberStaking
          • KyberStaking
          • IKyberDao
          • KyberDao
          • IKyberStorage
          • KyberStorage
          • IKyberHistory
          • KyberHistory
          • IKyberReserve
          • KyberReserve
          • ConversionRates
          • LiquidityConversionRates
          • EpochUtils
          • IEpochUtils
          • KyberFeeHandler
        • Contract ABIs
          • ABIs
        • Code Snippets
          • Token Quantity Conversion
        • Misc Contracts
          • KyberNetwork
          • ConversionRatesInterface
          • PermissionGroups
          • SanityRates
          • Withdrawable
          • OrderbookReserveInterface
          • OrderbookReserveLister
    • KyberSwap Operator MultiSig
    • Permitable Tokens
    • Third-Party Integrations
    • KyberSwap Analytics
    • KyberSwap App
    • GitHub
    • KyberSwap Analytics
    • KyberSwap Blog
    • Kyber Network Press Kit
  • Socials
    • X
    • Discord
    • Telegram
    • LinkedIn
    • Reddit
    • Instagram
    • Tik Tok
  • Support
    • KyberSwap Help Center
    • Complaints Handling Process
Powered by GitBook
On this page
  • Zap In
  • Zap Migrate

Was this helpful?

  1. KyberSwap Solutions
  2. KyberSwap Zap as a Service

KyberSwap Zap as a Service (ZaaS) API

Partners can directly integrate the API in their dapps. They will have to build their own front-end.

PreviousKyberSwap Zap as a ServiceNextZaaS HTTP API

Last updated 6 months ago

Was this helpful?

Zap In

The API consists of 2 main APIs - GetRoute and BuildRoute

  • GetRoute is used to fetch the best zap route for adding liquidity to a new/existing position in a pool. It helps user preview the result of the zapping in action before confirming the transaction. The clients call this API once in a while, for example, to refresh the route preview displayed in the front-end client.

    • Request fields

      • The client is required to pass all the relevant fields

        • The dex to zap into

        • Pool's token 0, token 1 and fee tier

        • Position id or position lower and upper ticks (for UniswapV3-like dexes)

        • Input tokens and amounts

          • The tokens can be any ERC-20 token or 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE for the specific chain's native token (not limited to the pool's token0 or token1).

          • The amounts are full amounts without decimals (for example: 1000000 for 1 USDT)

          • Slippage tolerance. This is used to calculate minimum swap output amount and minimum minted liquidity amount acceptable, otherwise the transaction will be reverted to protect against slippage.

        • Fee configuration: the client can opt to provide their fee collection address and fee per cent mille (0.001%) if they want to charge user with a fee

      • Provide a client id with the header X-Client-ID to get easier technical support and help facilitate better traffic observability.

        • By default, clients without a whitelisted client id are also rate limitted to 10 requests per 10 seconds. If you require a higher rate, please contact bd@kyber.network to request for a client id.

      • The client can optionally provide fee collection address and fee per cent mille (0.001%) to charge a fee from the input token. More details about zap's fee model can be found in the page.

    • Response

      • Pool details

        • Include details about pool price before and after zapping in. Clients should use this data to provide their users with appropriate warnings, e.g. in case the pool price deviates too much from market price after zapping, which will subject the user's position to potential arbitrage

      • Position details

        • Give details about user new position after zapping. Please note that as usual, these details can get affected by slippage due to on-chain activities and the final result may differ slightly.

      • Zap details

        • Give details about how the zap is executed. For example it may or may not involves swapping with aggregator and/or swapping with the pool itself. It also includes details about fee amounts collected, remaining amounts left over after zapping, and the estimated price impact after zapping.

      • Route: this is the encoded zap route to be passed to BuildRoute if the user would like to execute it. The router address is used for clients to check for user allowance.

      • Gas information: this is an estimated value for the amount of gas needed for executing the transaction. Clients are advised to use from 2 to 2.5 times this amount as the max limit for sending the transaction to cater for fluctuation of the actual gas usage.

  • BuildRoute is used to build the calldata from the route returned by GetRoute in order for the user to actually send the transaction on-chain. The clients call this API once the user confirm they want to execute the zap-in, then use the calldata and other details in the response to send the transaction on chain.

    • This endpoint simply returns the needed call data, transaction value, and router address to send the transaction to.

Zap Migrate

Similar to Zap In, Zap Migrate API consists of 2 main APIs - GetRoute and BuildRoute

Please refer to the two API specifications below for details about request and response fields.

Zap Fee Model

ZaaS HTTP API

ZaaS GRPC API