0
pragma solidity >=0.7.0 <0.9.0;
struct Student
{
    int roll;
    string name;
}
contract Test {
Student public s1;
    constructor(int n,string memory namee)
    {
        s1.roll=n;
        s1.name=namee;
        
    }
}

creation of Test errored: Error encoding arguments: Error: invalid BigNumber string (argument="value", value="", code=INVALID_ARGUMENT, version=bignumber/5.5.0)

I am a beginner and only started to learn solidity

2 Answers 2

0

Well, just tried your code on remix but I moved the struct Student inside your contract (on the code you provided, the structure declaration is outside of your contract), and now it works.

Looks like this:

pragma solidity >=0.7.0 <0.9.0;

contract Test {
    struct Student
    {
        int roll;
        string name;
    }

    Student public s1;
    
    constructor(int n, string memory name)
    {
        s1.roll=n;
        s1.name=name;
        
    }
}
2
  • Thanks for the reply and it worked. Dec 9, 2022 at 13:15
  • Great to hear! If you could mark my answer as valid so other people with the same issue can find it faster. Thanks! Dec 9, 2022 at 14:00
0

remix example

when you do the deploy, pls pass the parameters.for example, I pass 12,dfk,this is your funcotion need.

try it.

and you can also find same problem here: https://stackoverflow.com/questions/70011183/solidity-invalid-bignumber-string-argument-value-value-code-invalid-argu

hope it's helpful to you.

2
  • Thanks for the reply and yeah it worked. Dec 9, 2022 at 13:15
  • cheers, the answer is useful for u, that's a good news.
    – david fnck
    Dec 9, 2022 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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