All projects

CholeeFi

Automated DeFi lending with personal Agent contracts powered by Chainlink CRE

DeFi & Tokenization CRE & AI World Tenderly

What it is

CholeeFi - Hackathon Submission

1-Line Description

Automated DeFi lending with personal Agent contracts powered by Chainlink CRE

Full Project Description

CholeeFi is a decentralized lending protocol on World Chain that automates collateral management through personal Agent smart contracts and Chainlink CRE (Compute Runtime Environment).

The Problem
In DeFi lending, users must constantly monitor their positions to avoid liquidation. A sudden price drop can wipe out collateral before a user has time to react. The DeFi lending market exceeds $76B in TVL (DefiLlama, March 2026), yet none of the top 15 lending protocols offer built-in automated collateral management. Users either watch positions manually 24/7 or depend on separate third-party tools like DeFi Saver that aren't integrated into the protocol itself.

The Solution
CholeeFi gives every user a dedicated Agent smart contract that manages their lending positions autonomously. Users define strategies with conditions like "if my health factor drops below 1.5, swap collateral to stablecoin" — and the system executes automatically, around the clock, without any manual intervention.

Architecture

CholeeFi is composed of 6 repositories, each handling a distinct layer of the system:

  1. Smart Contracts (choleefi-sc): The core protocol built with Solidity, Foundry, and OpenZeppelin. Includes:

    • LendingPool: Manages supply/borrow/repay/withdraw with configurable LTV ratios per pool.
    • AgentFactory: Deploys a personal UUPS-upgradeable Agent contract for each user. Agents hold user positions and execute strategies on their behalf — no shared vaults, no third-party custody.
    • CholeeConsumer: Receives automation triggers from Chainlink CRE via the Keystone Forwarder (ReceiverTemplate). Supports 3 on-chain action types: Execute (lend to pool), Swap (via DEX), and Withdraw (from pool).
    • IsHealthy: Computes health factors for each position using oracle prices, with boosted LTV ratios and liquidation thresholds for World ID-verified users.
    • CholeeWorldID: Integrates World ID for human verification. Verified users are stored in an isVerifiedHuman mapping, enabling Sybil-resistant access to better borrowing terms.
    • OrbitaPriceConsumer: Receives and stores verified price reports from Chainlink Data Streams.
  2. Chainlink CRE Automation (choleefi-cre): A CRE workflow that runs every 30 seconds (*/30 * * * * * schedule) and:

    • Fetches all active user strategies from the backend API
    • Reads on-chain position data (health factors, borrow amounts, collateral levels)
    • Evaluates user-defined conditions: health_factor_below, health_factor_above, borrow_above, collateral_below
    • When conditions are met, encodes the appropriate action and submits it on-chain to CholeeConsumer, which forwards execution to the user's Agent contract
    • Currently configured for 2 pools: WETH/USDC and WBTC/USDC
  3. Data Streams Price Keeper (choleefi-datastreams): An offchain service that keeps oracle prices fresh:

    • Fetches signed price reports from Chainlink Data Streams API for ETH/USD and BTC/USD feeds
    • Submits reports on-chain when price deviates >1% or every 30 seconds (heartbeat)
    • Reports are verified through Chainlink's VerifierProxy with DON signature validation before storage
    • Built with the @chainlink/data-streams-sdk and viem
  4. Indexer (choleefi-indexer): A Ponder-based GraphQL indexer that listens to on-chain events in real-time — pool creations, deposits, borrows, strategy executions — providing a queryable API for the frontend and backend. Live at indexer.cholee.site.

  5. Backend API (choleefi-backend): A Bun + Hono REST API with PostgreSQL that manages user strategies (CRUD operations). Strategies define what action to take and under what condition, which the CRE workflow reads and evaluates every cycle.

  6. Frontend (frontend): User-facing dashboard for connecting wallets, supplying/borrowing assets, creating protection strategies, and monitoring positions. Accessible at app.cholee.site.

User Flow

  1. User connects wallet and optionally verifies with World ID for better borrowing terms
  2. User supplies collateral (WETH or WBTC) to a lending pool and borrows USDC
  3. User creates a protection strategy via the dashboard (e.g., "if health factor < 1.3, withdraw 50% collateral")
  4. Strategy is stored in the backend and picked up by the CRE workflow
  5. Every 30 seconds, the CRE checks the user's on-chain position against their strategy conditions
  6. When a condition triggers, the CRE sends an action to CholeeConsumer → Agent executes automatically
  7. User's position is protected without any manual intervention

