Skip to content

Commit

Permalink
prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
xrsv committed Dec 3, 2024
1 parent 782a94c commit 53b02fc
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
CurrencyAmount,
log,
STABLE_COINS_BY_CHAIN_ID,
WRAPPED_NATIVE_CURRENCY
WRAPPED_NATIVE_CURRENCY,
} from '../../../util';
import { calculateL1GasFeesHelper } from '../../../util/gas-factory-helpers';
import { V3RouteWithValidQuote, V4RouteWithValidQuote } from '../entities';
Expand Down Expand Up @@ -184,7 +184,7 @@ export abstract class TickBasedHeuristicGasModelFactory<
routeWithValidQuote.amount.currency,
routeWithValidQuote.quote.currency,
routeWithValidQuote.amount.quotient,
routeWithValidQuote.amount.quotient,
routeWithValidQuote.amount.quotient
);
}

Expand All @@ -196,15 +196,17 @@ export abstract class TickBasedHeuristicGasModelFactory<
: nativeAmountPool.token1Price;

// gasCostInTermsOfAmountToken = 29.487425 | 11.0
const gasCostInTermsOfAmountToken = nativeAndAmountTokenPrice.quote( // nativeAndAmountTokenPrice = 3554.58
const gasCostInTermsOfAmountToken = nativeAndAmountTokenPrice.quote(
// nativeAndAmountTokenPrice = 3554.58
totalGasCostNativeCurrency
) as CurrencyAmount;

// Convert gasCostInTermsOfAmountToken to quote token using execution price
let syntheticGasCostInTermsOfQuoteToken: CurrencyAmount | null;
try {
// syntheticGasCostInTermsOfQuoteToken = 29 | 19 | 11
syntheticGasCostInTermsOfQuoteToken = executionPrice.quote( // executionPrice = 0.99
syntheticGasCostInTermsOfQuoteToken = executionPrice.quote(
// executionPrice = 0.99
gasCostInTermsOfAmountToken
);
} catch (err) {
Expand Down Expand Up @@ -276,11 +278,18 @@ export abstract class TickBasedHeuristicGasModelFactory<
};
}

protected routeIsStableCoinPair(chainId: ChainId, routeWithValidQuote: TRouteWithValidQuote): boolean {
protected routeIsStableCoinPair(
chainId: ChainId,
routeWithValidQuote: TRouteWithValidQuote
): boolean {
const stableCoins = STABLE_COINS_BY_CHAIN_ID[chainId] || [];
return (
stableCoins.includes(routeWithValidQuote.amount.currency.wrapped.address.toLowerCase()) &&
stableCoins.includes(routeWithValidQuote.quote.currency.wrapped.address.toLowerCase())
stableCoins.includes(
routeWithValidQuote.amount.currency.wrapped.address.toLowerCase()
) &&
stableCoins.includes(
routeWithValidQuote.quote.currency.wrapped.address.toLowerCase()
)
);
}

Expand Down
2 changes: 1 addition & 1 deletion src/util/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ export const STABLE_COINS_BY_CHAIN_ID: { [chainId: number]: string[] } = {
'0x6b175474e89094c44da98b954eedeac495271d0f', // DAI
'0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT
],
}
};

export const NATIVE_NAMES_BY_ID: { [chainId: number]: string[] } = {
[ChainId.MAINNET]: [
Expand Down

0 comments on commit 53b02fc

Please sign in to comment.