Skip to content

web2basic/SecureFlow

Β 
Β 

Repository files navigation

SecureFlow - Decentralized Escrow & Freelance Marketplace

License: MIT Solidity Next.js

πŸš€ Overview

SecureFlow is a comprehensive decentralized platform combining escrow services with a freelance marketplace, built on Monad blockchain. Features gasless transactions through MetaMask Smart Accounts, multi-arbiter dispute resolution, and reputation systems.

✨ Key Features

πŸ—οΈ Core Platform

  • Hybrid Escrow + Marketplace: Direct hires and open job applications
  • Gasless Transactions: MetaMask Smart Account integration for zero-fee transactions
  • Multi-Arbiter Consensus: 1-5 arbiters with quorum-based voting
  • Reputation System: Anti-gaming reputation tracking
  • Native & ERC20 Support: MON and whitelisted ERC20 tokens

🎯 Advanced Features

  • Milestone Management: Submit, approve, reject, dispute milestones
  • Job Applications: Freelancers apply to open jobs
  • Dispute Resolution: Time-limited dispute windows with arbiter consensus
  • Real-time Notifications: In-app notification system
  • Client Feedback: Rejection reasons and improvement suggestions

πŸ›‘οΈ Security & Trust

  • Smart Account Integration: Delegated execution for gasless transactions
  • Paymaster Contract: Gas sponsorship for seamless UX
  • Reentrancy Protection: All external functions protected
  • Input Validation: Comprehensive parameter checking
  • Emergency Controls: Admin pause and refund mechanisms

πŸ“ Project Structure

β”œβ”€β”€ contracts/
β”‚   β”œβ”€β”€ SecureFlow.sol          # Main escrow & marketplace contract
β”‚   └── Paymaster.sol           # Gas sponsorship contract
β”œβ”€β”€ frontend/                   # Next.js application
β”‚   β”œβ”€β”€ app/                    # App router pages
β”‚   β”œβ”€β”€ components/             # UI components
β”‚   └── contexts/               # React contexts
β”œβ”€β”€ scripts/
β”‚   β”œβ”€β”€ deploy.js               # Contract deployment
β”‚   └── deploy-paymaster.js     # Paymaster deployment
└── test/
    └── SecureFlow.test.js      # Test suite

πŸš€ Quick Start

Prerequisites

  • Node.js 18+
  • MetaMask wallet
  • Monad testnet access

Installation

  1. Clone and install dependencies
git clone https://github.com/your-org/secureflow.git
cd secureflow
npm install
cd frontend
npm install
  1. Environment setup
# Copy environment files
cp .env.example .env
cp frontend/.env.example frontend/.env.local

# Configure your environment variables
  1. Deploy contracts
# Deploy to Monad testnet
npx hardhat run scripts/deploy.js --network monad
npx hardhat run scripts/deploy-paymaster.js --network monad
  1. Start frontend
cd frontend
npm run dev

🎯 User Workflows

For Clients

  1. Create Escrow β†’ Set project details, milestones, budget
  2. Manage Projects β†’ Review submissions, approve/reject milestones
  3. Provide Feedback β†’ Give rejection reasons for improvements

For Freelancers

  1. Browse Jobs β†’ View open listings, apply with proposals
  2. Work Management β†’ Submit milestones, address feedback
  3. Resubmit β†’ Improve rejected milestones with updates

For Arbiters

  1. Dispute Resolution β†’ Review cases, vote on resolutions
  2. Maintain Integrity β†’ Help resolve platform disputes

πŸ§ͺ Testing

# Run smart contract tests
npm test

# Run frontend tests
cd frontend
npm test

Test Coverage: 26+ tests covering deployment, escrow creation, marketplace functions, work lifecycle, reputation system, and security.

πŸš€ Deployment

Smart Contracts

# Deploy to Monad testnet
npx hardhat run scripts/deploy.js --network monad
npx hardhat run scripts/deploy-paymaster.js --network monad

Frontend (Vercel)

# Build for production
cd frontend
npm run build

# Deploy to Vercel
vercel --prod

πŸ“Š Current Deployment

  • Contract Address: 0x540fDEc0D5675711f7Be40a648b3F8739Be3be5a
  • Paymaster Address: 0x5333A1A9Aec72147E972B8A78d0bb0c42fDeE2E2
  • Network: Monad Testnet (Chain ID: 10143)
  • Status: Production Ready

πŸ”§ Configuration

Smart Contract Settings

// Platform fees (0% for demo)
uint256 public platformFeePercentage = 0;

// Arbiter management
function authorizeArbiter(address arbiter) external onlyOwner
function revokeArbiter(address arbiter) external onlyOwner

Frontend Configuration

// Contract addresses
export const CONTRACTS = {
  SECUREFLOW_ESCROW: "0x540fDEc0D5675711f7Be40a648b3F8739Be3be5a",
  PAYMASTER: "0x5333A1A9Aec72147E972B8A78d0bb0c42fDeE2E2",
};

πŸ”„ Gasless Transaction Flow

  1. User connects MetaMask β†’ Smart Account initializes
  2. Transaction request β†’ Delegation system activates
  3. Gasless execution β†’ Paymaster sponsors gas fees
  4. Blockchain confirmation β†’ Transaction completed

πŸ›‘οΈ Security Features

  • Reentrancy Protection: All external functions protected
  • Input Validation: Comprehensive parameter checking
  • Access Control: Role-based permissions
  • Emergency Pause: Admin-controlled pause functionality
  • Gas Optimization: Efficient contract design

πŸ“ˆ Roadmap

Phase 1: Core Platform βœ…

  • Smart contract development
  • Frontend application
  • Basic escrow functionality
  • Job marketplace

Phase 2: Advanced Features βœ…

  • Gasless transactions
  • Smart Account integration
  • Dispute resolution
  • Reputation system

Phase 3: Optimization

  • Mobile application
  • Advanced analytics
  • Multi-chain support

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Submit a pull request

πŸ“„ License

This project is licensed under the MIT License.

πŸ†˜ Support

  • GitHub Issues: Report bugs
  • Documentation: See project docs for detailed guides

Built with ❀️ for the decentralized future of work

SecureFlow - Where trust meets technology

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 90.7%
  • Solidity 6.0%
  • JavaScript 2.0%
  • CSS 1.3%