Hot answers tagged

1

Take a look a formatEther in the ethers.js documentation const weiValue = 100000; const ethValue = ethers.utils.formatEther(weiValue); You can also format an arbitrary amount of Wei into any other denomination using formatUnits. const gweiValue = ethers.utils.formatUnits(weiValue, "gwei");


1

you need to use swapExactETHForTokens, not 100% sure as im typing this on my phone but i believe the syntax is : IPancakeRouter.swapExactETHForTokens({msg.value})( amountOutMin, path, //path is WBNB->YourToken to, deadline );


1

You can have a receive function and has a require statement that makes the tx revert if msg.value > someAmount. More info in the solidity docs.


Only top voted, non community-wiki answers of a minimum length are eligible