Plugins
Last updated
Last updated
Traditionally DEXs relied on monolithic, immutable architectures, where the source code operated as a single unchangeable entity (code is permanent law).
Updating such systems required migrating liquidity, which introduced added costs and inefficiencies.
The introduction of Integral changed this model by separating the core liquidity storage from external functionality modules like oracles and fee calculation.
This architecture preserves the critical liquidity storage and swap calculation logic within an immutable Core, while allowing external functionalities to be updated independently through plugins.
There is no need for migrating the liquidity anymore. Plugins can be created by the DEX teams (like SwapX does) or external developers incentivized by fee structures.
Essentially, a plugin is just a smart contract that integrates with a pool’s contract to extend its functionality. Each pool can have one plugin initialized at a time, though Plugins can be replaced or disconnected.
Plugins can execute arbitrary blockchain actions, including interacting with other contracts, modify pool fees, and perform additional validations. It’s important to mention that using SwapX with integrated plugins, users and LPs retain full self-custody of their assets. Plugin cannot directly access or take users’ liquidity or alter the mathematical logic of pool operations.
Algebra Integral introduces an entire Plugin Marketplace. Developers can bring their plugin ideas and implement them in Integral-powered DEXes, like SwapX. If a plugin is implemented, developers will earn a share of the fees generated through transactions that use their plugin. Despite the fact that the plugin concept is relatively new, multiple plugins are already live, developed by various teams.
Other key components of Algebra Integral architecture are hooks. They serve as connection points between plugins and pools. These are functions triggered before or after key events, enabling bidirectional communication.
When a hook is activated for a pool, it calls the corresponding plugin function, which is defined in the Algebra Plugin Interface. Plugins can implement arbitrary logic within these functions, including operations on the same liquidity pool.
The Plugin Factory streamlines plugin creation by deploying plugins and initializing dynamic fee configurations. During the creation of a new pool, the system automatically sets up the plugin and links it to the pool.
This triggers a process where the plugin configures the pool’s settings, activates necessary functions, and enables adjustable fees. The Plugin Factory can also store a farming center address for plugin interactions with farming mechanisms.
There are a lot of use cases that can be created via plugins. Some of them include various dynamic fee options, gas fee discounts or compensation for trades, mitigating impermanent loss, staking-related fee discounts, and more.