0

I am a newbie here trying to understand smart contract. So when user transacts, money goes to the contract and then how do we call the withdraw function to withdraw the money? Can this done on front end or via truffle / hardhat?

bugbytes
  • 101
  • 1
  • wait! When you transact then money does not go to the contract. The user should explicitly send ether additional to the transaction fees – Majd TL Sep 11 '21 at 12:29
  • The contract should have a withdrawal function implemented and in that function you can write logic like withdrawals ether only to the owner of the contract or something else – Majd TL Sep 11 '21 at 12:31
  • I have this but it is still going to my contract when I test it. Do you know why? :( – bugbytes Sep 17 '21 at 08:24
  • we need to see the code and the problem :) sry cannot help alot you without it. – Majd TL Sep 17 '21 at 10:13
  • https://ethereum.stackexchange.com/questions/110101/cant-seem-to-withdraw-money-from-contract I posted the code here. Appreciate the help! – bugbytes Sep 17 '21 at 10:38

0 Answers0