I am stuck at Step-6 of Bitdegree's Solidity tutorial. Question is to Emit an event ScoreChanged with two arguments: int amount (equal to the value that was sent) and bool direction (true for up function and false for down).
This is my solution for this,I have previously checked it with remix and there are no errors in my code. I am able to pass second test case where I have to write bool direction event but stuck at int amount event.I am not able to figure out why my solution is not getting accepted? I hope someone can help me. I am beginner in Solidity.
pragma solidity 0.4.17;
contract TugOfWar {
int public score = 0;
int constant endAt = 1 ether;
bool public gameOver = false;
bool public _direction;
/*I even tried this
event ScoreChanged(int indexed _amount, bool indexed _direction);*/
event ScoreChanged(int _amount, bool _direction);
event GameEnded(bool _gameOver);
function up() external payable {
require(msg.value > 0);
require(!gameOver);
int value = int(msg.value);
score += value;
ScoreChanged(value,true);
checkIfGameOver();
}
function down() external payable {
require(msg.value > 0);
require(!gameOver);
int value = int(msg.value);
score -= value;
ScoreChanged(value,false);
checkIfGameOver();
}
function checkIfGameOver() internal {
if(score >= endAt || score <= endAt * -1) {
gameOver = true;
GameEnded(gameOver);
}
}
}