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 5, 2018 in Blockchain by digger
• 26,740 points
2,138 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 5, 2018 by Omkar
• 69,230 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,370 points
3,062 views
0 votes
3 answers
+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,370 points
11,857 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
1,885 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,740 points
45,064 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,402 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
• 69,230 points
2,851 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP