Skip to content

Commit

Permalink
fix: fixed events length checks
Browse files Browse the repository at this point in the history
  • Loading branch information
mishuagopian committed Jan 12, 2024
1 parent d371246 commit 42af2d1
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions src/contracts/AllV4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export class AllV4 extends Contract<typeof auctionLoanLiquidatorABIV4> {

const filter = await this.contract.createEventFilter.BidPlaced();
const events = filterLogs(receipt, filter);
if (events.length == 0) throw new Error("Bid not placed");
if (events.length === 0) throw new Error("Bid not placed");
return { ...events[0].args, ...receipt };
},
};
Expand Down Expand Up @@ -123,7 +123,7 @@ export class AllV4 extends Contract<typeof auctionLoanLiquidatorABIV4> {

const filter = await this.contract.createEventFilter.AuctionSettled();
const events = filterLogs(receipt, filter);
if (events.length == 0) throw new Error("Auction not settled");
if (events.length === 0) throw new Error("Auction not settled");
return { ...events[0].args, ...receipt };
},
};
Expand Down
4 changes: 2 additions & 2 deletions src/contracts/AllV5.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class AllV5 extends Contract<typeof auctionLoanLiquidatorABIV5> {

const filter = await this.contract.createEventFilter.BidPlaced();
const events = filterLogs(receipt, filter);
if (events.length == 0) throw new Error("Bid not placed");
if (events.length === 0) throw new Error("Bid not placed");
return { ...events[0].args, ...receipt };
},
};
Expand All @@ -80,7 +80,7 @@ export class AllV5 extends Contract<typeof auctionLoanLiquidatorABIV5> {

const filter = await this.contract.createEventFilter.AuctionSettled();
const events = filterLogs(receipt, filter);
if (events.length == 0) throw new Error("Auction not settled");
if (events.length === 0) throw new Error("Auction not settled");
return { ...events[0].args, ...receipt };
},
};
Expand Down
4 changes: 2 additions & 2 deletions src/contracts/Leverage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export class Leverage extends Contract<typeof leverageABI> {

const filter = await this.contract.createEventFilter.BNPLLoansStarted();
const events = filterLogs(receipt, filter);
if (events.length == 0) throw new Error("BNPL Loans not started");
if (events.length === 0) throw new Error("BNPL Loans not started");
return { ...events[0].args, ...receipt };
},
};
Expand Down Expand Up @@ -207,7 +207,7 @@ export class Leverage extends Contract<typeof leverageABI> {
const filter =
await this.contract.createEventFilter.SellAndRepayExecuted();
const events = filterLogs(receipt, filter);
if (events.length == 0) throw new Error("Sell and repay not executed");
if (events.length === 0) throw new Error("Sell and repay not executed");
return { ...events[0].args, ...receipt };
},
};
Expand Down
16 changes: 8 additions & 8 deletions src/contracts/MslV4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export class MslV4 extends Contract<typeof multiSourceLoanABIV4> {

const filter = await this.contract.createEventFilter.OfferCancelled();
const events = filterLogs(receipt, filter);
if (events.length == 0) throw new Error("Offer not cancelled");
if (events.length === 0) throw new Error("Offer not cancelled");
return { ...events[0].args, ...receipt };
},
};
Expand All @@ -126,7 +126,7 @@ export class MslV4 extends Contract<typeof multiSourceLoanABIV4> {
const filter =
await this.contract.createEventFilter.AllOffersCancelled();
const events = filterLogs(receipt, filter);
if (events.length == 0) throw new Error("Offers not cancelled");
if (events.length === 0) throw new Error("Offers not cancelled");
return { ...events[0].args, ...receipt };
},
};
Expand All @@ -146,7 +146,7 @@ export class MslV4 extends Contract<typeof multiSourceLoanABIV4> {
const filter =
await this.contract.createEventFilter.RenegotiationOfferCancelled();
const events = filterLogs(receipt, filter);
if (events.length == 0) throw new Error("Offer not cancelled");
if (events.length === 0) throw new Error("Offer not cancelled");
return { ...events[0].args, ...receipt };
},
};
Expand All @@ -166,7 +166,7 @@ export class MslV4 extends Contract<typeof multiSourceLoanABIV4> {
const filter =
await this.contract.createEventFilter.RenegotiationOfferCancelled();
const events = filterLogs(receipt, filter);
if (events.length == 0) throw new Error("Offer not cancelled");
if (events.length === 0) throw new Error("Offer not cancelled");
return { ...events[0].args, ...receipt };
},
};
Expand Down Expand Up @@ -196,7 +196,7 @@ export class MslV4 extends Contract<typeof multiSourceLoanABIV4> {
});
const filter = await this.contract.createEventFilter.LoanEmitted();
const events = filterLogs(receipt, filter);
if (events.length == 0) throw new Error("Loan not emitted");
if (events.length === 0) throw new Error("Loan not emitted");
const args = events[0].args;
return {
loan: {
Expand Down Expand Up @@ -240,7 +240,7 @@ export class MslV4 extends Contract<typeof multiSourceLoanABIV4> {
});
const filter = await this.contract.createEventFilter.LoanRepaid();
const events = filterLogs(receipt, filter);
if (events.length == 0) throw new Error("Loan not repaid");
if (events.length === 0) throw new Error("Loan not repaid");
return { ...events[0].args, ...receipt };
},
};
Expand Down Expand Up @@ -273,7 +273,7 @@ export class MslV4 extends Contract<typeof multiSourceLoanABIV4> {
});
const filter = await this.contract.createEventFilter.LoanRefinanced();
const events = filterLogs(receipt, filter);
if (events.length == 0) throw new Error("Loan not refinanced");
if (events.length === 0) throw new Error("Loan not refinanced");
const args = events[0].args;
return {
loan: {
Expand Down Expand Up @@ -307,7 +307,7 @@ export class MslV4 extends Contract<typeof multiSourceLoanABIV4> {
});
const filter = await this.contract.createEventFilter.LoanRefinanced();
const events = filterLogs(receipt, filter);
if (events.length == 0) throw new Error("Loan not refinanced");
if (events.length === 0) throw new Error("Loan not refinanced");
const args = events[0].args;
return {
loan: {
Expand Down
2 changes: 1 addition & 1 deletion src/contracts/Seaport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ export class Seaport extends Contract<typeof seaportABI> {
offerer: orderComponents.offerer,
});
const events = filterLogs(receipt, filter);
if (events.length == 0) throw new Error("Order not cancelled");
if (events.length === 0) throw new Error("Order not cancelled");
return { ...events[0].args, ...receipt };
},
};
Expand Down
4 changes: 2 additions & 2 deletions src/gondi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -871,7 +871,7 @@ export class Gondi {
});
const filter = await erc721.createEventFilter.ApprovalForAll({});
const events = filterLogs(receipt, filter);
if (events.length == 0)
if (events.length === 0)
throw new Error("ERC721 approval for all not set");
return { ...events[0].args, ...receipt };
},
Expand Down Expand Up @@ -913,7 +913,7 @@ export class Gondi {
});
const filter = await erc20.createEventFilter.Approval({});
const events = filterLogs(receipt, filter);
if (events.length == 0) throw new Error("ERC20 approval not set");
if (events.length === 0) throw new Error("ERC20 approval not set");
return { ...events[0].args, ...receipt };
},
};
Expand Down

0 comments on commit 42af2d1

Please sign in to comment.