Skip to content

Commit 607a992

Browse files
rvaggZenGround0
authored andcommitted
fix: check lockup period during allowance check
1 parent 4d87bb3 commit 607a992

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/core/payments/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,9 +415,11 @@ export async function checkAllowances(synapse: Synapse): Promise<{
415415
// Get current allowances
416416
const currentAllowances = await synapse.payments.serviceApproval(warmStorageAddress, TOKENS.USDFC)
417417

418-
// Check if we need to update (not at max)
418+
// Check if we need to update (not at max or max lockup period is not enough)
419419
const needsUpdate =
420-
currentAllowances.rateAllowance < MAX_RATE_ALLOWANCE || currentAllowances.lockupAllowance < MAX_LOCKUP_ALLOWANCE
420+
currentAllowances.rateAllowance < MAX_RATE_ALLOWANCE ||
421+
currentAllowances.lockupAllowance < MAX_LOCKUP_ALLOWANCE ||
422+
currentAllowances.maxLockupPeriod < BigInt(DEFAULT_LOCKUP_DAYS) * TIME_CONSTANTS.EPOCHS_PER_DAY
421423

422424
return {
423425
needsUpdate,

0 commit comments

Comments
 (0)