I am writing script for adding liquidity to dai-eth pool using ether.js sharing the code below facing some issues need help
Opened this issue · 5 comments
const { ethers } = require('ethers');
const routerAbi = require('./router.json');
const classicPoolFactoryAbi = require('./classicpool.json');
async function addLiquidityto() {
const wallet = new ethers.Wallet(privateKey, provider);
const router = new ethers.Contract("0xC458eED598eAb247ffc19d15F19cf06ae729432c",routerAbi,wallet.connect(provider));
const tokenInputs = [
{
token: "0x0cda85ade5c84c386b69b562d1722642748dd194",
amount: ethers.utils.parseEther("1001"),
},
{
token: "0xee589e91401066068af129b0005ac3ef69e3fdb4",
amount: ethers.utils.parseEther("0.01"),
},
];
const poolAddress="0x2e0d92Dc9f8dAF7dabCF0Ea8F6Ba2FcB77F34520"
const result = await router.addLiquidity(
poolAddress,
tokenInputs,
[],
0,
ethers.constants.AddressZero,
[],
);
console.log(result);
}
addLiquidityto();
Hi @VaibhavAher219 ! Have you figured out a solution to this yet or not?
I am also facing same issue 😢
hey @VaibhavAher219 @devsalman247 any one of you guys figured it out
const { ethers } = require('ethers');
const routerAbi = require('./router.json');
const classicPoolFactoryAbi = require('./classicpool.json');
async function addLiquidityto() {
const wallet = new ethers.Wallet(privateKey, provider); const router = new ethers.Contract("0xC458eED598eAb247ffc19d15F19cf06ae729432c",routerAbi,wallet.connect(provider)); const tokenInputs = [ { token: "0x0cda85ade5c84c386b69b562d1722642748dd194", amount: ethers.utils.parseEther("1001"), }, { token: "0xee589e91401066068af129b0005ac3ef69e3fdb4", amount: ethers.utils.parseEther("0.01"), }, ]; const poolAddress="0x2e0d92Dc9f8dAF7dabCF0Ea8F6Ba2FcB77F34520" const result = await router.addLiquidity( poolAddress, tokenInputs, [], 0, ethers.constants.AddressZero, [], ); console.log(result);
}
addLiquidityto();
const { ethers } = require('ethers');
const routerAbi = require('./router.json');
const classicPoolFactoryAbi = require('./classicpool.json');
async function addLiquidityto() {
const wallet = new ethers.Wallet(privateKey, provider); const router = new ethers.Contract("0xC458eED598eAb247ffc19d15F19cf06ae729432c",routerAbi,wallet.connect(provider)); const tokenInputs = [ { token: "0x0cda85ade5c84c386b69b562d1722642748dd194", amount: ethers.utils.parseEther("1001"), }, { token: "0xee589e91401066068af129b0005ac3ef69e3fdb4", amount: ethers.utils.parseEther("0.01"), }, ]; const poolAddress="0x2e0d92Dc9f8dAF7dabCF0Ea8F6Ba2FcB77F34520" const result = await router.addLiquidity( poolAddress, tokenInputs, [], 0, ethers.constants.AddressZero, [], ); console.log(result);
}
addLiquidityto();