From d9e741d62bb7fe265e53e70286e4c44cdecd6216 Mon Sep 17 00:00:00 2001 From: toyvo Date: Mon, 22 Jan 2024 12:56:51 -0500 Subject: [PATCH] factorypool fix --- subgraph/handlers/FactoryPool.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/subgraph/handlers/FactoryPool.ts b/subgraph/handlers/FactoryPool.ts index 7fe5627..1983116 100644 --- a/subgraph/handlers/FactoryPool.ts +++ b/subgraph/handlers/FactoryPool.ts @@ -206,6 +206,11 @@ export function getOrCreateCoin( coin.pool = pool.id; coin.token = token.id; coin.underlying = coin.id; + coin.balance = decimal.ZERO; + coin.rate = decimal.ZERO; + coin.updated = event.block.timestamp; + coin.updatedAtBlock = event.block.number; + coin.updatedAtTransaction = event.transaction.hash; } coin.balance = balance ? decimal.fromBigInt(balance, token.decimals.toI32()) : decimal.ZERO; coin.updated = event.block.timestamp; @@ -229,7 +234,10 @@ export function getOrCreateUnderlyingCoin( underlyingCoin.pool = pool.id; underlyingCoin.token = token.id; underlyingCoin.coin = underlyingCoin.id; - // underlyingCoin.balance = balances ? decimal.fromBigInt(balances![i]) : decimal.ZERO + underlyingCoin.balance = decimal.ZERO; + underlyingCoin.updated = event.block.timestamp; + underlyingCoin.updatedAtBlock = event.block.number; + underlyingCoin.updatedAtTransaction = event.transaction.hash; } underlyingCoin.balance = decimal.ZERO; underlyingCoin.updated = event.block.timestamp;