Skip to content

oluwagbemigaphilip/friedy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

44 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

TrustCircle - Decentralized Social Lending Protocol

TrustCircle is an advanced EVM-compatible decentralized lending protocol that combines on-chain reputation NFTs, social trust circles, dynamic interest rates, hybrid collateral lending, credit delegation, flash loans, and decentralized governance to create the most flexible peer-to-peer lending platform in DeFi. Built to win hackathons with cutting-edge features.

๐ŸŒŸ Key Features

๐Ÿ’Ž Dynamic Reputation NFTs

  • Soulbound NFTs that represent user creditworthiness
  • Evolving metadata with on-chain SVG generation
  • 5 reputation tiers: Bronze โ†’ Silver โ†’ Gold โ†’ Platinum โ†’ Diamond
  • Scores from 0-1000 points based on lending behavior

๐Ÿค Trust Circles

  • Create or join small communities (3-15 members)
  • Member vouching system increases borrowing capacity
  • Collective responsibility with slashing mechanisms
  • Trust score calculation across all circles

๐Ÿ’ฐ Uncollateralized Lending

  • Borrow based on reputation and social proof, not collateral
  • Dynamic interest rates (3%-30%) based on reputation tier
  • Flexible loan terms (7-365 days)
  • Early repayment bonuses boost reputation

๐ŸŽฎ Gamification Layer

  • Achievement NFTs with 9 different badges
  • Reputation bonuses for unlocking achievements
  • Progress tracking and milestone rewards

๐Ÿ“ˆ Referral System

  • Invite friends and earn reputation bonuses
  • 30 points for referrer, 20 for new user
  • Milestone bonuses every 5 referrals (+50 points)

๐Ÿ”’ Emergency Withdrawals

  • Timelock mechanism (7-day waiting period)
  • Safer emergency fund access
  • Reputation penalty for emergency use

๐Ÿ’ป Premium Frontend

  • Complete Borrow Interface - Loan amount, duration, interest preview
  • Complete Lend Interface - Deposit/withdraw with pool statistics
  • Trust Circles Interface - Create circles, set requirements
  • Loan Management - View all loans, repay directly
  • Transaction Tracking - Real-time tx notifications with Etherscan links
  • Analytics Dashboard - Protocol and user performance metrics โญ
  • Leaderboard - Competitive rankings for borrowers, lenders, and circles โญ
  • Enhanced Hero - Feature showcase for new users

๐Ÿ”„ Loan Extensions

  • Extend loan duration up to 2 times per loan โญ
  • Small 0.5% extension fee instead of default penalties
  • Flexible 7-90 day extensions
  • Reputation bonus for proactive management

๐Ÿ’Ž Hybrid Lending

  • Borrow with partial collateral (50-150%) โญ
  • 2-5x borrowing limit boost with collateral
  • Up to 3% interest rate discount
  • Liquidation protection mechanism
  • Collateral returned on successful repayment

๐Ÿค Credit Delegation

  • High-reputation users share borrowing capacity โญ
  • Set delegation limits and expiration
  • Revoke anytime with full control
  • Expand access to underserved users

๐Ÿ—ณ๏ธ Governance Token

  • ERC20 governance token (TCG) โญ
  • Stake for enhanced voting power (1.2x)
  • Create and vote on protocol proposals
  • Earn rewards for lending/borrowing
  • 100 tokens per reputation tier milestone

โšก Flash Loans

  • Zero-collateral instant loans โญ
  • 0.09% flash loan fee
  • No reputation requirement
  • Perfect for arbitrage and liquidations
  • Fees distributed to liquidity providers

๐Ÿ—๏ธ Architecture

Smart Contracts

Core Contracts:

  • ReputationNFT.sol - Soulbound NFT with dynamic metadata and reputation scoring
  • TrustCircle.sol - Circle creation, member management, and vouching system
  • LendingPool.sol - Core lending/borrowing with dynamic rates
  • AchievementBadges.sol - Gamification with achievement NFTs
  • ReferralSystem.sol - User growth incentives with reputation bonuses
  • EmergencyWithdraw.sol - Timelock mechanism for safer emergency withdrawals
  • LoanExtension.sol - Request loan extensions with 5% fee
  • GovernanceToken.sol - DAO-style voting on protocol parameters
  • Leaderboard.sol - Track and rank top performers

New Advanced Features: โญ

  • LoanExtension.sol - Loan refinancing and extension mechanism
  • HybridLending.sol - Collateral-backed loans with boosted limits
  • CreditDelegation.sol - Delegate borrowing power to trusted users
  • GovernanceToken.sol - ERC20 token for protocol governance and rewards
  • FlashLoan.sol - Flash loan implementation with 0.09% fee

