Skip to content

Instantly share code, notes, and snippets.

@vasa-develop
Created July 21, 2018 19:50
Show Gist options
  • Save vasa-develop/1ae4173cca15d71d9b551b33b0dae773 to your computer and use it in GitHub Desktop.
Save vasa-develop/1ae4173cca15d71d9b551b33b0dae773 to your computer and use it in GitHub Desktop.
DO NOT USE THIS CODE. THIS CODE IS USED TO DEMONSTRATE A VULNERABILITY IN A SOLIDITY CODE.
...
function cash(uint roundIndex, uint subpotIndex){ //line 80
var subpotsCount = getSubpotsCount(roundIndex);
if(subpotIndex>=subpotsCount)
return;
var decisionBlockNumber = getDecisionBlockNumber(roundIndex,subpotIndex);
if(decisionBlockNumber>block.number)
return;
if(rounds[roundIndex].isCashed[subpotIndex])
return;
//Subpots can only be cashed once. This is to prevent double payouts
var winner = calculateWinner(roundIndex,subpotIndex);
var subpot = getSubpot(roundIndex);
winner.send(subpot);
rounds[roundIndex].isCashed[subpotIndex] = true;
//Mark the round as cashed
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment