Fix #1716: set_close_factor_bps() and set_liquidation_incentive_bps() now emit on-chain events and record audit log entries, bringing them in line with other governance setters such as set_price_bounds(), set_pause(), and set_emergency_state().
The admin-only functions set_close_factor_bps() and set_liquidation_incentive_bps() modify protocol parameters that directly affect liquidation economics, but neither function emitted an on-chain event. This made it impossible for indexers and monitoring tools to track changes to these critical risk parameters.
- events.rs: Added
CloseFactorBpsSetEventandLiquidationIncentiveBpsSetEvent#[contracttype]structs (withschema_version, parameter value, andtimestamp) along with corresponding emit functionsemit_close_factor_bps_set()andemit_liquidation_incentive_bps_set(). - lib.rs: Updated
set_close_factor_bps()andset_liquidation_incentive_bps()to:- Emit typed events on every successful parameter update
- Record audit log entries (matching the pattern used by
set_max_move_bps,set_price_bounds, etc.) - Use explicit admin retrieval (consistent with other admin-gated setters)
| File | Changes |
|---|---|
stellar-lend/contracts/lending/src/events.rs |
+49 lines: two new event structs and emit functions |
stellar-lend/contracts/lending/src/lib.rs |
+34/-2 lines: event emission + audit logging in two setters |
All existing tests pass:
liquidation_params_test: 16/16 passedinitialization_guard_test: passedgovernance_audit_test: passedadmin_setters_dedupe_test: passed