Skip to content

Conversation

@fadeev
Copy link
Member

@fadeev fadeev commented Mar 21, 2025

  • Deploy Uniswap v3
  • Added liquidity
  • Added a bunch of checks to verify that liquidity indeed has been added. We'll probably want to not output that to the console. Maybe we should add a --verbose flag.
Position data: {
  tokenId: '1',
  position: {
    nonce: '0',
    operator: '0x0000000000000000000000000000000000000000',
    token0: '0x2ca7d64A7EFE2D62A725E2B35Cf7230D6677FfEe',
    token1: '0x5FbDB2315678afecb367f032d93F642f64180aa3',
    fee: '3000',
    tickLower: '-887220',
    tickUpper: '887220',
    liquidity: '100000000000000000005',
    feeGrowthInside0LastX128: '0',
    feeGrowthInside1LastX128: '0',
    tokensOwed0: '0',
    tokensOwed1: '0'
  }
}
Position data: {
  tokenId: '2',
  position: {
    nonce: '0',
    operator: '0x0000000000000000000000000000000000000000',
    token0: '0x5FbDB2315678afecb367f032d93F642f64180aa3',
    token1: '0x91d18e54DAf4F677cB28167158d6dd21F6aB3921',
    fee: '3000',
    tickLower: '-887220',
    tickUpper: '887220',
    liquidity: '100000000000000000005',
    feeGrowthInside0LastX128: '0',
    feeGrowthInside1LastX128: '0',
    tokensOwed0: '0',
    tokensOwed1: '0'
  }
}

Can be tested with:

@fadeev fadeev linked an issue Mar 21, 2025 that may be closed by this pull request
@fadeev

This comment was marked as resolved.

@fadeev fadeev marked this pull request as ready for review March 26, 2025 10:05
@fadeev fadeev requested review from a team, lumtis and skosito as code owners March 26, 2025 10:05
@fadeev
Copy link
Member Author

fadeev commented Mar 26, 2025

@lumtis @skosito please, review.

@fadeev
Copy link
Member Author

fadeev commented Apr 9, 2025

@lumtis @skosito @zeta-chain/devex please, review.

tssKeypair,
tssKeypair.publicKey,
null,
9
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same question for createEVMToken, just to double check, there is no need to customize decimals?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SPL decimals: c8fa7df

ERC-20 decimals: #150

import { uniswapV2AddLiquidity } from "./uniswapV2";
import { uniswapV3AddLiquidity } from "./uniswapV3";

export const createToken = async (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

up to you, but i think it would be helpful to add some doc comments for functions, maybe just for exported since there is a lot of going on

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

const suiNotSupported = chainID === NetworkID.Sui && !contracts.suiContracts;

if (solanaNotSupported || suiNotSupported) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i see below other networks token are created, why do we return if solana or sui are not supported?

Copy link
Member Author

@fadeev fadeev Apr 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function returns if we're creating a Solana token and Solana has not been initialized. Same for Sui.


let asset;

if (isGasToken) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe its more clear to use switch for chain id part

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


foreignCoins.push({
asset,
coin_type: isGasToken ? "Gas" : chainID === NetworkID.Sui ? "SUI" : "ERC20",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here for solana would be SPL?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wzetaAmount: any,
uniswapV3Factory: any,
uniswapV3PositionManager: any,
verbose: boolean = false
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this flag used around localnet?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not used yet, but we'll need to add support for this.

console.error("Error adding liquidity to Uniswap V3:", error);
if (error.message?.includes("LOK")) {
console.error(
"Pool initialization error - pool may already be initialized"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit but maybe in case pool is created we still allow liq to be added?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is inside catch, so we're not throwing an error if a pool has been initialized, we're just explaining why adding liquidity may have failed.

@fadeev fadeev requested a review from swift1337 as a code owner April 16, 2025 08:52
@fadeev fadeev requested a review from skosito April 16, 2025 09:13
@fadeev fadeev merged commit 1703815 into main Apr 16, 2025
4 checks passed
@fadeev fadeev added the feat label Apr 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deploy Uniswap v3 pools with liquidity on ZetaChain

3 participants