i am able to send eth (with a payable function ) to the my contract but what i really need is that when the user interact with the contract it takes a specific amount on the msg sender and add it to its balance.
1 Answer
The sender must attach the required amount of ETH to the transaction.
mywallet.sendTransaction({to: contractAddress, value: "1000000000"})
Contract will then be receiving this amount as part of the transaction.
-
so if i understand i do
msg.sender.sendTransaction({to: contractAddress, value: "1000000000"})
do i need to import any library for this function sendTransaction ?– devMay 16, 2022 at 7:21 -
-