Initializing Adapters
Nexera-Fi Adapters feature an initialize
function for storing essential operational data in specific storage slots.
Each Adapter posseses its own unique identifier for specifying the associated storage slot.
Orchestrator instances leverage their initializeAdapter
function, employing delegatecall, to invoke whitelisted Adapters' initialize
function.
This allows an Orchestrator to configure Adapters within its own storage context.
Although delegatecall executes code in the Adapter's context, changes are stored in the Orchestrator's storage in specific slots dedicated to each Adapter.
Ensuring seamless collaboration between Orchestrator instances and Adapters, it is imperative that the Adapters be initialized, a crucial step that enables the Orchestrator to effectively leverage their functionalities within its storage context.
The forthcoming example demonstrates how to initialize Adapters within your Orchestrator using the
Nexera-Fi SDK.
Make sure you've appropriately initialized the NexeraFiSDK, covering configurations essential for further interactions.
Initializing Adapters in Orchestrators
Typescript Example
Connect to your Orchestrator instance.
Get the target Adapters.
Note: The target Adapters must be whitelisted in your Orchestrator before initialization can take place.
Ensure you have already whitelisted the target Adapters by calling the isWhitelistedAdapter
view function of your Orchestrator instance.
Else, whitelist them by calling the addWhitelistedAdapters
function.
Finally, initialize each Adapter by calling the initializeAdapter
function of your Orchestrator instance.
Python Example
Get Orchestrator instance
Get the target Adapters address & initialize data.
Note: The target Adapters must be whitelisted in your Orchestrator before initialization can take place.
Ensure you have already whitelisted the target Adapters by calling the isWhitelistedAdapter
view function of your Orchestrator instance.
Else, whitelist them by calling the addWhitelistedAdapters
function.
Finally, initialize each Adapter by calling the initializeAdapter
function of your Orchestrator instance.
Note: After successful initialization, the Orchestrator can effectively utilize the respective Adapters, provided they remain whitelisted for continued collaboration.