I am very new to solidity, contracts, and truffle, and I ran across a disconnect between the results of calling the getBalance() function of this basic contract:
`contract TruffleTutorial {
address private owner;
constructor() public { owner = msg.sender; }
function getOwner() public view returns(address){ return owner; }
function getBalance() public view returns(uint256){ return owner.balance; } }`
contract TruffleTutorial {
address private owner;
constructor() public {
owner = msg.sender;
}
function getOwner() public view returns(address){
return owner;
}
function getBalance() public view returns(uint256){
return owner.balance;
}
}
The contract is about as simple as it gets, and when I tested it on remix, I got the balance of my test account as an unsigned integer, just as I had expected. When I tried to call the getBalance() function of a contract with the same exact code using the truffle console, I got a BN variable as such:
BN { negative: 0, words: [ 54327296, 54735606, 3094901, 596, <1 empty item> ], length: 4, red: null }
BN {
negative: 0,
words: [ 54327296, 54735606, 3094901, 596, <1 empty item> ],
length: 4,
red: null
}
Trying the getOwner() function works perfectly on both remix and truffle, but for some reason truffle seems to mess up with the getBalance() function. Again, I am very new to this, so anything helps!