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
• 26,550 points
114 views

1 answer to this question.

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
• 67,480 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,050 points
584 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,050 points
864 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
140 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
• 26,550 points
3,070 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
• 67,480 points
393 views