Skip to content

Commit c343706

Browse files
moose-codeclaude
andcommitted
perf: drop transaction-hash fetching across the board
Remove txHash / createdTxHash / deploymentTxHash from the schema, every handler, and all 41 field_selection blocks in config.yaml. No event requests transaction data now, so HyperSync does a pure log fetch with no tx join. A/B on the gauge-dense mainnet window [10.6M -> 12M] (same 408k events): 40s vs 44s wall clock (~9% faster) with fewer fetch ops (116 vs 136). tx hash was never used as an entity id, so this is trivially re-addable per-event if the Curve team wants transaction links. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 7652b36 commit c343706

12 files changed

Lines changed: 2 additions & 175 deletions

config.yaml

Lines changed: 2 additions & 123 deletions
Original file line numberDiff line numberDiff line change
@@ -20,257 +20,136 @@ contracts:
2020
- name: TricryptoFactoryNG
2121
events:
2222
- event: TricryptoPoolDeployed(address pool, string name, string symbol, address weth, address[3] coins, address math, bytes32 salt, uint256 packed_precisions, uint256 packed_A_gamma, uint256 packed_fee_params, uint256 packed_rebalancing_params, uint256 packed_prices, address deployer)
23-
field_selection:
24-
transaction_fields:
25-
- hash
2623

2724
- name: TwocryptoFactoryNG
2825
events:
2926
- event: TwocryptoPoolDeployed(address pool, string name, string symbol, address[2] coins, address math, bytes32 salt, uint256[2] precisions, uint256 packed_A_gamma, uint256 packed_fee_params, uint256 packed_rebalancing_params, uint256 packed_prices, address deployer)
30-
field_selection:
31-
transaction_fields:
32-
- hash
3327

3428
- name: TwocryptoFactoryV1
3529
events:
3630
- event: CryptoPoolDeployed(address token, address[2] coins, uint256 A, uint256 gamma, uint256 mid_fee, uint256 out_fee, uint256 allowed_extra_profit, uint256 fee_gamma, uint256 adjustment_step, uint256 admin_fee, uint256 ma_half_time, uint256 initial_price, address deployer)
37-
field_selection:
38-
transaction_fields:
39-
- hash
4031

4132
- name: CryptoPool
4233
events:
4334
- event: TokenExchange(address indexed buyer, uint256 sold_id, uint256 tokens_sold, uint256 bought_id, uint256 tokens_bought, uint256 fee, uint256 packed_price_scale)
44-
field_selection:
45-
transaction_fields:
46-
- hash
4735

4836
# Legacy tricrypto pool (e.g. tricrypto2 on mainnet) that was deployed
4937
# manually rather than via a factory. Older TokenExchange event signature:
5038
# no `fee`, no `packed_price_scale` fields. 3-coin pool.
5139
- name: LegacyTricryptoPool
5240
events:
5341
- event: TokenExchange(address indexed buyer, uint256 sold_id, uint256 tokens_sold, uint256 bought_id, uint256 tokens_bought)
54-
field_selection:
55-
transaction_fields:
56-
- hash
5742

5843
# Standalone 2-coin Curve crypto pool with donation features. Not deployed
5944
# by any of the tracked factories above, so it is registered statically by
6045
# address per chain. Pool entity is initialized lazily on the first event.
6146
- name: TwocryptoPool
6247
events:
6348
- event: TokenExchange(address indexed buyer, uint256 sold_id, uint256 tokens_sold, uint256 bought_id, uint256 tokens_bought, uint256 fee, uint256 price_scale)
64-
field_selection:
65-
transaction_fields:
66-
- hash
6749
- event: AddLiquidity(address indexed provider, address indexed receiver, uint256[2] token_amounts, uint256 fee, uint256 token_supply, uint256 price_scale)
68-
field_selection:
69-
transaction_fields:
70-
- hash
7150
- event: Donation(address indexed donor, uint256[2] token_amounts)
72-
field_selection:
73-
transaction_fields:
74-
- hash
7551
- event: RemoveLiquidity(address indexed provider, uint256[2] token_amounts, uint256 token_supply)
76-
field_selection:
77-
transaction_fields:
78-
- hash
7952
- event: RemoveLiquidityOne(address indexed provider, uint256 token_amount, uint256 coin_index, uint256 coin_amount, uint256 approx_fee, uint256 packed_price_scale)
80-
field_selection:
81-
transaction_fields:
82-
- hash
8353
- event: RemoveLiquidityImbalance(address indexed provider, uint256 lp_token_amount, uint256[2] token_amounts, uint256 approx_fee, uint256 price_scale)
84-
field_selection:
85-
transaction_fields:
86-
- hash
8754

