@@ -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
@@ -191,19 +182,9 @@ export class PairService {
191182 tx ?: SequelizeTransaction | undefined ,
192183 protocolAddress = DEFAULT_PROTOCOL ,
193184 ) : Promise < number | undefined > {
194- const now = Date . now ( ) ;
195- const cached = this . tokenPriceCache . get ( token . id ) ;
196-
197- // Return cached price if it's still valid
198- if ( cached && now - cached . timestamp < this . PRICE_CACHE_TTL ) {
199- return cached . price ;
200- }
201-
202185 // Calculate new price
203186 const price = await this . calculateTokenPriceInUSD ( token , { decimal : '1' } , tx , protocolAddress ) ;
204- if ( price !== undefined ) {
205- this . tokenPriceCache . set ( token . id , { price, timestamp : now } ) ;
206- }
187+
207188 return price ;
208189 }
209190
0 commit comments