Skip to content

Commit

Permalink
improve speedup predicates
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Rice <matthewcrice32@gmail.com>
  • Loading branch information
mrice32 committed Feb 8, 2024
1 parent 0d0018c commit 3e260c1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/clients/SpokePoolClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,8 +306,8 @@ export class SpokePoolClient extends BaseAbstractClient {
}

if (isV2Deposit(deposit)) {
const v2SpeedUps = depositorSpeedUps.filter((speedUp): speedUp is V2SpeedUp => isV2SpeedUp(speedUp));
const maxSpeedUp = v2SpeedUps?.reduce((prev, current) =>
const v2SpeedUps = depositorSpeedUps.filter(isV2SpeedUp<V2SpeedUp, V3SpeedUp>);
const maxSpeedUp = v2SpeedUps.reduce((prev, current) =>
prev.newRelayerFeePct.gt(current.newRelayerFeePct) ? prev : current
);

Expand All @@ -329,8 +329,8 @@ export class SpokePoolClient extends BaseAbstractClient {
return updatedDeposit;
}

const v3SpeedUps = depositorSpeedUps.filter((speedUp): speedUp is V3SpeedUp => isV3SpeedUp(speedUp));
const maxSpeedUp = v3SpeedUps?.reduce((prev, current) =>
const v3SpeedUps = depositorSpeedUps.filter(isV3SpeedUp<V3SpeedUp, V2SpeedUp>);
const maxSpeedUp = v3SpeedUps.reduce((prev, current) =>
prev.updatedOutputAmount.lt(current.updatedOutputAmount) ? prev : current
);

Expand Down

0 comments on commit 3e260c1

Please sign in to comment.