This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Description
Sample contract
contract GetMyBalance {
// below function cant get right result
// using Remix I get:
// 0: uint256: 115792089237316195423570985008687907853269984665640564039457581007913129639935
function _getMyBalance()
// external
public
view
returns(uint256)
{
return msg.sender.balance;
}
// Below can get right result
// by calling getMyBalance()
// and then get right
uint256 public logMyBalance_;
function getMyBalance()
external
{
logMyBalance_ = _getMyBalance();
}
// I can get right result
uint256 public logMyBalance;
function writeMyBalance() external {
logMyBalance = msg.sender.balance;
}
}
Expected behavior
Actual balance of caller
Actual behavior
115792089237316195423570985008687907853269984665640564039457581007913129639935
Steps to reproduce the behavior
- Deploy contract on any testnet except kovan or on Mainnet
- call
_getMyBalance method
Related Issues on different repos
https://github.com/ethereum/remix/issues/1430
argotorg/solidity#8545
Versions
web3js: 1.2.6