diff --git a/docker-compose.yml b/docker-compose.yml index 41694f2a..5355b3df 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -49,7 +49,8 @@ services: FEAT_UNISWAP_V3_SWAP_EVENT: "true" UNISWAP_V3_SWAP_START_BLOCK: 16670838 FEAT_UNISWAP_V3_POOL_CREATED_EVENT: "true" - UNISWAP_V3_POOL_CREATED_START_BLOCK: 16600000 + UNISWAP_V3_POOL_CREATED_START_BLOCK: 12369621 + UNISWAP_V3_FACTORY_ADDRESS: "0x1f98431c8ad98523631ae4a59f267346ea31f984" FEAT_LIMIT_ORDERS: "true" V4_NATIVE_FILL_START_BLOCK: "11591021" FEAT_PLP_SWAP_EVENT: "true" @@ -68,7 +69,6 @@ services: NFT_FEATURE_START_BLOCK: 14258205 FEAT_UNISWAP_V2_PAIR_CREATED_EVENT: "true" UNISWAP_V2_PAIR_CREATED_PROTOCOL_CONTRACT_ADDRESSES_AND_START_BLOCKS: "UniswapV2:0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f:10000835,SushiSwap:0xc0aee478e3658e2610c5f7a4a2e1777ce9e4f2ac:10794229" - UNISWAP_V3_FACTORY_ADDRESS: "0x1f98431c8ad98523631ae4a59f267346ea31f984" FEAT_UNISWAP_V2_SYNC_EVENT: "true" UNISWAP_V2_SYNC_START_BLOCK: 10000835 FEAT_ONCHAIN_GOVERNANCE: "true" diff --git a/src/config.ts b/src/config.ts index 4ac2574f..17339fc7 100644 --- a/src/config.ts +++ b/src/config.ts @@ -1,4 +1,3 @@ -import { get } from 'http'; import { DEFAULT_BASE_GITHUB_LOGO_URL, DEFAULT_BLOCK_FINALITY_THRESHOLD, @@ -40,7 +39,6 @@ import { DEFAULT_RESCRAPE_BLOCKS, DEFAULT_STAKING_POOLS_JSON_URL, DEFAULT_STAKING_POOLS_METADATA_JSON_URL, - DEFAULT_UNISWAP_V3_FACTORY_ADDRESS, } from './constants'; import { logger } from './utils'; @@ -263,9 +261,12 @@ validateStartBlock( FEAT_UNISWAP_V3_POOL_CREATED_EVENT, ); -export const UNISWAP_V3_FACTORY_ADDRESS = getStringConfig( +export const UNISWAP_V3_FACTORY_ADDRESS = process.env.UNISWAP_V3_FACTORY_ADDRESS || ''; +validateAddress( 'UNISWAP_V3_FACTORY_ADDRESS', - DEFAULT_UNISWAP_V3_FACTORY_ADDRESS, + UNISWAP_V3_FACTORY_ADDRESS, + 'UNISWAP_V3_POOL_CREATED_EVENT', + FEAT_UNISWAP_V3_POOL_CREATED_EVENT, ); export const FEAT_V3_FILL_EVENT = getBoolConfig('FEAT_V3_FILL_EVENT', DEFAULT_FEAT_V3_FILL_EVENT); @@ -472,14 +473,6 @@ function getIntConfig(env: string, defaultValue: number): number { return defaultValue; } -function getStringConfig(env: string, defaultString: string): string { - if (Object.prototype.hasOwnProperty.call(process.env, env)) { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - return process.env[env]!; - } - return defaultString; -} - function validateStartBlock(startBlockVar: string, startBlock: number, featureFlagVar: string, featureFlag: boolean) { if (startBlock === -1 && featureFlag) { throwError( diff --git a/src/constants.ts b/src/constants.ts index b173d3bc..0a503fd6 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -103,7 +103,6 @@ export const ONCHAIN_GOVERNANCE_CALL_SCHEDULED_EVENT_TOPIC = [ export const ONCHAIN_GOVERNANCE_PROPOSAL_CREATED_EVENT_TOPIC = [ '0x7d84a6263ae0d98d3329bd7b46bb4e8d6f98cd35a7adb45c274c8b7fd5ebd5e0', ]; -export const DEFAULT_UNISWAP_V3_FACTORY_ADDRESS = '0x1f98431c8ad98523631ae4a59f267346ea31f984'; export const SOCKET_BRIDGE_CONTRACT_ADDRESS = '0x3a23f943181408eac424116af7b7790c94cb97a5'; export const SOCKET_BRIDGE_EVENT_TOPIC = ['0x74594da9e31ee4068e17809037db37db496702bf7d8d63afe6f97949277d1609']; diff --git a/src/events.ts b/src/events.ts index 578fb9de..d7a8ea5f 100644 --- a/src/events.ts +++ b/src/events.ts @@ -24,13 +24,13 @@ import { TransformedERC20Event, UniswapV2PairCreatedEvent, UniswapV2SyncEvent, - UniswapV3SwapEvent, UniswapV3PoolCreatedEvent, + UniswapV3SwapEvent, + UnwrapNativeEvent, V4CancelEvent, V4LimitOrderFilledEvent, V4RfqOrderFilledEvent, WrapNativeEvent, - UnwrapNativeEvent, } from './entities'; import { @@ -50,13 +50,13 @@ import { FEAT_UNISWAP_V2_PAIR_CREATED_EVENT, FEAT_UNISWAP_V2_SYNC_EVENT, FEAT_UNISWAP_V2_VIP_SWAP_EVENT, - FEAT_UNISWAP_V3_SWAP_EVENT, FEAT_UNISWAP_V3_POOL_CREATED_EVENT, + FEAT_UNISWAP_V3_SWAP_EVENT, FEAT_UNISWAP_V3_VIP_SWAP_EVENT, - FEAT_WRAP_UNWRAP_NATIVE_EVENT, - FEAT_WRAP_UNWRAP_NATIVE_TRANSFER_EVENT, FEAT_V3_FILL_EVENT, FEAT_V3_NATIVE_FILL, + FEAT_WRAP_UNWRAP_NATIVE_EVENT, + FEAT_WRAP_UNWRAP_NATIVE_TRANSFER_EVENT, FIRST_SEARCH_BLOCK, FLASHWALLET_ADDRESS, FLASHWALLET_DEPLOYMENT_BLOCK, @@ -73,13 +73,13 @@ import { UNISWAP_V2_SYNC_START_BLOCK, UNISWAP_V2_VIP_SWAP_SOURCES, UNISWAP_V2_VIP_SWAP_START_BLOCK, - UNISWAP_V3_SWAP_START_BLOCK, + UNISWAP_V3_FACTORY_ADDRESS, UNISWAP_V3_POOL_CREATED_START_BLOCK, + UNISWAP_V3_SWAP_START_BLOCK, UNISWAP_V3_VIP_SWAP_START_BLOCK, V4_NATIVE_FILL_START_BLOCK, - UNISWAP_V3_FACTORY_ADDRESS, - WRAP_UNWRAP_NATIVE_START_BLOCK, WRAP_UNWRAP_NATIVE_CONTRACT_ADDRESS, + WRAP_UNWRAP_NATIVE_START_BLOCK, } from './config'; import { @@ -94,7 +94,6 @@ import { LIMITORDERFILLED_EVENT_TOPIC, LIQUIDITYPROVIDERSWAP_EVENT_TOPIC, LOG_TRANSFER_EVENT_TOPIC_0, - SOCKET_BRIDGE_EVENT_TOPIC, META_TRANSACTION_EXECUTED_EVENT_TOPIC, ONCHAIN_GOVERNANCE_CALL_SCHEDULED_EVENT_TOPIC, ONCHAIN_GOVERNANCE_PROPOSAL_CREATED_EVENT_TOPIC, @@ -102,21 +101,22 @@ import { POLYGON_MATIC_ADDRESS, PROTOCOL_ZEROEX_TIMELOCK_CONTRACT_ADDRESS, RFQ_ORDER_FILLED_EVENT_TOPIC, + SOCKET_BRIDGE_EVENT_TOPIC, + TRANSFER_EVENT_TOPIC_0, TRANSFORMEDERC20_EVENT_TOPIC, TREASURY_ZEROEX_TIMELOCK_CONTRACT_ADDRESS, UNISWAP_V2_PAIR_CREATED_TOPIC, UNISWAP_V2_SWAP_EVENT_TOPIC_0, UNISWAP_V2_SYNC_TOPIC, - UNISWAP_V3_SWAP_EVENT_TOPIC_0, UNISWAP_V3_POOL_CREATED_TOPIC_0, + UNISWAP_V3_SWAP_EVENT_TOPIC_0, + UNWRAP_NATIVE_EVENT_TOPIC, V3_EXCHANGE_ADDRESS, V3_FILL_EVENT_TOPIC, V4_CANCEL_EVENT_TOPIC, + WRAP_NATIVE_EVENT_TOPIC, ZEROEX_PROTOCOL_GOVERNOR_CONTRACT_ADDRESS, ZEROEX_TREASURY_GOVERNOR_CONTRACT_ADDRESS, - WRAP_NATIVE_EVENT_TOPIC, - UNWRAP_NATIVE_EVENT_TOPIC, - TRANSFER_EVENT_TOPIC_0, } from './constants'; import { DeleteOptions } from './utils';