1

When i try to deploy my example contract it gives me the error creation of Auction errored: Error encoding arguments: Error: invalid BigNumber string (argument="value", value="", code=INVALID_ARGUMENT, version=bignumber/5.0.8)

// SPDX-License-Identifier: GPL-3.0

pragma solidity ^0.5.2;


contract Auction{
    mapping(address=> uint)public bids;

    struct Car{
        string description;
        uint value;
        uint built_year;
    }
    
    Car public private_car;
    mapping(address=> Car) public cars;
    
    
    constructor(string memory _description, uint _value, uint _built_year) public{
    private_car.description = _description;
    private_car.value = _value;
    private_car.built_year = _built_year;
    
       cars[msg.sender] = private_car;
    }
    
    function bid() payable public{
        bids[msg.sender] = msg.value;
    }
    
    
}

Why it gives this error when i pass nothing in the constructor? It works fine if i pass something in the constructor at the time of deployment.

4
  • 1
    The problem is in the deployer, not in your smart contract code. – Mikko Ohtamaa Feb 1 at 9:24
  • please post the transaction hash – Nulik Feb 1 at 16:02
  • @MikkoOhtamaa what do you mean by that? i am deploying on Remix JavaScript VM with the same account that i'm using while passing the parameters on the constructor – Talha Javaid Malik Feb 1 at 20:09
  • @Nulik I am not getting the transaction hash. all i am getting in the logs is the error "creation of Auction errored: Error encoding arguments: Error: invalid BigNumber string (argument="value", value="", code=INVALID_ARGUMENT, version=bignumber/5.0.8)" – Talha Javaid Malik Feb 1 at 20:10
3

If you have a constructor with arguments and you don't have an empty constructor defined, you have to give the arguments when deploying the contract. If you try to deploy without arguments you get an error - Remix just seems to give a bit strange error.

0

I am having the same issue as well. Trying to deploy a trading bot and just get " Error encoding arguments: Error: invalid BigNumber string (argument="value", value="", code=INVALID_ARGUMENT, version=bignumber/5.0.8)"

0
0

You're probably leaving out some required part of the input, i.e. the function expects 3 fiels of data, and you're providing only 2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.