8855
# Stableswap-NG factory. Deploy events carry NO pool address, so the address
8956
# is resolved in contractRegister via pool_list(pool_count()-1).
9057
- name: StableswapFactoryNG
9158
events:
9259
- event: PlainPoolDeployed(address[] coins, uint256 A, uint256 fee, address deployer)
93-
field_selection:
94-
transaction_fields:
95-
- hash
9660
- event: MetaPoolDeployed(address coin, address base_pool, uint256 A, uint256 fee, address deployer)
97-
field_selection:
98-
transaction_fields:
99-
- hash
10061

10162
# Stableswap-NG pool, registered dynamically by the factory above. Pool
10263
# entity is initialized lazily on the first event we see for it.
10364
- name: StableswapPool
10465
events:
10566
- event: TokenExchange(address indexed buyer, int128 sold_id, uint256 tokens_sold, int128 bought_id, uint256 tokens_bought)
106-
field_selection:
107-
transaction_fields:
108-
- hash
10967
- event: AddLiquidity(address indexed provider, uint256[] token_amounts, uint256[] fees, uint256 invariant, uint256 token_supply)
110-
field_selection:
111-
transaction_fields:
112-
- hash
11368
- event: RemoveLiquidity(address indexed provider, uint256[] token_amounts, uint256[] fees, uint256 token_supply)
114-
field_selection:
115-
transaction_fields:
116-
- hash
11769
- event: RemoveLiquidityOne(address indexed provider, int128 token_id, uint256 token_amount, uint256 coin_amount, uint256 token_supply)
118-
field_selection:
119-
transaction_fields:
120-
- hash
12170
- event: RemoveLiquidityImbalance(address indexed provider, uint256[] token_amounts, uint256[] fees, uint256 invariant, uint256 token_supply)
122-
field_selection:
123-
transaction_fields:
124-
- hash
12571

12672
# Legacy stableswap — pools are registered via the Main Registry's PoolAdded
12773
# (which, unlike the NG factory, carries the pool address). Metadata is read
12874
# from the registry; swaps share the int128 TokenExchange signature.
12975
- name: MainRegistry
13076
events:
13177
- event: PoolAdded(address indexed pool, bytes rate_method_id)
132-
field_selection:
133-
transaction_fields:
134-
- hash
13578

13679
- name: LegacyStablePool
13780
events:
13881
- event: TokenExchange(address indexed buyer, int128 sold_id, uint256 tokens_sold, int128 bought_id, uint256 tokens_bought)
139-
field_selection:
140-
transaction_fields:
141-
- hash
14282

14383
# Curve Lend (one-way lending markets). NewVault carries every address, so
14484
# controller/amm/vault are registered with no RPC resolution. The Controller
14585
# + LLAMMA design is shared with the crvUSD mint markets.
14686
- name: OneWayLendingFactory
14787
events:
14888
- event: NewVault(uint256 indexed id, address indexed collateral_token, address indexed borrowed_token, address vault, address controller, address amm, address price_oracle, address monetary_policy)
149-
field_selection:
150-
transaction_fields:
151-
- hash
15289

