Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions contracts/split/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -677,6 +677,88 @@ pub fn circuit_breaker_deactivated(env: &Env) {
.publish((symbol_short!("split"), symbol_short!("cb_dact")), ());
}

/// Issue #925: Emitted when a payment batch is opened.
/// Topics: (split, pb_open, payer)
/// Data: (batch_id, token)
pub fn payment_batch_opened(env: &Env, batch_id: u64, payer: &Address, token: &Address) {
env.events().publish(
(symbol_short!("split"), symbol_short!("pb_open"), payer.clone()),
(batch_id, token.clone()),
);
}

/// Issue #925: Emitted when a payment batch is executed.
/// Topics: (split, pb_exec, payer)
/// Data: (batch_id, item_count, total_amount, savings_bps)
pub fn payment_batch_executed(
env: &Env,
batch_id: u64,
payer: &Address,
item_count: u32,
total_amount: i128,
savings_bps: u32,
) {
env.events().publish(
(symbol_short!("split"), symbol_short!("pb_exec"), payer.clone()),
(batch_id, item_count, total_amount, savings_bps),
);
}

/// Issue #925: Emitted when a payment batch is cancelled.
/// Topics: (split, pb_cncl, payer)
/// Data: batch_id
pub fn payment_batch_cancelled(env: &Env, batch_id: u64, payer: &Address) {
env.events().publish(
(symbol_short!("split"), symbol_short!("pb_cncl"), payer.clone()),
batch_id,
);
}

/// Issue #923: Emitted on every circuit breaker state transition.
/// Topics: (split, cb_state)
/// Data: (from, to, actor, reason, ledger)
pub fn circuit_breaker_state_changed(
env: &Env,
from: CircuitBreakerState,
to: CircuitBreakerState,
actor: &Address,
reason: &String,
) {
env.events().publish(
(symbol_short!("split"), symbol_short!("cb_state")),
(from, to, actor.clone(), reason.clone(), env.ledger().sequence()),
);
}

/// Issue #923: Emitted when a failure is reported against the circuit breaker.
/// Topics: (split, cb_fail, reporter)
/// Data: (failure_count, failure_threshold)
pub fn circuit_breaker_failure_reported(
env: &Env,
reporter: &Address,
failure_count: u32,
failure_threshold: u32,
) {
env.events().publish(
(
symbol_short!("split"),
symbol_short!("cb_fail"),
reporter.clone(),
),
(failure_count, failure_threshold),
);
}

/// Issue #923: Emitted when an operation is added to or removed from the exemption list.
/// Topics: (split, cb_exmpt)
/// Data: (function, exempt)
pub fn circuit_breaker_exemption_set(env: &Env, function: &Symbol, exempt: bool) {
env.events().publish(
(symbol_short!("split"), symbol_short!("cb_exmpt")),
(function.clone(), exempt),
);
}

/// Issue #296: Emitted when a fee waiver is granted to a creator.
/// Topics: (split, fw_grant, creator)
/// Data: ()
Expand Down Expand Up @@ -705,6 +787,34 @@ pub fn fee_waiver_revoked(env: &Env, creator: &Address) {
);
}

/// Issue #922: Emitted when a fee waiver's expiry is set or extended.
/// Topics: (split, fw_exp, creator)
/// Data: expires_at (0 = never)
pub fn fee_waiver_expiry_set(env: &Env, creator: &Address, expires_at: u64) {
env.events().publish(
(
symbol_short!("split"),
symbol_short!("fw_exp"),
creator.clone(),
),
expires_at,
);
}

/// Issue #922: Emitted when an expired fee waiver is purged from the whitelist.
/// Topics: (split, fw_purge, creator)
/// Data: expires_at
pub fn fee_waiver_expired(env: &Env, creator: &Address, expires_at: u64) {
env.events().publish(
(
symbol_short!("split"),
symbol_short!("fw_purge"),
creator.clone(),
),
expires_at,
);
}

/// Issue #285: Emitted when fee tiers are updated.
/// Topics: (split, fee_tiers_updated)
/// Data: count of tiers
Expand Down
Loading