Chainlink Integration

  • Chainlink CRE: Core automation engine — the entire strategy monitoring and execution pipeline runs as a CRE workflow. This is not a simple Keeper/Upkeep; it's a full compute workflow that fetches off-chain data (strategies from API), reads on-chain state (positions, health factors), evaluates conditions, and submits transactions.
  • Chainlink Data Streams: Provides the price oracle layer. The Data Streams keeper fetches DON-signed reports and submits them on-chain, where they're verified through VerifierProxy before being stored in OrbitaPriceConsumer. These prices feed directly into health factor calculations.

What's Built & Deployed
CholeeFi is fully deployed on World Chain Sepolia (chainId: 4801) with:

  • 2 live lending pools (WETH/USDC, WBTC/USDC)
  • 3 on-chain action types (swap, lend, withdraw)
  • 30-second position monitoring intervals
  • Real-time price feeds for ETH/USD and BTC/USD
  • World ID human verification integration
  • Full end-to-end automation from strategy creation to on-chain execution

Tech Stack

  • Smart Contracts: Solidity, Foundry, OpenZeppelin, UUPS Proxy Pattern
  • Automation: Chainlink CRE (Compute Runtime Environment)
  • Oracles: Chainlink Data Streams (@chainlink/data-streams-sdk)
  • Identity: World ID (Sybil resistance)
  • Backend: Bun, Hono, PostgreSQL
  • Indexer: Ponder (GraphQL)
  • Frontend: app.cholee.site
  • Chain Interaction: viem
  • Chain: World Chain Sepolia

Demo Video

https://www.youtube.com/watch?v=f8EegjIAZoA

How it Works

CholeeFi is built as a modular system across 6 repositories, with Chainlink CRE and Data Streams at its core.

Smart Contract Layer — The protocol is written in Solidity using Foundry and OpenZeppelin. The LendingPool contract handles supply, borrow, repay, and withdraw operations with per-pool configurable LTV ratios. Each user gets a personal Agent contract deployed via AgentFactory — these are UUPS-upgradeable proxies that hold the user's positions and execute strategies autonomously. CholeeConsumer extends Chainlink's ReceiverTemplate to receive CRE automation triggers via the Keystone Forwarder, supporting 3 action types: Execute (lend to pool), Swap (via DEX), and Withdraw (from pool). IsHealthy computes health factors using oracle prices, with boosted LTV ratios and liquidation thresholds for World ID-verified users. CholeeWorldID integrates World ID's verifyAndExecute for on-chain human verification, storing results in an isVerifiedHuman mapping.

Chainlink CRE Automation — The automation engine is a Chainlink CRE workflow written in TypeScript that runs on a */30 * * * * * cron schedule (every 30 seconds). Each cycle, the workflow: (1) fetches all active strategies from the backend REST API, (2) reads on-chain position data for each user's Agent — health factors, borrow amounts, collateral levels, (3) evaluates user-defined conditions (health_factor_below, health_factor_above, borrow_above, collateral_below), and (4) when a condition is met, encodes the action parameters and submits a transaction to CholeeConsumer on-chain. CholeeConsumer then forwards the action to the user's Agent contract for execution. The workflow is configured for 2 pools (WETH/USDC, WBTC/USDC) via a staging config.

Chainlink Data Streams Oracle — A separate offchain keeper service fetches signed price reports from the Chainlink Data Streams API using @chainlink/data-streams-sdk with HMAC authentication. It monitors ETH/USD and BTC/USD feeds, submitting reports on-chain to OrbitaPriceConsumer when price deviates >1% or every 30 seconds (heartbeat). On-chain, reports are verified through Chainlink's VerifierProxy with DON signature validation before the price is stored. These prices are used by IsHealthy for health factor calculations. The keeper is built with viem for chain interaction and node-cron for scheduling.

Backend & Indexer — The backend is a Bun + Hono REST API with PostgreSQL that provides CRUD operations for user strategies. Each strategy defines a condition type, threshold, action type, and parameters. The CRE workflow reads these strategies every cycle. The indexer is built with Ponder, listening to on-chain events (pool creations, deposits, borrows, withdrawals, strategy executions) and exposing them via a GraphQL API at indexer.cholee.site.

Frontend — The user dashboard at app.cholee.site allows users to connect wallets, supply/borrow assets, create and manage protection strategies, verify with World ID, and monitor their positions in real-time.

Deployment — All contracts are deployed on World Chain Sepolia (chainId: 4801). The backend, indexer, and frontend are hosted and accessible via cholee.site subdomains.

Demo Video

https://www.youtube.com/watch?v=f8EegjIAZoA

Links

Created by

  • Rudi Setiawan Ghoza
  • Rifki Easy