Skip to content

ProjectWaja/Revitalization-Protocol

Repository files navigation

Revitalization Protocol

Decentralized infrastructure monitoring + tokenized rescue funding powered by 7 Chainlink services

Tracks: DeFi & Tokenization | CRE & AI | Risk & Compliance | Privacy


30-Second Summary

A $1.2B skyscraper in downtown LA broke ground in 2015, ran out of money in 2019, and sat unfinished for seven years. Nobody noticed until it was too late.

Revitalization Protocol prevents this. Every 5 minutes, a CRE workflow powered by AI scores a project's financial health. When the score drops critically, the protocol automatically creates a rescue funding round with premium incentives that attract emergency capital. When milestones are verified complete via satellite data, tranches release automatically. Every dollar is tracked on-chain via Proof of Reserves.

6 smart contracts. 3 CRE workflows. 100 tests. 7 Chainlink services.


Chainlink Services (7)

# Service How We Use It
1 CRE Workflows 3 workflows using @chainlink/cre-sdk — cron triggers, HTTPClient, EVMClient, consensus aggregation, signed report delivery
2 AI Agent Claude called via HTTP inside the Solvency Oracle CRE workflow for narrative risk assessment. Graceful fallback to rule-based if AI is unavailable
3 Data Feeds Real AggregatorV3Interface — ETH/USD price feed in TokenizedFundingEngine for USD valuations (getEthPriceUsd(), getRoundValueUsd())
4 CCIP Real CCIPReceiver from @chainlink/contracts-ccipFundingBridgeReceiver.sol receives cross-chain funding. Tested with CCIPLocalSimulator
5 Automation checkUpkeep/performUpkeep on FundingEngine (expired round cleanup) and ReserveVerifier (periodic reserve checks). Ready for automation.chain.link
6 Proof of Reserves AggregatorV3Interface in ReserveVerifier.sol — verifies project reserves + funding engine ETH balance matches deposits
7 Confidential Compute ConfidentialSolvencyCompute.sol with submitEnclaveResult(), attestation hashes, and ENCLAVE_ROLE. CRE workflows have [CC_BOUNDARY] markers ready to swap for ccRuntime.execute()

Architecture

CRE Solvency Oracle (5 min)──┐      CRE Milestone Oracle (weekly)──┐
 HTTPClient: cost indices     │       HTTPClient: satellite/permits  │
 EVMClient: onchain reads     │       EVMClient: onchain reads       │
 AI Agent: Claude risk        │       Rule-based: progress scoring   │
 Consensus: median + identical│       Consensus: median + identical  │
                              │                                      │
                    ┌─────────v──────────┐      ┌───────────v────────────┐
                    │ SolvencyConsumer   │      │ MilestoneConsumer      │
                    │ score < 25?        │      │ progress == 100%?      │
                    └────────┬───────────┘      └──────────┬─────────────┘
                             │ try/catch                   │ try/catch
                             │ initiateRescueFunding()     │ releaseTranche()
                             │                             │
                    ┌────────v─────────────────────────────v──────────┐
                    │         TokenizedFundingEngine                  │
                    │  ERC-1155 positions │ CCIP cross-chain          │
                    │  Rescue premiums    │ Automation: expired       │
                    │  Data Feeds: USD    │ Milestone-gated tranches  │
                    └───────────┬─────────────────┬──────────────────-┘
                                │                 │
                    ┌───────────v──────┐  ┌───────v────────────────┐
                    │ ReserveVerifier  │  │ FundingBridgeReceiver  │
                    │ PoR + Automation │  │ Real CCIPReceiver      │
                    └──────────────────┘  └────────────────────────┘
                                          ┌────────────────────────┐
                                          │ ConfidentialSolvency   │
                                          │ Compute (CC ready)     │
                                          └────────────────────────┘

Cross-module hooks use typed interfaces + try/catch — if a hook fails, the report still stores and emits a RESCUE_CALL_FAILED event. No silent failures.


The Rescue Premium Mechanism

When solvency drops below 25 (CRITICAL), the protocol creates emergency rescue rounds with premium incentives proportional to severity:

Rescue Target = (100 - score) * 0.1 ETH
Premium       = min((100 - score) * 50, 5000) basis points

