@@ -25,6 +25,7 @@ import { EVM_CHAIN_IDS } from '../util/chainIds'
2525
2626const MAX_RETRIES = 5
2727const QUERY_INTERVAL_MS = 1000 * 60 * 60 * 24 * 30 // 30 days in milliseconds
28+ const QUERY_ROLLBACK_MS = 1000 * 60 * 60 * 24 * 7 // 7 days in milliseconds
2829const LETSEXCHANGE_START_DATE = '2022-02-01T00:00:00.000Z'
2930
3031/**
@@ -214,6 +215,16 @@ const NATIVE_TOKEN_ADDRESSES = new Set([
214215 'xmr1'
215216] )
216217
218+ // Mapping of chain plugin IDs and currency code to contract address.
219+ const LETSEXCHANGE_NETWORK_CURRENCY_CODE_TO_CONTRACT_ADDRESS : Record <
220+ string ,
221+ Record < string , string >
222+ > = {
223+ binance : {
224+ COTI : 'COTI-CBB'
225+ }
226+ }
227+
217228// In-memory cache for currency contract addresses
218229// Key format: `${code}_${network_code}` (both lowercase)
219230interface CoinInfo {
@@ -302,6 +313,13 @@ function getAssetInfo(
302313
303314 // Determine tokenId from the contract address in the response
304315 let tokenId : EdgeTokenId = null
316+ const overrideContractAddress =
317+ LETSEXCHANGE_NETWORK_CURRENCY_CODE_TO_CONTRACT_ADDRESS [ chainPluginId ] ?. [
318+ currencyCode
319+ ]
320+ if ( overrideContractAddress != null ) {
321+ contractAddress = overrideContractAddress
322+ }
305323
306324 if ( contractAddress == null ) {
307325 // Try to lookup contract address from cache
@@ -354,7 +372,7 @@ export async function queryLetsExchange(
354372 }
355373
356374 // Query from the saved date forward in 30-day chunks (oldest to newest)
357- let windowStart = new Date ( latestIsoDate ) . getTime ( ) - QUERY_INTERVAL_MS
375+ let windowStart = new Date ( latestIsoDate ) . getTime ( ) - QUERY_ROLLBACK_MS
358376 const now = Date . now ( )
359377 let done = false
360378 let newTxStart : number = 0
0 commit comments