Hi abcoathup
Cant understand how write in 2_deploy_contracts.js rate and cap
const rate = new web3.BigNumber(2*10^-18);
const cap = 200 * 100000;
TypeError: web3.BigNumber is not a constructor
Hi abcoathup
Cant understand how write in 2_deploy_contracts.js rate and cap
const rate = new web3.BigNumber(2*10^-18);
const cap = 200 * 100000;
TypeError: web3.BigNumber is not a constructor
Hi @asven-2020,
I just use strings '1000000000000000000000'
.
Though happy to hear better ways to do this using a big number or some other syntax.
If you use the version of the web3 is 1.0, you can use web3.utils.toBN()
in the web3,
web3.utils.toBN('1234000000000000000000').mul(web3.utils.toBN('123000000000000000000')).toString();
and also you can use web3.utils.toWei(1234, 'ether') => 1234000000000000000000
But I would like to use bn.js
or bignumber.js
.
thank you
also want ask mul in JS give mistake as i see it is function safeMath also I see mul in crowdsale test it give TypeError: rate.mul is not a function
Hi @asven-2020,
If you want to do arithmetic in your JavaScript tests, you will need to use a BigNumber library.
OpenZeppelin Test Helpers include a bn.js
object: https://docs.openzeppelin.com/test-helpers/0.5/api#bn
Does that answer your question?