Skip to content

fix: smart contract events missing caller address — cannot attribute actions in audit log #794

Description

@sanmipaul

Bug

Several events emitted by the Astera contracts omit the caller's address from the event data. For example, the pool's `deposit` event includes the amount and token but not the depositor address. Off-chain audit logs and indexers cannot attribute on-chain actions to specific addresses without this information.

Events Missing Caller Address

  • `pool::deposit` — missing depositor address
  • `pool::withdrawal` — missing withdrawer address
  • `invoice::funded` — missing funder (lender) address
  • `invoice::repaid` — missing repayer address
  • `credit::score_updated` — missing trigger address (who caused the update)

Fix

Include the caller address in all action events:

```rust
pub fn deposit(env: Env, token: Address, amount: i128) {
let depositor = env.invoker();
// ... deposit logic ...
env.events().publish(
(Symbol::new(&env, "pool"), Symbol::new(&env, "deposit")),
(depositor, token, amount, shares_minted, env.ledger().timestamp()),
);
}
```

Acceptance Criteria

  • All 5 events above include the caller/actor address
  • Event data struct documented in `docs/events.md`
  • Integration tests assert event data includes actor address
  • TypeScript SDK event types updated to include actor field
  • Indexer updated to store and query by actor address

References

  • `contracts/pool/src/lib.rs` — deposit, withdrawal events
  • `contracts/invoice/src/lib.rs` — funded, repaid events
  • `contracts/credit_score/src/lib.rs` — score_updated event

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingsmart-contractSoroban/Rust contract work

    Type

    No type

    Fields

    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