About Adapters
The Role of Adapters
Adapters are Smart Contracts within the Nexera-FI SDK. They act as specialized modules that enable the dynamic interaction between the abstracted constructs of the SDK (primitives such as deposit
, borrow
, and withdraw
) and the concrete implementations of various DeFi protocols (i.e. Compound, Aave, Morpho, etc). Their primary role is to provide a standardized interface through which the SDK can execute actions on different blockchain protocols without requiring direct interaction with the protocols' smart contracts.
As such, Adapters are a foundational aspect of the Nexera-FI Development Kit, providing the necessary abstraction to allow developers to interact with multiple DeFi protocols efficiently and securely. Through the use of primitives and the Dynamic Strategy Orchestrator, the SDK facilitates a simplified yet powerful developer experience in creating sophisticated DeFi strategies.
The inherent complexity of each DeFi protocol is managed through the SDK's abstraction of their core functionalities into primitives. These primitives are simplified representations of the protocol's actions—such as liquidity provision, token swaps, borrowing, and repayment—that are consistent across different protocols. Adapters are never used directly by the SDK. The Orchestrator acts as a bridge, ensuring that the Actions of a DeFi strategy are accurately translated into on-chain transactions, interpreted by the Adapters.
From a technical standpoint, each adapter is a Smart Contract that encapsulates the ABI of the DeFi protocol it corresponds to. When a developer calls an SDK function, the call is routed through the Orchestrator to the appropriate adapter. The adapter then interacts with the protocol's smart contract, executing the desired action. For developers, this means that there is no need to write protocol-specific code. Instead, they can rely on the SDK's primitives to build their strategies. This reduces both the complexity and the potential for errors when interacting with smart contracts directly. Adapters are employed and initialized within Orchestrator contracts. You can read more about this here
Most adapters inherit from the Base Adapter
smart contract. At its core, there are a few basic operations:
Each one represents a primitive, that will then be executed on the DeFi underlying Protocol.
Every Adapter must implement the following function: