Skip to content

Souravjoy7/cross-chain-lend

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cross-Chain Lending Protocol

Deposit collateral on one chain, borrow on another. Multi-chain DeFi with unified liquidity — the protocol Aave, Compound, and MakerDAO never built.

On-Chain Proof (Deployed & Verified)

Base Sepolia (OP Stack)

Contract Address
LendingPool 0x0c528b57...5691
LiquidationEngine 0x47738C17...1c48
CrossChainMessenger 0xd3523B89...8EaA
YieldVault 0xB972CcEc...eDC7
RiskManager 0xF1D3A321...1BE
GovernanceToken 0x44B5914e...aAC3
PriceOracle 0x0457800F...6877

Linea Sepolia (ZK-Rollup)

Contract Address
LendingPool 0x2AaA42fa...85cC
LiquidationEngine 0x49F22168...6976
CrossChainMessenger 0x77aaA2AB...01D3
YieldVault 0x5c886F28...5B19
RiskManager 0x9ff0C982...4861
GovernanceToken 0x7793F72c...e50A
PriceOracle 0xB48f1eEc...A862

Deployer: 0x7F75bfAfeD5c96584774c7F2Bc33F3bF887BC739

Why This Is Different

Current DeFi lending is siloed per chain:

  • Aave on Ethereum ≠ Aave on Base
  • Users must bridge, swap, deposit, borrow on each chain separately
  • Liquidity is fragmented, capital efficiency is wasted

Cross-Chain Lending Protocol unifies this:

  • Deposit ETH on Base → Borrow USDC on Linea (or any supported chain)
  • Single position, multi-chain exposure
  • Unified interest rates across the entire protocol

Architecture

┌──────────────────────────────────────────────────────────┐
│                  CROSS-CHAIN MESSENGER                   │
│                  (Chainlink CCIP)                        │
└──────────────────────────────────────────────────────────┘
        │              │              │              │
        ▼              ▼              ▼              ▼
   ┌─────────┐   ┌─────────┐   ┌─────────┐   ┌─────────┐
   │  Base   │   │  Linea  │   │  Other  │   │  Other  │
   │ Lending │   │ Lending │   │ Lending │   │ Lending │
   │  Pool   │   │  Pool   │   │  Pool   │   │  Pool   │
   └─────────┘   └─────────┘   └─────────┘   └─────────┘
        │              │              │              │
        └──────────────┴──────────────┴──────────────┘
                              │
                ┌─────────────┼─────────────┐
                ▼             ▼             ▼
          ┌──────────┐ ┌──────────┐ ┌──────────┐
          │ Price    │ │Liquidation│ │  Risk    │
          │ Oracle   │ │  Engine  │ │ Manager  │
          └──────────┘ └──────────┘ └──────────┘

Smart Contracts

LendingPool.sol — Core Lending Engine

  • Multi-asset deposit/borrow/repay/withdraw
  • Kinked interest rate model (5% base, 20% slope, 150% steep)
  • Health factor calculation with 80% LTV / 85% liquidation threshold
  • 5% liquidation bonus for liquidators
  • Non-reentrant, gas-optimized

CrossChainMessenger.sol — CCIP Integration

  • Send/receive cross-chain messages via Chainlink CCIP
  • Queue and execute cross-chain actions
  • Message timeout protection (30 min default)
  • Replay protection (executed messages can't be re-executed)

LiquidationEngine.sol — Automated Liquidations

  • Register/remove liquidators
  • Auto-trigger on health factor < 0.85
  • 0.5% reward + 5% bonus for liquidators
  • Cooldown protection (1 min between liquidations)
  • Full liquidation history tracking

RiskManager.sol — Protocol-Wide Risk Monitoring

  • Per-market risk configurations
  • Real-time risk assessment (utilization, APY, reserves)
  • Auto circuit breaker for critical alerts
  • Emergency market pause
  • Protocol health scoring (0-1000)

YieldVault.sol — Auto-Compounding Vault

  • Multi-strategy yield aggregation
  • Deposit cap enforcement
  • Performance fee (2%) + withdrawal fee (0.1%)
  • Share-based accounting (ERC4626-style)
  • Auto-harvest with configurable interval

GovernanceToken.sol — Protocol Governance

  • ERC20 with delegation (Compound-style)
  • On-chain proposals with voting
  • 100k token threshold to propose
  • 400k token quorum requirement
  • Vote delegation and power tracking

PriceOracle.sol — Chainlink Price Feeds

  • Multi-feed support (AggregatorV3)
  • Stale price detection (1 hour threshold)
  • Exchange rate calculation
  • Governance-controlled feed management

Interest Rate Model

Interest Rate
      │
20% ──┤                          ╱
      │                        ╱
10% ──┤                    ╱
      │                ╱
 5% ──┤────────────╱
      │          ╱
 0% ──┼───────╱─────────────────────
      0%   80% (kink)         100% Utilization
  • Base Rate: 5% APR
  • Slope 1: 0% → 80% utilization: rate = 5% + 20% × util
  • Slope 2: 80% → 100% utilization: rate = 21% + 150% × (util - 80%)

This incentivizes borrowing at healthy utilization while preventing complete capital drain.

Setup

git clone https://github.com/Souravjoy7/cross-chain-lend.git
cd cross-chain-lend
npm install
npx hardhat compile

Deployment

export DEPLOYER_PRIVATE_KEY=0x...
npx hardhat run scripts/deploy.js --network base_sepolia
npx hardhat run scripts/deploy.js --network linea_sepolia

Tech Stack

  • Solidity 0.8.24
  • Hardhat 3
  • OpenZeppelin v5
  • Chainlink CCIP + Price Feeds
  • Ethers v6

Security Features

  • ReentrancyGuard on all state-changing functions
  • Health factor checks before borrow
  • Liquidation threshold with bonus
  • Message timeout + replay protection
  • Governance-controlled emergency pause
  • Circuit breaker on critical risk events

License

MIT

About

Cross-Chain Lending Protocol — deposit on one chain, borrow on another. Unified multi-chain DeFi with Chainlink CCIP.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors