Fluid Contracts
A proprietary stateful migration system for smart contracts, unique to XOLIXBlock, allowing for seamless upgrades.
The Challenge of Smart Contract Upgrades
On traditional blockchains, upgrading a smart contract is a major challenge. Because contract code is immutable, developers must deploy an entirely new contract and then persuade users to manually migrate their assets and data from the old contract to the new one. This process is cumbersome, expensive, and introduces significant security risks.
The Fluid Contract Solution: Separating Logic and State
Fluid Contracts, which are part of our RAISE contract architecture, solve this problem by fundamentally separating a contract's logic from its state (data storage). The contract's address points to a proxy contract that delegates calls to a specific logic implementation contract, while the state is held in a persistent storage contract.
This architecture allows the logic contract to be swapped out for a new version via a governance vote, while the state and the public-facing contract address remain unchanged. Users don't have to do anything; the contract simply starts using the new code seamlessly.
How It Works (Proxy Pattern)
- **Initial Deployment:** A developer deploys a `Logic` contract, a `Storage` contract, and a `Proxy` contract. The Proxy holds the public address and delegates all calls to the initial `Logic` contract, which reads and writes to the `Storage` contract.
- **Deploying an Upgrade:** When a bug needs fixing or a new feature is added, the developer deploys a new `LogicV2` contract.
- **Governance Proposal:** A DAO proposal is created to upgrade the `Proxy` to point to the new `LogicV2` address.
- **Upgrade Execution:** Once the proposal passes, a function is called on the `Proxy` contract that updates its implementation address to the new `LogicV2` contract.
- **Seamless Transition:** All subsequent user interactions with the original `Proxy` address are now automatically routed to the new, upgraded logic, which continues to operate on the same persistent `Storage` contract. No migration is needed.
Key Advantages
- Patch Security Vulnerabilities: Critical bugs can be fixed in a live contract without requiring a full migration.
- Add New Features: Protocols can evolve and add new functionality over time in a secure and governed manner.
- Improved User Experience: Users are not burdened with the complex and risky process of migrating their assets to a new contract.
- Governance-Controlled: Upgrades are not controlled by a single developer but are subject to the decentralized governance process of the DAO, ensuring changes are made in the community's best interest.