dennoh

Interacting with TestAddLiquidity S.C

Jun 3rd, 2022 (edited)
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2.  
  3. const signer = Wallet.createRandom(); // Create your signer instance here
  4.  
  5. const testAddLiquidityContract = new Contract(
  6.     config.TEST_ADD_LIQUIDITY_CONTRACT_ADDRESS,
  7.     [
  8.      `function addLiqETH(address token,
  9.         uint amountTokenDesired,
  10.         uint amountTokenMin,
  11.         uint amountETHMin,
  12.         address to,
  13.         uint deadline) external payable`,
  14.     ],
  15.     signer
  16. )
  17.  
  18. const addLiquidityETH = async () => {
  19.   const amountTokenDesired = 1000000000000000000;
  20.   const amountTokenMin = 1000000000000000000;
  21.   const amountETHMin = 1000000000000000000;
  22.   const to = '0x0000000000000000000000000000000000000000';
  23.   const deadline = Math.floor(Date.now() / 1000) + 60;
  24.  
  25.   const tx = await testAddLiquidityContract.addLiqETH(
  26.     config.TOKEN_ADDRESS,
  27.     amountTokenDesired,
  28.     amountTokenMin,
  29.     amountETHMin,
  30.     to,
  31.     deadline
  32.   );
  33.  
  34.   console.log({ tx });
  35. };
  36.  
  37.  
Add Comment
Please, Sign In to add comment