Skip to content

Align defi Module — Protocol Adapter Registry & Strategy Discovery #9

@grantfox-oss

Description

@grantfox-oss

Description
The AaveAdapter implements the ProtocolAdapter interface, but there is no registry or factory for protocol adapters. Adding a new protocol (Compound, Uniswap, etc.) requires manual wiring with no discovery mechanism. The DeFiModule doesn't register the adapter as a provider, so it can't be injected into services. This blocks all future DeFi protocol integrations.

Direction

  1. Create src/defi/protocols/protocol-registry.service.ts following the same registry pattern as StrategyRegistry in core/auth.
  2. Register AaveAdapter as a provider in DeFiModule and auto-register it with the registry on module init.
  3. Define a ProtocolAdapterMetadata interface so adapters self-describe their supported chains and capabilities.
  4. Expose a getAdapter(protocolName: string) method on the registry for runtime protocol selection.
  5. Add a controller endpoint GET /api/v1/defi/protocols that lists available protocols.

Definition of Done

  • A ProtocolRegistry service exists and auto-discovers all registered protocol adapters.
  • Adding a new protocol requires only: (a) create adapter file, (b) register in module providers.

Acceptance Criteria

  • ProtocolRegistry service is created with register() and getAdapter() methods
  • AaveAdapter is registered as a provider in DeFiModule
  • DeFiModule.onModuleInit() registers all adapters with the registry
  • GET /api/v1/defi/protocols returns the list of available protocols
  • Adding a stub adapter (e.g., CompoundAdapter) requires no changes to the registry
  • npm run build succeeds

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions