Skip to content

Repository files navigation

Zenith: High-Fidelity Cross-Chain Yield Optimization

Zenith Logo

🚀 Overview

Zenith is a production-grade lending automation vault that leverages Reactive Smart Contracts to autonomously rebalance liquidity between major lending protocols (Aave V3 and Compound V2) on Ethereum Sepolia. By utilizing the Reactive Network (Lasna), Zenith eliminates the need for centralized off-chain keepers, providing a trustless, event-driven pipeline for yield optimization.

🏗 Architecture

Zenith follows a "Signal Repeater" model designed specifically for the Reactive Network:

  1. YieldMonitor (Reactive Contract): Deployed on Lasna, it subscribes to yield-changing events on Sepolia (e.g., ReserveDataUpdated).
  2. Signal Propagation: When the Monitor detects a profitable yield differential, it emits a cross-chain Callback via the ReactVM.
  3. Local Audit & Rebalance: The CrossChainLendingVault on Sepolia receives the callback, performs a local yield audit to verify the opportunity, and reallocates assets between underlying pools.

Note

Zenith supports two environments: Demonstration (Mock Pools) for triggering yield shifts manually, and Verification (Official Protocols) for testing on live Aave V3 and Compound V2 deployments. Switch between them in the Dashboard header.

✨ Key Features

  • ERC-4626 Compliant: Standardized vault interface for seamless integration.
  • Trustless Automation: Rebalancing is triggered by live on-chain logs, processed by Lasna, and executed on Sepolia without human intervention.
  • Security-First Logic: The Vault performs its own yield check upon receiving a signal, ensuring that "garbage input" cannot trigger a loss-making rebalance.
  • Dynamic Configuration: On-chain management of rebalance thresholds (basis points), percentage shifts, and emergency pause controls.
  • Native Protocol Integration: 100% compatible with existing Aave V3 and Compound V2/V3 interfaces.

🔍 Workflow Proof (The Zenith Cycle)

To demonstrate production-grade reactivity, we have executed a full autonomous rebalancing cycle:

  1. Origin (APY Update): 0x9d713...6af
  2. Reactive (Signal Emitted): 0xdc334...3be
  3. Destination (Vault Rebalance): 0x1f8dd...5c6

Architecture Visualization

Zenith Architecture

Deployment & Setup

Environment

  1. Clone the repository.
  2. Setup environment variables:
    cp .env.example .env
    # Fill in PRIVATE_KEY and RPC URLs

Quick Deploy

  1. Sepolia Components:
    forge script script/DeploySepolia.s.sol --rpc-url $SEPOLIA_RPC_URL --broadcast --legacy
  2. Reactive Monitor:
    forge create src/reactive/YieldMonitor.sol:YieldMonitor \
      --rpc-url https://lasna-rpc.rnk.dev/ \
      --private-key $PRIVATE_KEY \
      --constructor-args \
      0x0000000000000000000000000000000000000000 \
      $POOL_A_ADDR $POOL_B_ADDR $ASSET_ADDR $VAULT_ADDR
  3. Linking: Call updateYieldMonitor(address) on the Vault with the deployed monitor address.

Verification & Walkthrough

A detailed step-by-step description of the rebalancing workflow, including transaction hashes, can be found in REACTIVE_BOUNTY_SUBMISSION.md.

Latest Verified State:

  • Sepolia Vault: 0x4e30c7578e27f3b66451d3b57277629d43df3c56
  • Lasna Monitor: 0x3830772Ec746270f79a65cd897cb16eA890759f5
  • Successful Rebalance: Verified via automated rebalance triggers following APY updates.

🖥 Frontend Dapp (Zenith UI)

The project includes a premium, high-fidelity frontend for monitoring and managing your autonomous strategy.

Key UX Improvements

  • Persistent Ledger: Transaction history is tracked via localStorage, ensuring data survival across page refreshes.
  • Sliding Window Sync: Historical event fetching uses a sliding window approach to prevent RPC timeouts while maintaining 100% data coverage.
  • Robust Multi-Step UI: "Approve" and "Deposit" flows are managed by a custom state machine for a seamless user experience.

Tech Stack

  • Framework: Vite + React
  • Connectivity: Reown Appkit + Wagmi + Viem
  • Animations: Framer Motion

Getting Started

  1. cd frontend
  2. npm install
  3. npm run dev

Installation

# Clone the repository
# (Foundry must be installed)
forge install
forge build

Testing

# Run all tests
forge test

Contract Addresses

Sepolia Testnet

  • Asset Token (MTK): 0xc866e23c6c889a67fd1b86be9a4871b6f3427ced
  • Aave Pool Mock: 0x16e4307a045b06b125446fe612860a98df51f245
  • Compound Pool Mock: 0xf11a3c025b7ab4d0c9ba15c3f8957cfc5102965b
  • Config Manager: 0x8401e37c4e5212b7f545bad02bd39ab89d6fbbb7
  • Main Vault: 0x4e30c7578e27f3b66451d3b57277629d43df3c56

Bounty Requirements Checklist

Requirement Compliance Status Proof / Location
Integrate 2+ Lending Pools ✅ Verified Aave V3 & Compound V2 Mocks (Vault.sol#L45)
Reactive Reactivity ✅ Verified YieldMonitor.sol reacts to log events via react() (YieldMonitor.sol#L92)
Meaningful Cross-Chain ✅ Verified Trustless rebalancing from Lasna to Sepolia based on yield signals.
Deployed on Lasna ✅ Verified 0x3830772Ec746270f79a65cd897cb16eA890759f5
Step-by-Step Hashes ✅ Verified See REACTIVE_BOUNTY_SUBMISSION.md
Design/Threat Write-up ✅ Verified Detailed sections in REACTIVE_BOUNTY_SUBMISSION.md
Security/Maintainability ✅ Verified 100% Foundry coverage + pause()/rescue() emergency gates.

License

MIT License

About

A cross-chain lending automation vault using Reactive Smart Contracts

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages