Hi guys, I am using web3.js to deploy a contract. I am using the following code:
const standardtokenContract = new web3.eth.Contract(abi);
standardtokenContract.
deploy({
data: '0x' + bytecode,
arguments: [
$name_,
$symbol_,
$decimalUnits,
$initialSupply_,
feeReceiver_],
})
.send({
from: userAddress,
value: web3.utils.toWei('5')
})
When I deploy the contract without the value parameter it deploys just fine. The problem is that when I introduce the value, the gas fee increases a lot (from around 70$ to 1000$ in eth). I have deployed the same contract using the value parameter on Remix with the gas fee remaining constant or just increasing for a couple of dollars. That is why I know it is not an smart contract issue, but something regarding the js.
The contract deploys nicely using js when I delete the value parameter, so I am guessing the problem may be with the web3.utilstoWei() implementation. What do you think? Why is the gas fee increasing tremendously when I include a value?
I am using the bytecode and ABI from Remix and the web3.js version is 1.2.8.
Any help would be much appreciated,
Thank you and best regards,
Íñigo