Skip to content

Commit

Permalink
fix gas token ordering for now (Uniswap#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
snreynolds authored May 13, 2022
1 parent 9e9987d commit d245931
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/providers/v3/subgraph-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ const SUBGRAPH_URL_BY_CHAIN: { [chainId in ChainId]?: string } = {
'https://api.thegraph.com/subgraphs/name/ianlapham/arbitrum-minimal',
[ChainId.POLYGON]:
'https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-polygon',
[ChainId.GÖRLI]:
'https://api.thegraph.com/subgraphs/name/ianlapham/uniswap-v3-gorli',
};

const PAGE_SIZE = 1000; // 1k is max possible query size from subgraph.
Expand Down
1 change: 1 addition & 0 deletions src/routers/alpha-router/functions/best-swap-route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ export async function getBestSwapRouteBy(
// For each gas estimate, normalize decimals to that of the chosen usd token.
const estimatedGasUsedUSDs = _(bestSwap)
.map((routeWithValidQuote) => {
// TODO: will error if gasToken has decimals greater than usdToken
const decimalsDiff =
usdTokenDecimals - routeWithValidQuote.gasCostInUSD.currency.decimals;

Expand Down
2 changes: 1 addition & 1 deletion src/routers/alpha-router/gas-models/gas-model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export const usdGasTokensByChain: { [chainId in ChainId]?: Token[] } = {
],
[ChainId.ARBITRUM_RINKEBY]: [DAI_ARBITRUM_RINKEBY, USDT_ARBITRUM_RINKEBY],
[ChainId.KOVAN]: [DAI_KOVAN, USDC_KOVAN, USDT_KOVAN],
[ChainId.GÖRLI]: [USDC_GÖRLI, USDT_GÖRLI, WBTC_GÖRLI, DAI_GÖRLI],
[ChainId.GÖRLI]: [DAI_GÖRLI, USDC_GÖRLI, USDT_GÖRLI, WBTC_GÖRLI],
[ChainId.ROPSTEN]: [DAI_ROPSTEN, USDC_ROPSTEN, USDT_ROPSTEN],
[ChainId.POLYGON]: [USDC_POLYGON],
[ChainId.POLYGON_MUMBAI]: [DAI_POLYGON_MUMBAI],
Expand Down
2 changes: 1 addition & 1 deletion src/util/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export const ID_TO_PROVIDER = (id: ChainId): string => {
case ChainId.RINKEBY:
return process.env.JSON_RPC_PROVIDER_RINKEBY!;
case ChainId.GÖRLI:
return process.env.JSON_RPC_PROVIDER_GÖRLI!;
return process.env.JSON_RPC_PROVIDER_GORLI!;
case ChainId.KOVAN:
return process.env.JSON_RPC_PROVIDER_KOVAN!;
case ChainId.OPTIMISM:
Expand Down

0 comments on commit d245931

Please sign in to comment.