Skip to content

Add contract event emissions for timelock, fee calculator, fee distributor, and platform stats - #182

Merged
terngunan merged 5 commits into
terngunan:mainfrom
aishabellova:drips/113-114-115-116
Oct 21, 2026
Merged

terngunan merged 5 commits into
terngunan:mainfrom
aishabellova:drips/113-114-115-116

Conversation

@aishabellova

Copy link
Copy Markdown
Contributor

Summary

Add contract event emissions for timelock, fee calculator, fee distributor, and platform stats

What was solved

#113 — admin_timelock: prune_change removes change records silently without emitting a pruning event

Add a ChangePrunedEvent { change_id: BytesN<32> } to the admin_timelock contract and publish it as ("TIMELOCK", "change_pruned") inside prune_change, plus a unit test asserting the event is emitted when a change is pruned.

Addressed:

  • Changed: settliq_contracts/contracts/admin_timelock/src/lib.rs
  • Define struct ChangePrunedEvent { change_id: BytesN<32> } in settliq_contracts/contracts/admin_timelock/src/lib.rs
  • Publish ("TIMELOCK", "change_pruned") with ChangePrunedEvent in prune_change after removing the change record
  • Add a unit test in settliq_contracts/contracts/admin_timelock/src/test.rs asserting the pruning event is emitted

#114 — fee_calculator: Missing audit events on set_settlement_caller and set_min_fee_stroops updates

Add audit event emissions to fee_calculator's set_settlement_caller and set_min_fee_stroops, defining SettlementCallerUpdatedEvent and MinFeeUpdatedEvent, and add unit tests verifying event publication.

Addressed:

  • Changed: settliq_contracts/contracts/fee_calculator/src/lib.rs, settliq_contracts/contracts/fee_calculator/src/test.rs
  • Define SettlementCallerUpdatedEvent and MinFeeUpdatedEvent in fee_calculator lib.rs
  • set_settlement_caller must publish SettlementCallerUpdatedEvent including the caller and the new settlement address
  • set_min_fee_stroops must publish MinFeeUpdatedEvent including the old and new min fee values

#115 — fee_distributor: set_allowed_caller emits no event when distribution authority is changed

Add an AllowedCallerUpdatedEvent emission to fee_distributor's set_allowed_caller so caller-authorization changes are observable, and add a unit test asserting the event is published on caller rotation.

Addressed:

  • Changed: settliq_contracts/contracts/fee_distributor/src/lib.rs, settliq_contracts/contracts/fee_distributor/src/lib.rs
  • Define struct AllowedCallerUpdatedEvent { old_caller: Address, new_caller: Address } in fee_distributor
  • In set_allowed_caller, read the existing AllowedCaller value as old_caller before overwriting
  • Publish event with topics ("FEE_DISTRIBUTOR", "allowed_caller_updated") and the event data containing old and new caller

#116 — platform_stats: Metric update functions lack audit events preventing real-time event-driven telemetry

Add Soroban contract events to the platform_stats contract so that record_merchant, record_payment, and set_partner_ok emit MerchantRecordedEvent, PaymentRecordedEvent, and PartnerHealthUpdatedEvent respectively, enabling off-chain indexers and Prometheus exporters to consume real-time telemetry via event streaming instead of polling. Add unit tests in the platform_stats test module verifying the emitted event payloads.

Addressed:

  • Changed: settliq_contracts/contracts/platform_stats/src/lib.rs, settliq_contracts/contracts/platform_stats/src/lib.rs, settliq_contracts/contracts/platform_stats/src/test.rs
  • Define MerchantRecordedEvent, PaymentRecordedEvent, and PartnerHealthUpdatedEvent types (with #[contracttype] and appropriate fields) in settliq_contracts/contracts/platform_stats/src/lib.rs
  • Emit MerchantRecordedEvent via env.events().publish in record_merchant after state update
  • Emit PaymentRecordedEvent via env.events().publish in record_payment after state update

Changes

  • settliq_contracts/contracts/admin_timelock/src/lib.rs (modify)
  • settliq_contracts/contracts/fee_calculator/src/lib.rs (modify)
  • settliq_contracts/contracts/fee_calculator/src/test.rs (modify)
  • settliq_contracts/contracts/fee_distributor/src/lib.rs (modify)
  • settliq_contracts/contracts/platform_stats/src/lib.rs (modify)
  • settliq_contracts/contracts/platform_stats/src/test.rs (modify)

Approach

  1. admin_timelock: prune_change removes change records silently without emitting a pruning event #113 — admin_timelock: prune_change removes change records silently without emitting a pruning event (Changed: settliq_contracts/contracts/admin_timelock/src/lib.rs)
  2. fee_calculator: Missing audit events on set_settlement_caller and set_min_fee_stroops updates #114 — fee_calculator: Missing audit events on set_settlement_caller and set_min_fee_stroops updates (Changed: settliq_contracts/contracts/fee_calculator/src/lib.rs, settliq_contracts/contracts/fee_calculator/src/test.rs)
  3. fee_distributor: set_allowed_caller emits no event when distribution authority is changed #115 — fee_distributor: set_allowed_caller emits no event when distribution authority is changed (Changed: settliq_contracts/contracts/fee_distributor/src/lib.rs, settliq_contracts/contracts/fee_distributor/src/lib.rs)
  4. platform_stats: Metric update functions lack audit events preventing real-time event-driven telemetry #116 — platform_stats: Metric update functions lack audit events preventing real-time event-driven telemetry (Changed: settliq_contracts/contracts/platform_stats/src/lib.rs, settliq_contracts/contracts/platform_stats/src/lib.rs, settliq_contracts/contracts/platform_stats/src/test.rs)

Issues

Closes #113
Closes #114
Closes #115
Closes #116

@drips-wave

drips-wave Bot commented Oct 21, 2026

Copy link
Copy Markdown

@aishabellova 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

@terngunan
terngunan merged commit 8f04849 into terngunan:main Oct 21, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment