Skip to content

Commit

Permalink
feat: liquidate loan, settle auction and lockup seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
mishuagopian committed Feb 23, 2024
1 parent f1312cc commit a3934a4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/contracts/MslV6.ts
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,7 @@ export class MslV6 extends BaseContract<typeof multiSourceLoanAbiV6> {

async liquidateLoan({ loan, loanId }: { loan: LoanV6; loanId: bigint }) {
const txHash = await this.safeContractWrite.liquidateLoan([loanId, loan]);
// TODO: Check with examples if events from other contracts are included in the receipt
return {
txHash,
waitTxInBlock: async () => await this.bcClient.waitForTransactionReceipt({ hash: txHash }),
Expand Down
13 changes: 7 additions & 6 deletions src/gondi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ export class Gondi {

async getRemainingLockupSeconds({ loan }: { loan: Loan }) {
return this.contracts.Msl(loan.contractAddress).getRemainingLockupSeconds({
loan,
loan: loanToMslLoan(loan),
});
}

Expand Down Expand Up @@ -572,10 +572,9 @@ export class Gondi {
}

async liquidateLoan({ loan, loanId }: { loan: Loan; loanId: bigint }) {
return this.contracts.Msl(loan.contractAddress).liquidateLoan({
loan,
loanId,
});
return this.contracts
.Msl(loan.contractAddress)
.liquidateLoan({ loanId, loan: loanToMslLoan(loan) });
}

async placeBid({
Expand All @@ -595,7 +594,9 @@ export class Gondi {
}

async settleAuction({ loan, auction }: { loan: Loan; auction: model.Auction }) {
return this.contracts.All(auction.loanAddress).settleAuction({ loan, auction });
return this.contracts
.All(auction.loanAddress)
.settleAuction({ auction, loan: loanToMslLoan(loan) });
}

async buy(
Expand Down

0 comments on commit a3934a4

Please sign in to comment.