Score 22 → 7.8 ETH target, 39% premium → Investor earns 39% return
Score 10 → 9.0 ETH target, 45% premium → Investor earns 45% return
Score  0 → 10  ETH target, 50% premium → Maximum premium (capped)

Worse solvency = higher investor return. This creates a self-correcting market where emergency capital flows to the projects that need it most.


Smart Contracts (6)

Contract What It Does Chainlink Services Tests
SolvencyConsumer Receives CRE solvency reports, triggers rescue via cross-module hook CRE, CC 17
MilestoneConsumer Receives milestone reports, releases tranches via cross-module hook CRE 21
TokenizedFundingEngine ERC-1155 positions, milestone-gated tranches, rescue premiums Data Feeds, CCIP, Automation 16
FundingBridgeReceiver Receives cross-chain funding messages from Sepolia CCIP 9
ReserveVerifier Verifies project + engine reserves against PoR feeds PoR, Automation 14
ConfidentialSolvencyCompute Privacy-preserving scoring with attestation proofs CC 15
Integration.t.sol Full lifecycle E2E test All services 8
Total 100

CRE Workflows (3)

Solvency Oracle — The Hero Feature

Schedule: Every 5 min | AI-powered (only workflow with AI)

  1. Fetch cost indices → median consensus across DON nodes
  2. Read onchain financials → EVMClient (BFT guaranteed)
  3. Fetch funding metrics → median consensus
  4. Compute solvency score → weighted: FH 35% + CE 20% + FM 25% + RA 20% [CC_BOUNDARY]
  5. Call AI risk agent → Claude via HTTP, structured JSON, identical consensus, graceful fallback
  6. Write signed reportruntime.report()EVMClient.writeReport() → onchain

Milestone Oracle — Rule-Based (v0.2.0)

Schedule: Weekly | Satellite/drone imagery + city permits → progress scoring → tranche trigger

Funding Engine Monitor — Rule-Based (v0.2.0)

Schedule: Every 10 min | Cross-module reads (solvency + milestones + funding rounds) → health metrics


Try It Yourself — Demo Walkthrough

Prerequisites

git clone <repo>
cd revitalization-protocol
bun install
forge build && forge test    # 100 tests pass

cd dashboard
bun install
bun run dev                  # http://localhost:3000

Contracts are pre-deployed to Tenderly Virtual TestNet (Sepolia fork). The dashboard auto-loads deployed addresses — no setup needed.

Demo Scenario: The Oceanwide Plaza Story

The dashboard tells the real story of Oceanwide Plaza through 3 stages, each with 3 outcome variants. Each stage executes real onchain transactions on Tenderly.

Stage 1: Foundation (2015-2017)

  1. Open the dashboard at http://localhost:3000
  2. You'll see Stage 1: Foundation selected with three variant cards
  3. Click "On Track" (green) — the best-case scenario:
    • Registers the project on SolvencyConsumer + MilestoneConsumer
    • Creates a funding round on TokenizedFundingEngine
    • Submits a solvency report (score: 85, LOW risk)
    • Completes milestone 0 → triggers releaseTranche() cross-module hook
    • Investor deposits ETH → round reaches FUNDED
    • Reserve verification confirms balance matches deposits
  4. Watch the Chainlink Pipeline sidebar animate through 8 steps
  5. See the Metrics Summary update: Solvency 85 (green), Milestone 1/4, Funding round FUNDED

Stage 2: Construction (2017-2019)

  1. Click Stage 2 tab, then select "Slowdown" (yellow):
    • Submits deteriorating solvency reports (42 → 38, HIGH risk)
    • Milestone 1 completes but at inflated cost
    • HIGH risk alerts fire
    • Score approaches the rescue threshold (25)
  2. Watch solvency drop to orange, burn rate spike in the metrics