15390
- name: LendController
15491
events:
15592
- event: UserState(address indexed user, uint256 collateral, uint256 debt, int256 n1, int256 n2, uint256 liquidation_discount)
15693
- event: Borrow(address indexed user, uint256 collateral_increase, uint256 loan_increase)
157-
field_selection:
158-
transaction_fields:
159-
- hash
16094
- event: Repay(address indexed user, uint256 collateral_decrease, uint256 loan_decrease)
161-
field_selection:
162-
transaction_fields:
163-
- hash
16495
- event: RemoveCollateral(address indexed user, uint256 collateral_decrease)
165-
field_selection:
166-
transaction_fields:
167-
- hash
16896
- event: Liquidate(address indexed liquidator, address indexed user, uint256 collateral_received, uint256 stablecoin_received, uint256 debt)
169-
field_selection:
170-
transaction_fields:
171-
- hash
17297

17398
- name: LendAMM
17499
events:
175100
- event: SetRate(uint256 rate, uint256 rate_mul, uint256 time)
176101
- event: TokenExchange(address indexed buyer, uint256 sold_id, uint256 tokens_sold, uint256 bought_id, uint256 tokens_bought)
177-
field_selection:
178-
transaction_fields:
179-
- hash
180102

181103
- name: LendVault
182104
events:
183105
- event: Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares)
184-
field_selection:
185-
transaction_fields:
186-
- hash
187106
- event: Withdraw(address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares)
188-
field_selection:
189-
transaction_fields:
190-
- hash
191107

192108
# crvUSD mint markets. ControllerFactory.AddMarket registers the same
193109
# Controller + LLAMMA contracts that Curve Lend uses, so the engine is shared.
194110
- name: CrvUsdControllerFactory
195111
events:
196112
- event: AddMarket(address indexed collateral, address controller, address amm, address monetary_policy, uint256 ix)
197-
field_selection:
198-
transaction_fields:
199-
- hash
200113

201114
# Gauges + GaugeController (CRV emissions / gauge weights).
202115
- name: GaugeController
203116
events:
204117
- event: NewGauge(address addr, int128 gauge_type, uint256 weight)
205-
field_selection:
206-
transaction_fields:
207-
- hash
208118
- event: NewGaugeWeight(address gauge_address, uint256 time, uint256 weight, uint256 total_weight)
209119
- event: VoteForGauge(uint256 time, address user, address gauge_addr, uint256 weight)
210-
field_selection:
211-
transaction_fields:
212-
- hash
213120

214121
- name: Gauge
215122
events:
123+
# tx hash not stored by these handlers — skip the HyperSync tx join.
216124
- event: Deposit(address indexed provider, uint256 value)
217-
field_selection:
218-
transaction_fields:
219-
- hash
220125
- event: Withdraw(address indexed provider, uint256 value)
221-
field_selection:
222-
transaction_fields:
223-
- hash
224126
- event: UpdateLiquidityLimit(address user, uint256 original_balance, uint256 original_supply, uint256 working_balance, uint256 working_supply)
225127

226128
# veCRV vote-escrow + fee distribution (protocol revenue).
227129
- name: VotingEscrow
228130
events:
131+
# tx hash not stored by these handlers — skip the HyperSync tx join.
229132
- event: Deposit(address indexed provider, uint256 value, uint256 indexed locktime, int128 type, uint256 ts)
230-
field_selection:
231-
transaction_fields:
232-
- hash
233133
- event: Withdraw(address indexed provider, uint256 value, uint256 ts)
234-
field_selection:
235-
transaction_fields:
236-
- hash
237134
- event: Supply(uint256 prevSupply, uint256 supply)
238135

239136
- name: FeeDistributor
240137
events:
241138
- event: CheckpointToken(uint256 time, uint256 tokens)
242139
- event: Claimed(address indexed recipient, uint256 amount, uint256 claim_epoch, uint256 max_epoch)
243-
field_selection:
244-
transaction_fields:
245-
- hash
246140

247141
# scrvUSD savings vault (ERC4626).
248142
- name: ScrvUsdVault
249143
events:
250144
- event: Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares)
251-
field_selection:
252-
transaction_fields:
253-
- hash
254145
- event: Withdraw(address indexed sender, address indexed receiver, address indexed owner, uint256 assets, uint256 shares)
255-
field_selection:
256-
transaction_fields:
257-
- hash
258146

259147
# crvUSD PegKeepers (v2) — peg-defense reserves (discovered via Regulator).
260148
- name: PegKeeper
261149
events:
262150
- event: Provide(uint256 amount)
263-
field_selection:
264-
transaction_fields:
265-
- hash
266151
- event: Withdraw(uint256 amount)
267-
field_selection:
268-
transaction_fields:
269-
- hash
270152
- event: Profit(uint256 lp_amount)
271-
field_selection:
272-
transaction_fields:
273-
- hash
274153

275154
chains:
276155
# Ethereum Mainnet

schema.graphql

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ type Pool {
7777
isActive: Boolean!
7878
deploymentBlock: Int!
7979
deploymentTimestamp: BigInt!
80-
deploymentTxHash: String!
8180
lastUpdatedBlock: Int!
8281
lastUpdatedTimestamp: BigInt!
8382
liquidityEvents: [LiquidityEvent!]! @derivedFrom(field: "pool")
@@ -103,7 +102,6 @@ type Swap {
103102
volumeUsd: BigDecimal
104103
blockNumber: Int! @index
105104
timestamp: BigInt! @index
106-
txHash: String!
107105
logIndex: Int!
108106
}
109107

@@ -145,7 +143,6 @@ type PoolPrice {
145143
price: BigDecimal!
146144
blockNumber: Int! @index
147145
timestamp: BigInt! @index
148-
txHash: String!
149146
logIndex: Int
150147
isRelevant: Boolean!
151148
buyer: String! @index
@@ -177,7 +174,6 @@ type LiquidityEvent {
177174
fee: BigInt
178175
timestamp: BigInt! @index
179176
blockNumber: Int!
180-
txHash: String!
181177
}
182178

183179
# =========================================================================
@@ -213,7 +209,6 @@ type Market {
213209
rate: BigInt
214210
createdBlock: Int!
215211
createdTimestamp: BigInt!
216-
createdTxHash: String!
217212
lastUpdatedBlock: Int!
218213
lastUpdatedTimestamp: BigInt!
219214
loans: [Loan!]! @derivedFrom(field: "market")
@@ -293,7 +288,6 @@ type GaugeVote {
293288
votedAt: BigInt!
294289
timestamp: BigInt! @index
295290
blockNumber: Int!
296-
txHash: String!
297291
}
298292

299293
# =========================================================================
@@ -342,7 +336,6 @@ type FeeClaim {
342336
epoch: BigInt!
343337
blockNumber: Int!
344338
timestamp: BigInt! @index
345-
txHash: String!
346339
}
347340

348341
type Loan {
@@ -381,7 +374,6 @@ type LoanEvent {
381374
debtChange: BigInt!
382375
blockNumber: Int!
383376
timestamp: BigInt! @index
384-
txHash: String!
385377
}
386378

387379
type Liquidation {
@@ -396,7 +388,6 @@ type Liquidation {
396388
isSelf: Boolean!
397389
blockNumber: Int!
398390
timestamp: BigInt! @index
399-
txHash: String!
400391
}
401392

402393
# Daily per-market time-series (debt / collateral / loan count / rate).
@@ -427,7 +418,6 @@ type AmmSwap {
427418
tokensBought: BigInt!
428419
blockNumber: Int!
429420
timestamp: BigInt! @index
430-
txHash: String!
431421
}
432422

433423
# =========================================================================
@@ -467,5 +457,4 @@ type PegKeeperAction {
467457
pegPrice: BigDecimal
468458
blockNumber: Int!
469459
timestamp: BigInt! @index
470-
txHash: String!
471460
}

src/handlers/CryptoPool.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ indexer.onEvent(
9898
price: pricing.price,
9999
blockNumber: event.block.number,
100100
timestamp: BigInt(event.block.timestamp),
101-
txHash: event.transaction.hash,
102101
logIndex: event.logIndex,
103102
isRelevant,
104103
buyer: event.params.buyer,

0 commit comments

Comments
 (0)