Skip to content

Structured Contract Events with Indexed Topics across Escrow, Reputation & Loyalty #45

Closed

Description

@meshackyaro

Description

This issue aims to address the implementation of Structured Contract Events with Indexed Topics across Escrow, Reputation & Loyalty.

The core objective is to: Publish a consistent, documented event on every state-changing contract operation, with topics chosen so an off-chain indexer can filter by appointment, worker, or address without scanning every ledger.

By completing this feature, we will ensure that the GuildWorkman protocol maintains its high standards for security, usability, and decentralized logic. This issue requires careful attention to the Smart Contract architecture and adherence to the existing project conventions.

When picking up this issue, please ensure you document any new dependencies or architectural decisions made during development.

Component

Smart Contracts (Soroban)

Difficulty

🟡 Medium

Current state

None of the three contracts publishes a single event — grep -rn "events()" contracts/*/src/lib.rs returns nothing. Escrow funding, completion, cancellation, dispute, reputation submission, and loyalty mint/transfer/burn all mutate state invisibly.

That directly blocks the on-chain ingestion pipeline in #22, which has nothing to ingest, and it means the only way to learn a contract's state today is to poll get_appointment for every id the backend already knows about. Events are the small change that unblocks the larger one.

Tasks

  • Review the existing Soroban workspace under soroban-contracts/contracts/
  • Implement the contract logic for: Structured Contract Events with Indexed Topics across Escrow, Reputation & Loyalty
  • Publish an event from every state-changing entry point in escrow (create, confirm, cancel, dispute, resolve), reputation (review submitted), and loyalty-token (mint, transfer, burn, approve, minter rotation)
  • Choose topic tuples deliberately so an indexer can filter by appointment_id, worker address, or account without a full scan — document the topic layout per event
  • Follow SEP-41 conventions for the loyalty token's events so standard tooling recognizes them
  • Keep event payloads small and typed; do not emit unbounded String data
  • Document the full event catalogue (name, topics, data shape) in the contracts README so the backend indexer in On-Chain Event Ingestion Pipeline with Transactional Outbox & Replay #22 can be written against a stable contract
  • Write comprehensive unit and integration tests, including adversarial edge cases — assert emitted events via the test env's event recorder, and assert that failed operations emit nothing
  • Add caching for cargo dependencies in CI
  • Run cargo fmt --check and cargo clippy -- -D warnings
  • Run cargo test and soroban contract build to verify the optimized WASM build

Acceptance Criteria

  • Feature accurately implements the objective: Publish a consistent, documented event on every state-changing contract operation, with topics chosen so an off-chain indexer can filter by appointment, worker, or address without scanning every ledger.
  • Every state-changing entry point across all three contracts emits exactly one event
  • An operation that fails and returns an Error emits no event
  • Topic layout supports filtering by appointment id and by address, demonstrated in tests
  • The event catalogue is documented and stable enough for On-Chain Event Ingestion Pipeline with Transactional Outbox & Replay #22 to be implemented against it
  • Any PR that introduces compiler or clippy warnings is automatically blocked
  • Contract logic is covered by tests exercising success, failure, and attack paths
  • Storage layout and authorization are documented and reviewed for safety
  • Code is properly reviewed and approved by codeowners

Estimated Time

1-2 days

Activity

  1. grantfox-oss commented on Aug 19, 2026

    @grantfox-oss

    🦊 GrantFox — @Chigybillionz has been assigned to this issue as part of the Third Campaign campaign!

    Next steps:

    1. Open a Pull Request referencing this issue (e.g., Closes #45)
    2. Your PR will be reviewed by the workman-labs maintainers

    Good luck! Track your progress on GrantFox.

  2. Meet-hybrid commented on Aug 20, 2026

    @Meet-hybrid

    I would like to contribute to this issue. I have experience with JavaScript/TypeScript, React, backend APIs, testing, Git, and software architecture. I will follow the acceptance criteria, add tests, and provide a focused pull request.

  3. rexx010 commented on Aug 28, 2026

    @rexx010

    Hi, I’m interested in this issue. I’d implement structured Soroban events across the three contracts with deliberate indexed topics for appointment IDs and addresses, follow SEP-41 conventions for loyalty events, and add tests covering successful and failed operations while documenting the event catalogue for the indexer.

  4. Chigybillionz commented on Aug 28, 2026

    @Chigybillionz
    Contributor

    @meshackyaro good day, I open PR for this issue. I did not hear any feedback, what's going on?

    Thank you

  5. grantfox-oss commented on Aug 29, 2026

    @grantfox-oss

    🦊 GrantFox — @rexx010 has been assigned to this issue as part of the Third Campaign campaign!

    Next steps:

    1. Open a Pull Request referencing this issue (e.g., Closes #45)
    2. Your PR will be reviewed by the workman-labs maintainers

    Good luck! Track your progress on GrantFox.

  6. grantfox-oss commented on Aug 30, 2026

    @grantfox-oss

    🎉 This issue has been marked as completed on GrantFox!

    @Chigybillionz's PR #49 was approved and merged by @meshackyaro.

    🏆 @Chigybillionz: You earned 40 FoxPoints for this contribution! Your current tier: Builder (2,955 total points). Track your full progress on GrantFox.

    👏 Great work, @Chigybillionz! Keep contributing to workman-labs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions