What would cause my reclaim function that was working before to suddenly stop working as I add other functionality to the the contract?
DeclarationError: Undeclared identifier. Did you mean "_balance"?
uint256 _balance = balances[this];
^^^^^^^^^^
It is flagging on every "balances" in this fragment:
function reclaimPAXG() external onlyOwner {
uint256 _balance = balances[this];
balances[this] = 0;
balances[owner] = balances[owner].add(_balance);
emit Transfer(this, owner, _balance);
}
with balances mapped:
mapping(address => uint256) internal balances;
This is Solidity 0.8.4 and I am interfacing IERC20 into the token contract and I tried several potential fixes.
Attempted to move it into the Ownable contract and it kept the error. The closest other search result is a grammatical error so I don't know what's happening.
Was able to get past the balances error by moving the IERC20 interface into the token contract where its mapping is. Ended up deleting an extra "balanceOf" function which may have been causing the problem.