Skip to content
This repository has been archived by the owner on May 7, 2024. It is now read-only.

Commit

Permalink
fix: incorrect TVL indexing tinlake (#223)
Browse files Browse the repository at this point in the history
* fix: incorrect TVL indexing tinlake

* Update chains-tinlake/centrifuge.yaml
  • Loading branch information
filo87 authored Mar 13, 2024
1 parent 6e3adcc commit 3b7852b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion chains-tinlake/centrifuge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 0 additions & 9 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
10 changes: 5 additions & 5 deletions src/mappings/handlers/ethHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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()
}
}
}
Expand All @@ -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<ReturnType<typeof shelfContract.token>>
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') {
Expand Down Expand Up @@ -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}`)
}
}

Expand Down

0 comments on commit 3b7852b

Please sign in to comment.