Skip to content

Commit

Permalink
Merge pull request #98 from ten-protocol/0xjba-patch-22
Browse files Browse the repository at this point in the history
Added an active check for guess submission
  • Loading branch information
0xjba authored Mar 1, 2024
2 parents 8cbdcf2 + 4751cc5 commit a6e2827
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions spot-the-ball/contracts/ImageGuessGame.sol
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ contract ImageGuessGame {
uint256 newChallengeIndex = challenges.length - 1;
challenges[newChallengeIndex].isActive = true;
challenges[newChallengeIndex].activationTime = block.timestamp;
challenges[newChallengeIndex].expirationTime = block.timestamp + 24 minutes;
challenges[newChallengeIndex].expirationTime = block.timestamp + 24 hours;
currentChallengeIndex = newChallengeIndex;
}

Expand Down Expand Up @@ -135,7 +135,8 @@ contract ImageGuessGame {
require(msg.value == entryFee, "Incorrect entry fee.");
require(_challengeId == currentChallengeIndex, "This challenge is not active.");
Challenge storage challenge = challenges[_challengeId];

require(challenge.isActive, "Challenge is not active.");

guessCoordinates[_challengeId][msg.sender].push(_guessCoordinates);
guessTimestamps[_challengeId][msg.sender].push(block.timestamp);
guessCount[msg.sender] += 1;
Expand All @@ -158,7 +159,7 @@ contract ImageGuessGame {
Challenge storage nextChallenge = challenges[currentChallengeIndex];
nextChallenge.isActive = true;
nextChallenge.activationTime = block.timestamp;
nextChallenge.expirationTime = block.timestamp + 24 minutes;
nextChallenge.expirationTime = block.timestamp + 24 hours;
} else {
emit NoMoreChallengesFound();
}
Expand Down
2 changes: 1 addition & 1 deletion spot-the-ball/src/assets/contract/address.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "address": "0x12fDcA9E3D2867580c3717Bf201556B29D8a2b6F" }
{ "address": "0x91062083Ce4630625DFd20BAA8a0e636E8fF1b54" }

0 comments on commit a6e2827

Please sign in to comment.