Skip to content

Instantly share code, notes, and snippets.

@corbifex
Created August 31, 2020 09:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save corbifex/db5b55c654e3c9f0de32f043822e298c to your computer and use it in GitHub Desktop.
Save corbifex/db5b55c654e3c9f0de32f043822e298c to your computer and use it in GitHub Desktop.
Verify if a claim for a period is allowed
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