Skip to content

Commit 2456d17

Browse files
committed
fix: check lockup period during allowance check
1 parent ed4ef82 commit 2456d17

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
@@ -413,9 +413,11 @@ export async function checkAllowances(synapse: Synapse): Promise<{
413413
// Get current allowances
414414
const currentAllowances = await synapse.payments.serviceApproval(warmStorageAddress, TOKENS.USDFC)
415415

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

420422
return {
421423
needsUpdate,

0 commit comments

Comments
 (0)