Skip to main content

When a method can be payable and thenis payable, it's possible to send ether to the contract while calling it, and the function can check the ammountamount sent through msg.valuemsg.value.

How can I make a function receive something elseother than ether, for examplesuch as an ERC20 token?

a method can be payable and then it's possible to send ether to the contract while calling it, and the function can check the ammount sent through msg.value.

How can I make a function receive something else than ether, for example an ERC20 token?

When a method is payable, it's possible to send ether to the contract while calling it, and the function can check the amount sent through msg.value.

How can I make a function receive something other than ether, such as an ERC20 token?

Source Link

Make function payable for a specific ERC20 token?

a method can be payable and then it's possible to send ether to the contract while calling it, and the function can check the ammount sent through msg.value.

How can I make a function receive something else than ether, for example an ERC20 token?