The Ember Plugin System is a standardized framework that enables developers to integrate any DeFi protocols into the Ember ecosystem. The system creates a unified layer that enables seamless, type-safe access to DeFi protocols across the entire network.

Features

Modular Plugin System: Extensible architecture for DeFi protocol integrations Multi-Protocol Support: Lending, liquidity, swap, perpetuals protocol, NFT Type Safety: Full TypeScript support with Zod validation schemas Multi-Chain: Support for multiple blockchain networks Action-Based: Define actions for supply, borrow, swap, and more Plugin for AAVE V3: Complete lending protocol with supply, borrow, repay, and withdraw

Installation

npm install @emberai/onchain-actions-registry
pnpm add @emberai/onchain-actions-registry
yarn add @emberai/onchain-actions-registry

Core Architecture

Ember Plugin Interface

Every plugin implements the standardized EmberPlugin<Type> interface that defines the contract between protocols and the ecosystem.

  interface EmberPlugin<Type extends PluginType> {
    id?: string;                    // Unique identifier
    type: Type;                     // Plugin category (lending, liquidity, swap, perpetuals)
    name: string;                   // Human-readable name
    description?: string;           // Protocol description
    website?: string;              // Official protocol website
    x?: string;                    // Social media presence
    actions: ActionDefinition[];   // Available protocol actions
    queries: AvailableQueries[];   // Data retrieval capabilities
  }
This interface ensures every plugin provides:Metadata: Essential information about the protocol and pluginActions: Executable operations (supply, borrow, swap, etc.) with input/output token specificationsQueries: Read-only data access (positions, markets, health factors)Type Safety: Compile-time guarantees through TypeScript generics

Action-Based Design

Each plugin exposes specific DeFi actions with standardized interfaces:Input/Output Tokens: Define supported token transformationsCallback Functions: Handle the actual protocol interactionsFlexible Action System: Implement multiple strategies for the same action type

Plugin Registry

Central discovery system that manages plugin registration and lazy loading:
  const registry = new PublicEmberPluginRegistry();
  registry.registerDeferredPlugin(getProtocolPlugin(chainConfig));

Plugin Types

The registry supports four main plugin types:

Current Plugin Ecosystem

Plugin Discovery Flow

  1. Registration: Plugins register with the central registry during initialization
  2. Discovery: Agents query the registry for available actions by type
  3. Execution: Registry routes requests to appropriate plugin callbacks
  4. Validation: All inputs/outputs validated against TypeScript + Zod schemas

AAVE Lending Plugin Implementation

Complete reference implementation demonstrating all lending operations (supply, borrow, repay, withdraw) with comprehensive error handling and multi-strategy support.

Building Custom Plugins

The Plugin System is designed for rapid expansion. To get started, check out our contribution guidelines and our comprehensive guide on building custom plugins.