Loan can be written off by anybody before overdue delay expires
When a borrower takes a second loan after a loan that has been written off, this second loan can be written off instantly by any other member due to missing update of last repay block, leaving the staker at a loss.\\nA staker stakes and vouches a borrower\\nthe borrower borrows calling UToken:borrow: `accountBorrows[borrower].lastRepay` is updated with the current block number\\nthe staker writes off the entire debt of the borrower calling `UserManager:debtWriteOff`. In the internal call to `UToken:debtWriteOff` the principal is set to zero but `accountBorrows[borrower].lastRepay` is not updated\\n90 days pass and a staker vouches for the same borrower\\nthe borrower borrows calling UToken:borrow: `accountBorrows[borrower].lastRepay` is not set to the current block since non zero and stays to the previous value.\\n`accountBorrows[borrower].lastRepay` is now old enough to allow the check in `UserManager:debtWriteOff` at line 738 to pass. The debt is written off by any other member immediatly after the loan is given. The staker looses the staked amount immediatly.\\n```\\n        if (block.number <= lastRepay + overdueBlocks + maxOverdueBlocks) {\\n            if (staker != msg.sender) revert AuthFailed();\\n        }\\n```\\n\\nThe last repay block is still stale and a new loan can be taken and written off immediatly many times as long as stakers are trusting the borrower\\nNote that this can be exploited maliciously by the borrower, who can continously ask for loans and then write them off immediatly.
Issue Loan can be written off by anybody before overdue delay expires\\nReset `lastRepay` for the borrower to 0 when the debt is written off completely\\n```\\n    function debtWriteOff(address borrower, uint256 amount) external override whenNotPaused onlyUserManager {\\n        uint256 oldPrincipal = getBorrowed(borrower);\\n        uint256 repayAmount = amount > oldPrincipal ? oldPrincipal : amount;\\n\\n// Add the line below\\n       if (oldPrincipal == repayAmount) accountBorrows[borrower].lastRepay = 0;\\n        accountBorrows[borrower].principal = oldPrincipal - repayAmount;\\n        totalBorrows -= repayAmount;\\n    }\\n```\\n
The staker of the loan looses the staked amount well before the overdue delay is expired
```\\n        if (block.number <= lastRepay + overdueBlocks + maxOverdueBlocks) {\\n            if (staker != msg.sender) revert AuthFailed();\\n        }\\n```\\n