beeb / pancaketrade

Limit orders for PancakeSwap
GNU General Public License v3.0
200 stars 92 forks source link

Can't get gas estimate, cancelling transaction: execution reverted: PancakeRouter: INSUFFICIENT_OUTPUT_AMOUNT #88

Closed 41v4 closed 2 years ago

41v4 commented 2 years ago

Please confirm the following

Setup (please complete the following information):

Describe the bug It fails to execute an order because (I guess) it fails to estimate the gas limit

network/bsc.py:

try:
    gas_limit = Wei(int(Decimal(func.estimateGas({'from': self.wallet, 'value': amount_bnb})) * Decimal(1.2)))
except Exception as e:
    logger.error(f'Can\'t get gas estimate, cancelling transaction: {e}')
    return None

To Reproduce Steps to reproduce the behavior:

  1. Token address: 0xdFE6891ce8E5a5c7Cf54fFdE406A6C2C54145F71
  2. Amount: 0.006 BNB
  3. Price: < 1.14e-17
  4. Slippage: 5.00%
  5. Gas: network default +2 Gwei

Expected behavior I expect to buy a token

Screenshots estimateGas terminal

Additional context None

41v4 commented 2 years ago

It seems the 5% slippage was too low. I have tried with 15% slippage and it went ok.

beeb commented 2 years ago

Yep when in doubt, refer to the pancakeswap documentation. All error messages are described.