-
Notifications
You must be signed in to change notification settings - Fork 36
Open
Labels
backendCore blockchain logic and keeper implementationsCore blockchain logic and keeper implementationschoreImprovement to existing functionalityImprovement to existing functionalitycross-chainMulti-chain integrations and protocolsMulti-chain integrations and protocolsibcInter-Blockchain Communication protocolInter-Blockchain Communication protocol
Description
This issue was migrated from sonr-io/sonr2#222
Migration date: Fri Oct 3 03:17:15 PM EDT 2025
Summary
The DEX module's ICA-based message handlers need to be fully implemented to enable cross-chain trading operations. Currently, all message handlers contain TODO items and placeholder implementations that need to be replaced with actual ICA functionality.
Current Status
The DEX module has foundational ICA controller logic implemented (x/dex/keeper/ica_controller.go) but the message handlers and DWN integration are incomplete.
TODOs to Implement
Message Handlers (x/dex/keeper/msg_server.go)
ExecuteSwap (Lines 60-66)
- Validate DID and UCAN token
- Get ICA account for this DID and connection
- Construct swap message for remote chain
- Send ICA packet with swap instruction
- Track transaction in DWN
ProvideLiquidity (Lines 74-80)
- Validate DID and UCAN token
- Get ICA account for this DID and connection
- Construct liquidity provision message for remote chain
- Send ICA packet with liquidity instruction
- Track transaction in DWN
RemoveLiquidity (Lines 88-94)
- Validate DID and UCAN token
- Get ICA account for this DID and connection
- Construct liquidity removal message for remote chain
- Send ICA packet with removal instruction
- Track transaction in DWN
CreateLimitOrder (Lines 102-108)
- Validate DID and UCAN token
- Get ICA account for this DID and connection
- Construct limit order message for remote chain
- Send ICA packet with order instruction
- Track order in DWN
CancelOrder (Lines 116-122)
- Validate DID and UCAN token
- Get ICA account for this DID and connection
- Construct order cancellation message for remote chain
- Send ICA packet with cancellation instruction
- Update order status in DWN
DWN Integration (x/dex/keeper/dwn_integration.go)
Storage Operations
- Line 189-190: Implement actual DWN storage when DWN keeper is available
// TODO: Implement actual DWN storage when DWN keeper is available // k.dwnKeeper.StoreRecord(ctx, record.DID, record.ID, data)
Query Operations
- Line 212-213: Implement actual DWN query when DWN keeper is available
// TODO: Implement actual DWN query when DWN keeper is available // records := k.dwnKeeper.QueryRecords(ctx, did, recordType, limit)
Deletion Operations
- Line 231-232: Implement actual DWN deletion when DWN keeper is available
// TODO: Implement actual DWN deletion when DWN keeper is available // return k.dwnKeeper.DeleteRecord(ctx, did, recordID)
Implementation Requirements
Authentication & Authorization
- Integrate with DID module for identity validation
- Implement UCAN token verification for operation authorization
- Ensure proper access controls for each operation type
ICA Integration
- Utilize existing ICA controller logic in
ica_controller.go - Implement proper message construction for each DEX operation type
- Handle ICA packet timeouts and error responses
- Track transaction sequences and handle acknowledgments
DWN Integration
- Wire up DWN keeper when available
- Implement proper record schemas for each operation type
- Ensure data consistency between chain state and DWN storage
- Handle DWN storage failures gracefully
Error Handling
- Implement comprehensive error handling for ICA operations
- Provide meaningful error messages for failed operations
- Handle partial failures (e.g., ICA success but DWN storage failure)
Acceptance Criteria
- All message handlers have complete implementations (no TODOs remain)
- DID and UCAN validation is implemented and working
- ICA packets are successfully sent for each operation type
- DWN integration stores appropriate records for each operation
- Unit tests cover all new functionality
- Integration tests verify end-to-end operation flows
- Error handling is comprehensive and user-friendly
Related Files
x/dex/keeper/msg_server.go- Main message handlersx/dex/keeper/dwn_integration.go- DWN storage operationsx/dex/keeper/ica_controller.go- Existing ICA foundationx/dex/types/- Type definitions and schemas
Dependencies
- DWN module integration (may need coordination with DWN team)
- DID module for identity validation
- UCAN implementation for authorization tokens
- ICA controller functionality (already implemented)
Technical Notes
The existing ica_controller.go provides the foundation with:
SendDEXTransaction()method for sending ICA packets- Account management and validation
- Channel capability handling
The implementation should leverage this existing functionality rather than reimplementing ICA logic.
Metadata
Metadata
Assignees
Labels
backendCore blockchain logic and keeper implementationsCore blockchain logic and keeper implementationschoreImprovement to existing functionalityImprovement to existing functionalitycross-chainMulti-chain integrations and protocolsMulti-chain integrations and protocolsibcInter-Blockchain Communication protocolInter-Blockchain Communication protocol