Submitted by Ch_301
Isolated Margin Lending the BendDAO protocol will calculate the health factor based on a single collateral (one NFT), the liquidation of collateral will be achieved by selling the NFT through an auction mechanism.
However, the borrower who gets liquidated (his NFT is in the auction state) still able to repay his loan and close the auction, by triggering IsolateLiquidation.sol#isolateRedeem(). Each asset has a redemption threshold redeemThreshold to define the minimum debt repayment amount by the borrower.
The redeemThreshold is updateable from Configurator.sol#setAssetAuctionParams() with a max value of 10_000. In case the user calls IsolateLiquidation.sol#isolateRedeem() and nftAssetData.redeemThreshold is 10_000 (MAX_REDEEM_THRESHOLD). This will be set scaledAmount to zero.
This means the debt is fully paid; however,
So, the user is not able to withdraw his NFT from BVault.sol or even update the loan state and LockerAddr values through IsolateLending.sol#isolateRepay() due to this check
Note: The only way the user can unlock his NFT is by borrowing again. This will increase loanData.scaledAmount again to greater than zero, and then he needs to repay that loan  IsolateLending.sol#isolateRepay() to update the erc721TokenData.LockerAddr to address(0). This will expose the user to the unnecessary risk of being liquidated again.
Users are forced to borrow again to unlock their NFTs after Isolate Redeem.
Foundry PoC - Please copy the following POC in TestIntIsolateRedeem.t.sol:
Foundry
In case loanData.scaledAmount == 0 call
VaultLogic.erc721SetTokenLockerAddr(nftAssetData, params.nftTokenIds[vars.nidx], address(0));.
thorseldon (BendDAO) confirmed and commented:
