Skip to content

feat: complete PERP_ABI with trade/position free events (0.14.0)#58

Merged
lukemacauley merged 1 commit into
mainfrom
feat/complete-perp-abi
Jul 9, 2026
Merged

feat: complete PERP_ABI with trade/position free events (0.14.0)#58
lukemacauley merged 1 commit into
mainfrom
feat/complete-perp-abi

Conversation

@lukemacauley

@lukemacauley lukemacauley commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

forge inspect omits Solidity "free events", so every forge-derived copy of PERP_ABI was missing all 20 Perp trade/position eventsTakerOpened, TakerAdjusted, TakerClosed, TakerBackstopped, the five Maker* events, plus the pool/market-state and tick events (MarginTransferred, OpenInterestUpdated, RatesAndEmasRefreshed, CumulativesAccrued, CapacityUpdated, Donated, LossSocialized, BadDebtAccounted, TickInitialized, TickDeleted, TicksCrossed).

This vendors the v0.1.0 definitions (from the deployed contract, via perpcity-indexer/abis/Perp.json) into src/abis/perp.ts, so any consumer can decodeEventLog({ abi: PERP_ABI, ... }) on every Perp trade log. Bumps to 0.14.0 and adds CHANGELOG entries (incl. a backfill for the skipped 0.13.0).

Source-of-truth note

These are not regenerated from ../perpcity-contracts/out, which is now at v0.2.x where several of these signatures have already drifted (TakerClosed/MakerClosed/MakerConverted dropped liqFee, isLiquidation; liquidations split into new events). A guard comment above the inserted block records this. Re-vendor from the deployed version at each contract upgrade.

Verification

  • Build / tsc --noEmit / test:unit (271 passed) / biome lint — all clean
  • dist/index.d.ts exports the new events
  • All 20 event toEventSelector topic0 hashes match perpcity-indexer/abis/Perp.json — proving the vendored v0.1.0 signatures are byte-exact

Release

After merge, cut GitHub Release v0.14.0publish.yml OIDC publish to npm. The downstream perpcity-client PR (backend ABI artifact + abi-sync drift gate) is blocked on 0.14.0 being on npm.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Expanded Perp event support so trade and market logs can now be decoded successfully, including maker/taker, pool, market-state, and tick events.
    • Added the latest release notes entry documenting supported Perp events.
  • Bug Fixes

    • Improved log decoding compatibility for Perp event data, reducing failures when reading trade logs.
  • Chores

    • Bumped the package version to 0.14.0.

forge inspect omits Solidity "free events", so every forge-derived copy of
PERP_ABI was missing all 20 Perp trade/position events (TakerOpened,
MakerClosed, RatesAndEmasRefreshed, ...). Vendor the v0.1.0 definitions from
the deployed contract so consumers can decodeEventLog every trade log, bump
to 0.14.0, and add CHANGELOG entries. These are NOT regenerated from
../perpcity-contracts/out (now v0.2.x, where several signatures have drifted).

Verified: all 20 event topic0 selectors match perpcity-indexer/abis/Perp.json.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ad947b2b-d475-40a0-9da3-ea1b067b0847

📥 Commits

Reviewing files that changed from the base of the PR and between 59f892a and 8a01cb8.

📒 Files selected for processing (3)
  • CHANGELOG.md
  • package.json
  • src/abis/perp.ts

📝 Walkthrough

Walkthrough

The PR extends the PERP_ABI array in src/abis/perp.ts with 20 vendored Perp contract event definitions (Maker/Taker lifecycle, pool/market-state, and tick events), bumps package.json to version 0.14.0, and adds CHANGELOG.md entries documenting the ABI update and event decoding support.

Changes

PERP_ABI free events expansion

Layer / File(s) Summary
Maker and Taker lifecycle events
src/abis/perp.ts
Adds a vendoring comment and inserts event ABI entries for BadDebtAccounted, CapacityUpdated, CumulativesAccrued, Donated, LossSocialized, and the full Maker*/Taker* event set (MakerAdjusted, MakerBackstopped, MakerClosed, MakerConverted, MakerOpened, TakerAdjusted, TakerBackstopped, TakerClosed, TakerOpened) with their structured tuple parameters.
Pool/market-state and tick events
src/abis/perp.ts
Inserts MarginTransferred, OpenInterestUpdated, RatesAndEmasRefreshed, and tick lifecycle events (TickDeleted, TickInitialized, TicksCrossed).
Version bump and changelog
package.json, CHANGELOG.md
Bumps package version from 0.13.0 to 0.14.0 and adds a 0.14.0 CHANGELOG entry describing the ABI expansion and decodeEventLog support, alongside an update to the existing 0.13.0 entry.

Estimated code review effort: 2 (Simple) | ~10 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Consumer
  participant ViemDecodeEventLog
  participant PERP_ABI
  Consumer->>ViemDecodeEventLog: decodeEventLog({ abi: PERP_ABI, log })
  ViemDecodeEventLog->>PERP_ABI: match event signature (MakerOpened, TakerClosed, ...)
  PERP_ABI-->>ViemDecodeEventLog: matched event definition
  ViemDecodeEventLog-->>Consumer: decoded event args
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: completing PERP_ABI with the missing trade and position events for 0.14.0.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/complete-perp-abi

Comment @coderabbitai help to get the list of available commands.

@lukemacauley
lukemacauley merged commit 23da4a8 into main Jul 9, 2026
7 checks passed
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