0

I search it a lot but answers is Confusing i using remix.ethereum. solidity can return balance of ethereum account white code like this

pragma solidity ^0.4.9;

contract showBalance{
address owner = 0xca35b7d915458ef540ade6068dfe2f44e8fa733c;
uint256 public showBalance = owner.balance;
}

now if i have token named like TESTTOKEN [TTN] whit this details

Token Holder: 0xe780e329d218a1f849f1cab777217a2cfbb410f2 ERC20 Contract: 0xf3106ff9bd5ad9a12e91d90e0ed3526111668c1c (metamask token details)

who can i get and read TTN balance tanks for helping

1
// ----------------------------------------------------------------------------
// ERC Token Standard #20 Interface
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20-token-standard.md
// ----------------------------------------------------------------------------
pragma solidity ^0.4.17;

contract ERC20 {
    function totalSupply() public constant returns (uint);
    function balanceOf(address tokenOwner) public constant returns (uint balance);
    function allowance(address tokenOwner, address spender) public constant returns (uint remaining);
    function transfer(address to, uint tokens) public returns (bool success);
    function approve(address spender, uint tokens) public returns (bool success);
    function transferFrom(address from, address to, uint tokens) public returns (bool success);
    event Transfer(address indexed from, address indexed to, uint tokens);
    event Approval(address indexed tokenOwner, address indexed spender, uint tokens);
}

contract MyContract {
  address tracker_0x_address = 0xf3106ff9bd5ad9a12e91d90e0ed3526111668c1c;

  function getResult() public returns (uint256) {
    // address test = msg.sender; // use this if you want to get the sender
    address test = 0xe780e329d218a1f849f1cab777217a2cfbb410f2; // hardcode the sender
    return ERC20(tracker_0x_address).balanceOf(msg.sender);
  }

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.