feat: add on-chain event logging for transfers and conversions#23
Conversation
|
@Samuel1505 please resolve confilct and fix build error |
|
Conflict fixed @portableDD |
portableDD
left a comment
There was a problem hiding this comment.
fix build error, your work is failing to build, o please find the error throughthe ci/cd, and fix
…uild error in escrow.rs
|
build error fixed @portableDD |
portableDD
left a comment
There was a problem hiding this comment.
please check properly build is still failing
|
can you check now? @portableDD |
|
@Samuel1505 BUILD IS STILL FAILING this os the error Compiling stellar-multisig-contract v0.1.0 (/home/runner/work/NexaFx-contract/NexaFx-contract) error: could not compile Caused by: |
|
well done @Samuel1505 but you still got some errors format error Run cargo fmt --all -- --check // Event topics for efficient filtering and indexing // Helper macro for importing symbol_short
|
Description
Added an on-chain event logging for transfers and conversions in the contract
This PR introduces a robust event emission system for tracking all DeFi operations across escrow, swap, token, multisig, and system functions. The implementation provides structured event data that enables efficient monitoring, indexing for both on-chain and off-chain applications.
Related Issues #21
Changes Made
Created an event.rs file in the contract/src
Core Event Infrastructure
Event Topics: Added 5 categorized topics (ESCROW, SWAP, MULTISIG, TOKEN, SYSTEM) for efficient event filtering
Event Data Structures: Implemented 12 comprehensive event data types covering all DeFi operations
Unified Event Enum: Created DeFiEvent enum with tuple variants for type-safe event handling
Event Types Implemented
Escrow Events: EscrowCreated, EscrowReleased, EscrowRefunded
Swap Events: SwapOfferCreated, SwapOfferAccepted
Token Events: TokenTransferred, TokenMinted
Multisig Events: MultisigTransactionProposed, MultisigTransactionExecuted, MultisigConfigUpdated
System Events: WalletToppedUp, ContractError
Utilities
EventEmitter: Static helper methods for easy event emission with automatic timestamp handling
EventQuery: Filter utilities for backend integration and event querying
🔧 Key Features
Automatic Data Population
Timestamps automatically set using env.ledger().timestamp()
Exchange rate calculations for swap events
Timeout calculations for escrow events
Backend Integration Ready
Topic-based filtering for efficient event indexing
Structured data format compatible with block explorers
Support for real-time event streaming
Error Handling
Comprehensive error event tracking with context data
Contract address attribution for debugging
Serialized error messages and context
How to Test
Screenshots (if applicable)
Checklist