INNER CODE UNIT · JavaScript

gasLimit

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

    const gasLimit = Math.floor(transactionDetails.gas * 1.2)
    
    const inputEth = parseFloat(ETH_AMOUNT) * 0.99;
    const ethAmount = ethers.utils.parseEther(inputEth.toString());
    const trade = new Trade(route, new TokenAmount(weth, ethAmount), TradeType.EXACT_INPUT);
    const path = [weth.address, token.address];
    const deadline = Math.floor(Date.now() / 1000) + 60 * 20;
    const deadlineHex = ethers.BigNumber.from(deadline.toString()).toHexString();

    tokensToSell = trade.outputAmount.raw
    const amountOutHex = ethers.BigNumber.from(tokensToSell.toString()).toHexString();
    
    const ethAmt = parseFloat(ETH_AMOUNT) * 1.2;
    const amountInMax = ethers.utils.parseEther(ethAmt.toString());
    const amountInMaxHex = ethers.BigNumber.from(amountInMax.toString()).toHexString();
   
    const tx = await uniswap.swapETHForExactTokens(
      amountOutHex,

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…