Skip to content

User account can get stuck for pools with creditApprovalExpirationInSeconds changed to 0 #279

@wisdant

Description

@wisdant

Steps to reproduce:

  1. Create a pool with creditApprovalExpirationInSeconds configured as non-zero in poolConfig
  2. A user account request a credit line and got approved, but no drawdown
  3. Changed creditApprovalExpirationInSeconds to 0 in poolConfig
  4. Wait until the credit expiration window of the approved credit line to pass
  5. When the user tries to drawdown, the system complains with error creditExpiredDueToFirstDrawdownTooLate
  6. When the user tries to request a new credit line and got approved, the system updates the user state, but since creditApprovalExpirationInSeconds is 0, the if condition in line 398 in BaseCreditPool is evaluated to false, thus, the dueDate is not updated. When the user tries to drawdown, it complains creditExpiredDueToFirstDrawdownTooLate.

Desired behavior: In _approveCredit(), if validPeriod > 0 or dueDate > 0, the dueDate should be refreshed. The current implementation did not consider the case when creditApprovalExpirationInSeconds is changed from non-zero to zero.

Workaround: Because the next contract upgrade, require all pools to set creditApprovalExpirationInSeconds to non-zero, which is totally reasonable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions