The Programmatic Intents System is an on-chain smart contract platform that allows users to deploy complex token trading strategies using dynamic algorithms. Tokens move between vaults based on strategies expressed in Rainlang, an adaptable, on-chain domain-specific language.
Rainlang
Rainlang is an on-chain smart contract language designed for creating trading orders. Its intuitive syntax makes it accessible, allowing users of all levels to understand the intent behind the code. Rainlang is open-source, permissionlessly extensible, and supports multiple interpreters to accommodate various versions.
Orders
Orders written in Rainlang offer near-limitless flexibility in strategy design. Each order specifies a maximum trade amount and price ratio, and execution occurs only if these exact terms are met.
The logic used to reach the final agreement can originate from on-chain oracles and smart contract data, or from off-chain signed data provided by solvers. The strategy ensures the correctness of this data by verifying the signature. Any logic can then be implemented on top of this, offering highly flexible trading intent.
Strategies
Strategies are a combination of conditions following custom logic that result in one or multiple Orders.
Strategies written in Rainlang can be deployed to achieve multiple objectives including On- chain market making, Treasury strategies, Portfolio / Fund strategies, Stablecoin arbitrage, Broker token arbitrage, DCA, Volatility-based strategies, Momentum-based strategies, Reversal-based strategies, Correlation arbitrage, DCF flows on fixed income products, buy side / sell side strategies
Execution Model
Strategies remain live on-chain until removed, without the need for ongoing execution fees from the order creator. Instead, the protocol incentivizes third-party solvers to fulfill orders by capitalizing on arbitrage opportunities, ensuring continuous execution.
Vault System
Tokens are deposited into vaults created by users that function as virtual accounts. Orders reference these vaults for inputs and outputs, allowing for complex and interconnected strategies. All vaults operate under a self-custody model, maintaining user control. Users deploy their own funds in and out of these vaults from their wallet.
The ST0x orderbook is an on-chain smart contract that incorporate dynamic algorithms directing token transfers between vaults.
Strategies formulated using Rainlang must determine a maximum amount and a price ratio for but offer near-limitless flexibility beyond this. Furthermore, Rainlang itself is permissionless extensible – the protocol facilitates the integration of multiple interpreters supporting various versions of the language.
Instead of granting token approvals, users deposit their tokens into vaults that function as virtual accounts within the orderbook. Orders reference input/output vaults, and each order can have multiple inputs and outputs. For instance, a user could accept a range of different stablecoins for WETH. Additionally, distinct orders can reference the same vaults, enabling the construction of even more sophisticated meta-strategies.
Strategies deployed on-chain remain active until filled or removed. Order placers do not bear the gas costs associated with continuous strategy execution. Instead, the protocol fosters an ecosystem where fillers capitalize on arbitrage opportunities, guaranteeing active strategy execution without imposing burdens on the original order placer. Arbitrage can occur between two orders on the orderbook or between an order and external liquidity.
As a result, the ST0x orderbook resembles an intent-driven system.
Strategy writing: A user formulates a strategy including target assets and trade logic.