Repository navigation
feat(options): emit versioned lifecycle events - #1726
Merged
github-actions[bot] merged 1 commit intoOct 22, 2026
Merged
github-actions[bot] merged 1 commit into
github-actions[bot] merged 1 commit into
Conversation
|
Good job. |
|
@alabiopeyemi is attempting to deploy a commit to the Edeh Victor's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Comprehensive Implementation Summary: Versioned Option Lifecycle Events
📌 Issue Overview
Issue Reference: #1467
Title: Emit versioned lifecycle events for option positions
Area:
contracts/optionsThe options contract previously emitted ad-hoc event pairs without a schema
version, and partial exercises reused the full-exercise topic. This PR replaces
those lifecycle emissions with a single versioned schema that consistently
identifies the position and covers creation, fill, exercise, expiry, and
cancellation.
🏗️ Architecture & Core Design Decisions
1. One stable event envelope
Every position transition now publishes one event with:
(kind, option_id, schema_version)OptionLifecycleEventkindis one ofcreate,fill,exercise,expire, orcancel. Theposition id is available both as a topic and inside the payload, while
schema_versionis1for the current layout.2. Complete, self-describing payload
OptionLifecycleEventcarries enough data for indexers and clients to decode atransition without additional calls:
3. Consistent lifecycle mapping
create— emitted bymintafter collateral is escrowed.fill— emitted when an exercise partially consumes the remaining collateral.exercise— emitted when the position is fully exercised.expire— emitted when unexercised collateral is returned after expiry.cancel— emitted when the minter cancels and receives unexercised collateral.No storage layout, public method signature, or collateral accounting behavior
changed.
depositandwithdrawretain their existing events.📁 File-by-File Detailed Breakdown
1.
contracts/options/src/events.rs(New)OPTION_EVENT_SCHEMA_VERSION = 1.OptionLifecycleEventcontract type.create,fill,exercise,expire, andcancel.(kind, option_id, schema_version).2.
contracts/options/src/lib.rseventsmodule.mint,settle,expire, andcancelwith the versioned emitters.fillfor partial exercises andexerciseonce the position is fullyconsumed.
3.
contracts/options/src/tests.rsversioned_lifecycle_eventscoverage for:create→fill→exerciseordering and cumulative amountsschema version, actor, amount, exercised total, and remaining collateral.
4.
contracts/options/README.md✅ Automated Verification & CI Results
cargo test -p options --libcargo clippy -p options --all-targets -- -D warnings ...cargo fmt -p options -- --checkCloses #1467