feat: complete PERP_ABI with trade/position free events (0.14.0)#58
Merged
Conversation
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>
Contributor
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThe 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. ChangesPERP_ABI free events expansion
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
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
forge inspectomits Solidity "free events", so every forge-derived copy ofPERP_ABIwas missing all 20 Perp trade/position events —TakerOpened,TakerAdjusted,TakerClosed,TakerBackstopped, the fiveMaker*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) intosrc/abis/perp.ts, so any consumer candecodeEventLog({ abi: PERP_ABI, ... })on every Perp trade log. Bumps to0.14.0and 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/MakerConverteddroppedliqFee, 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
tsc --noEmit/test:unit(271 passed) / biome lint — all cleandist/index.d.tsexports the new eventstoEventSelectortopic0 hashes matchperpcity-indexer/abis/Perp.json— proving the vendored v0.1.0 signatures are byte-exactRelease
After merge, cut GitHub Release
v0.14.0→publish.ymlOIDC publish to npm. The downstreamperpcity-clientPR (backend ABI artifact +abi-syncdrift gate) is blocked on0.14.0being on npm.🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes
Chores
0.14.0.