Closed ghost closed 6 years ago
@lazaridiscom Is the error you saw correct? i.e for some reason the constructor was called without arguments? If so we should close this because it's un-related to #596 - that's a re-compilation bug.
@cgewecke , its "similar to #596", not 100% sure if related. Placed this just for info. I cannot verify this at this moment, the error exists (although its something else what triggers it, possibly command-line handling). For sure: there is something wrong. And until someone pinpoints it, this should stay open.
@lazaridiscom - Where / when is the error being triggered? We just recently added this constructor error message in order to address silent failures caused by the ability to instantiate a contract that requires constructor arguments without actually specifying them. The error you're seeing is definitely from Truffle (rather than web3) and intentional.
Don't you get a line number for the error? Does it originate in migrations or a test?
@lazaridiscom Thanks for the reminder about the EthPM, will look at that shortly.
Error: Ballot contract constructor expected 1 arguments, received 0 that's the same contract in tutorial website. please can you help me find a solution?
My code:
`contract Listing {
address public creator;
uint public id;
bytes32 public title;
function Listing(address _creator, uint _id, bytes32 _title) public {
creator = _creator;
id = _id;
title = _title;
}
}`
Same here, truffle version Truffle v4.1.5 (core: 4.1.5).
And the output with truffle migrate
:
Error: Listing contract constructor expected 3 arguments, received 0 at /usr/local/lib/node_modules/truffle/build/webpack:/home/truffle-contract/contract.js:390:1 at /usr/local/lib/node_modules/truffle/build/webpack:/home/truffle-contract/contract.js:374:1 at process._tickCallback (internal/process/next_tick.js:103:7)
Hi @FabiolaBusch If you're passing Listing
to the deploy
method, you'll also need to specify the values of its constructor parameters. For example:
address = "0xabc.......";
id = 5;
title = web3.fromAscii("Hello!");
deployer.deploy(Listing, address, id, title);
There's more info about the deployer API in the docs here.
@cgewecke Thanks a lot, that helped me!
@lazaridiscom Is this closable? Does it seem like the constructor argument validation is working correctly?