Replies: 2 comments 4 replies
-
@EzeCerino See the actual code was correct, what it was doing that resetting the array and mapping and after that at the end withdrawing the amount into the owner of the contract. But what you are doing, is that you are withdrawing to each individual account and at the end, the contract has not left anything to be withdrawn to the owner account. Ask me any questions if you still have queries. |
Beta Was this translation helpful? Give feedback.
3 replies
-
dude dont update your balance at the end of the transaction, that is a major security risk |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone, I just realize something that I want to share and I want to know if am I correct.
During the Remix Fund Me video, around 5h05m, @PatrickAlphaC call the withdraw function but he only fund that with just one account. As the the call function was not inside the loop it's only withdrawing to the owner of the contract.
It's that correct or did I miss something. I quickly heck the code on the repo and seems to be the same as the one during the 5h05m o f the video.
Let me share screenshots:
Note that I change my code to 5 usd minimum because I have not enough eth from the Rinkeby Faucet.
This is the balance for the account 1 (the owner) after deploying the contract: 0.2541 eth

After doing the first fund of 5 usd (0.06 eth at the time) : 0.2478 eth

Balance of the account 2 after doing the fund with that address (not the owner): 0.0335 eth

I'm sorry, i have missed the screenshot before funding.
Both account after the withdrawal: Account 1 balance=0.2597 / Account 2 balance = 0.0035


If you look at the ether scan of the contract, the withdraw creates only one transaction. This is the address of the contract for you to check: 0x8d72C0061c27EA74B9F42b299c9D40d1a0569E27


Leave you my code for you to check if I did something wrong, please let me know:
So, I tried to fix this this way:
It creates 2 transaction on the withdraw function but the thing is that I'm not seeing reflected the withdrawal into my account 2 balance.
This is the contract with the modifications.: 0x7A9d8875AA21D624F856d5D7Fc3bC1A80f711DA7

An this is the withdrawal TX:
Please let me know if I'm doing something wrong here.
It's an amazing course by the way, congratulation to @PatrickAlphaC !!
Beta Was this translation helpful? Give feedback.
All reactions