-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Loans: transfer_debt implementation #1465
Conversation
This is ready for a final review |
b117c25
to
36423f1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Maybe good if @mustermeiszer also reviews but looks good to me
ensure!( | ||
from_loan_id != to_loan_id, | ||
Error::<T>::TransferDebtToSameLoan | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to double-check @hieronx, could it make sense to allow transferring debt to the same loan? i.e. for paying the interest with the amount borrowed from the principal.
Maybe I'm being too strict with this restriction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regarding the logic here.
Is it okay if
transfer_debt_action
returnsOk(())
during proposal - borrower has enough funds to repaytransfer_debt_action
returnsErr(..)
during execution - borrower has NOT enough funds to repay
Otherwise it looks good.
I would say yes. Although the borrower account is not considered here, the borrower repays with the amount they borrow, so the account funds are not moved. But it's also true that the borrower can propose a How to remove later that "proposed action" that can never be applied is another topic that should be solved. |
It can also fail if in the meantime the pool itself has not enough funds to borrow. So it can fail for various reasons. But I can not see any misbehaviour that could occur if this action has been released but never executed. Do you see some? |
Actually, this can not happen, because
If not executed, it does not change/mutate anything, so it takes no effect. Nevertheless from a game theory point of view, some investors could have redeemed/invested money because they knew about some "transfer_debt" actions that were supposed to occur but did not. So false positives could affect how investors behave, but not sure how really it affects the system or if it could be an attack vector. By now, I think there's no issue with this |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re-approve
Description
Fixes #1378
Changes