# Liquid Strategy Engine (LSE)

The **Liquid Strategy Engine (LSE)** is **Orby** AI’s on-chain capital automation module. It enables zk-verified AI agents to execute financial strategies directly on Ethereum — including staking, trading, lending, and rebalancing — all driven by inference outputs validated with zero-knowledge proofs.

Every action is verifiable. Every execution is programmable. Every strategy is a financial primitive.

***

**🔁 Execution Flow:**

```
zk-Inference → Ethereum Verifier Contract → StrategyExecution Struct → On-Chain DeFi Calls
```

***

**📦 StrategyExecution Struct:**

```solidity
struct StrategyExecution {
  bytes32 strategy_id;
  address agent_address;
  DeFiAction[] actions;
  uint64 timestamp;
  bytes32 inference_hash;
  bytes32 execution_digest;
}
```

This structure cryptographically commits each strategy to the zk-proven inference that triggered it. The `execution_digest` represents a hashed simulation outcome verified off-chain.

***

**⚙️ Supported Actions (Abstracted Enum):**

```solidity
enum DeFiAction {
  Swap(tokenIn, tokenOut, amount),
  Stake(protocol, token, amount),
  Borrow(protocol, collateral),
  Unstake(protocol, token),
  Custom(callData)
}
```

This action set gives agents universal access to DeFi protocols, AMMs, lending markets, or custom on-chain instructions.

***

**🌍 RWA Implications:**

`⦿ Model-Driven Capital: AI agents can manage tokenized capital pools, issuing yield-bearing RWA shares.`

`⦿ Proof-Based Performance: Every portfolio adjustment is backed by zk-proven strategy logic.`

`⦿ On-Chain Revenue Accounting: Profits and losses are automatically tied to model owners or token holders.`

> AI becomes a **composable money manager** — and every transaction is enforceable by code, auditable by proof, and monetizable as a Real World Asset.

***

**🧠 Example:**

```
          +---------------------------+
          |   zk-Restaking Model      |
          |  (Validator Scoring AI)   |
          +------------+--------------+
                       |
                       v
          +----------------------------+
          |     LSE Agent (Strategy)   |
          | Rebalances ETH allocations |
          +------------+---------------+
                       |
                       v
          +----------------------------+
          |     zk-Proof Generation    |
          |  (Executor Node off-chain) |
          +------------+---------------+
                       |
                       v
          +----------------------------+
          |   Ethereum Verifier SC     |
          | Validates model & output   |
          +------------+---------------+
                       |
                       v
          +----------------------------+
          |   Execution Digest Log     |
          |  (Proof of strategy run)   |
          +------------+---------------+
                       |
                       v
          +----------------------------+
          |    Fee Collection Module   |
          |  (e.g. 100 $ORBY per job)  |
          +------------+---------------+
                       |
                       v
          +------------------------------+
          |  RWA Token Contract (ERC-20) |
          | Distributes yield to holders |
          +------------------------------+
```
