0

I want to do functions involving a few specific addresses. They are defined as such at the top of the contract :

 address lockaddress = 0x36667BCBBE6574520fba783410beB6C0AfDE5043; //replace with real lockaddress 
address companyaddress = 0x49CcAF0ca6afd79Be35b908b34431b553cF21e9b; //replace with real companyaddress 
address team1 = 0xdE6B5637C4533a50a9c38D97CDCBDEe129fd966D; //replace with jeffs address or whoever deploys the contract

They are then called in this function.

function UnlockLocked () public {
 if (LockTime1 + 730 days <= now) { 
   if (address(msg.sender) == team1) {
       _balances(address(lockaddress)) = 
       _balances(address(lockaddress)).sub(_balances(address(lockaddress)));
       _balances(address(team1)) = _balances(address(team1)).add(45000000000000000000000000);
       emit Transfer (address(lockaddress), team1, 45000000000000000000000000);
   }
   else {

   }
  } 
  else {

  }
}

The error seems to revolve around _balances, which is defined as such

  mapping (address => uint256) private _balances;

I get errors such as :

TypeError: Type is not callable
TypeError: Expression has to be an lvalue.

Is it actually possible to create functions using specific set addresses? If so, how can I fix these errors?

1

If you defined _balances as follows:

mapping (address => uint256) private _balances; 

then you should use this variable as _balances[theAddress] not with parenthesis.

You can also define a function to get the balance of an account, but you should use _balances in this function:

function getBalance(address x) private view returns(uint) {
  return _balances[x];
}
| improve this answer | |

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.