@@ -13,12 +13,6 @@ import Transaction from '@/models/transaction';
1313
1414type TokenAmount = number | { decimal : string } ;
1515
16- // Cache for token prices in USD
17- interface TokenPriceCache {
18- price : number ;
19- timestamp : number ;
20- }
21-
2216interface CreatePairParams {
2317 moduleName : string ;
2418 name : string ;
@@ -40,9 +34,6 @@ interface TokenReference {
4034}
4135
4236export class PairService {
43- private static tokenPriceCache : Map < number , TokenPriceCache > = new Map ( ) ;
44- private static readonly PRICE_CACHE_TTL = parseInt ( process . env . PRICE_CACHE_TTL || '300000' , 10 ) ; // Default 5 minutes
45-
4637 /**
4738 * Formats a number to exactly 8 decimal places
4839 * @param value The number to format
@@ -186,19 +177,9 @@ export class PairService {
186177 tx ?: SequelizeTransaction | undefined ,
187178 protocolAddress = DEFAULT_PROTOCOL ,
188179 ) : Promise < number | undefined > {
189- const now = Date . now ( ) ;
190- const cached = this . tokenPriceCache . get ( token . id ) ;
191-
192- // Return cached price if it's still valid
193- if ( cached && now - cached . timestamp < this . PRICE_CACHE_TTL ) {
194- return cached . price ;
195- }
196-
197180 // Calculate new price
198181 const price = await this . calculateTokenPriceInUSD ( token , { decimal : '1' } , tx , protocolAddress ) ;
199- if ( price !== undefined ) {
200- this . tokenPriceCache . set ( token . id , { price, timestamp : now } ) ;
201- }
182+
202183 return price ;
203184 }
204185
0 commit comments