fix: Ban colliding Kyber reserve (#216)

This commit is contained in:
Jacob Evans 2021-04-29 15:24:39 +10:00 committed by GitHub
parent fe0c26387c
commit cbade0d558
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View File

@ -1,4 +1,13 @@
[
{
"version": "6.9.0",
"changes": [
{
"note": "Remove conflicting Kyber reserve",
"pr": 216
}
]
},
{
"version": "6.8.0",
"changes": [

View File

@ -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,
@ -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

View File

@ -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>(
{