Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion contracts/truefi2/SAFU.sol
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ contract SAFU is ISAFU, UpgradeableClaimable {
* to compensate TrueFiPool. Deficit is saved to be redeemed later
* @param loan Loan to be liquidated
*/
function liquidate(ILoanToken2 loan) external {
function liquidate(ILoanToken2 loan) external onlyOwner {
require(loanFactory.isLoanToken(address(loan)), "SAFU: Unknown loan");
require(loan.status() == ILoanToken2.Status.Defaulted, "SAFU: Loan is not defaulted");

Expand Down
4 changes: 2 additions & 2 deletions deployments.json
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,8 @@
"address": "0xCB829B1Aa77B8B57D320AF05a780757c8c2B88C1"
},
"sAFU": {
"txHash": "0x5856ef56a67575ed46d74f86e7c5c6a4eb344a516ddfdc83fac445b324ac96ac",
"address": "0xc7B4BB7c8e3620A6c4F9E96524ccB8a81D52A1b1"
"txHash": "0x9f05b29a297527d56a4d3baed643928d4267404acedd1aec6190ec72376fcc69",
"address": "0x97638479ee4a25e69F8782a18831325C78485565"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

diff: https://www.diffchecker.com/EWSNKK0L/ (but you should check for yourself with smartdiffer)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirm that the new SAFU contract implementation deployment (0x97638479ee4a25e69F8782a18831325C78485565) compared to the previous one includes only a single line change in the SAFU.sol file from commit 6136aac -- onlyOwner modifier has been added.

},
"sAFU_proxy": {
"txHash": "0xaa5bbaa6ca71899793cea116bfa42e4b06791c7ab85523e83bf911a4b9e12c42",
Expand Down
5 changes: 5 additions & 0 deletions test/truefi2/SAFU.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ describe('SAFU', () => {

describe('liquidate', () => {
describe('reverts if', () => {
it('caller is not owner', async () => {
await expect(safu.connect(borrower).liquidate(loan.address))
.to.be.revertedWith('Ownable: caller is not the owner')
})

it('loan is not defaulted', async () => {
await expect(safu.liquidate(loan.address))
.to.be.revertedWith('SAFU: Loan is not defaulted')
Expand Down