truffle compile shows error: TypeError: Invalid type for argument in function call.

0 votes

When run truffle compile, I get the error:

Compiling ./contracts/Migrations.sol...

/home/edureka/t/contracts/Migrations.sol:16:32: TypeError: Type int256 is not implicitly convertible to expected type uint256.
    last_completed_migration = completed;
                               ^-------^
,/home/edureka/t/contracts/Migrations.sol:21:27: TypeError: Invalid type for argument in function call. Invalid implicit conversion from uint256 to int256 requested.
    upgraded.setCompleted(last_completed_migration);
                          ^----------------------^

How to solve this?

Dec 4, 2018 in Blockchain by digger
• 27,620 points
67 views

1 answer to this question.

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
0 votes

You are getting this error because you have mentioned a wrong datatype. The generally used datatype is uint. So change the code

function setCompleted(uint completed)
answered Dec 4, 2018 by Omkar
• 65,820 points

Related Questions In Blockchain

0 votes
1 answer

Can't call contract function in truffle console

Inspect the object adoption within the console. You will ...READ MORE

answered Sep 28, 2018 in Blockchain by slayer
• 29,040 points
343 views
+1 vote
5 answers

How to solve "truffle: command not found" error in blockchain?

First try restarting the system and then ...READ MORE

answered Jul 16, 2018 in Blockchain by slayer
• 29,040 points
484 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
61 views
+1 vote
3 answers

Removing double quotes from a string from JSON response in PHP

Just remove the json_encode call, and it should work: $resp ...READ MORE

answered Sep 12, 2018 in Blockchain by digger
• 27,620 points
1,509 views
0 votes
1 answer
0 votes
1 answer

Calling function in truffle console error

Inside Truffle console ContractName.deployed().then(function(instance){app = instance}) app.adopt(23)//call method on ...READ MORE

answered Oct 10, 2018 in Blockchain by Omkar
• 65,820 points
218 views

© 2018 Brain4ce Education Solutions Pvt. Ltd. All rights Reserved.
"PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc.