tokenSale.deploy({ data, arguments: [params.openingTime, params.closingTime, params.rate, params.wallet, 100e14, params.token, params.goal] }).send({
from: '0xdeadbeef',
gas: 5000000,
gasPrice: 10e9,
}).then(console.log);
fails with:
Uncaught Error: invalid number value (arg="_cap", coderType="uint256", value=10000000000000000)
tokenSale.deploy({ data, arguments: [params.openingTime, params.closingTime, params.rate, params.wallet, 100e13, params.token, params.goal] }).send({
from: '0xdeadbeef',
gas: 5000000,
gasPrice: 10e9,
}).then(console.log);
passes as normal (and any values smaller than 100e13
It looks like this isn't a problem with web3. I think it's due to https://github.com/MetaMask/metamask-extension/issues/2350
I'm using MetaMask as web3 provider and I was using "web3": "^1.0.0-beta.36". So i downgraded to 0.2.0 which MetaMask requires and it works now. I only see this problem for deploying functions with large uint256 arguments in constructor

My above comment, downgrading web3js deployed the contract. Then I realized all the arguments were set to "3.963877391197344453575983046348115674221700746820753546331534351508065746944e+75"
Ah, number inputs need to be in hex format:
const { toHex } = web3.utils;
const arguments = [toHex(params.openingTime), ...]
@mjdietzx Where did you get the info that all number inputs need to be in hex? In 1.0.0-beta34 we could send bignumber decimal strings into web3 without any problems. In 1.0.0-beta.36 there is this extra heuristic added that prevents us to send higher bignumbers to the API. So what piece of documentation or announcement did we miss?
@wigy-opensource-developer Look at this: https://github.com/ethereum/web3.js/issues/2077
Most helpful comment
Ah, number inputs need to be in hex format: