Soul Architecture
Soul is a revolutionary decentralized finance (DeFi) protocol designed to unify liquidity and borrowing capabilities across multiple blockchains. By integrating with base lending protocols like Aave, Compound, and Venus, Soul enables users to supply collateral on one chain and borrow assets on another—all without transferring assets between chains. This unique architecture makes Soul a key player in the evolution of cross-chain DeFi.
General Architecture
The architecture of Soul is designed to be modular, scalable, and secure, allowing seamless interactions between different blockchains and base protocols. Below is an overview of the key components:
1. Controller
- Monitors user lending activities.
Computes global risk profiles for users to assess borrow and remove collateral operations.
- Facilitates cross-chain cluster managment, by allowing connecting and disconnecting chains.
Aggregates user collateral and borrow positions from connected chains.
Allows liquidations of unhealthy borrowers.
Each Controller is deployed on a specific chain but can manage assets across multiple chains through the cross-chain messaging system.
2. SToken
Represents interest-bearing tokens corresponding to user-supplied collateral in a base protocol.
Maintains accurate records of user balances (supply, borrow, and collateral).
Supports delegated actions like supply, borrow, redeem, and repay within the base protocol.
3. PriceOracle
Aggregates price data from decentralized oracle providers like Chainlink.
- Supplies real-time, tamper-proof asset prices to the protocol.
Ensures accurate valuation for collateral and borrow positions across chains.
4. Router
- Facilitates secure cross-chain communication.
Uses messaging providers like LayerZero to transmit data (e.g., user balances, collateral updates) between chains.
Abstracts cross-chain complexities, making operations efficient and cost-effective.
Implements retry mechanisms to redeliver unsuccessful cross-chain messages.
5. InterestStrategy
Middleware that handles interest rate calculations and interactions with base protocols.
Adapts the logic for specific protocols (e.g., Aave, Compound) to support unique supply and borrow strategies.
5. Invoker
Lets users start borrow or collateral removal from any chain. They pay gas in that chain’s native token.
Uses the Router to forward the message to the Controller chain. This adds one extra cross-chain step.
5. ACLManager
Handles all roles and permissions in the Soul Protocol. It’s based on Aave’s design and OpenZeppelin’s AccessControl.
Each role has an adminRole that can grant or revoke it. The contract owner holds the default admin role and can change any role's admin.
Key roles include CONFIG ADMIN (for protocol settings), RISK ADMIN (for risk parameters), and EMERGENCY ADMIN (for pausing markets and providers).
How the Architecture Works Together
1. User Operations
Users interact with the protocol through either the Controller or the SToken contracts on their chosen chain.
Operations like
supply
,addCollateral
,repayBorrow
, andwithdraw
are executed in the corresponding SToken contract of the target market.
In contrast,borrow
,removeCollateral
, andliquidate
are executed through the Controller to which the market’s chain is connected.
2. Cross-Chain Synchronization
When users leverage cross-chain functionality, their data is transmitted via the Router to the remote Controller.
The Controller unifies collateral and borrow positions from all connected chains.
3. Risk Management
The PriceOracle provides accurate asset prices, while the Controller evaluates user risk profiles to approve or deny operations. This ensures user positions remain secure and protocol health is maintained.
Risk and emergency admins can trigger specific transactions to adjust risk parameters, such as changing collateral factors or pausing a money market, based on broader market conditions."
4. Interaction with Base Protocols
The SToken and InterestStrategy components handle all interactions with base protocols, such as depositing collateral, earning interest, or borrowing funds.
Key Features for Developers
- Modular Design
Each component is independently upgradeable, allowing to be adapted to new blockchains or base protocols as the DeFi landscape evolves.
- Cross-Chain Scalability
Built to support an expanding ecosystem of chains and protocols, Soul leverages LayerZero for reliable cross-chain communication.
- Transparency
All operations and transactions are recorded on-chain, providing full visibility into the protocol's mechanics.
- Flexibility
Developers can easily integrate Soul into their dApps, leveraging its unified liquidity model and robust smart contract infrastructure.
Example Workflow: Connecting a Chain and Borrowing
- User Connect Chains and Supplies Collateral
The user connects Polygon to the Ethereum Controller by triggering the
connectToChain
operation from the Polygon Controller.
The user supplies USDT as collateral in Polygon.
On both operations, the Polygon Controller communicates with the Controller on Ethereum to update the user's balances.
In a similar way, the user also connectes BNB Chain to the Ethereum Controller. After this, Polygon, BNB Chain and Ethereum form a single cluster, managed by Ethereum Controller.
- Borrow Request
The user initiates a borrow operation from BNB Chain's Venus protocol through the Ethereum Controller.
The Ethereum Controller validates the borrow request by assessing the user's global risk profile. This evaluation aggregates the user's collateral and borrow balances across all chains connected to the Ethereum Controller: such as Ethereum, Polygon, and BNB Chain.
After successful validation, the Router smart contract transmits a cross-chain message to the BNB Chain Controller.
Once the message is received by the BNB Chain Controller, funds are borrowed from the Venus protocol and sent to the user.
A cross-chain callback message is sent back to the Ethereum Controller to acknowledge the successful borrow operation.
Soul's modular, secure, and scalable architecture empowers developers to build next-generation DeFi applications. Whether integrating cross-chain liquidity or leveraging unified borrowing, Soul provides the tools to innovate with confidence.