I have the function resolveProject()
in my contract, which iterates over a list of Task, let's say 2, both with status 3
.
function resolveProject() {
// ...
uint closedTask;
uint totalPayout;
for(uint i=0; i<taskIds.length; i++){
if(tasks[taskIds[i]].status == 3) {
// Issue here
closedTask = closedTask + 1;
totalPayout += tasks[taskIds[i]].compensationOracle;
}
}
// ...
}
After one iteration, the line closedTask = closedTask + 1
assign 1000000000000000000
to the variable, where my intention would be to set it to 1
. I tried also using closedTask++
with the same result.
1000000000000000000
gwei is 1
eth, is this some sort of implicit conversion happening? I get this when running on Remix JavaScript VM.
Edit 1
The Solidity code works actually fine, but I think there might be a bug in the debug panel of Remix
at line 146 there is a comparison between closedTask
and taskIds.length
. The latter has 3 items, as you can see on the right, but closedTask
in debug panel shows 3000000000000000000
. Still that comparison returns true when runs, I can confirm the projectStatus
set to 2.
Edit 2 I created a bug in remix-ide' github, it has been tagged as bug so I assume this confirms there is a minor bug with Remix debug console.