Hi @darthgawd,
When you input the amount of ether to withdraw (the amount
argument when you call the withdraw function) the value you enter needs to be in units of wei not ether. Solidity cannot handle numbers with decimal places, so it operates in units of wei (not ether). If you only input the number 30
then only 30 wei will be transferred from the contract address to the caller’s external wallet address: 30 wei = 0.000000000000000030 ether so this may be why you are only seeing the wallet address balance (which is displayed in ether) increase by very small increments.
To withdraw 1 ether, you need to input: 1000000000000000000 wei (10^18)
To withdraw 30 ether, you need to input: 30000000000000000000 wei (30^19)
When you input the amount of ether to deposit (when you call the deposit function) you can set the value you enter in the Value field in units of wei, gwei, finney or ether (using the dropdown next to the input box).
To deposit 1 ether, you need to input:
- 1 ether
- 1000 finney
- 1000000000 gwei (10^9)
or - 1000000000000000000 wei (10^18)
I think you already know that for the assignment you will need to add more code to the withdraw function than you currently have. But you should still be able to see the caller’s wallet address balance increase by what you expect, just for testing purposes— you just won’t have any checks or internal accounting adjustments in place which are essential for a correct implementation.
Let me know if anything is unclear, or if you have any further questions