Skip to content

Najnomics/ConfluxMind

Repository files navigation

ConfluxMind

Autonomous DeFAI yield optimization — your capital, always working at peak efficiency.

Demo Video | Slide Deck | Live App | About Page


Overview

ConfluxMind is an autonomous, AI-powered yield aggregation protocol built on Conflux eSpace. Users deposit assets into a non-custodial ERC-4626 vault; an on-chain AI strategy agent continuously reads live yield signals across Conflux's DeFi ecosystem — dForce Unitus lending markets, SHUI Finance liquid staking, and WallFreeX liquidity pools — and autonomously rebalances allocations toward the highest risk-adjusted returns. All user interactions are gasless via Conflux's native Fee Sponsorship mechanism, enabling zero-friction onboarding for any wallet.

ConfluxMind is the first fully on-chain DeFAI (Decentralized Finance + AI) yield manager on Conflux — delivering the "DeFAI era" vision that dForce has articulated, in production.


Hackathon

Global Hackfest 2026 | 2026-03-23 – 2026-04-20

Prize Targets: Main Award ($1,500) + Best AI + Conflux Project ($500)


Team

  • Nosakhare Jesuorobo — Solo Developer (GitHub: @najnomics, Discord: najnomics)

Problem Statement

DeFi yield on Conflux eSpace is fragmented across multiple protocols — dForce Unitus lending, SHUI Finance CFX staking, WallFreeX liquidity pools — each with independently fluctuating APYs. Today, a user who wants to maximize returns must:

  1. Monitor rate changes across all protocols manually, in real time
  2. Calculate and compare risk-adjusted yields themselves
  3. Execute multiple transactions to rebalance — each costing gas
  4. Repeat this process continuously as market conditions shift

This is operationally impossible for most users. Capital sits idle in suboptimal positions, leaking yield every hour. The result: Conflux's DeFi ecosystem has deep liquidity primitives but no intelligent layer to route capital efficiently between them.

For protocols like dForce, this means TVL that underperforms its potential. For users, it means systematic wealth erosion through inaction.


Solution

ConfluxMind introduces a three-layer architecture:

1. The Vault Layer — An ERC-4626 compliant smart contract that accepts user deposits in supported assets (USDT0, AxCNH, CFX). Shares are minted representing proportional ownership of vault assets plus accrued yield. Withdrawals are available at any time, no lockups.

2. The AI Strategy Layer — A Solidity StrategyController contract maintains a weighted allocation across registered yield strategies. Strategy weights are updated by an AIflux-inspired autonomous agent (built on the Eliza action pattern from cfxdevkit/AIflux) that uses a 3-factor scoring model to evaluate each strategy:

  • Yield Rate (40%) — current on-chain APY from strategy contracts
  • Utilization Risk (30%) — pool utilization ratio (higher utilization = higher withdrawal delay risk)
  • Liquidity Depth (30%) — TVL from GeckoTerminal via @cfxdevkit/geckoterminal

The agent computes composite scores, converts them to allocation weights, and submits rebalance(weights[]) on-chain when the delta exceeds the configured threshold. All reasoning is logged transparently.

3. The Gasless UX Layer — Conflux's Fee Sponsorship mechanism is used to sponsor all vault deposit, withdraw, and claim transactions. A GasSponsorManager contract auto-maintains the sponsor whitelist, funded from a portion of protocol fees. Users with zero CFX balance can still interact fully.

The result: deposit once, earn optimized yield perpetually, withdraw whenever.


Go-to-Market Plan

Target Users

  • Primary: DeFi-native users on Conflux eSpace seeking passive yield without manual management overhead — estimated 15,000–25,000 active eSpace addresses as of Q1 2026.
  • Secondary: Users bridging USDT0 or AxCNH to Conflux for the first time via KinetFlow, Meson, or Orbiter — ConfluxMind is their first stop.
  • Tertiary: DAOs and protocol treasuries on Conflux seeking automated treasury yield management.

Distribution

  • Phase 1 (Hackathon): Deploy on Conflux eSpace testnet. Live demo with real Conflux testnet CFX. Submission to Global Hackfest 2026.
  • Phase 2 (Post-Hackathon, Month 1–2): Mainnet launch with USDT0 and AxCNH as initial supported assets. Apply for Conflux Ecosystem Grants Program (fast-tracked for hackathon winners). Partnership outreach to dForce and SHUI Finance for co-marketing.
  • Phase 3 (Month 3–6): Expand strategy integrations (Swappi, GinsengSwap). Introduce protocol fee switch (10% of yield → protocol treasury). Launch referral program with on-chain attribution. Target $500K TVL within 90 days of mainnet.

Growth Mechanics

  • Gasless UX removes the single biggest friction for new users — they never need to acquire CFX before using the protocol.
  • Auto-compounding creates compounding retention — once deposited, users have no reason to leave.
  • Transparent AI signals — publish rebalance reasoning publicly on-chain to build trust with DeFi-native audiences.

Key Metrics

Metric 30-Day Target 90-Day Target
TVL $50K $500K
Unique depositors 200 1,500
Rebalance events 30 150
Gas sponsored (USD) $500 $3,000

Conflux Integration

ConfluxMind is built natively for Conflux eSpace and leverages multiple Conflux-specific capabilities:

  • Core Space
  • eSpace — All smart contracts deployed on Conflux eSpace (EVM-compatible, low gas, high TPS)
  • Cross-Space Bridge
  • Gas SponsorshipGasSponsorManager.sol sponsors all user-facing transactions (deposit, withdraw, claimYield). Users with zero CFX can fully interact with the protocol.
  • Built-in Contracts — Uses Conflux's SponsorWhitelistControl built-in contract at 0x0888000000000000000000000000000000000001 for programmatic Fee Sponsorship management.
  • Partner Integrations:
    • dForce Unitus — Primary lending yield strategy. Deposits assets into Unitus lending markets; harvests interest continuously.
    • SHUI Finance — CFX liquid staking strategy. Converts CFX deposits to sFX for staking yield; sFX held in vault as a yield-bearing position.
    • WallFreeX — Stablecoin LP strategy. Provides AxCNH/USDT liquidity to WallFreeX pools; earns swap fees.
    • Meson.fi — Cross-chain entry: users bridge USDT0 or AxCNH from external chains directly into ConfluxMind deposits in one transaction.

Features

  • Autonomous Yield Optimization — AIflux-inspired AI agent continuously monitors and rebalances across dForce, SHUI Finance, and WallFreeX using a 3-factor scoring model (yield rate, utilization risk, liquidity depth)
  • ERC-4626 Compliant Vault — Standard share accounting; composable with any DeFi protocol that reads ERC-4626 vaults
  • Gasless User Experience — Conflux's Fee Sponsorship mechanism eliminates all gas costs for end users; zero CFX required to deposit or withdraw
  • Multi-Asset Support — Accepts USDT0, AxCNH, and CFX as deposit assets; auto-converts to strategy-optimal form
  • Real-Time Rebalancing — AI agent triggers rebalance when yield delta between strategies exceeds a configurable threshold (default: 50bps)
  • Transparent AI Reasoning — All rebalance decisions are logged with full 3-factor scoring breakdown visible on the dashboard and on-chain
  • Non-Custodial — Users hold ERC-4626 shares; no admin key can access underlying assets
  • Emergency Withdrawal — Circuit breaker allows immediate full withdrawal bypassing keeper logic if triggered

Technology Stack

  • Frontend: React 18, Next.js 14, Wagmi v2, Viem, TailwindCSS, Recharts, @cfxdevkit/geckoterminal
  • AI Agent: AIflux-inspired (Eliza action pattern), Node.js 20, TypeScript, ethers.js v6, @cfxdevkit/geckoterminal, @conflux-devkit/node
  • Blockchain: Conflux eSpace (Chain ID: 1030 mainnet / 71 testnet)
  • Smart Contracts: Solidity ^0.8.24, Foundry (forge, cast, anvil), OpenZeppelin ERC-4626
  • Protocol Integrations: dForce Unitus, SHUI Finance sFX, WallFreeX router
  • Conflux Ecosystem Tools: @cfxdevkit/geckoterminal, @conflux-devkit/node, SponsorWhitelistControl built-in
  • Testing: Forge test suite with 31 passing tests

Setup Instructions

