Skip to content

Commit

Permalink
gas param also by protocol version (Uniswap#575)
Browse files Browse the repository at this point in the history
  • Loading branch information
jsy1218 authored May 13, 2024
1 parent 5c032cc commit 6d92423
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/providers/on-chain-quote-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,10 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider {
minTimeout: 25,
maxTimeout: 250,
},
protected batchParams: (optimisticCachedRoutes: boolean) => BatchParams = (
_
) => {
protected batchParams: (
optimisticCachedRoutes: boolean,
useMixedRouteQuoter: boolean
) => BatchParams = (_optimisticCachedRoutes, _useMixedRouteQuoter) => {
return {
multicallChunk: 150,
gasLimitPerCall: 1_000_000,
Expand Down Expand Up @@ -389,10 +390,12 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider {
this.validateRoutes(routes, functionName, useMixedRouteQuoter);

let multicallChunk = this.batchParams(
optimisticCachedRoutes
optimisticCachedRoutes,
useMixedRouteQuoter
).multicallChunk;
let gasLimitOverride = this.batchParams(
optimisticCachedRoutes
optimisticCachedRoutes,
useMixedRouteQuoter
).gasLimitPerCall;
const { baseBlockOffset, rollback } = this.blockNumberConfig;

Expand Down Expand Up @@ -1092,7 +1095,10 @@ export class OnChainQuoteProvider implements IOnChainQuoteProvider {

const successRate = (1.0 * numSuccessResults) / numResults;

const { quoteMinSuccessRate } = this.batchParams(optimisticCachedRoutes);
const { quoteMinSuccessRate } = this.batchParams(
optimisticCachedRoutes,
useMixedRouteQuoter
);
if (successRate < quoteMinSuccessRate) {
if (haveRetriedForSuccessRate) {
log.info(
Expand Down

0 comments on commit 6d92423

Please sign in to comment.