Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable tapcompare for caching quotes #415

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions lib/handlers/shared.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ChainId, Currency, CurrencyAmount, Percent } from '@uniswap/sdk-core'
import {
AlphaRouterConfig,
CacheMode,
ITokenListProvider,
ITokenProvider,
MapWithLowerCaseKey,
@@ -137,14 +138,16 @@ export const QUOTE_SPEED_CONFIG: { [key: string]: QuoteSpeedConfig } = {

export type IntentSpecificConfig = {
useCachedRoutes?: boolean
overwriteCacheMode?: CacheMode
optimisticCachedRoutes?: boolean
}

export const INTENT_SPECIFIC_CONFIG: { [key: string]: IntentSpecificConfig } = {
caching: {
// When the intent is to create a cache entry, we should not use the cache
useCachedRoutes: false,
// This is *super* important to avoid an infinite loop of caching quotes calling themselves
// When the intent is to create a cache entry, we will use cachedRoutes with Tapcompare to track accuracy
useCachedRoutes: true,
overwriteCacheMode: CacheMode.Tapcompare,
// This optimistic=false is *super* important to avoid an infinite loop of caching quotes calling themselves
optimisticCachedRoutes: false,
},
quote: {