the default value for uint variable is 10
now on function call, I want to change this value to 0
steps to reproduce:
-
copy the following code to remix:
contract test { uint128 public aPos=10; function updateQuota( uint128 _Quota){ aPos = _Quota; } }
-
Use the environment as a web3 provider (configure local ganache server with remix ID)
-
Deploy contract.
-
Call
updateQuota
function with parameter as 0 -
Shows error as
"transact to test.updateQuota errored: base fee exceeds gas limit "
.
Question: how to assign zero value to uint variable when we work with the web3 provider (local ganache server)
Best Answer
You most probably have assinged too little gas to the transaction. The Solidity code is fine (works as-expected with injected JS VM). Try using
gasPrice: 8000000000
andgas: 4700000
, that should run fine on ganache.