Fujicracy / fuji-v2

Cross-chain money market aggregator
https://fuji-v2-frontend.vercel.app
15 stars 10 forks source link

L-6 lack of option to payback complete loan #492

Closed 0xdcota closed 1 year ago

0xdcota commented 1 year ago

[L-6] Lack of option for borrowers to payback their complete loan

Description

Fuji's Borrowing Vault accepts absolute debt amount only in payback.

Lending providers charge interest per block, so between the time you submit a transaction and the time it gets processed, the debt will have increased by some small margin, especially on L2s. On L1s, it is also not guaranteed that you will land in the same block; there is always some latency. This prevents someone from paying off their total debt, and there will always be some leftover dust.

Remediation to consider

  1. Ask users to pass the unit max as the amount in payback if they want to repay their total debt, then define the amount as the user's current debt inside payback. AAVE does the same
  2. Define a different payback in terms of shares.