Hi I am trying to call a custom function of a contract that expects a parameter of unit256.
Im calling this function from web3 with this value as parameter: 10000000000000000000 (10 with 18 zeros) As soon as this call is hit by web3, I faced following Big number error:
Error: overflow (fault="overflow", operation="BigNumber.from", value=10000000000000000000, code=NUMERIC_FAULT, version=bignumber/5.0.0-beta.138)
Does any one know the cause?
Here is the function of the contract I'm calling:
function lock(
address tokenAddress,
uint256 amount
)
and here is the web3 code snippet:
Contract.methods.lock(0x57AA33D53351eA4BF00C6F10c816B3037E268b7a, 10000000000000000000,
).send({
from: accounts[0],
gasLimit: 500000,
value: 0
});
I tried the same function with small values for amount and it worked e.g. 1(with 18 zeros)
I tried sending the parameter as String and it worked.
Posting this answer, so might be helpful for somebody.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With