Thanks to visit codestin.com
Credit goes to github.com

Skip to content

katherinesullivan/londonhackathon

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

13 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ¦– T-rex - Prehistoric Cross-Chain Bridge

RAWR! Stomp through the blockchain jungle like a prehistoric beast! πŸ¦•

A fun, T-rex themed cross-chain bridge enabling swaps between Avalanche L1s and external blockchains using Avlanche's ICM, Avalanche's ICTT and Chainlink's CCIP.

🌿 General Overview

T-rex enables seamless token swapping between different blockchain networks:

  • Avalanche L1s (Dispatch, Echo) using ICM/ICTT
  • Avalanche C-Chain (Fuji) using both ICM/ICTT and CCIP
  • External Chains (Ethereum Sepolia, Polygon Amoy) via CCIP

🦴 Technical Overview

For a technical overview on how the multi-hop cross-chain swapping is being enabled read the src README.md

🎨 Repository's organization

  • src folder contains the smart contracts that enable to perform the cross-chain swapping
  • frontend folder contains all the frontend files
  • chainlink_deployedcontracts folder contains chainlink contracts that perfom token and data transfers on the same transactions which are the basis for understanding how to implement ccip logic for the multi-hop cross-chain swapping
  • lib folder contains contract's dependencies that came in as handy when we had problems using forge
  • t-rex_graveyard folder is a fun place to explore previous ideas we developed and files we just felt attached too to

πŸš€ Quick Start

1. Setup & Installation

# Clone and setup
git clone <repository>
cd londonhackathon

# Install frontend dependencies
cd frontend
npm install

# Start development server
npm run dev

2. Access the T-rex Bridge

  • URL: http://localhost:3001 (or next available port)
  • Default Route: Dispatch β†’ Polygon Amoy
  • Default Tokens: DIS β†’ MATIC

3. Feed the T-rex! πŸ–

Get test tokens from faucets:

πŸ¦– T-rex Interface Features

🎯 Main Swap Interface

  • T-rex Swap Header with prehistoric branding
  • From/To Selectors: "T-rex starts here" β†’ "T-rex destination"
  • Feed Input: "πŸ– Feed me!" placeholder
  • Route Display: Shows Teleporter, CCIP, or Hybrid routes

πŸ”οΈ Cave-Themed Wallet Connection

  • Green Theme: Matches jungle aesthetic
  • Cave Icon: πŸ”οΈ represents T-rex habitat
  • Connect State: Shows wallet address with cave branding

🦴 T-rex Feeding Costs

  • Cost Breakdown: Gas, Bridge, Protocol fees
  • Mock Data Badge: "πŸ¦– Mock" indicator
  • Confidence Levels: High/Medium/Low based on trade parameters

πŸ”„ Prehistoric Route Types

  • Teleporter: Avalanche L1 ↔ L1 (fastest)
  • CCIP: External ↔ External (standard)
  • Hybrid Route: L1 β†’ External (multi-hop)
  • CCIP + Teleporter: External β†’ L1 (complex)

🌿 Technical Architecture of the Frontend

Frontend (Next.js + TypeScript)

frontend/
β”œβ”€β”€ pages/
β”‚   β”œβ”€β”€ index.tsx           # Main T-rex interface
β”‚   └── _app.tsx           # Wallet providers
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ SwapInterface.tsx    # Main swap component
β”‚   β”‚   β”œβ”€β”€ WalletConnect.tsx    # Cave-themed wallet
β”‚   β”‚   β”œβ”€β”€ ChainSelector.tsx    # Network selection
β”‚   β”‚   └── TokenSelector.tsx    # Token selection
β”‚   β”œβ”€β”€ constants/
β”‚   β”‚   β”œβ”€β”€ chains.ts           # 4 supported networks
β”‚   β”‚   └── tokens.ts           # Token configurations
β”‚   β”œβ”€β”€ utils/
β”‚   β”‚   β”œβ”€β”€ contracts.ts        # Mock pricing engine
β”‚   β”‚   └── wallet.ts           # Wallet management
β”‚   └── styles/
β”‚       └── globals.css         # Jungle theme CSS

🎨 Jungle Theme Styling

  • Color Palette: Green/Emerald/Teal gradients
  • Background: from-green-900 via-emerald-900 to-teal-900
  • Components: Green focus states, borders, buttons
  • Animations: Jungle-themed pulse and shimmer effects

