Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: incorrect TVL indexing tinlake (#223) #122

Merged
merged 2 commits into from
Mar 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: 300
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
Loading