Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const uniswap = new Contract(config.UNISWAP_ADDRESS, [
- `function addLiquidityETH(
- address token,
- uint amountTokenDesired,
- uint amountTokenMin,
- uint amountETHMin,
- address to,
- uint deadline
- ) external payable returns (uint amountToken, uint amountETH, uint liquidity)`,
- `function addLiquidity(
- address tokenA,
- address tokenB,
- uint amountADesired,
- uint amountBDesired,
- uint amountAMin,
- uint amountBMin,
- address to,
- uint deadline
- ) external returns (uint amountA, uint amountB, uint liquidity)`,
- ]);
- const addLiquidityETH = async () => {
- const amountTokenDesired = 1000000000000000000;
- const amountTokenMin = 1000000000000000000;
- const amountETHMin = 1000000000000000000;
- const to = '0x0000000000000000000000000000000000000000';
- const deadline = Math.floor(Date.now() / 1000) + 60;
- const tx = await uniswap.addLiquidityETH(
- config.TOKEN_ADDRESS,
- amountTokenDesired,
- amountTokenMin,
- amountETHMin,
- to,
- deadline
- );
- console.log({ tx });
- };
- const addLiquidity = async () => {
- const amountADesired = 1000000000000000000;
- const amountBDesired = 1000000000000000000;
- const amountAMin = 1000000000000000000;
- const amountBMin = 1000000000000000000;
- const to = '0x0000000000000000000000000000000000000000';
- const deadline = Math.floor(Date.now() / 1000) + 60;
- const tx = await uniswap.addLiquidity(
- config.TOKEN_ADDRESS,
- config.TOKEN_ADDRESS, // could be any token like USDC
- amountADesired, // amount of tokenA desired
- amountBDesired, // amount of tokenB desired e.g 1000 USDC
- amountAMin,
- amountBMin,
- to,
- deadline
- );
- console.log({ tx });
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement