Remix Error – Troubleshooting Argument Encoding Errors During Contract Deployment

contract-deploymentencodingerrorremix

I'm building a simple fund raising smart contract and having problems deploying this through Remix. I'm wanting to set the "goal" and "minimum contribution" values (in wei) during the contract deployment and so have the following code:

pragma solidity ^0.5.0;

contract FundRaiser {
  // Initial storage variables
  uint256 public goal;
  uint256 public minimumContribution;
  address public owner;

  constructor(uint256 _goal, uint256 _minimumContribution) public {
    goal = _goal;
    minimumContribution = _minimumContribution;
    owner = msg.sender;
  }
}

This compiles fine in Remix and then I try to deploy and have the following prompt:
enter image description here

However, if I enter two large values here (1000000000000000000, 10000000000000000 – which equates to a goal of 1ETH with a minimum contribution of 0.01ETH) then I get the error:

creation of FundRaiser errored: Error encoding arguments: Error: invalid number value (arg="", coderType="uint256", value=10000000000000000, version=4.0.32)

If I then click the drop-down arrow next to the Deploy option it then shows the following:
enter image description here

Strangely Remix seems to have converted the first value into a string (surrounded by quotes) but not the second value. If I now update the values so that either both are strings or both are numbers and click "transact" then it deploys fine.

Is this an error on my part in using Remix or a bug??

Best Answer

This seems to be a remix bug.

When you deploy it using web3 or so it should work properly.

Everything should be fine. As the other answer stated you can bypass this problem.

Related Topic