Description
Event topic strings ("init", "pause_set", "distribute", "admin_changed") are repeated as ad-hoc Symbol::new(&env, "...") calls across the three crates. Extract a shared events module per crate that exports pub const Symbol topic constants so renames are mechanical and the catalog is grep-able.
Requirements and Context
- New
contracts/<crate>/src/events.rs with pub fn event_init(env: &Env) -> Symbol (or similar) per topic
- Replace inline literals at emit sites
- Must be secure, tested, and documented
- Should be efficient and easy to review
Suggested Execution
- Fork the repo and create a branch
git checkout -b task/event-symbol-catalog
- Implement changes
contracts/vault/src/events.rs, contracts/settlement/src/events.rs, contracts/revenue_pool/src/events.rs
- Replace
Symbol::new(&env, "init") etc. throughout
- Test and commit
cargo test --workspace
- Cover edge cases: every topic still produces identical bytes (snapshot test)
- Include test output and notes in the PR
Example commit message
task: centralize event topic symbols per crate
Acceptance Criteria
Guidelines
.rs only under contracts/.../src/, NatSpec-style /// doc comments
- Use real Soroban SDK idioms
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
Event topic strings (
"init","pause_set","distribute","admin_changed") are repeated as ad-hocSymbol::new(&env, "...")calls across the three crates. Extract a sharedeventsmodule per crate that exportspub constSymboltopic constants so renames are mechanical and the catalog is grep-able.Requirements and Context
contracts/<crate>/src/events.rswithpub fn event_init(env: &Env) -> Symbol(or similar) per topicSuggested Execution
contracts/vault/src/events.rs,contracts/settlement/src/events.rs,contracts/revenue_pool/src/events.rsSymbol::new(&env, "init")etc. throughoutcargo test --workspaceExample commit message
Acceptance Criteria
Symbol::new(env, "...")for event topicsEVENT_SCHEMA.mdcross-links each topic constantGuidelines
.rsonly undercontracts/.../src/, NatSpec-style///doc comments