Skip to content

Commit b6e95b1

Browse files
committed
fix: fix last contract selection for FF1
1 parent 99bd229 commit b6e95b1

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export const tinlakePools = [
9696
startBlock: 11282587,
9797
navFeed: [
9898
{ address: '0xcAB9ed8e5EF4607A97f4e22Ad1D984ADB93ce890', startBlock: 11282611 },
99+
{ address: null, startBlock: 16537499 },
99100
{ address: '0x887db3ee1166ddaf5f7df96b195912594112431e', startBlock: 16799275 },
100101
],
101102
reserve: [

src/mappings/handlers/ethHandlers.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ async function _handleEthBlock(block: EthereumBlock): Promise<void> {
7171
}
7272

7373
//Append navFeed Call for pool
74-
if (latestNavFeed && latestNavFeed.address) {
74+
if (latestNavFeed && !!latestNavFeed.address) {
7575
logger.info(`Appending navFeed Call for pool ${pool.id} to address ${latestNavFeed.address}`)
7676
poolUpdateCalls.push({
7777
id: pool.id,
@@ -496,7 +496,7 @@ async function getNewLoans(existingLoans: number[], shelfAddress: string) {
496496

497497
function getLatestContract(contractArray: ContractArray[], blockNumber: number) {
498498
if (contractArray.length === 1) return contractArray[0]
499-
return contractArray.find((entry) => entry.startBlock! <= blockNumber)
499+
return contractArray.sort((a, b) => b.startBlock! - a.startBlock!).find((entry) => entry.startBlock! <= blockNumber)
500500
}
501501

502502
function chunkArray<T>(array: T[], chunkSize: number): T[][] {

0 commit comments

Comments
 (0)