Skip to content

Commit

Permalink
fix for native (#1513)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReflectiveChimp authored Jul 18, 2024
1 parent 65ec0d7 commit b9a511d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/api/zap/proxy/common.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import Koa from 'koa';
import { getTokenByAddress } from '../../tokens/tokens';
import { getTokenByAddress, getTokenNative } from '../../tokens/tokens';
import { AnyChain, ApiChain, toApiChain } from '../../../utils/chain';
import { getAmmPrice } from '../../stats/getAmmPrices';
import { fromWeiString } from '../../../utils/big-number';

const MIN_QUOTE_VALUE: Partial<Record<ApiChain, number>> = {
optimism: 5,
};
const NATIVE_ADDRESS = '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE';

export function setNoCacheHeaders(ctx: Koa.Context) {
ctx.set('Cache-Control', 'no-store, no-cache, must-revalidate');
Expand All @@ -25,7 +26,10 @@ export async function isQuoteValueTooLow(
return undefined;
}

const srcToken = getTokenByAddress(inputAddress, apiChainId);
const srcToken =
inputAddress.toLowerCase() === NATIVE_ADDRESS.toLowerCase()
? getTokenNative(apiChainId)
: getTokenByAddress(inputAddress, apiChainId);
if (!srcToken) {
return {
code: 400,
Expand Down

0 comments on commit b9a511d

Please sign in to comment.