Frontend

  • React + Vite - Modern, fast development experience
  • Ethers.js - Web3 integration for wallet connection
  • Premium UI/UX - Glassmorphism effects, gradient animations, responsive design
  • Analytics Dashboard - Real-time protocol and user metrics โญ
  • Leaderboard System - Gamified rankings with competitive elements โญ

๐Ÿš€ Quick Start

Prerequisites

  • Node.js v18+
  • MetaMask or compatible Web3 wallet
  • Test ETH (Sepolia or Alfajores testnet)

Installation

# Clone the repository
git clone https://github.com/Gbangbolaoluwagbemiga/chinchin
cd chinchin

# Install dependencies
npm install

# Compile contracts
npx hardhat compile

# Run tests
npx hardhat test

# Deploy to local network
npx hardhat node
npx hardhat run scripts/deploy.js --network localhost

Frontend Setup

cd frontend
npm install
npm run dev

Update contract addresses in frontend/src/App.jsx after deployment.

๐Ÿงช Testing

All 15 integration tests passing:

npx hardhat test

Tests cover:

  • โœ… Reputation NFT minting and soulbound mechanics
  • โœ… Reputation score updates and tier calculation
  • โœ… Trust circle creation and member management
  • โœ… Vouching system and trust score calculation
  • โœ… Lending pool deposits and withdrawals
  • โœ… Dynamic interest rate calculation
  • โœ… Loan borrowing and repayment
  • โœ… Achievement unlocking and reputation bonuses
  • โœ… Full user journey from mint to repayment

๐Ÿ“Š Project Structure

chinchin/
โ”œโ”€โ”€ contracts/              # Smart contracts
โ”‚   โ”œโ”€โ”€ ReputationNFT.sol
โ”‚   โ”œโ”€โ”€ TrustCircle.sol
โ”‚   โ”œโ”€โ”€ LendingPool.sol
โ”‚   โ””โ”€โ”€ AchievementBadges.sol
โ”œโ”€โ”€ scripts/               # Deployment scripts
โ”‚   โ””โ”€โ”€ deploy.js
โ”œโ”€โ”€ test/                  # Integration tests
โ”‚   โ””โ”€โ”€ Integration.test.js
โ”œโ”€โ”€ frontend/              # React frontend
โ”‚   โ”œโ”€โ”€ src/
โ”‚   โ”‚   โ”œโ”€โ”€ App.jsx
โ”‚   โ”‚   โ”œโ”€โ”€ App.css
โ”‚   โ”‚   โ””โ”€โ”€ index.css
โ”‚   โ””โ”€โ”€ package.json
โ”œโ”€โ”€ hardhat.config.js
โ””โ”€โ”€ package.json

๐ŸŽฏ Why This Wins Hackathons

  1. Novel Problem: Addresses real financial inclusion challenges
  2. Technical Innovation: Combines DeFi + social proof in a unique way
  3. On-Chain Everything: All reputation and trust data verifiable on-chain
  4. Complete Solution: Smart contracts + tests + beautiful UI
  5. Demonstrable: Can show actual lending cycles in live demo
  6. Gamification: Achievement system increases engagement
  7. Real Impact: Enables lending for the unbanked/underbanked

๐Ÿ’ก How It Works

  1. User mints Reputation NFT - Starting with 100 points (Bronze tier)
  2. Joins/creates Trust Circles - Connects with trusted community
  3. Receives vouches - Circle members vouch to boost trust score
  4. Borrows funds - Dynamic rate based on reputation (e.g., Diamond = 3%)
  5. Repays loan - On-time payment boosts reputation, unlocks achievements
  6. Reputation grows - Higher tier = better rates + higher limits

๐Ÿ” Security Features

  • Soulbound NFTs prevent reputation trading
  • Access control for reputation updates
  • Reentrancy guards on all financial functions
  • Grace period before loan defaults
  • Circle slashing for defaulters affects vouchers

๐Ÿ“ˆ Demo Scenarios

Perfect for hackathon demos:

  1. New User Journey - Mint โ†’ Circle โ†’ Borrow โ†’ Repay
  2. Reputation Growth - Show tier progression from Bronze to Diamond
  3. Trust Circle Impact - Demonstrate how vouches reduce interest rates
  4. Achievement Unlocks - Showcase gamification mechanics

๐Ÿ› ๏ธ Tech Stack

  • Solidity 0.8.24 - Smart contract language
  • Hardhat - Development environment
  • OpenZeppelin - Battle-tested contract libraries
  • Ethers.js - Web3 integration
  • React - Frontend framework
  • Vite - Build tool

๐Ÿ“ License

MIT

๐Ÿ™ Acknowledgments

Built with inspiration from winning hackathon projects in DeFi, social lending, and on-chain reputation systems.


Ready to revolutionize peer-to-peer lending? Deploy TrustCircle and win your hackathon! ๐Ÿ†

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors