I have a function
function tokenValue( address _token, uint _amount ) public view returns ( uint ) {
return _amount.mul( 10 ** IERC20( MY_TOKEN ).decimals() ).div( 10 ** IERC20( _token ).decimals() );
}
To convert the decimals of one token into my token. However, when trying to call this on the deployed contract in a hardhat console, I get this error
reason: 'cannot estimate gas; transaction may fail or may require manual gas limit',
code: 'UNPREDICTABLE_GAS_LIMIT',
In my hardhat.config I have a manual gas limit of 2100000 so I'm not sure what I'm doing wrong here.