Skip to content

Commit e446d9d

Browse files
committed
0.5.0
1 parent 838f08c commit e446d9d

File tree

6 files changed

+18
-12
lines changed

6 files changed

+18
-12
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"private": true,
33
"name": "spark-processor",
4-
"version": "1.0.0",
4+
"version": "0.5.0",
55
"type": "module",
66
"scripts": {
77
"build": "sentio build",

src/config.ts

-1
This file was deleted.

src/marketsConfig.json

+2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"BTC-USDC": {
3+
"name": "BTC-USDC",
34
"market": "0xb1ed073b4dccbff48e2ac1b52a49454e6a2921aa54effee89eb958dc5ddbffbe",
45
"baseToken": "0x38e4ca985b22625fff93205e997bfc5cc8453a953da638ad297ca60a9f2600bc",
56
"baseTokenSymbol": "BTC",
@@ -11,6 +12,7 @@
1112
"defaultQuotePrice": 1
1213
},
1314
"ETH-USDC": {
15+
"name": "ETH-USDC",
1416
"market": "0x2dd759eb0671e293b5e386f9b4f1cc8a1cb2c4ed1cf839e5de4f06f822d3790f",
1517
"baseToken": "0xf8f8b6283d7fa5b672b530cbb84fcccb4ff8dc40f8176ef4544ddb1f1952ad07",
1618
"baseTokenSymbol": "ETH",

src/processor.ts

+11-6
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { SparkMarketProcessorTemplate } from "./types/fuel/SparkMarketProcessor.js";
22
import { FuelNetwork } from "@sentio/sdk/fuel";
33
import { SparkRegistryProcessor } from './types/fuel/SparkRegistryProcessor.js';
4-
import { MARKET_REGISTRY_ADDRESS } from './config.js';
4+
import { REGISTRY_ADDRESS } from './registry.js';
55
import { BigDecimal, LogLevel } from "@sentio/sdk";
66
import crypto from "crypto";
77
import marketsConfig from './marketsConfig.json';
@@ -183,7 +183,7 @@ marketTemplate.onTimeInterval(async (block, ctx) => {
183183
const filteredBalances = balances.filter(balance => balance.market === ctx.contractAddress);
184184

185185
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);
187187

188188
if (!marketConfig) {
189189
ctx.eventLogger.emit('MarketConfigNotFound', {
@@ -241,18 +241,23 @@ marketTemplate.onTimeInterval(async (block, ctx) => {
241241

242242
await ctx.store.upsert(snapshot);
243243

244-
ctx.eventLogger.emit('SnapshotCreation', {
244+
ctx.eventLogger.emit('Snapshot', {
245245
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(),
248251
user_address: balance.user,
252+
pool_address: ctx.contractAddress,
253+
total_value_locked_score: tvl
249254
});
250255

251256
}
252257
}, 60 * 60);
253258

254259
SparkRegistryProcessor.bind({
255-
address: MARKET_REGISTRY_ADDRESS,
260+
address: REGISTRY_ADDRESS,
256261
chainId: FuelNetwork.TEST_NET
257262
})
258263
.onLogMarketRegisterEvent(async (log, ctx) => {

src/registry.ts

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const REGISTRY_ADDRESS = "0x0f5232e0d927f7a477baa7e6f0380c50f8b3de5c0d6ae42bb29ba8a767e5ff1a";

src/schema/store.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ export class UserScoreSnapshot extends AbstractEntity {
5454

5555
@Required
5656
@Column("String")
57-
block_date: String
57+
timestamp: String
5858

5959
@Required
6060
@Column("String")
61-
timestamp: String
61+
block_date: String
6262

6363
@Required
6464
@Column("String")
@@ -95,9 +95,8 @@ const source = `type Balance @entity {
9595
9696
type UserScoreSnapshot @entity {
9797
id: ID!
98-
block_date: String!
9998
timestamp: String!
100-
# timestamp_block: String!
99+
block_date: String!
101100
chain_id: String!
102101
block_number: String!
103102
user_address: String!

0 commit comments

Comments
 (0)