Skip to content

feat(contracts): emit events for all admin actions in LoanManager for audit trail #480

@Akpolo

Description

@Akpolo

💬 Want to contribute? Join us on Telegram: https://t.me/+DOylgFv1jyJlNzM0

Problem

The LoanManager contract has no audit trail for admin actions. When an admin calls approve_loan(), set_min_score(), set_interest_rate(), set_default_window(), or pause(), no event is emitted. Off-chain monitoring tools have no way to detect unauthorized admin changes or spot patterns like repeated score threshold changes.

Expected Behavior

Every admin action should emit a named event with:

  1. The action type (e.g. AdminAction)
  2. The function called
  3. Old and new values where applicable
  4. The admin address

Suggested Fix

Add env.events().publish((Symbol::new(&env, "AdminAction"), action_name), (old_value, new_value)) to each admin-gated function in contracts/loan_manager/src/lib.rs.

Location

contracts/loan_manager/src/lib.rs in all admin functions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Stellar WaveIssues in the Stellar wave program

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions