Skip to content

fix: Gains USDC collateral array index - #2111

Merged
Flotapponnier merged 1 commit into
devfrom
feat/fee-compare-carry-v2
Aug 27, 2026
Merged

fix: Gains USDC collateral array index#2111
Flotapponnier merged 1 commit into
devfrom
feat/fee-compare-carry-v2

Conversation

@Flotapponnier

Copy link
Copy Markdown
Collaborator

Bug

GAINS_USDC_COLLATERAL_IDX = 3 was using the wrong array index.

The vars.collaterals array is 0-indexed:

  • [0] DAI (collateralIndex field = 1)
  • [1] WETH (collateralIndex field = 2)
  • [2] USDC (collateralIndex field = 3) ← correct
  • [3] GNS (collateralIndex field = 4)

We were reading GNS borrow/funding rates and applying them to USDC trades.

Fix

Change constant from 3 to 2.

Note: the collateralIndex === 3 filter in fetchGainsTrades is correct — it refers to the collateralIndex field value (1-indexed) on individual trade objects, not the array position.

@Flotapponnier
Flotapponnier force-pushed the feat/fee-compare-carry-v2 branch from 0c54bb3 to 35ad732 Compare August 27, 2026 13:03
@Flotapponnier
Flotapponnier merged commit 6232e06 into dev Aug 27, 2026
1 check failed
bakabhai993 pushed a commit to bakabhai993/OpenChainBench that referenced this pull request Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant