Skip to content

Commit

Permalink
revert gas price provider changes
Browse files Browse the repository at this point in the history
  • Loading branch information
KillariDev committed Feb 7, 2024
1 parent 4565e3a commit d3e6c6c
Showing 1 changed file with 1 addition and 21 deletions.
22 changes: 1 addition & 21 deletions src/lib/hooks/routing/clientSideSmartOrderRouter.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { BigNumber } from '@ethersproject/bignumber'
import type { Web3Provider } from '@ethersproject/providers'
import { JsonRpcProvider } from '@ethersproject/providers'
import { BigintIsh, ChainId, CurrencyAmount, Token, TradeType } from '@uniswap/sdk-core'
// This file is lazy-loaded, so the import of smart-order-router is intentional.
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
import {
AlphaRouter,
AlphaRouterConfig,
EIP1559GasPriceProvider,
LegacyGasPriceProvider,
OnChainGasPriceProvider,
OnChainQuoteProvider,
UniswapMulticallProvider,
} from '@uniswap/smart-order-router'
Expand All @@ -25,10 +20,6 @@ const tokenValidatorProvider = {
validateTokens: async () => ({ getValidationByToken: () => undefined }),
}

class fixedPriceProvider extends EIP1559GasPriceProvider {
getGasPrice = async () => ({ gasPriceWei: BigNumber.from(1000000000) })
}

type RouterAndProvider = { router: AlphaRouter; provider: AppStaticJsonRpcProvider | Web3Provider }
let cachedProviderRouter: { chainId: number; routerProvider: RouterAndProvider } | undefined = undefined
const routers = new Map<ChainId, RouterAndProvider>()
Expand Down Expand Up @@ -68,11 +59,6 @@ export function getRouter(chainId: ChainId, web3Provider: Web3Provider | undefin
multicallChunk: 6,
}
)
const gasPriceProvider = new OnChainGasPriceProvider(
chainId,
new fixedPriceProvider(web3Provider as JsonRpcProvider, 0, 0),
new LegacyGasPriceProvider(web3Provider as JsonRpcProvider)
)
cachedProviderRouter = {
chainId,
routerProvider: {
Expand All @@ -82,7 +68,6 @@ export function getRouter(chainId: ChainId, web3Provider: Web3Provider | undefin
multicall2Provider,
onChainQuoteProvider,
tokenValidatorProvider,
gasPriceProvider,
}),
provider: web3Provider,
},
Expand All @@ -95,13 +80,8 @@ export function getRouter(chainId: ChainId, web3Provider: Web3Provider | undefin
const supportedChainId = asSupportedChain(chainId)
if (supportedChainId) {
const provider = RPC_PROVIDERS[supportedChainId]
const gasPriceProvider = new OnChainGasPriceProvider(
chainId,
new fixedPriceProvider(provider as JsonRpcProvider, 0, 0),
new LegacyGasPriceProvider(provider as JsonRpcProvider)
)
const routerProvider = {
router: new AlphaRouter({ chainId, provider, tokenValidatorProvider, gasPriceProvider }),
router: new AlphaRouter({ chainId, provider, tokenValidatorProvider }),
provider,
}
routers.set(chainId, routerProvider)
Expand Down

0 comments on commit d3e6c6c

Please sign in to comment.