Stage 3: Resolution (2019-2026) — The Rescue Chain Reaction

  1. Click Stage 3 tab, then select "Rescue Funded" (yellow):

    • Submits CRITICAL solvency report (score: 22)
    • Rescue chain reaction fires automatically:
      • SolvencyConsumer.receiveSolvencyReport() → detects score < 25
      • Cross-module hook: initiateRescueFunding(projectId, 22)
      • Rescue round created: 7.8 ETH target, 39% premium
      • Admin deposits 3.042 ETH premium pool
      • Investor deposits 7.8 ETH → round FUNDED
      • 100% tranche released (rescue rounds skip milestone gates)
      • Investor claims: 7.8 + 3.042 = 10.842 ETH (39% profit)
    • Reserve verification confirms engine balance
  2. Or select "Desperate Measures" (red) for the worst case:

    • Score crashes to 10 → 9.0 ETH target, 45% premium
    • Investor earns 45% return on rescue capital

Simulation Preview (Optional)

  1. Toggle "Simulate First" checkbox before running Stage 3
  2. Click "Simulate Rescue" — previews the full rescue chain via Tenderly's simulation bundle API
  3. See gas estimates, decoded events, and PASS/FAIL for each step before committing
  4. Click "Execute" to run it live and compare simulation vs actual

What to Look For

  • Solvency Score gauge changes color: green (85) → yellow (68) → orange (42) → red (22)
  • Rescue rounds appear in the Funding panel with premium badges (+39%, +45%)
  • Cross-module hooks fire automatically — no manual intervention between solvency drop and rescue creation
  • ERC-1155 tokens minted for each investor deposit (visible in events)
  • USD equivalents next to all ETH amounts via live Chainlink ETH/USD Data Feed
  • Pipeline sidebar shows all 8 Chainlink workflow steps with type badges (CRE, AI, Contract, Human, Automation)

Real vs Mock

What's Real What's a Gap
CRE SDK (@chainlink/cre-sdk) with HTTPClient, EVMClient, consensus, cron Construction material price feeds (steel, concrete, lumber, labor, fuel)
AI Agent (Claude via HTTP in CRE workflow) Satellite/drone imagery oracle
Data Feeds (AggregatorV3Interface — ETH/USD on Sepolia) Construction escrow PoR feed
CCIP (CCIPReceiver, Client.EVM2AnyMessage, tested with CCIPLocalSimulator) CC SDK (expected early 2026)
Automation (checkUpkeep/performUpkeep — ready to register)
Proof of Reserves (real AggregatorV3Interface)

Every gap is documented in-code with CHAINLINK DATA GAP or CHAINLINK CONFIDENTIAL COMPUTE GAP comments.


Tech Stack

Layer Technology
Contracts Solidity 0.8.24, Foundry, OpenZeppelin v5.5.0
Tokens ERC-1155 + AccessControl + ReentrancyGuard + Pausable
Chainlink @chainlink/contracts + contracts-ccip + local + cre-sdk
Workflows TypeScript CRE with consensus aggregation
Dashboard Next.js 15, Tailwind 4, viem
Testnet Tenderly Virtual TestNet (Sepolia fork, persistent state)
Runtime Bun (TS), Forge (Solidity)

Deployment

Contract Address
SolvencyConsumer 0x20c05394477009de055344634d7a6af97c129d25
MilestoneConsumer 0x27b04578675b5c4c86fb01c48d7f188ded1659fc
TokenizedFundingEngine 0xcb33e2aeea6c37b4b632fbd4ceadc06f0c03eea4
ReserveVerifier 0xbcb860713bdb23b8be403084fbefe61b40a9948b

View on Tenderly Explorer


Why This Matters

The $13 trillion construction industry has zero decentralized tooling. Project monitoring is manual — quarterly audits, self-reported financials, trust-based verification. By the time anyone notices a project is failing, it's 18-24 months too late.

Revitalization Protocol replaces trust with verification:

  • Every solvency assessment is signed by a Chainlink DON
  • Every milestone is independently verified via satellite data
  • Every funding dollar is tracked on-chain via Proof of Reserves
  • Every rescue round uses market incentives to attract emergency capital

For the full technical deep dive (every function, struct, and state variable), see DEEP-DIVE.md.


Willis — Revitalization Protocol

MIT License

About

Revitalization Protocol — Real-time solvency monitoring & tokenized rescue funding for stalled infrastructure projects. Built with Chainlink CRE, CCIP, Automation, Proof of Reserves, and AI Agents.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors