From 3b7852b74ef4a30202d788a709c9d26d84cdc41b Mon Sep 17 00:00:00 2001 From: Filippo Date: Wed, 13 Mar 2024 14:10:26 +0100 Subject: [PATCH 1/2] fix: incorrect TVL indexing tinlake (#223) * fix: incorrect TVL indexing tinlake * Update chains-tinlake/centrifuge.yaml --- chains-tinlake/centrifuge.yaml | 2 +- src/config.ts | 9 --------- src/mappings/handlers/ethHandlers.ts | 10 +++++----- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/chains-tinlake/centrifuge.yaml b/chains-tinlake/centrifuge.yaml index f8afad67..90c5a5a5 100644 --- a/chains-tinlake/centrifuge.yaml +++ b/chains-tinlake/centrifuge.yaml @@ -24,7 +24,7 @@ dataSources: - handler: handleEthBlock kind: ethereum/BlockHandler filter: - modulo: 3600 + modulo: 360 specVersion: 1.0.0 name: centrifuge-pools version: 1.0.0 diff --git a/src/config.ts b/src/config.ts index 095c1df8..50484fc5 100644 --- a/src/config.ts +++ b/src/config.ts @@ -156,15 +156,6 @@ export const tinlakePools = [ shelf: [{ address: '0xE791898207C129dB963260D6A3b23C8e7B8E31f2' }], pile: [{ address: '0x6af9dA8dB1925F8ef359274A59eF01e1c6Df7bE0' }], }, - { - id: '0x92332a9831ac04275bc0f22b9140b21c72984eb8', - shortName: 'Pezesha 1', - startBlock: 12113740, - navFeed: [{ address: '0xcea9f97d7fe55154e4a35a8b3316a8cdf9e08626', startBlock: 12114080 }], - reserve: [{ address: '0x7f5dea6c463a7250c53f1347f82b506f40e1b0cb', startBlock: 12114265 }], - shelf: [{ address: '' }], - pile: [{ address: '0xAAEaCfcCc3d3249f125Ba0644495560309C266cB' }], - }, { id: '0x9de3064f49696a25066252c35ede68850ea33bf8', shortName: 'UP Series 1', diff --git a/src/mappings/handlers/ethHandlers.ts b/src/mappings/handlers/ethHandlers.ts index 1ae65c67..42e55558 100644 --- a/src/mappings/handlers/ethHandlers.ts +++ b/src/mappings/handlers/ethHandlers.ts @@ -308,7 +308,7 @@ async function updateLoans(poolId: string, blockDate: Date, shelf: string, pile: if (!nftLocked || (loan.status === AssetStatus.ACTIVE && debt.toBigInt() === BigInt(0))) { loan.isActive = false loan.status = AssetStatus.CLOSED - loan.save() + await loan.save() } loan.outstandingDebt = debt.toBigInt() const currentDebt = loan.outstandingDebt || BigInt(0) @@ -333,7 +333,7 @@ async function updateLoans(poolId: string, blockDate: Date, shelf: string, pile: : (loan.totalBorrowed = loan.borrowedAmountByPeriod) } logger.info(`Updating loan ${loan.id} for pool ${poolId}`) - loan.save() + await loan.save() } } } @@ -344,11 +344,11 @@ async function getNewLoans(existingLoans: number[], shelfAddress: string) { const shelfContract = ShelfAbi__factory.connect(shelfAddress, api as unknown as Provider) // eslint-disable-next-line while (true) { - let response + let response: Awaited> try { response = await shelfContract.token(loanIndex) } catch (e) { - logger.info(`Error ${e}`) + logger.error(`Failed shelfcontract.token call. ${e}`) break } if (!response || response.registry === '0x0000000000000000000000000000000000000000') { @@ -390,7 +390,7 @@ async function processCalls(callsArray: PoolMulticall[], chunkSize = 30): Promis results = await multicall.callStatic.aggregate(calls) results[1].map((result, j) => (callsArray[i * chunkSize + j].result = result)) } catch (e) { - logger.info(`Error fetching chunk ${i}: ${e}`) + logger.error(`Error fetching chunk ${i}: ${e}`) } } From 0cb3200c6c605c44b1d215aa77b48d8fa1070c92 Mon Sep 17 00:00:00 2001 From: Filippo Fontana Date: Wed, 13 Mar 2024 14:31:37 +0100 Subject: [PATCH 2/2] fix: modulo interval for tinlake --- chains-tinlake/centrifuge.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chains-tinlake/centrifuge.yaml b/chains-tinlake/centrifuge.yaml index 90c5a5a5..6e70c882 100644 --- a/chains-tinlake/centrifuge.yaml +++ b/chains-tinlake/centrifuge.yaml @@ -24,7 +24,7 @@ dataSources: - handler: handleEthBlock kind: ethereum/BlockHandler filter: - modulo: 360 + modulo: 300 specVersion: 1.0.0 name: centrifuge-pools version: 1.0.0