(node:10292) UnhandledPromiseRejectionWarning: ReferenceError: amounOutMin is not defined
duartemdoria opened this issue · comments
Hi guys,
I'm getting this error:
(node:10292) UnhandledPromiseRejectionWarning: ReferenceError: amounOutMin is not defined
CODE:
//We buy for 0.1 BNB of the new token
//ethers was originally created for Ethereum, both also work for BSC
//'ether' === 'bnb' on BSC
const amountIn = ethers.utils.parseUnits('0.0001', 'ether');
console.log(amountIn);
const amounts = await router.getAmountsOut(amountIn, [tokenIn, tokenOut]);
console.log(amounts);
//Our execution price will be a bit different, we need some flexbility
const amountOutMin = amounts[1].sub(amounts[1].div(10));
console.log(Buying new token ================= tokenIn: ${amountIn.toString()} ${tokenIn} (WBNB) tokenOut: ${amounOutMin.toString()} ${tokenOut}
);
console.log(Buying new token ================= tokenIn: ${amountIn.toString()} ${tokenIn} (WBNB) tokenOut: ${amounOutMin.toString()} ${tokenOut}
There is a typo at ${amounOutMin.toString()}
You need to change it to ${amountOutMin.toString()}