Created
September 5, 2022 04:40
-
-
Save Shashank-In/58d146d81055e2f4cdb155bc58e7475a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function SendCash(uint roundIndex, uint subpotIndex){ | |
var subpotsCount = getSubpotsCount(roundIndex); | |
if(subpotIndex>=subpotsCount) { | |
return; | |
} | |
var decisionBlocksNumber = getDecisionBlocksNumber(roundIndex,subpotIndex); | |
if(decisionBlocksNumber>block.number) { | |
return; | |
} | |
if(rounds[roundIndex].isCashed[subpotIndex]) { | |
return; | |
} | |
// Prevent double payouts | |
var winner = calculateWinnerEarning(roundIndex,subpotIndex); | |
var subpot = getSubpot(roundIndex); | |
winner.send(subpot); | |
rounds[roundIndex].isCashed[subpotIndex] = true; | |
//Mark all the round as cashed | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment