I'm building a token contract with a sell and buy function. User should be able to buy my token not only for eth but also for another token, that I define. Therefore I need the balance mapping of the external token in my contract. I've tried:
contract externalToken {
function transfer(address receiver, uint amount){ }
mapping (address => uint256) public balanceOf; }
and in my buy function:
...
amount = externalToken.balanceOf[msg.sender] / buyPrice;
...
But it shows this error:
Indexed expression has to be a type, mapping or array (is function (address) returns (uint256)) if (exchangeToken.balanceOf[msg.sender] < buyPrice) throw;
How to do that right?