Prerequisites

  • Node.js v20+
  • Foundry (curl -L https://foundry.paradigm.xyz | bash && foundryup)
  • Git
  • Conflux wallet (Fluent Wallet or MetaMask with Conflux eSpace network added)
  • Testnet CFX from Conflux faucet

Installation

  1. Clone the repository

    git clone https://github.com/najnomics/conflux-mind
    cd conflux-mind
  2. Install Foundry dependencies

    forge install
  3. Install frontend and keeper dependencies

    npm run install:all
  4. Configure environment

    cp .env.example .env

    Edit .env with your configuration:

    # Conflux eSpace
    CONFLUX_ESPACE_RPC=https://evm.confluxrpc.com
    CONFLUX_ESPACE_TESTNET_RPC=https://evmtestnet.confluxrpc.com
    CHAIN_ID=1030
    
    # Deployer
    PRIVATE_KEY=your_private_key_here
    
    # Protocol addresses (eSpace mainnet)
    DFORCE_UNITUS_COMPTROLLER=0x...
    SHUI_FINANCE_STAKING=0x...
    WALLFREEX_ROUTER=0x...
    USDT0_ADDRESS=0x...
    AXCNH_ADDRESS=0x...
    
    # Keeper
    KEEPER_REBALANCE_THRESHOLD_BPS=50
    KEEPER_POLL_INTERVAL_SECONDS=300
    
    # Sponsor
    SPONSOR_FUND_AMOUNT_CFX=1000
  5. Compile contracts

    forge build
  6. Run the application

    # Start frontend
    npm run dev
    
    # Start keeper (in separate terminal)
    npm run keeper

Testing

# Run full test suite
forge test -vvv

# Run with Conflux eSpace mainnet fork
forge test --fork-url https://evm.confluxrpc.com -vvv

# Run specific test file
forge test --match-path test/ConfluxMindVault.t.sol -vvv

# Generate coverage report
forge coverage --report lcov

Usage

For Users

  1. Connect Wallet — Open the ConfluxMind app and connect Fluent Wallet or MetaMask (configured for Conflux eSpace). No CFX needed — all gas is sponsored.

  2. Select Asset & Amount — Choose your deposit asset (USDT0, AxCNH, or CFX) and enter an amount.

  3. Deposit — Click "Deposit". The vault mints cmTokens (ERC-4626 shares) representing your proportional stake. Your tokens begin earning optimized yield immediately.

  4. Monitor — The dashboard shows your current position value, APY, accumulated yield, the AI agent's 3-factor scoring breakdown, and a real-time feed of rebalance decisions with full reasoning.

  5. Withdraw — Click "Withdraw" and specify share amount or percentage. Funds arrive in your wallet within the same transaction. No unlock period.

For Developers (Keeper Integration)

The AI agent polls on-chain state on a 5-minute interval, scoring each strategy with a 3-factor model:

# Start the AIflux agent
npm run agent

Example reasoning output:

ConfluxMind AI — Strategy Analysis

Strategy: dForce Unitus Lending
  Yield Rate: 8.00% APY → Score: 67/100
  Utilization Risk: 45% utilized → Score: 78/100 (low risk)
  Liquidity Depth: $2.1M TVL → Score: 85/100 (deep)
  Composite: 75.3

Strategy: SHUI Finance Staking
  Yield Rate: 5.00% APY → Score: 42/100
  Utilization Risk: N/A (staking) → Score: 90/100 (minimal)
  Liquidity Depth: $5.4M TVL → Score: 95/100 (very deep)
  Composite: 72.1

Strategy: WallFreeX LP
  Yield Rate: 12.00% APY → Score: 100/100
  Utilization Risk: 72% utilized → Score: 44/100 (moderate risk)
  Liquidity Depth: $800K TVL → Score: 45/100 (shallow)
  Composite: 65.8

Decision: Rebalance to [35%, 34%, 31%] — dForce leads on risk-adjusted basis

Demo


Architecture

System Overview

graph TB
    subgraph Frontend["Frontend (React + Next.js)"]
        UI[Dashboard UI]
        WC[Wallet Connect<br/>RainbowKit + Wagmi]
        AR[AI Reasoning Panel]
    end

    subgraph Vault["ConfluxMindVault.sol (ERC-4626)"]
        SA[Share Accounting<br/>cmToken mint/burn]
        GSM[GasSponsorManager<br/>SponsorWhitelistControl]
    end

    subgraph Controller["StrategyController.sol"]
        WM[Weight Manager]
        AL[Allocator]
    end

    subgraph Strategies["Strategy Adapters (IStrategy)"]
        S1[dForce Unitus<br/>Lending Yield]
        S2[SHUI Finance<br/>CFX Staking]
        S3[WallFreeX<br/>Stablecoin LP]
    end

    subgraph Agent["AIflux Agent (Eliza Pattern)"]
        SC[3-Factor Scoring]
        YP[Yield Provider<br/>@cfxdevkit/geckoterminal]
        RE[Rebalance Executor]
    end

    UI -->|deposit / withdraw| SA
    WC -->|gasless tx| GSM
    SA -->|allocate| AL
    AL --> S1
    AL --> S2
    AL --> S3
    Agent -->|"rebalance(weights[])"| WM
    YP -->|market data| SC
    SC -->|optimal weights| RE
    RE -->|on-chain tx| WM
    S1 -.->|yield signals| YP
    S2 -.->|yield signals| YP
    S3 -.->|yield signals| YP
    AR -.->|reads scores| SC

    style Frontend fill:#1e1b4b,stroke:#6366f1,color:#fff
    style Vault fill:#1e1b4b,stroke:#8b5cf6,color:#fff
    style Controller fill:#1e1b4b,stroke:#a78bfa,color:#fff
    style Strategies fill:#1e1b4b,stroke:#c4b5fd,color:#fff
    style Agent fill:#1e1b4b,stroke:#10b981,color:#fff
Loading

AI Agent Decision Flow

flowchart LR
    subgraph Input["Data Collection"]
        A1[On-Chain APYs<br/>via ethers.js]
        A2[Pool Utilization<br/>via contract state]
        A3[TVL / Liquidity<br/>via @cfxdevkit/geckoterminal]
    end

    subgraph Scoring["3-Factor Scoring Model"]
        F1["Yield Rate<br/>(40% weight)"]
        F2["Utilization Risk<br/>(30% weight)"]
        F3["Liquidity Depth<br/>(30% weight)"]
        CS[Composite Score<br/>per strategy]
    end

    subgraph Decision["Decision Engine"]
        NW[Normalize to<br/>BPS Weights]
        TH{Delta ><br/>Threshold?}
        EX[Execute<br/>Rebalance]
        HO[Hold<br/>Current]
    end

    A1 --> F1
    A2 --> F2
    A3 --> F3
    F1 --> CS
    F2 --> CS
    F3 --> CS
    CS --> NW
    NW --> TH
    TH -->|Yes| EX
    TH -->|No| HO

    style Input fill:#0f172a,stroke:#6366f1,color:#fff
    style Scoring fill:#0f172a,stroke:#f59e0b,color:#fff
    style Decision fill:#0f172a,stroke:#10b981,color:#fff
Loading

Smart Contract Interactions

sequenceDiagram
    participant User
    participant Vault as ConfluxMindVault<br/>(ERC-4626)
    participant Controller as StrategyController
    participant S1 as dForce Adapter
    participant S2 as SHUI Adapter
    participant S3 as WallFreeX Adapter
    participant Agent as AIflux Agent

    Note over User,Vault: Deposit Flow (gasless)
    User->>Vault: deposit(amount, receiver)
    Vault->>Vault: mint cmTokens
    Vault->>Controller: allocate(amount)
    Controller->>S1: deposit(40%)
    Controller->>S2: deposit(30%)
    Controller->>S3: deposit(30%)

    Note over Agent,Controller: AI Rebalance Flow (every 5 min)
    Agent->>Agent: Score strategies (3-factor)
    Agent->>Controller: rebalance(newWeights[])
    Controller->>S1: withdraw(excess)
    Controller->>S2: deposit(additional)
    Controller-->>Agent: Rebalanced event

    Note over User,Vault: Withdraw Flow
    User->>Vault: withdraw(amount, receiver, owner)
    Vault->>Controller: deallocate(needed)
    Controller->>S1: withdraw(share)
    Controller->>S2: withdraw(share)
    Controller->>S3: withdraw(share)
    Controller->>Vault: return assets
    Vault->>User: transfer + burn cmTokens
Loading

Conflux Ecosystem Integration Map

graph LR
    subgraph ConfluxMind["ConfluxMind Protocol"]
        V[Vault]
        C[Controller]
        A[AI Agent]
    end

    subgraph Conflux["Conflux eSpace"]
        ES[eSpace RPC]
        GS[Gas Sponsorship<br/>SponsorWhitelistControl]
        SC[ConfluxScan]
    end

    subgraph DeFi["Conflux DeFi Ecosystem"]
        DF[dForce Unitus<br/>Lending Markets]
        SH[SHUI Finance<br/>CFX Staking]
        WF[WallFreeX<br/>Stablecoin LPs]
    end

    subgraph DevTools["Conflux DevKit"]
        GT["@cfxdevkit/geckoterminal<br/>Pool & Price Data"]
        CD["@conflux-devkit/node<br/>Chain Utilities"]
        AF["AIflux / ElizaOS<br/>Agent Framework"]
    end

    V --- ES
    V --- GS
    C --> DF
    C --> SH
    C --> WF
    A --> GT
    A --> CD
    A -.-> AF
    V --- SC

    style ConfluxMind fill:#1e1b4b,stroke:#6366f1,color:#fff
    style Conflux fill:#0c4a6e,stroke:#38bdf8,color:#fff
    style DeFi fill:#14532d,stroke:#4ade80,color:#fff
    style DevTools fill:#431407,stroke:#fb923c,color:#fff
Loading

Key Design Decisions:

  • The AI agent is permissioned but non-custodial — it can only call rebalance(), never touch user funds directly. Built on the Eliza action pattern from cfxdevkit/AIflux.
  • All strategy adapters implement a common IStrategy interface, making new protocol integrations a single adapter contract.
  • ERC-4626 compliance ensures ConfluxMind vault shares are natively composable with any future Conflux DeFi protocol.
  • The 3-factor scoring model ensures the AI makes decisions based on risk-adjusted metrics, not just raw APY.

Smart Contracts

Testnet (Conflux eSpace Testnet — Chain ID: 71)

Contract Address
MockUSDT 0x1Fb61DC9751c3c0259E2E70E1af5968012953667
ConfluxMindVault 0x76Cbe8f11FdaC8edE2a49E297163508af9A17cF2
StrategyController 0x766d707FA8deD8F23C3bF65e547d19aA5F154188
GasSponsorManager 0x0105543D716AbE2dc96c41d6AEA913a3A0603eFA
dForce Strategy (Mock) 0x6926165994325ABC6e551af84EdCBab98Af4eFe3
SHUI Strategy (Mock) 0xF94A8F5CfA9E0FD1D0920419b936181eC1790be8
WallFreeX Strategy (Mock) 0xF0A7dbCCBcB3F315103cf7e6368A5b0CdBCf0e10

Mainnet (Conflux eSpace — Chain ID: 1030)

Contract Address
ConfluxMindVault Post-hackathon deployment
StrategyController Post-hackathon deployment

All contracts verified on ConfluxScan


Future Improvements

  • Multi-chain Vault Entry — Accept deposits from Ethereum, Base, and Arbitrum via LayerZero USDT0 or Meson.fi in a single cross-chain transaction; settlement on Conflux eSpace
  • Risk Tiers — Conservative / Balanced / Aggressive vault variants with different strategy weight constraints
  • On-chain Governance — CFX-holder governance to vote on strategy whitelisting and fee parameters
  • Additional Strategy Integrations — Swappi, GinsengSwap, Orbit Finance, KinetFlow liquidity provisioning
  • Agent Decentralization — Replace single permissioned agent with a decentralized agent network with slashable bonds
  • Full Eliza Runtime — Upgrade from standalone polling to full AIflux/ElizaOS runtime with Discord, Telegram, and Twitter connectors
  • Mobile Support — React Native app with Fluent Wallet deep-link integration
  • Known Limitations: Current AI agent is centralized (single EOA signer); Gas Sponsorship via SponsorWhitelistControl requires Core Space deployment for full gasless UX (eSpace uses meta-transaction alternatives) — mitigations planned for post-hackathon production release

License

This project is licensed under the MIT License — see the LICENSE file for details.


Acknowledgments

  • Conflux Network — For the Gas Sponsorship mechanism and eSpace infrastructure that makes gasless DeFi UX possible
  • dForce — For Unitus lending market contracts and the "DeFAI era" vision that ConfluxMind realizes
  • SHUI Finance — For the sFX liquid staking primitive and integration support
  • WallFreeX — For the stablecoin LP infrastructure on Conflux eSpace
  • Meson.fi — For cross-chain bridging that enables seamless asset entry to Conflux
  • OpenZeppelin — ERC-4626 base implementation and security patterns
  • Foundry — For the Solidity testing and deployment framework
  • Tenderly — For contract monitoring and alerting on Conflux eSpace

About

Autonomous DeFAI Yield Agent

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors