Created
August 31, 2020 09:29
-
-
Save corbifex/db5b55c654e3c9f0de32f043822e298c to your computer and use it in GitHub Desktop.
Verify if a claim for a period is allowed
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
public allowedToClaim(currentTime: number, startTime: number, payments: Array<Payment>): boolean { | |
const currentPeriod = this.calculateCurrentPeriod(currentTime, startTime); | |
if (payments.find(p => | |
p.type === 0 && | |
p.period === this.asset.period)) { | |
return false; | |
} | |
return currentPeriod >= this.asset.period && (this.asset.period * PERIOD) + startTime < currentTime; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment