ULDM Performance

Challenging The Leading DEX Aggregators

This study was conducted April 4, 2023

Abstract In this study, we put Unizen Trade's unique liquidity distribution mechanism (ULDM) to the test against leading decentralized exchange (DEX) aggregators 1inch and Paraswap. By simulating 37 random trades across 7 different blockchains, we demonstrate the efficiency and cost-effectiveness of Unizen Trade as compared to its competitors.

Introduction Decentralized exchanges (DEXs) have gained immense popularity in recent years as an alternative to traditional centralized exchanges. With the rising interest in DEXs, the competition among DEX aggregators has also intensified. 1inch, and Paraswap are among the leading DEX aggregators, each offering distinct features and benefits to their users. In this article, we compare the performance of Unizen Trade, powered by its unique liquidity distribution mechanism ("ULDM"), against 1inch and Paraswap through a series of simulated trades.

None of the trades nor networks was hand picked, nor has the data been manipulated in anyway to accommodate biases.

Methodology We conducted a comparison by writing the below script that generated 37 random trades on 7 different blockchains, using an input amount of $10,000. The trades were executed across all platforms, and the results were recorded to evaluate the performance of Unizen Trade, 1inch, and Paraswap.

async function main() {
    const X = parseInt(prompt("Enter number of tokens in dataset to be considered "));

    const rawData = fs.readFileSync('tokenlist.json');
    const jsonData = JSON.parse(rawData);
    const tokenList = jsonData.tokens;

    const randomTokens = getRandomTokens(tokenList, X);

    for (let i = 0; i < randomTokens.length - 1; i++) {
        const tokenIn = randomTokens[i].address;
        const tokenOut = randomTokens[i + 1].address;
        const chainId = 1;

        const tokenInDetails = await getTokenDetails(tokenIn, chainId);
        const amountIn = new BigNumber(10000).dividedBy(tokenInDetails.price).multipliedBy(new BigNumber(10).pow(tokenInDetails.decimals)).toFixed(0);

        const result = await getQuotes(tokenIn, tokenOut, amountIn, chainId);
        console.log(`Swapping 10,000 USD worth of ${tokenList.find(token => token.address === tokenIn).symbol} tokens to ${tokenList.find(token => token.address === tokenOut).symbol} will get you:`);
        console.log(`ZCX: ${result.zcx}`);
        console.log(`Paraswap: ${result.paraswap}`);
        console.log(`1inch: ${result.oneInch}`);
    }
}

function getRandomTokens(tokenList, X) {
    const randomTokens = [];

    for (let i = 0; i < X; i++) {
        const randomIndex = Math.floor(Math.random() * tokenList.length);
        randomTokens.push(tokenList[randomIndex]);
    }

    return randomTokens;
}

async function getTokenDetails(tokenAddress, chainId) {
    const apiUrl = ``;
    const response = await axios.get(apiUrl);
    const data = response.data;

    return {
      decimals: data.decimals,
      price: data.price
    };
}

async function getQuotes(tokenIn, tokenOut, amountIn, chainId) {
  const paraswapUrl = `https://apiv5.paraswap.io/prices`;
  const oneInchUrl = `https://api.1inch.io/v5.0/${chainId}/quote`;
  let chainIdToRPC = new Map();

  chainIdToRPC.set(1, "");
  chainIdToRPC.set(137, "");
  chainIdToRPC.set(56, "");
  chainIdToRPC.set(43114, "");
  chainIdToRPC.set(42161, "");
  chainIdToRPC.set(10, "");
  chainIdToRPC.set(250, "");

  const tradeParams = {
    tokenIn: tokenIn,
    tokenOut: tokenOut,
    slippage: 0.03,
    chainId: chainId,
    inNative: false,
    outNative: false,
    deadline: 1679649641,
    isVIP: true,
    amount: amountIn,
  };
  const dexAggr = new DexAggregatorSDK(chainIdToRPC, undefined);
  // fetching zcx quotes
  let uzParams = dexAggr.getBestQuoteCall(
    tradeParams,
    false,
    undefined,
    undefined,
    false,
    true,
    false,
  );
  
  // fetching paraswap
  const paraswapParams = new URLSearchParams({
    srcToken: tokenIn,
    destToken: tokenOut,
    amount: amountIn,
    side: 'SELL',
    network: chainId,
    srcDecimals: 18,
    destDecimals: 18
  });
  // fetching 1inch
  const oneInchParams = new URLSearchParams({
    fromTokenAddress: tokenIn,
    toTokenAddress: tokenOut,
    amount: amountIn
  });
  const paraswapRequest = fetch(`${paraswapUrl}?${paraswapParams}`).then(response => response.json());
  const oneInchRequest = fetch(`${oneInchUrl}?${oneInchParams}`).then(response => response.json());

  const [uzResult, paraswapResult, oneInchResult] = await Promise.all([
    uzParams,
    paraswapRequest,
    oneInchRequest,
  ]);
  // splitting trade for zcx quotes
  let paramsSplit = await dexAggr.getBestQuoteCall(
    tradeParams,
    false,
    undefined,
    undefined,
    false,
    true,
    true,
    uzResult
  );
  let tot = new BigNumber(0)
  for (let i = 0; i < paramsSplit.length; i++) {
    tot = tot.plus(new BigNumber(paramsSplit[i].actualQuote));
  }
  console.log(uzResult[0].actualQuote, tot.toFixed(0))
  const results = {
    tokenIn: tokenIn,
    tokenOut: tokenOut,
    amountIn: amountIn,
    timestamp: Math.floor(Date.now() / 1000),
    chainId: chainId,
    zcx: BigNumber.max(uzResult[0].actualQuote, tot).toFixed(0),
    paraswap: paraswapResult.priceRoute == undefined ? undefined : paraswapResult.priceRoute.destAmount,
    oneInch: oneInchResult.toTokenAmount,
  };
  return results;
}

