I've made a game that depends on a counter, the first user that get to the target wins. Can someone exploit this and always win?
I know that everyone can know the current count, but since there are multiple people competing, I'm not really sure if someone could always get in the the right position everytime.
I've been looking for 2 days, and haven't found an exact answer (Maybe I'm looking the wrong way).
Here's a dumbed down version of the contract.
pragma solidity ^0.4.19;
contract Ten {
uint counter = 0;
function increment() external {
counter++;
if(counter == 10) {
// User won - Give hime the prize
counter = 0;
}
}
}