Skip to content

Commit

Permalink
fix: Ban colliding Kyber reserve
Browse files Browse the repository at this point in the history
  • Loading branch information
dekz committed Apr 29, 2021
1 parent fe0c263 commit a7bb68f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
CRYPTO_COM_ROUTER_BY_CHAIN_ID,
CURVE_MAINNET_INFOS,
ELLIPSIS_BSC_INFOS,
KYBER_BANNED_RESERVES,
KYBER_BRIDGED_LIQUIDITY_PREFIX,
KYBER_DMM_ROUTER_BY_CHAIN_ID,
MAX_DODOV2_POOLS_QUERIED,
Expand All @@ -32,7 +33,11 @@ import { CurveInfo, ERC20BridgeSource } from './types';
* @param reserveId Kyber reserveId
*/
export function isAllowedKyberReserveId(reserveId: string): boolean {
return reserveId !== NULL_BYTES && !reserveId.startsWith(KYBER_BRIDGED_LIQUIDITY_PREFIX);
return (
reserveId !== NULL_BYTES &&
!reserveId.startsWith(KYBER_BRIDGED_LIQUIDITY_PREFIX) &&
!KYBER_BANNED_RESERVES.includes(reserveId)
);
}

// tslint:disable-next-line: completed-docs ban-types
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ export const NERVE_BSC_INFOS: { [name: string]: CurveInfo } = {
* 0xbb Bridged price reserve (i.e Uniswap/Curve)
*/
export const KYBER_BRIDGED_LIQUIDITY_PREFIX = '0xbb';
export const KYBER_BANNED_RESERVES = ['0xff4f6e65426974205175616e7400000000000000000000000000000000000000'];
export const MAX_KYBER_RESERVES_QUERIED = 5;
export const KYBER_CONFIG_BY_CHAIN_ID = valueByChainId<KyberSamplerOpts>(
{
Expand Down

0 comments on commit a7bb68f

Please sign in to comment.