LogoLogo
  • Introduction to Unizen
    • Unizen Overview
      • Unizen Liquidity Distribution Mechanism (ULDM)
        • ULDM Performance
      • Unizen Interoperability Protocol (UIP)
        • LayerZero
        • DeBridge
        • Stargate
        • Celer
        • Axelar
        • Thorchain
    • Unizen Dashboard
      • General
      • Portfolio
      • History
    • Unizen Trade
      • Fees
    • Unizen Explore
      • Unizen Omni-Chain Data Pool
    • Unizen Earn
  • ZCX
    • Token Utility
    • Tokenomics
  • API - Introduction
    • Introduction
    • Before you get started
      • Understanding Price Impact and Price Slippage in Token Swaps
      • Token Allowance Management for Non-updatable Allowance Tokens
      • Tokens with taxes
      • Wrapping and Unwrapping Native Tokens
      • Quote expiration deadline
    • Security Best Practices for Integrating Unizen
      • Why disable CORS
      • How to integrate with a reverse proxy
    • Version 2 of our smart contracts
      • Migration to smart contract v2
  • API - GET STARTED
    • QuickStart guide
    • Swagger
    • Information endpoints
      • GET /trade/v1/info/chains
      • GET /trade/v1/info/sources
      • GET/v1/info/cross-providers
      • GET /trade/v1/info/token/search
      • GET /v1/info/token/popular
      • GET /trade/v1/info/token/{chainId}/{tokenAddress}
      • GET /trade/v1/info/tokenLogo/{chainId}/{tokenAddress}
      • GET /info/thorchain-inbound-address
      • GET /trade/v1/info/tx/{txHash}
      • GET /trade/v1/info/trade/{chainId}/{txHash}
      • GET /trade/v1/info/trades
    • Approval
      • GET /trade/v1/{chainId}/approval/spender
      • GET /trade/v1/{chainId}/approval/transaction
      • GET /trade/v1/{chainId}/approval/allowance
    • Single-Chain Swap
      • GET /trade/v1/{chainId}/quote/single
      • GET /trade/v1/{chainId}/swap/single
      • Send transaction in evm chains
      • Send transaction in Solana
    • Cross-Chain Swap
      • GET /trade/v1/{chainId}/quote/cross
      • GET /trade/v1/{chainId}/swap/cross
      • Send transaction
    • Gasless orders
      • POST /trade/v1/gasless/typed-data
      • POST /v1/gasless/estimate
      • POST /v1/gasless/create
      • POST /v1/gasless/cancel
      • GET /trade/v1/gasless/status/{orderId}
      • GET /v1/gasless/orderByAddress/{address}
    • UTXO Assets and Cosmos Swap
      • GET /trade/v1/{chainId}/quote/cross 1
      • GET /trade/v1/{chainId}/swap/cross
      • Sending transactions
    • Efficient Quote Retrieval with Batch Processing
      • GET /trade/v1/{chainId}/batch_quote/single
    • Error Messages
  • GASLESS TRADES
    • Obtaining gasless quotes
    • Gas estimation
    • Executing the trade
    • Following the orders
  • On-Chain Contracts - Get Started
    • Integration with Unizen Contracts for Token Swapping
    • Registering Errors on Smart Contract Calls
  • PERMIT2
    • What is Permit2?
    • Usage in our api
  • WIDGET - Get Started
    • Embed the Unizen Widget
    • Playground
  • Other
    • Smart Contracts
    • Security Audits
    • Roadmap
  • links
    • Unizen
    • Marketing Website
    • Medium
    • Twitter
    • Discord
    • Telegram
Powered by GitBook
On this page
  • How to set the fees
  • Make sure you grasp the concepts of Price Impact and Slippage

Was this helpful?

  1. API - Introduction

Before you get started

Good to know

PreviousIntroductionNextUnderstanding Price Impact and Price Slippage in Token Swaps

Last updated 7 months ago

Was this helpful?

Here's an example project built with Next.js. Its purpose is to demonstrate how to integrate the Unizen API for single-chain and cross-chain trade:

For security reasons, our API does not return contract addresses. Instead, you can obtain Trade Aggregator addresses using either of the following methods:

  1. Install the npm package: and use the JSON file from @unizen-io/unizen-contract-addresses/production.json

  2. Configure the JSON file provided below for your project.


  {
  "v1": {
    "ethereum": "0xd3f64BAa732061F8B3626ee44bab354f854877AC",
    "bsc": "0x880E0cE34F48c0cbC68BF3E745F17175BA8c650e",
    "polygon": "0x07d0ac7671D4242858D0cebcd34ec03907685947",
    "avax": "0x1C7F7e0258c81CF41bcEa31ea4bB5191914Bf7D7",
    "fantom": "0xBE2A77399Cde40EfbBc4e89207332c4a4079c83D",
    "arbitrum": "0x1C7F7e0258c81CF41bcEa31ea4bB5191914Bf7D7",
    "optimism": "0xad1D43efCF92133A9a0f33e5936F5ca10f2b012E",
    "base": "0x4F68248ecB782647D1E5981a181bBe1bfFee1040"
  },
  "v2": {
    "ethereum": "0xf140bE1825520F773Ff0F469786FCA65c876885f",
    "bsc": "0x12067e4473a1f00e58fa24e38e2cf3e53e21a33d",
    "polygon": "0x85f8fb7ac814d0a6a0b16bc207df5bbc631f1ca6",
    "avax": "0x468ae09BD4c8B4D9f7601e37B6c061776FeCFE3B",
    "fantom": "0xD38559966E53B651794aD4df6DDc190d2235180E",
    "arbitrum": "0x9660b95fcDBA4B0f5917C47b703179E03a28bf27",
    "optimism": "0x3ce6e87922e62fc279152c841102eb2bf5497010"
  },
  "v3": {
    "ethereum": "0xCf2DBA4e5C9f1B47AC09dc712A0F7bD8eE31A15d",
    "bsc": "0xa9c430de6a91132330A09BE41f9f19bf45702f74",
    "polygon": "0xCf2DBA4e5C9f1B47AC09dc712A0F7bD8eE31A15d",
    "avax": "0xa9c430de6a91132330A09BE41f9f19bf45702f74",
    "arbitrum": "0xa9c430de6a91132330A09BE41f9f19bf45702f74",
    "optimism": "0xa9c430de6a91132330A09BE41f9f19bf45702f74",
    "base": "0xa9c430de6a91132330A09BE41f9f19bf45702f74"
  }
}

This file contains the addresses of our production contracts. The version, indicated by "v1" or "v2" or "v3", corresponds to the trade and can be obtained from the quote data of the respective trade using the /quote API.

How to set the fees

The fees for each integrator can vary based on the selected API plan and, for custom plans, are determined by the fee and revenue-sharing percentage agreed upon with Unizen. Additionally, each trade quote includes a feePercentage parameter, allowing integrators to specify different fees based on the trade. For custom plans, the feePercentage must fall within the predefined range agreed upon with Unizen.

Make sure you grasp the concepts of Price Impact and Slippage

For more detailed information, please refer to .

We have written an article diving into the concepts and protective measures that should be put in place to protect users from conducting trades with high price impact or slippage. This article can be found .

https://github.com/unizen-io/unizen-dex-aggregator-example
https://www.npmjs.com/package/@unizen-io/unizen-contract-addresses
here
here