I am getting a syntax error. I am not sure if its a problem related to 2D mapping or 2D array. My code is given below:
contract Stealing{
mapping (address => uint) balances;
mapping (address => bool) frozenAccount;
mapping (address => uint) allowed;
function transferFrom ( address from , address to , uint value )public returns ( bool success ) {
// checking account is freeze or not
if( frozenAccount [ msg. sender ]) return false ;
// checking the from should have enough coins
if( balances [ from ] < value ) return false ;
// checking for allowance
if( allowed [ from ][ msg. sender ] >= value ) return false ;
// checking for overflows
if( balances [to] + value < balances [to ]) return false ;
balances [ from ] -= value ;
allowed [ from ][ msg . sender ] -= value ;
balances [to] += value ; // Notify anyone listening that this transfer took place
transferFrom (from , to , value );
return true ;
}
}
The error message is:
prg9.sol:37:11: Error: Indexed expression has to be a type, mapping or array (is uint256) if( allowed [ from ][ msg. sender ] >= value ) return false ;
Somebody please guide me. Zulfi.