|
1 | 1 | import Joi from '@hapi/joi' |
2 | | -import { Protocol } from '@uniswap/router-sdk' |
3 | | -import { ChainId, Currency, CurrencyAmount, Token, TradeType } from '@uniswap/sdk-core' |
| 2 | +import { ADDRESS_ZERO, Protocol } from '@uniswap/router-sdk' |
| 3 | +import { ChainId, Currency, CurrencyAmount, Percent, Token, TradeType } from '@uniswap/sdk-core' |
4 | 4 | import { |
5 | 5 | AlphaRouterConfig, |
6 | 6 | getAddress, |
@@ -47,6 +47,7 @@ import { |
47 | 47 | URVersionsToProtocolVersions, |
48 | 48 | } from '../../util/supportedProtocolVersions' |
49 | 49 | import { enableMixedRouteEthWeth } from '../../util/enableMixedRouteEthWeth' |
| 50 | +import { HOOKS_ADDRESSES_ALLOWLIST } from '../../util/hooksAddressesAllowlist' |
50 | 51 |
|
51 | 52 | export class QuoteHandler extends APIGLambdaHandler< |
52 | 53 | ContainerInjected, |
@@ -509,6 +510,11 @@ export class QuoteHandler extends APIGLambdaHandler< |
509 | 510 | trade, |
510 | 511 | } = swapRoute |
511 | 512 |
|
| 513 | + if (hitsCachedRoute && trade.priceImpact.greaterThan(new Percent(20, 10000))) { |
| 514 | + metric.putMetric('CachedRoutePriceImpactTooHigh', 1, MetricLoggerUnit.Count) |
| 515 | + metric.putMetric(`CachedRoutePriceImpactTooHighChainId${chainId}`, 1, MetricLoggerUnit.Count) |
| 516 | + } |
| 517 | + |
512 | 518 | const estimatedGasUsed = adhocCorrectGasUsed(preProcessedEstimatedGasUsed, chainId) |
513 | 519 | const estimatedGasUsedUSD = adhocCorrectGasUsedUSD( |
514 | 520 | preProcessedEstimatedGasUsed, |
@@ -567,6 +573,11 @@ export class QuoteHandler extends APIGLambdaHandler< |
567 | 573 | continue |
568 | 574 | } |
569 | 575 |
|
| 576 | + if (nextPool.hooks !== ADDRESS_ZERO && !HOOKS_ADDRESSES_ALLOWLIST[chainId].includes(nextPool.hooks)) { |
| 577 | + metric.putMetric(`V4UndesiredHooksOnChain${chainId}`, 1, MetricLoggerUnit.Count) |
| 578 | + metric.putMetric(`V4UndesiredHooksOnChain${chainId}Hooks${nextPool.hooks}`, 1, MetricLoggerUnit.Count) |
| 579 | + } |
| 580 | + |
570 | 581 | curRoute.push({ |
571 | 582 | type: 'v4-pool', |
572 | 583 | address: v4PoolProvider.getPoolId( |
|
0 commit comments