fix(tokens): emit transfer/mint/burn/approve events in wpi-token and mock-usdc - #66
Merged
Junman140 merged 2 commits intoAug 18, 2026
Merged
Conversation
|
Important Review available on request
Reviews should be triggered manually for repositories with fewer than 10 stars. Select Trigger review above or comment ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Reworks the event emission added in the previous commit and repairs pre-existing CI breakage inherited from "chore: sync contract sources from PUSD-MAIN" (a83a15d), which left main red. Events (the actual issue fix): - soroban-sdk 23.0.1 deprecates `env.events().publish(...)`, so the previous commit's calls became hard errors under the CI clippy step's `-D warnings`. Ported to the `#[contractevent]` macro. - Topic/data shape is unchanged and still matches the conventional Soroban token layout: struct name supplies the leading topic, `#[topic]` fields follow, and `data_format = "single-value"` keeps `amount` as the bare payload rather than a map: ("transfer", from, to) -> amount ("mint", admin, to) -> amount ("burn", admin, from) -> amount ("approve", owner, spender)-> amount Pre-existing CI failures, unrelated to events: - cargo fmt: the sync commit landed all three contracts unformatted; `cargo fmt --all` applied. - clippy: needless_borrows_for_generic_args in mock-amm; bind the pool address to a local before passing it to `transfer`. - relayer typecheck: scripts/e2e-demo.ts omitted the required `BurnEvent.redemptionId`; added a demo id matching the file's existing `demo-*` fixture naming. - The sync commit deleted scripts/verify_dependency_provenance.sh along with the [patch.crates-io] pinning it validated, but ci.yml and release.yml still invoked it, so both workflows failed on a missing file. Removed the dead steps. Supply-chain note: that deletion dropped the ark-*/wasmi_core git-rev pinning entirely. Restoring it is a dependency change in its own right and is deliberately left to a follow-up PR. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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
Closes #3
mint,burn,transfer,transfer_from, andapprovein bothwpi-tokenand
mock-usdcperformed state mutations silently — noenv.events().publish(...)calls anywhere. Wallets, block explorers (StellarExpert), and the future
relayer/indexer confirmation logic had no on-chain signal to observe token
activity.
Changes
Added event emission to every state-mutating entrypoint in both contracts,
using the conventional Soroban token topic/data shape:
transfer/transfer_from("transfer", from, to)amountmint("mint", admin, to)amountburn("burn", admin, from)amountapprove("approve", owner, spender)amounttransferandtransfer_fromboth route through the sharedtransfer_internalhelper, so the event is emitted exactly once pertransfer regardless of call path (no duplicate events for the
transfer_fromcase).amount <= 0inmint/burn, or anyerror return) since no balance/supply state actually changes there —
consistent with the existing early-return behavior.
wpi-tokenandmock-usdcsince theyshare the same interface shape.
Testing
cargo build -p wpi-token -p mock-usdc— compiles clean.Follow-up (not in this PR)
StellarExpert/Freighter on testnet — needs a manual testnet deploy once
merged.