πŸ¦– Mock Data Engine

// Real market prices (January 2025)
const REAL_TOKEN_PRICES = {
  DIS: 0.0075,      // Dispatch token
  ECHO: 0.012,      // Echo token  
  ETH: 2500,        // Ethereum
  MATIC: 0.35,      // Polygon
  AVAX: 22.80,      // Avalanche
  USDC: 1.00,       // Stablecoin
  LINK: 15.30       // Chainlink
};

πŸ”§ Configuration

Environment Setup

# Frontend environment (.env.local)
NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID=your_project_id
NEXT_PUBLIC_ENVIRONMENT=development

Default Configuration

  • From Chain: Dispatch (Avalanche L1)
  • To Chain: Polygon Amoy (External)
  • Slippage: 0.5% default
  • Mock Data: Always enabled for demo

πŸ¦• User Experience Flow

1. Landing Experience

  • T-rex Branding: Immediate prehistoric theme
  • Jungle Background: Subtle T-rex silhouettes
  • Default Setup: Ready to swap Dispatch β†’ Amoy

2. Wallet Connection

  • Cave Theme: πŸ”οΈ Connect Wallet button
  • Green Styling: Matches jungle aesthetic
  • Status Display: Shows connected address with cave icon

3. Token Swapping

  • Feed the T-rex: Enter amount to "feed" the beast
  • Route Calculation: T-rex "thinks" and calculates best path
  • Cost Display: "T-rex Feeding Costs" breakdown
  • Execution: "πŸ¦– RAWR! Execute Swap" button

4. Loading States

  • Calculating: "πŸ¦– T-rex is calculating..."
  • Processing: "πŸ¦– T-rex is stomping..."
  • Thinking: "πŸ¦– T-rex is thinking..."

🎯 Demo Features

βœ… Implemented

  • T-rex Themed UI with jungle aesthetics
  • 4 Testnet Support (Dispatch, Echo, Sepolia, Amoy)
  • Realistic Mock Pricing based on real market data
  • Dynamic Fee Calculation with proper slippage
  • Route Type Detection (Teleporter/CCIP/Hybrid)
  • Cave-themed Wallet connection
  • Responsive Design for all screen sizes

πŸ”„ Mock Data System

  • Real Price Feeds: Current market values
  • Dynamic Slippage: 0.1% - 3% based on conditions
  • Realistic Fees: Chain-specific gas costs
  • Time Estimates: Route complexity based
  • Confidence Scoring: Trade size and route dependent

πŸ› οΈ Development

Adding New Prehistoric Networks

  1. Update frontend/src/constants/chains.ts
  2. Add to SUPPORTED_CHAINS object
  3. Configure in wagmi providers

Customizing T-rex Theme

  1. Modify frontend/src/styles/globals.css
  2. Update color variables and animations
  3. Add new T-rex themed components

Mock Data Customization

  1. Edit frontend/src/utils/contracts.ts
  2. Update REAL_TOKEN_PRICES object
  3. Modify fee calculation logic

πŸ¦– T-rex Easter Eggs

  • Background Elements: Subtle T-rex silhouettes
  • Loading Messages: Prehistoric themed states
  • Error Handling: "T-rex is confused!" messages
  • Button Text: "Wake up T-rex!" and "RAWR! Execute"
  • Input Placeholders: "πŸ– Feed me!" for amounts

πŸ“± Responsive Design

  • Mobile Optimized: Works on all screen sizes
  • Touch Friendly: Large buttons and inputs
  • Compact Layout: Efficient use of space
  • Jungle Theme: Consistent across devices

πŸŽ‰ Demo Instructions

  1. Start Server: cd frontend && npm run dev
  2. Open Browser: Navigate to http://localhost:3001
  3. Connect Wallet: Click cave-themed connect button
  4. Feed T-rex: Enter amount in "πŸ– Feed me!" input
  5. Watch Magic: See realistic pricing calculations
  6. Execute Swap: Click "πŸ¦– RAWR! Execute Swap"

πŸ¦– Built for London Hackathon 2025 Stomp through the blockchain jungle with prehistoric power! πŸŒΏπŸ¦•

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •