Cross-Chain-Delegate-Bridge
Cross-Chain Delegate Bridge is a decentralized automation framework that enables users to securely automate cross-chain asset management using MetaMask Smart Accounts, Envio, and the Monad testnet.
Video
Sự miêu tả
🔮 Cross-Chain Delegate Bridge
Single Agent, Multi-Chain Control.
🚀 Overview
Cross-Chain Delegate Bridge is a decentralized automation framework that enables users to securely automate cross-chain asset management using MetaMask Smart Accounts, Envio, and the Monad testnet.
It introduces the concept of a delegated cross-chain agent — an autonomous executor that operates under scoped delegation permissions.
This agent can automatically rebalance, migrate, or safeguard user assets across chains (e.g., Monad → Polygon/Arbitrum) based on live on-chain events, without ever having direct key access.
🧠 Problem
Managing digital assets across multiple blockchains is painful and insecure today:
Users must manually approve, bridge, and swap tokens on each chain.
Rebalancing portfolios or reacting to yield/opportunity changes requires constant monitoring.
Automated bots that help with this often require full private-key access, introducing massive security risks.
No unified agent exists that can safely act on behalf of users across chains — until now.
💡 Solution
Cross-Chain Delegate Bridge provides a secure, delegated automation system that enables:
Scoped, revocable permissions via MetaMask Smart Accounts.
Event-driven triggers via Envio to monitor balances, liquidity, and price thresholds.
Automated execution on Monad testnet, including cross-chain bridging and portfolio rebalancing.
Multi-chain orchestration, allowing one agent to manage assets on Monad, Polygon, and Arbitrum — with full transparency and user control.
🔐 Key Innovation
Feature | Description |
|---|---|
Delegation via MetaMask Smart Accounts | Users grant limited permissions (swap, bridge, transfer) to the Bridge Agent. No private keys are exposed. |
Envio-driven Automation | Envio indexes real-time blockchain data and emits triggers to the Bridge Agent when on-chain conditions are met. |
Monad Execution Layer | All delegated actions are executed efficiently on Monad testnet for low-latency, high-speed performance. |
Cross-chain Orchestration | The Bridge Agent uses bridge contracts or relayers to move assets safely across chains when user-defined policies are triggered. |
🧩 Use Cases
1. 🧮 Cross-Chain Portfolio Rebalancing
Keep your portfolio balanced automatically.
Example: Maintain 70% USDC on Monad and 30% on Polygon. If the ratio shifts beyond 10%, the agent rebalances autonomously.
2. 💸 Yield Migration
When yield on Polygon’s protocol > Monad by 5%, automatically bridge funds and deposit to the better pool.
3. 🛡 Auto Safety Revoke
If Envio detects a malicious contract requesting high token allowance, the agent auto-revokes permissions and moves tokens to a safe vault.
🏗 Architecture
[User Interface / dApp]
│
├── (1) Create MetaMask Smart Account
│
├── (2) Configure delegation policy (swap/bridge/limits)
│
▼
[MetaMask Smart Account + Delegation]
│
├── Stores delegation JSON policy
│
└── Issues delegation token → [Bridge Agent]
│
├── (3) Receives Envio events
│
├── (4) Validates policy, constructs tx
│
└── (5) Executes on Monad testnet
│
├── (6) Bridge contract locks tokens
│
└── (7) Relayer submits proof → Polygon/Arbitrum
│
└── (8) Tokens minted / received
🧱 Components
🧍 User & MetaMask Smart Account
User creates an MSA (MetaMask Smart Account) as a secure smart wallet abstraction.
Defines delegation policy — a JSON config specifying what actions the delegated agent is allowed to perform.
Example Policy:
{
"delegate": "0xAgentAddress",
"allowed_actions": ["swap", "bridge", "revokeApproval"],
"token_whitelist": ["0xUSDC", "0xWETH"],
"per_tx_limit_usd": 2000,
"daily_limit_usd": 5000,
"expires_at": 1750000000,
"require_envio_proof": true
}
🤖 Bridge Agent
Receives events from Envio.
Verifies event proofs and delegation policy.
Constructs and signs delegated transactions.
Sends them to Monad for on-chain execution.
Monitors cross-chain bridge confirmations.
🛰 Envio Indexer
Indexes:
Wallet balances (USDC, ETH, etc.)
Pool liquidity and APY changes
Bridge contract events
Emits triggers to the Bridge Agent when defined conditions are met.
Example Envio Event:
{
"type": "BALANCE_THRESHOLD",
"wallet": "0xUser",
"asset": "USDC",
"chain": "Monad",
"threshold": "80%",
"timestamp": 1750001234,
"proof": "0xEnvioProof"
}
⚙ Monad Smart Contracts
DelegationExecutor.sol — validates delegation policies and executes approved actions.
BridgeLock.sol — locks tokens on Monad before cross-chain transfer.
MockMint.sol (Polygon side) — mints equivalent assets for demo.
🔁 Cross-Chain Flow Example
Goal: Maintain 70/30 balance split between Monad and Polygon.
Envio detects that 85% of user’s stablecoins are now on Monad.
Envio emits event → Bridge Agent receives it.
Bridge Agent validates event proof + policy limits.
Bridge Agent constructs transaction (approve + bridgeLock).
Transaction executed by MetaMask Smart Account on Monad testnet.
BridgeLock emits event → relayer submits proof on Polygon.
MockMint contract mints USDC on Polygon → balance restored to 70/30.
Dashboard updates status via Envio’s confirmation event.
🔧 Technologies Used
Component | Technology |
|---|---|
Smart Wallet & Delegation | MetaMask Smart Accounts (EIP-5792) |
Indexing & Event Triggers | Envio |
Execution Layer | Monad Testnet |
Cross-Chain Messaging | Custom mock bridge or real bridge adapter |
Frontend | Next.js / React + Wagmi hooks |
Backend / Agent | Node.js / Express or Serverless Functions |
Smart Contracts | Solidity (Hardhat / Foundry) |
⚡ Key Advantages
✅ No private key exposure — automation is done through delegation, not key sharing.
✅ Fully revocable permissions — user can revoke or modify delegation at any time.
✅ Multi-chain aware — one agent manages all user assets across supported chains.
✅ Event-driven — powered by Envio for precision triggers and monitoring.
✅ Efficient & secure execution — Monad ensures near-zero latency and cheap execution.
🔒 Security Model
Layer | Protection |
|---|---|
Delegation | Scoped, time-limited, token/amount whitelisted |
Envio | Signed event proofs, rate-limited callbacks |
Execution | Smart Account verifies delegation on every call |
Bridging | One-time proofs and confirmation receipts |
User Control | Full emergency revoke, logs, and receipts |
🧠 Example Scenario Demo
“If my USDC balance on Monad exceeds 80% of total holdings, move 10% to Polygon.”
Steps:
User defines rule in UI and grants delegation.
Envio tracks wallet balances and detects imbalance.
Sends event → Bridge Agent executes
bridgeLock()on Monad.Relayer observes event and calls
mint()on Polygon.Tokens appear on Polygon side automatically.
User sees the update on dashboard, along with on-chain receipts.
⚙️ Smart Contract Architecture
1. DelegationExecutor.sol
Handles all delegated calls under allowed actions and policy limits.
function executeDelegated(
address user,
bytes calldata txData,
Delegation calldata policy
) external {
require(isValidDelegation(user, msg.sender, policy), "unauthorized");
require(txWithinLimits(txData, policy), "limit exceeded");
(bool success,) = address(target).call(txData);
require(success, "execution failed");
}
2. BridgeLock.sol
Locks assets on Monad before cross-chain proof generation.
function lockTokens(address token, uint amount) external {
IERC20(token).transferFrom(msg.sender, address(this), amount);
emit BridgeLocked(msg.sender, token, amount, block.timestamp);
}
3. MockMint.sol (Polygon Testnet)
Simulates the arrival of tokens on the destination chain.
function mintFromProof(bytes calldata proof) external {
require(verifyProof(proof), "invalid proof");
_mint(msg.sender, parseAmount(proof));
}
🧪 Deployment Steps
Setup
git clone https://github.com/yourusername/crosschain-delegate-bridge cd crosschain-delegate-bridge npm installDeploy Contracts on Monad Testnet
npx hardhat run scripts/deployMonad.js --network monadTestnetDeploy Mock Bridge Contracts on Polygon Testnet
npx hardhat run scripts/deployPolygon.js --network polygonTestnetRun Bridge Agent
npm run agentStart Frontend
npm run dev
📺 Demo Flow for Hackathon Video
Create MetaMask Smart Account and grant delegation to Bridge Agent.
Configure rule: “Keep 70% USDC on Monad, 30% on Polygon.”
Envio detects imbalance and triggers event.
Bridge Agent executes delegated transaction on Monad.
Cross-chain proof confirmed on Polygon testnet (tokens arrive).
Dashboard shows updated balances and transaction receipts.
Emergency revoke shown as proof of security.
🛡 Future Enhancements
🔁 Integrate real bridges like LayerZero or Axelar.
🤖 Add AI-based optimization for yield strategies.
🧮 Enable DAO Treasury automation.
🌉 Add multi-hop rebalancing between 3+ chains.
🧠 Integrate ENS / Safe module for institutional use.
🏆 Why This Will Impress Judges
Real automation (not just trigger → alert, but full delegated transaction).
Security-first via MetaMask Smart Accounts Delegation — no private keys.
Envio used as real event indexer, not placeholder.
Monad fully utilized as execution backbone.
Cross-chain orchestration shows advanced use case.
Polished architecture and demo flow shows end-to-end integration.
⚙️ Tech Stack Summary
Layer | Tool |
|---|---|
Wallet & Delegation | MetaMask Smart Accounts |
Event Indexing | Envio |
Execution | Monad Testnet |
Bridging | Mock bridge (simulated LayerZero flow) |
Frontend | Next.js + Wagmi + Tailwind |
Backend | Node.js / Express Agent |
Contracts | Solidity + Hardhat |
DB / Logs | IPFS + local JSON (for receipts) |
Tiến độ hackathon
na
Công nghệ sử dụng
Trạng thái huy động vốn
na