|
1 | 1 | import { SparkMarketProcessorTemplate } from "./types/fuel/SparkMarketProcessor.js";
|
2 | 2 | import { FuelNetwork } from "@sentio/sdk/fuel";
|
3 | 3 | import { SparkRegistryProcessor } from './types/fuel/SparkRegistryProcessor.js';
|
4 |
| -import { MARKET_REGISTRY_ADDRESS } from './config.js'; |
| 4 | +import { REGISTRY_ADDRESS } from './registry.js'; |
5 | 5 | import { BigDecimal, LogLevel } from "@sentio/sdk";
|
6 | 6 | import crypto from "crypto";
|
7 | 7 | import marketsConfig from './marketsConfig.json';
|
@@ -183,7 +183,7 @@ marketTemplate.onTimeInterval(async (block, ctx) => {
|
183 | 183 | const filteredBalances = balances.filter(balance => balance.market === ctx.contractAddress);
|
184 | 184 |
|
185 | 185 | for (const balance of filteredBalances) {
|
186 |
| - const marketConfig = Object.values(marketsConfig).find(market => market.market.toLowerCase() === balance.market.toLowerCase()); |
| 186 | + const marketConfig = Object.values(marketsConfig).find(market => market.market === balance.market); |
187 | 187 |
|
188 | 188 | if (!marketConfig) {
|
189 | 189 | ctx.eventLogger.emit('MarketConfigNotFound', {
|
@@ -241,18 +241,23 @@ marketTemplate.onTimeInterval(async (block, ctx) => {
|
241 | 241 |
|
242 | 242 | await ctx.store.upsert(snapshot);
|
243 | 243 |
|
244 |
| - ctx.eventLogger.emit('SnapshotCreation', { |
| 244 | + ctx.eventLogger.emit('Snapshot', { |
245 | 245 | severity: LogLevel.INFO,
|
246 |
| - message: `Creating snapshot at ${new Date().toISOString()}`, |
247 |
| - block_number: ctx.block?.id, |
| 246 | + message: `Snapshot for user ${balance.user}: ${new Date().toISOString()}`, |
| 247 | + timestamp: new Date().toISOString(), |
| 248 | + block_date: ctx.timestamp.toString(), |
| 249 | + chain_id: ctx.chainId, |
| 250 | + block_number: block.height.toString(), |
248 | 251 | user_address: balance.user,
|
| 252 | + pool_address: ctx.contractAddress, |
| 253 | + total_value_locked_score: tvl |
249 | 254 | });
|
250 | 255 |
|
251 | 256 | }
|
252 | 257 | }, 60 * 60);
|
253 | 258 |
|
254 | 259 | SparkRegistryProcessor.bind({
|
255 |
| - address: MARKET_REGISTRY_ADDRESS, |
| 260 | + address: REGISTRY_ADDRESS, |
256 | 261 | chainId: FuelNetwork.TEST_NET
|
257 | 262 | })
|
258 | 263 | .onLogMarketRegisterEvent(async (log, ctx) => {
|
|
0 commit comments