๐Ÿ” Autonomous Rebalancing: The Solancer Logic

This is where Solancer's innovation shines, as the system is designed to be fully autonomous and on-chain, leveraging Solana's unique architecture without relying on external bots. The entire rebalancing logic is encapsulated within a single Solana Program, written in Rust.

How the Program Works:

  1. Vault as a Program-Derived Address (PDA): Each vault is a PDA owned by the Solancer Program. The vault's state (token balances, target weights, deviation threshold) is stored directly on the blockchain as part of the PDA account data. This design allows the program itself to have the sole authority to modify the vault's contents.

  2. Permissionless rebalance() Instruction: The Solancer program exposes a public rebalance() instruction that can be called by anyone. This instruction is permissionless, meaning no special privileges are required to execute it.

  3. On-Chain Deviation Check: When the rebalance() instruction is invoked, the program performs a series of crucial checks:

    • It reads the current token balances from the vault's account data.

    • Instead of calling an off-chain oracle, the program calls a decentralized aggregator's on-chain program (like Jupiter's) to get real-time swap quotes.

    • It then simulates a swap to determine if the current token ratios have deviated beyond the vault's predefined threshold.

  4. Autonomous Execution and Incentivization: If the deviation is significant, the program uses its on-chain authority to call Jupiter and execute the necessary swaps to re-align the token weights. The gas fee for this transaction is paid for by the user who sends it. However, the vault's program is designed to immediately transfer a small reward (a portion of the rebalancing fee) to that user, effectively refunding their gas and providing a positive incentive. This creates a powerful game theory loop: anyone can check a vault's state, and if it's out of balance, they have a financial reason to send a transaction to correct it.

This model completely replaces the need for a centralized bot network, making the system robust, decentralized, and truly autonomous.

Last updated