Results The results of the trades indicate a clear advantage for Unizen Trade, thanks to its in-house produced ULDM. In many instances, Unizen Trade outperformed its competitors by a significant margin, with better exchange rates and improved efficiency. The table below summarizes the results of the trades across all platforms:

Sold
Bought
Network
Unizen Out
Paraswap Out
1inch Out

GTON

USDC

Ethereum

1593

877

873

GTON

OGN

Ethereum

7364

7141

7151

USDC

OGN

Ethereum

81201

81481

81212

ELON

USDC

Polygon

8922

8247

8112

ELON

TEL

Polygon

3571453

1

3282245

USDC

TEL

Polygon

3950712

1

4055932

STRX

BUSD

BNB Chain

9787.6920269854

9671.2718994656

9671.4917587943

STRX

EVER

BNB Chain

105391

7

87346

BUSD

EVER

BNB Chain

0

0

0

SPELL

USDC

Fantom

9266

9291

9419

SPELL

CREAM

Fantom

134

105

88

USDC

CREAM

Fantom

187

106

89

SPA

USDC

Arbitrum

9421

9512

3850

SPA

SPELL

Arbitrum

9044804

7485484

4897293

USDC

SPELL

Arbitrum

12587215

12540219

12415396

YAK

USDC

Avalanche

9629

9649

9651

YAK

MILK2

Avalanche

1075323

890454

890454

USDC

MILK2

Avalanche

1094318

915633

915633

BIT

USDC

Ethereum

9995

10006

10006

BIT

METIS

Ethereum

383

385

385

USDC

METIS

Ethereum

385

385

385

GFI

USDC

Polygon

5779

4651

9200

GFI

NEXO

Polygon

5087

2780

4981

USDC

NEXO

Polygon

5214

5236

5236

SHEESHA

BUSD

BNB Chain

9815.2053875240

9675.1578566227

9675.2488882910

SHEESHA

TWT

BNB Chain

8107

8171

8171

BUSD

TWT

BNB Chain

0

0

0

LINK

USDC

Fantom

9831

9852

9838

LINK

COVER

Fantom

218

218

209

USDC

COVER

Fantom

219

219

210

CELR

USDC

Arbitrum

1284

644

2

OOE

USDC

Avalanche

2074

1156

1156

OOE

PEFI

Avalanche

227208

127415

127302

USDC

PEFI

Avalanche

844622

862878

856744

CELR

USDC

Arbitrum

1285

645

2

CELR

TUSD

Arbitrum

643

1

2

USDC

TUSD

Arbitrum

9992

10002

10002

Percentage Difference in Amount Returned

For a clearer and more comprehensive representation of the data, we calculated the percentage differences in the amount returned for each trade. These percentages highlight the extent to which trades executed using Unizen Trade's engine outperformed or underperformed compared to those conducted on 1inch and Paraswap.

The formula used to calculate the difference in percentage can be seen below.

((UnizenOutputCompetitorOutput)/CompetitorOutput)100((Unizen Output - Competitor Output) / Competitor Output) * 100

To avoid errors by zero division, one was used instead to represent the output whenever a zero output was returned. These occurrences are notable where the percentages are very excessive.

The instances where Unizen returns higher amounts compared to its competitors are color-coded in green. Cases with minimal differences in the amounts returned are highlighted in orange. For situations where the competition returns significantly larger amounts, the color red is employed to visually represent these instances.

Trade
Unizen vs Paraswap
Unizen vs 1inch

1

81.64%

82.47%

2

3.12%

2.98%

3

-0.34%

-0.01%

4

8.18%

9.99%

5

357145200.00%

8.81%

6

395071100.00%

-2.59%

7

1.20%

1.20%

8

1505485.71%

20.66%

9

N/A

N/A

10

-0.27%

-1.62%

11

27.62%

52.27%

12

76.42%

110.11%

13

-0.96%

144.70%

14

20.83%

84.69%

15

0.37%

1.38%

16

-0.21%

-0.23%

17

20.76%

20.76%

18

19.51%

19.51%

19

-0.11%

-0.11%

20

-0.52%

-0.52%

21

0.00%

0.00%

22

24.25%

-37.18%

23

82.99%

2.13%

24

-0.42%

-0.42%

25

1.45%

1.45%

26

-0.78%

-0.78%

27

N/A

N/A

28

-0.21%

-0.07%

29

0.00%

4.31%

30

0.00%

4.29%

31

99.38%

64100.00%

32

79.41%

79.41%

33

78.32%

78.48%

34

-2.12%

-1.41%

35

99.22%

64150.00%

36

64200.00%

32050.00%

37

-0.10%

-0.10%

Conclusion

This analysis showcases the efficacy of Unizen Trade's distinctive liquidity distribution mechanism (ULDM) in delivering a superior trading experience when compared to prominent DEX aggregators like 1inch and Paraswap. By optimally distributing trades across a diverse range of decentralized liquidity pools, Unizen Trade can offer more competitive rates and enhanced efficiency, rendering it an attractive option for traders seeking optimal outcomes for their transactions.

Nevertheless, it is important to note that the trades evaluated in this study were randomly generated, and certain DEX aggregators may outperform others for specific trading pairs under different circumstances. Both 1inch and Paraswap are innovative solutions that offer additional benefits and serve thousands of DeFi traders worldwide. This study was conducted as a competitive analysis to provide deeper insights into ULDM's performance in real-world situations.

Last updated