Skip to content

Commit 3106f03

Browse files
committed
work through lint issues
- most are annoying, some are nice to fix
1 parent 1ddc20a commit 3106f03

28 files changed

+78
-134
lines changed

eslint.config.js

+1
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ module.exports = [
2222
'@typescript-eslint/await-thenable': 'error',
2323
'@typescript-eslint/no-misused-promises': 'error',
2424
},
25+
ignores: ['**/abi/**', '**/src/abi/**', '**/src/model/**'],
2526
},
2627
]

src/main-test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable */
12
import 'tsconfig-paths/register'
23
import { formatUnits } from 'viem'
34

src/main.ts

+13-6
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,17 @@ import mainnet from './main-mainnet'
88
import oeth from './main-oeth'
99
import ogv from './main-ogv'
1010
import ousd from './main-ousd'
11+
import sonic from './main-sonic'
1112

12-
run(mainnet)
13-
run(base)
14-
run(arbitrum)
15-
run(oeth)
16-
run(ogv)
17-
run(ousd)
13+
Promise.all([
14+
// line by line
15+
run(mainnet),
16+
run(base),
17+
run(arbitrum),
18+
run(oeth),
19+
run(ogv),
20+
run(ousd),
21+
run(sonic),
22+
]).catch((err) => {
23+
throw err
24+
})

src/mainnet/processors/balancer/balancer.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { Context, EvmBatchProcessor } from '@originprotocol/squid-utils'
22
import { MainnetCurrencyAddress } from '@shared/post-processors/exchange-rates/mainnetCurrencies'
33
import { createBalancerInitializer, createBalancerProcessor, createBalancerSetup } from '@templates/balancer'
44

5-
const ousdResetFrom = 11585978
6-
const oethDeployFrom = 16933090
5+
// const ousdResetFrom = 11585978
6+
// const oethDeployFrom = 16933090
77

88
const pools: {
99
name: string

src/mainnet/processors/coingecko.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const from = 20933088
99
export const coingeckoProcessor = defineProcessor({
1010
from, // This is irrelevant
1111
name: 'coingecko',
12-
setup: async (processor) => {
12+
setup: (processor) => {
1313
processor.includeAllBlocks({ from })
1414
},
1515
process: async (ctx) => {

src/mainnet/processors/protocol/protocol.ts

-10
Original file line numberDiff line numberDiff line change
@@ -110,16 +110,6 @@ export const protocolProcessor = defineProcessor({
110110
},
111111
})
112112

113-
const getLatestProtocolDailyStat = async (ctx: Context) => {
114-
const latestProtocolDailyStat = await ctx.store.findOne(ProtocolDailyStat, {
115-
order: {
116-
date: 'desc',
117-
},
118-
})
119-
if (latestProtocolDailyStat) {
120-
return latestProtocolDailyStat
121-
}
122-
}
123113
const getLatestProtocolDailyStatDetail = async (ctx: Context, product: string) => {
124114
const latestProtocolDailyStatDetail = await ctx.store.findOne(ProtocolDailyStatDetail, {
125115
order: {

src/ogv/post-processors/governance.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ const _updateProposalStatus = async (ctx: Context, result: IProcessResult, block
223223

224224
const _processProposalEvents = async (ctx: Context, result: IProcessResult, block: Block, log: Log) => {
225225
// ctx.log.info('_processProposalEvents')
226-
const { decode, status, event } = eventMapper[log.topics[0]]!
226+
const { decode, event } = eventMapper[log.topics[0]]!
227227

228228
const { proposalId } = decode(log)
229229
const blockTimestamp = new Date(block.header.timestamp)

src/ogv/processors/ogv.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export const process = async (ctx: Context) => {
6161
}
6262
}
6363

64-
await ctx.store.upsert(Array.from(result.addresses.values()).sort((a, b) => (a.delegatee?.id ? 1 : -1)))
64+
await ctx.store.upsert(Array.from(result.addresses.values()).sort((a) => (a.delegatee?.id ? 1 : -1)))
6565
await ctx.store.upsert(Array.from(result.lockups.values()))
6666
await ctx.store.upsert(result.lockupEvents)
6767
}

src/server-extension/erc20.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export class ERC20Resolver {
3333
@Arg('address', () => String, { nullable: false }) address: string,
3434
@Arg('from', () => String, { nullable: false }) from: string,
3535
@Arg('to', () => String, { nullable: true }) to: string | null,
36-
@Info() info: GraphQLResolveInfo,
36+
@Info() _info: GraphQLResolveInfo,
3737
): Promise<ERC20StateByDayR[]> {
3838
const manager = await this.tx()
3939
const repository = manager.getRepository(ERC20StateByDay)

src/server-extension/strategies.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export class StrategyResolver {
7171
@Arg('timestamp', () => String, { nullable: true }) timestamp: string | null,
7272
@Arg('chainId', () => Number, { nullable: true }) chainId: number | null,
7373
@Arg('otoken', () => String, { nullable: true }) otoken: string | null,
74-
@Info() info: GraphQLResolveInfo,
74+
@Info() _info: GraphQLResolveInfo,
7575
): Promise<Strategy[]> {
7676
const manager = await this.tx()
7777

src/server-extension/symbols.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class SymbolResolver {
2323
constructor(private tx: () => Promise<EntityManager>) {}
2424

2525
@Query(() => [Symbol])
26-
async symbols(@Info() info: GraphQLResolveInfo): Promise<Symbol[]> {
26+
async symbols(@Info() _info: GraphQLResolveInfo): Promise<Symbol[]> {
2727
return symbols.map((symbol) => new Symbol(symbol))
2828
}
2929
}

src/shared/post-processors/exchange-rates/price-routing-base.ts

+3-7
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,9 @@ const chainlinkPriceFeeds: Record<string, (ctx: Context, height: number) => Prom
2222
}
2323

2424
const createAMMPriceFeed = (pool: PoolDefinition) => async (ctx: Context, height: number) => {
25-
if (baseAddresses.aerodrome.pools['vAMM-OGN/superOETHb'].from > height) return 0n
26-
const pool = new aerodromePoolAbi.Contract(
27-
ctx,
28-
{ height },
29-
baseAddresses.aerodrome.pools['vAMM-OGN/superOETHb'].address,
30-
)
31-
return await pool.getReserves().then((r) => (r._reserve1 * ONE_ETH) / r._reserve0)
25+
if (pool.from > height) return 0n
26+
const poolContract = new aerodromePoolAbi.Contract(ctx, { height }, pool.address)
27+
return await poolContract.getReserves().then((r) => (r._reserve1 * ONE_ETH) / r._reserve0)
3228
}
3329

3430
const alternativePriceFeeds: Record<string, (ctx: Context, height: number) => Promise<bigint>> = {

src/shared/post-processors/exchange-rates/price-routing-mainnet.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const getChainlinkPrice = async (ctx: Context, height: number, base: MainnetCurr
8989
}
9090
}
9191

92-
const oethOracleCurrencies = new Set(['WETH', 'stETH', 'frxETH'])
92+
// const oethOracleCurrencies = new Set(['WETH', 'stETH', 'frxETH'])
9393
const oethOracleAddress = '0xbE19cC5654e30dAF04AD3B5E06213D70F4e882eE'
9494
const getOethOraclePrice = async (ctx: Context, height: number, quote: MainnetCurrency) => {
9595
if (height < 18032300) return 0n

src/templates/curve/curve.ts

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ export const createCurveProcessor = ({
5151
tokens: string[]
5252
ratesToPull?: { i: bigint; j: bigint; dx: bigint }[] | undefined
5353
}) => {
54+
console.log('createCurveProcessor', name)
5455
const update = blockFrequencyUpdater({ from })
5556
return async (ctx: Context) => {
5657
const result: ProcessResult = {

src/templates/erc20/erc20-event.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export const createERC20EventTracker = ({ from, address }: { from: number; addre
4040
})
4141
await ctx.store.insert(erc20)
4242
}
43-
} catch (err) {
44-
ctx.log.info({ height: block.header.height }, `Failed to get contract name for ${address}`)
43+
} catch (err: any) {
44+
ctx.log.info({ height: block.header.height, err: err.message }, `Failed to get contract name for ${address}`)
4545
}
4646
if (!lastState) {
4747
lastState = await ctx.store

src/templates/governance/governance.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ export const createGovernanceProcessor = ({ from, address }: { from: number; add
223223

224224
const _processProposalEvents = async (ctx: Context, result: IProcessResult, block: Block, log: Log) => {
225225
// ctx.log.info('_processProposalEvents')
226-
const { decode, status, event } = eventMapper[log.topics[0]]!
226+
const { decode, event } = eventMapper[log.topics[0]]!
227227

228228
const { proposalId } = decode(log)
229229
const blockTimestamp = new Date(block.header.timestamp)

src/templates/maverick/maverick.ts

+1
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ export const createMaverickProcessor = ({
4848
from: number
4949
tokens: [string, string]
5050
}) => {
51+
console.log('createMaverickProcessor', name, tokens)
5152
const update = blockFrequencyUpdater({ from })
5253
return async (ctx: Context) => {
5354
const result: ProcessResult = {

src/templates/otoken/otoken-2.ts

+19-7
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,18 @@ import * as otokenAbi20241221 from '@abi/otoken-2024-12-21'
99
import * as otokenHarvester from '@abi/otoken-base-harvester'
1010
import * as otokenUpgradeAccountsAbi from '@abi/otoken-upgradeAccounts'
1111
import { OTokenAsset, OTokenRawData } from '@model'
12-
import { Block, Context, defineProcessor, env, logFilter, multicall, traceFilter } from '@originprotocol/squid-utils'
12+
import {
13+
Block,
14+
Context,
15+
EvmBatchProcessor,
16+
defineProcessor,
17+
env,
18+
logFilter,
19+
multicall,
20+
traceFilter,
21+
} from '@originprotocol/squid-utils'
1322
import { CurrencyAddress, CurrencySymbol } from '@shared/post-processors/exchange-rates/mainnetCurrencies'
14-
import { EvmBatchProcessor, Trace } from '@subsquid/evm-processor'
23+
import { Trace } from '@subsquid/evm-processor'
1524
import { bigintJsonParse, bigintJsonStringify } from '@utils/bigintJson'
1625

1726
import { areContracts, loadIsContractCache, saveIsContractCache } from '../../utils/isContract'
@@ -59,7 +68,7 @@ const endSection = (section: string) => {
5968
const logPerformanceStats = () => {
6069
if (!DEBUG_PERF) return
6170
let totalTime = 0
62-
for (const [_, stats] of performanceStats) {
71+
for (const stats of performanceStats.values()) {
6372
totalTime += stats.totalTime
6473
}
6574

@@ -250,7 +259,7 @@ export const createOTokenProcessor2 = (params: {
250259

251260
let otoken: OTokenClass
252261
let producer: OTokenEntityProducer
253-
let hasUpgraded = false
262+
// let hasUpgraded = false
254263

255264
return defineProcessor({
256265
name: `otoken2-${otokenAddress}`,
@@ -270,8 +279,10 @@ export const createOTokenProcessor2 = (params: {
270279
// })
271280

272281
// Monkeypatch Hack
282+
// eslint-disable-next-line
273283
const originalAddTrace = processor.addTrace
274284
function modifiedMapRequest<T extends { range?: { from: number } }>(options: T): Omit<T, 'range'> {
285+
// eslint-disable-next-line
275286
let { range, ...req } = options
276287
for (let key in req) {
277288
let val = (req as any)[key]
@@ -395,8 +406,8 @@ export const createOTokenProcessor2 = (params: {
395406
copyData(otoken, newImplementation)
396407
otoken = newImplementation
397408
producer.otoken = newImplementation
398-
justUpgraded = true
399-
hasUpgraded = true
409+
// justUpgraded = true
410+
// hasUpgraded = true
400411
} else {
401412
throw new Error('Implementation hash not found.')
402413
}
@@ -433,7 +444,7 @@ export const createOTokenProcessor2 = (params: {
433444
}
434445
}
435446

436-
let justUpgraded = false
447+
// let justUpgraded = false
437448

438449
// Cache isContract results
439450
const transferRelated = ctx.blocks
@@ -854,6 +865,7 @@ const saveOTokenRawData = async (ctx: Context, block: Block, otoken: OTokenClass
854865
}
855866
}
856867

868+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
857869
const checkState = async (ctx: Context, block: Block, otoken: OTokenClass, addressesToCheck: Set<string>) => {
858870
ctx.log.info(`checking state at height ${block.header.height}`)
859871
let wrongCount = 0

src/templates/otoken/otoken-2021-01-02.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export class OToken_2021_01_02 {
4949
/**
5050
* @dev Verifies that the caller is the Savings Manager contract
5151
*/
52-
private onlyVault(caller: string): void {
52+
private onlyVault(_caller: string): void {
5353
// if (caller !== this.vaultAddress) {
5454
// throw new Error('Caller is not the Vault')
5555
// }
@@ -402,7 +402,7 @@ export class OToken_2021_01_02 {
402402

403403
/* compat for object fit */
404404

405-
public async governanceRebaseOptIn(caller: string, account: string): Promise<void> {
405+
public async governanceRebaseOptIn(_caller: string, _account: string): Promise<void> {
406406
return
407407
}
408408
}

src/templates/otoken/otoken-2021-01-08.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class OToken_2021_01_08 {
6363
/**
6464
* @dev Verifies that the caller is the Savings Manager contract
6565
*/
66-
private onlyVault(caller: string): void {
66+
private onlyVault(_caller: string): void {
6767
// if (caller !== this.vaultAddress) {
6868
// throw new Error('Caller is not the Vault')
6969
// }
@@ -435,7 +435,7 @@ export class OToken_2021_01_08 {
435435

436436
/* compat for object fit */
437437

438-
public async governanceRebaseOptIn(caller: string, account: string): Promise<void> {
438+
public async governanceRebaseOptIn(_caller: string, _account: string): Promise<void> {
439439
return
440440
}
441441
}

src/templates/otoken/otoken-2021-01-25.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class OToken_2021_01_25 {
6363
/**
6464
* @dev Verifies that the caller is the Savings Manager contract
6565
*/
66-
private onlyVault(caller: string): void {
66+
private onlyVault(_caller: string): void {
6767
// if (caller !== this.vaultAddress) {
6868
// throw new Error('Caller is not the Vault')
6969
// }
@@ -433,7 +433,7 @@ export class OToken_2021_01_25 {
433433

434434
/* compat for object fit */
435435

436-
public async governanceRebaseOptIn(caller: string, account: string): Promise<void> {
436+
public async governanceRebaseOptIn(_caller: string, _account: string): Promise<void> {
437437
return
438438
}
439439
}

src/templates/otoken/otoken-2021-06-06.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export class OToken_2021_06_06 {
6363
/**
6464
* @dev Verifies that the caller is the Savings Manager contract
6565
*/
66-
private onlyVault(caller: string): void {
66+
private onlyVault(_caller: string): void {
6767
// if (caller !== this.vaultAddress) {
6868
// throw new Error('Caller is not the Vault')
6969
// }
@@ -443,7 +443,7 @@ export class OToken_2021_06_06 {
443443

444444
/* compat for object fit */
445445

446-
public async governanceRebaseOptIn(caller: string, account: string): Promise<void> {
446+
public async governanceRebaseOptIn(_caller: string, _account: string): Promise<void> {
447447
return
448448
}
449449
}

src/templates/otoken/otoken.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -589,13 +589,13 @@ export const createOTokenLegacyProcessor = (params: {
589589
address,
590590
hash,
591591
option,
592-
delegate,
592+
_delegate,
593593
}: {
594594
block: Context['blocks']['0']
595595
address: string
596596
hash: string
597597
option: RebasingOption
598-
delegate?: string
598+
_delegate?: string
599599
}) => {
600600
if (rebaseOptsHandled.has(`${hash}-${address}-${option}`)) return
601601
rebaseOptsHandled.add(`${hash}-${address}-${option}`)
@@ -753,7 +753,7 @@ export const createOTokenLegacyProcessor = (params: {
753753
}
754754

755755
// Update the unallocatedSupply of OToken.
756-
const processWithdrawalRelated = async (block: Block, log: Log) => {
756+
const processWithdrawalRelated = async (block: Block, _log: Log) => {
757757
if (!params.redemptionAsset) return
758758
const vault = new otokenVault.Contract(ctx, block.header, params.otokenVaultAddress)
759759
const redeemingAsset = new erc20.Contract(ctx, block.header, params.redemptionAsset.asset)

src/templates/pools/pools.ts

-9
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,8 @@ import * as shadowV3FactoryAbi from '@abi/shadow-v3-factory'
1818
import * as swapxPairFactoryAbi from '@abi/swapx-pair-factory'
1919
import { Pool } from '@model'
2020
import { Context, EvmBatchProcessor, defineProcessor, joinProcessors, logFilter } from '@originprotocol/squid-utils'
21-
import { OETH_ADDRESS, OGN_ADDRESS, OUSD_ADDRESS } from '@utils/addresses'
2221
import { baseAddresses } from '@utils/addresses-base'
2322

24-
const TRACKED_TOKENS = [
25-
OETH_ADDRESS,
26-
OUSD_ADDRESS,
27-
OGN_ADDRESS,
28-
baseAddresses.tokens.OGN,
29-
baseAddresses.superOETHb.address,
30-
].filter(Boolean)
31-
3223
/**
3324
* For curve data refer to the AddressProvider:
3425
* https://docs.curve.fi/integration/address-provider/?h=addressprovider

src/templates/strategy/strategy-earnings.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -355,7 +355,7 @@ const processDepositWithdrawal = async (
355355
MainnetCurrency,
356356
MainnetCurrency,
357357
][]
358-
const rates = await ensureExchangeRates(ctx, block, desiredRates)
358+
await ensureExchangeRates(ctx, block, desiredRates)
359359
let previousBalance = 0n
360360
for (let index = 0; index < assets.length; index++) {
361361
const a = assets[index]

0 commit comments

Comments
 (0)