Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solidity address.balance bug #4857

Closed
Eggsyz opened this issue Aug 24, 2018 · 5 comments
Closed

solidity address.balance bug #4857

Eggsyz opened this issue Aug 24, 2018 · 5 comments

Comments

@Eggsyz
Copy link

Eggsyz commented Aug 24, 2018

Hi
I deployed a smart contract on the Ropsten test network, but I can't request it when I query the local account balance, but I can query other account balances.

contract:

contract MetaCoin {
        function getBalance() public view returns(uint) {
                return msg.sender.balance;
        }
}

result
115792089237316195423570985008687907853269984665640564039457434007913129639935

@Eggsyz
Copy link
Author

Eggsyz commented Aug 24, 2018

contract MetaCoin {

        function getBalance(address addr) public view returns(uint) {
                return addr.balance;
        }
}

@kyriediculous
Copy link

Both work for me.
This will return the ethereum balance, not the MetaCoin token balance. Keep that in mind.

@Eggsyz
Copy link
Author

Eggsyz commented Aug 27, 2018

@kyriediculous
hi
Thank you very much for your reply.
The above case is just that when I am learning MetaCoin, I can modify the code test to get the Ethereum balance, but I get the Ether Balance to get the above value, and the Ether balance of other accounts is correct. And the same is true for my test results in the test chain. If you have time, you can test it in the test chain or your private chain instead of ganache.

@kyriediculous
Copy link

#2325

@chriseth
Copy link
Contributor

chriseth commented Sep 4, 2018

Closing as this does not seem to be a compiler or language issue.

@chriseth chriseth closed this as completed Sep 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants