Here's the code:
contract C {
function a(uint x){}
}
I try to call C.a(1000000000000000000);
and get an error:
Error encoding arguments: Error: Assertion failed
while C.a(100000000);
is perfectly fine
What's the problem there?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityHere's the code:
contract C {
function a(uint x){}
}
I try to call C.a(1000000000000000000);
and get an error:
Error encoding arguments: Error: Assertion failed
while C.a(100000000);
is perfectly fine
What's the problem there?
The uint is too big for a native Javascript Number, so the Solidity Browser needs the input in quotes ("1000000000000000000") so that it can read the input as a string and manipulate it as a BigNumber.
Thanks for asking and I added it to How to quickly test a Solidity function?
For easy testing, I tested with this code:
contract C {
function a(uint x) returns(uint) { return x; }
}