I am writing a BSC contract where I want to control things by how much a buyer has spent in a token buy transaction from pancakeswap. In its simplest form I set a variable in the contract section uint256 BNB; Then BNB = msg.value; In a function called by the transfer function. But the response is always 0. The contract is compiled in remix and deployed on the testnet. I have tried setting the called function to payable amongst other things. Does anyone know the issue here and how to code in msg.value in a BSC contract to get the correct return value?

Aug 11, 2021, 9:09 PM
Because it's wrapped BNB not msg.value bois
Aug 11, 2021, 9:11 PM
So what should msg.value return if anything? And can you pull the wrapped BNB spent somehow?
Thanks that could be a great help I’ll try it
Aug 11, 2021, 9:26 PM

© 2024 Draquery.com All rights reserved.