Skip to content

feat(events): contract pause, unpause, config-updated and approval-revoked events - #938

Merged
Eniola3321 merged 3 commits into
ANYTECHS:mainfrom
Calebux:feat/events-931-932-933-934
Aug 29, 2026
Merged

Eniola3321 merged 3 commits into
ANYTECHS:mainfrom
Calebux:feat/events-931-932-933-934

Conversation

@Calebux

@Calebux Calebux commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Implements the four administrative lifecycle events tracked by #931#934.

Closes #931
Closes #932
Closes #933
Closes #934

Event types

Added to clips_nft/src/types.rs:

Event Topic Fields Issue
ContractPausedEvent ctr_pause admin, optional reason, timestamp #933
ContractUnpausedEvent ctr_unpse admin, timestamp #934
ConfigUpdatedEvent cfg_updt field, previous value, new value, admin, timestamp #932
ApprovalRevokedEvent aprv_rvk owner, approved account, scope, timestamp #931

ConfigUpdatedEvent carries a ConfigField enum (platform fee, max royalty, batch size, supported asset, mint cooldown, admin, contract limit) and a ConfigValue enum (Unset / Number / Address), so numeric and address settings share one event shape while still reporting both the previous and the new value.

ApprovalRevokedEvent carries an ApprovalScope of either Token(id) for a single-token approval or AllTokens for an operator permission, covering the issue's "token ID or approval scope".

Emitters live in three new modules that follow the existing *_event.rs convention: pause_event.rs, config_updated_event.rs, approval_revoked_event.rs.

Where the events fire

  • ClipsNftContract::pause / unpause / is_paused — new admin-gated entry points. There was previously no way to reach pause_state, so the pause events had no trigger. Both refuse a redundant call (ContractPaused / NotPaused), which means a received event always marks a real transition.
  • config::set_config — now emits one typed ConfigUpdatedEvent per setting that actually changed. This replaces the ad-hoc ConfigUpdateEvent (a free-text key plus two u32s, which could not represent an address). Coverage widens from four fields to every field, including max_batch_transfer_size, version and the owner address, all of which previously changed silently.
  • payment_currency::add_currency_by / remove_currency_by and the matching add_currency / remove_currency entry points — report supported-asset changes.
  • token_approval::revoke_approval / operator_approval::revoke_operator — remove the permission and emit. Both are no-ops that emit nothing when there was no approval to revoke, so subscribers never see a phantom revocation.

Breaking change

config::ConfigUpdateEvent and the "config_update" topic are replaced by ConfigUpdatedEvent on "cfg_updt". Nothing in the repository consumed the old shape, but any external indexer watching "config_update" needs updating.

Build fix included

main did not compile before this branch. The conflicting event definitions merged in #936 left:

  • duplicated pub use re-exports in marketplace/mod.rs
  • ListingCancelledEvent and NftSoldEvent both defined and re-exported from events::listing in marketplace/types.rs
  • a missing ListingId import in marketplace/types.rs
  • two interleaved emit_listing_cancelled call sites (lib.rs::cancel_listing, marketplace/listing_validator.rs::cancel_listing) — one of them a syntax error
  • a RoyaltyPaidEvent literal missing the sale_reference field
  • create_listing passing &listing where &mut ListingRequest is required

Those are fixed here because the new events cannot be built or tested otherwise. In each case the centralised events::listing module won, per its own module docs. The resolution is minimal — no behaviour beyond making the two competing versions agree.

Still failing on this branch, and out of scope: cargo test --lib (the src/tests/ modules) and several older integration test targets do not compile, mostly from soroban-sdk API drift and the same #936 merge. That is pre-existing and worth its own issue.

Tests

clips_nft/tests/test_admin_lifecycle_events.rs — 15 integration tests through the contract client, asserting the full (emitter, topics, data) tuple for each event:

test result: ok. 15 passed; 0 failed; 0 ignored

Every event is covered on both paths: it fires on a real state change, and stays silent on a no-op or a rejected call (already paused, non-admin caller, duplicate asset, absent approval).

🤖 Generated with Claude Code

…voked events

Implements the four administrative lifecycle events tracked by ANYTECHS#931ANYTECHS#934.

New event types (clips_nft/src/types.rs):
- ContractPausedEvent    — admin, optional reason, timestamp        (ANYTECHS#933)
- ContractUnpausedEvent  — admin, timestamp                         (ANYTECHS#934)
- ConfigUpdatedEvent     — field, previous value, new value, admin,
                           timestamp, with ConfigField/ConfigValue  (ANYTECHS#932)
- ApprovalRevokedEvent   — owner, approved account, scope (token id
                           or all-tokens), timestamp                (ANYTECHS#931)

New emitter modules, one per event family, following the existing
`*_event.rs` convention:
- pause_event.rs            → "ctr_pause" / "ctr_unpse"
- config_updated_event.rs   → "cfg_updt"
- approval_revoked_event.rs → "aprv_rvk"

Emission is wired to real state changes:
- ClipsNftContract::pause / unpause / is_paused — admin-gated via
  config_guard, refusing a redundant pause or unpause so a received
  event always marks an actual transition
- config::set_config now emits one typed ConfigUpdatedEvent per changed
  setting, replacing the ad-hoc `ConfigUpdateEvent`. Coverage widens from
  four fields to every field, including max_batch_transfer_size, version
  and the owner address, which previously changed silently
- payment_currency::add_currency_by / remove_currency_by and the matching
  add_currency / remove_currency entry points report supported-asset
  changes
- token_approval::revoke_approval and operator_approval::revoke_operator
  remove the permission and emit; both are no-ops that emit nothing when
  there was no approval to revoke

Also fixes the crate build, which was broken on main by conflicting event
definitions merged in ANYTECHS#936: duplicated `pub use` re-exports in
marketplace/mod.rs, `ListingCancelledEvent`/`NftSoldEvent` defined and
re-exported in marketplace/types.rs, a missing ListingId import, two
interleaved emit_listing_cancelled call sites, a RoyaltyPaidEvent literal
missing sale_reference, and a create_listing call passing a shared
reference where a mutable one is required.

15 integration tests in clips_nft/tests/test_admin_lifecycle_events.rs
cover every event, both the emitting and the silent path.

Closes ANYTECHS#931
Closes ANYTECHS#932
Closes ANYTECHS#933
Closes ANYTECHS#934

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@Calebux Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Eniola3321
Eniola3321 merged commit 89c6f3f into ANYTECHS:main Aug 29, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants