INNER CODE UNIT · JavaScript

amountOutMin

CleBeert/crypto-trading-bot-eth-bnb · swapWeb3.js:147

    const amountOutMin = Math.floor(ethAmount * 0.01);
    const amountOutMinHex = ethers.BigNumber.from(amountOutMin.toString()).toHexString();
    const path = [token.address, weth.address];
    const deadline = Math.floor(Date.now() / 1000) + 60 * 20;
    const deadlineHex = ethers.BigNumber.from(deadline.toString()).toHexString();
  
    const nonceCount = await web3.eth.getTransactionCount(ACCOUNT)
    
    const tx = await uniswap.swapExactTokensForETH(
      amountInHex,
      amountOutMinHex,
      path,
      ACCOUNT,
      deadlineHex,
      { 
        nonce: nonceCount + 1,
        gasPrice: ethers.BigNumber.from(newGasPrice).toHexString(),
        gasLimit: ethers.BigNumber.from(gasLimit).toHexString()

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…