Before you get started

Good to know

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: https://github.com/unizen-io/unizen-dex-aggregator-example

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: https://www.npmjs.com/package/@unizen-io/unizen-contract-addresses 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"
  }
}

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

How to set fixed fees

Third parties who integrate to Unizen through the Unizen Trade API can choose to charge a fee to their users. The API agreement with each third party will stipulate the following:

Important! The intended fee is to be communicated to the Unizen Team that will proceed to upgrade their smart contracts to reflect the integrators requested trading fee.

  1. If the trading fee charged is greater than 0.1%, then Unizen will charge (retain) a fixed portion of that fee. No further fee will be charged by Unizen based on slippage, whether it is positive or negative.

  2. The revenue generated from that fee will have Unizen's portion automatically deducted. The integrator can then decide to manually claim their token revenue, or have it automatically sent to a wallet of their choice.

Make sure you grasp the concepts of Price Impact and Slippage

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 here.

Last updated