🎯 Context & Impact
With multiple contracts (guild, bounty, payment, milestone, etc.), we need a robust integration layer to enable seamless communication and event coordination. Without this, contracts operate in silos and cannot react to each other's state changes.
Why this matters:
- Enables complex workflows across multiple contracts
- Provides unified event system for frontend tracking
- Ensures data consistency across contracts
- Simplifies contract upgrades and versioning
- Creates a cohesive platform experience
📋 Scope
Implement a Soroban integration layer that provides cross-contract communication, unified events, and contract registry management.
What's included:
- Contract registry for address management
- Unified event emission system
- Cross-contract authorization framework
- Contract interface definitions
- Event subscription and filtering
- Contract version tracking
- Integration helpers and utilities
- Error handling standardization
What's NOT included:
- Oracle integration (future)
- Cross-chain communication
- Off-chain event processing
🛠️ Implementation Guidelines
File Structure
Create the following files in the contract/ directory:
contract/
├── src/
│ ├── integration/
│ │ ├── mod.rs
│ │ ├── registry.rs
│ │ ├── events.rs
│ │ ├── auth.rs
│ │ └── types.rs
│ ├── interfaces/
│ │ ├── mod.rs
│ │ ├── guild.rs
│ │ ├── bounty.rs
│ │ ├── payment.rs
│ │ └── common.rs
│ └── utils/
│ ├── mod.rs
│ ├── errors.rs
│ └── validation.rs
Key Data Structures
Define:
ContractRegistry (mapping of contract types to addresses)
ContractType enum (Guild, Bounty, Payment, Milestone, Dispute, Reputation, Treasury, Subscription, Governance)
Event struct (event_type, contract_source, timestamp, data)
EventType enum (comprehensive list of all platform events)
ContractVersion struct (contract_type, version, address, deployed_at)
- Error codes enum with descriptive messages
Core Functions to Implement
Registry Management:
register_contract(env, contract_type, address, version) → bool
get_contract_address(env, contract_type) → Address
update_contract(env, contract_type, new_address, new_version) → bool
get_all_contracts(env) → Vec<(ContractType, Address, Version)>
Event System:
5. emit_event(env, event_type, source_contract, data) → bool
6. get_events(env, filters, from_timestamp, limit) → Vec
7. subscribe_to_events(env, subscriber, event_types) → bool
Cross-Contract Operations:
8. call_guild_contract(env, function_name, params) → Result
9. call_bounty_contract(env, function_name, params) → Result
10. verify_cross_contract_auth(env, caller, target_contract, required_permission) → bool
Utilities:
11. validate_address(env, address) → bool
12. format_error(env, error_code, context) → Error
13. create_event_id(env) → u128
Standard Event Types
Define events for all major operations:
- Guild: Created, MemberAdded, MemberRemoved, RoleUpdated
- Bounty: Created, Funded, Claimed, Completed, Cancelled
- Payment: Distributed, PoolCreated, RecipientAdded
- Milestone: Created, Started, Submitted, Approved, PaymentReleased
- Dispute: Created, VoteCast, Resolved
- Reputation: Updated, AchievementAwarded, TierChanged
- Treasury: Deposited, WithdrawalProposed, TransactionExecuted
- Subscription: Created, PaymentExecuted, Cancelled
- Governance: ProposalCreated, Voted, ProposalExecuted
Constraints & Requirements
- Only admin can register/update contracts
- All contracts must emit standardized events
- Event data must be versioned for compatibility
- Cross-contract calls must validate permissions
- Contract addresses cannot be zero
- Version numbers must increment
- Events immutable once emitted
- Maximum event data size: 1KB
Edge Cases to Handle
- Calling unregistered contracts
- Contract address collisions
- Event storage limits (pagination)
- Malformed event data
- Circular contract dependencies
- Failed cross-contract calls
- Version incompatibilities
- Registry corruption recovery
✅ Definition of Done
Your PR should include:
🧪 Testing Requirements
Provide tests that cover:
- Contract registration and updates
- Address retrieval
- Event emission from multiple sources
- Event filtering and querying
- Cross-contract authorization
- Failed call handling
- Event pagination
- Version tracking
- Edge cases (invalid addresses, unregistered contracts)
- Integration scenarios (bounty creation → treasury funding → payment)
📚 Resources
🔍 Review Criteria
Your submission will be evaluated on:
- Completeness: Are all integration points covered?
- Reliability: Is cross-contract communication robust?
- Usability: Are interfaces developer-friendly?
- Performance: Is event querying optimized?
- Test Coverage: Are integration scenarios tested?
- Documentation: Are interfaces well-documented?
💡 Questions?
Comment on this issue if you need clarification on:
- Event schema design
- Cross-contract authorization patterns
- Registry security model
- Interface definition approach
🎯 Context & Impact
With multiple contracts (guild, bounty, payment, milestone, etc.), we need a robust integration layer to enable seamless communication and event coordination. Without this, contracts operate in silos and cannot react to each other's state changes.
Why this matters:
📋 Scope
Implement a Soroban integration layer that provides cross-contract communication, unified events, and contract registry management.
What's included:
What's NOT included:
🛠️ Implementation Guidelines
File Structure
Create the following files in the
contract/directory:Key Data Structures
Define:
ContractRegistry(mapping of contract types to addresses)ContractTypeenum (Guild, Bounty, Payment, Milestone, Dispute, Reputation, Treasury, Subscription, Governance)Eventstruct (event_type, contract_source, timestamp, data)EventTypeenum (comprehensive list of all platform events)ContractVersionstruct (contract_type, version, address, deployed_at)Core Functions to Implement
Registry Management:
register_contract(env, contract_type, address, version)→ boolget_contract_address(env, contract_type)→ Addressupdate_contract(env, contract_type, new_address, new_version)→ boolget_all_contracts(env)→ Vec<(ContractType, Address, Version)>Event System:
5.
emit_event(env, event_type, source_contract, data)→ bool6.
get_events(env, filters, from_timestamp, limit)→ Vec7.
subscribe_to_events(env, subscriber, event_types)→ boolCross-Contract Operations:
8.
call_guild_contract(env, function_name, params)→ Result9.
call_bounty_contract(env, function_name, params)→ Result10.
verify_cross_contract_auth(env, caller, target_contract, required_permission)→ boolUtilities:
11.
validate_address(env, address)→ bool12.
format_error(env, error_code, context)→ Error13.
create_event_id(env)→ u128Standard Event Types
Define events for all major operations:
Constraints & Requirements
Edge Cases to Handle
✅ Definition of Done
Your PR should include:
🧪 Testing Requirements
Provide tests that cover:
📚 Resources
🔍 Review Criteria
Your submission will be evaluated on:
💡 Questions?
Comment on this issue if you need clarification on: