'Transaction failing on Pancake Swap Smart Contract with error INSUFFICIENT_B_AMOUNT

When trying to write to addLiquidityEth on this contract the transaction fails with the error Fail with error 'PancakeRouter: INSUFFICIENT_B_AMOUNT'. Why is this?

The inputs are:

  • addLiquidityEth: .0171
  • token (address): 0x32f7f735D4Fb03f92F81562bf69B1dEA72181FCa
  • amountTokenDesired (uint256): 100000000000000000000
  • amountTokenMin (uint256): 100000000000000000000
  • amountETHMin (uint256): 171000000000000000
  • to (address): 0x1ef47b1fb42a2a3872e33F18b629e559648299d7
  • deadline (uint256): 1645863301

I have a feeling the solution is very simple like I haven't given permission to PancakeSwap or something to utilize my funds... but shouldn't that be included in this write, or am I missing a step before I am able to write to this function?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source