Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AVAX / USDC addLiquidity error #34

Open
iFrez opened this issue Feb 15, 2024 · 0 comments
Open

AVAX / USDC addLiquidity error #34

iFrez opened this issue Feb 15, 2024 · 0 comments

Comments

@iFrez
Copy link

iFrez commented Feb 15, 2024

Hello!

I got this error:

Uncaught ContractFunctionExecutionError ContractFunctionExecutionError: The contract function "addLiquidity" reverted.
Error: AddressHelper__CallFailed()

Here is part of code:

...
 let firstToken = new Token(
        CHAIN_ID,
        '0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E',
        6,
        'USDC',
        'USD Coin'
      );
  let secondToken =  WNATIVE[CHAIN_ID];
  let BIN_STEP = 20;  

...

const { deltaIds, distributionX, distributionY } = getLiquidityConfig(LiquidityDistribution.SPOT)
  // declare liquidity parameters
  const addLiquidityInput = {
    tokenX: secondToken.address,
    tokenY: firstToken.address,
    binStep: Number(BIN_STEP),
    amountX: firstTokenAmount.raw.toString(),
    amountY: secondTokenAmount.raw.toString(),
    amountXMin: minFirstTokenAmount.toString(),
    amountYMin: minSecondTokenAmount.toString(),
    activeIdDesired: activeBinId,
    idSlippage: 5,
    deltaIds,
    distributionX,
    distributionY,
    to: account.address,
    refundTo: account.address,
    deadline: deadline
  }
  const { request } = await publicClient.simulateContract({
    address: router,
    abi: LBRouterV21ABI,
    functionName: "addLiquidity",
    args: [addLiquidityInput],
    account
  })
  const hash = await walletClient.writeContract(request)
  console.log(`Transaction sent with hash ${hash}`)

Could someone please help me deal with it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant