Skip to content

somtech123/NextProtocol

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

NexProtocol β€” Decentralized Freelance Payment Protocol

A trustless, transparent, and token-powered protocol for freelance work β€” eliminating middlemen, ensuring fair pay, and rewarding the community.


Table of Contents


overview

NexProtocol is a fully decentralized freelance payment system built on Ethereum. It replaces traditional freelance platforms by enabling clients and freelancers to interact directly through smart contracts β€” with no fees, no censorship, and no single point of failure.

Payments are made in NXT, the protocol's native ERC20 token. Work is broken into milestones, funds are held in escrow, and tokens are vested for team members and investors ensuring long-term alignment.

Why NexProtocol?

Traditional Platforms NexProtocol
20% platform fees 0% platform fees
Centralized dispute resolution Smart contract enforced
Fiat only NXT token payments
No token ownership Community ownership via NXT
Opaque fund holding Transparent on-chain escrow

Screenshots

View Screenshots for all the deployed contracts on testnet

nextprotocol/
└── assets/
    └── screenshots/
        β”œβ”€β”€ Screenshot (1).png.png
        β”œβ”€β”€ Screenshot (2).png.png
        └── Screenshot (3).png.png

Demo

NexProtocol Demo

Click the image above to watch the full demo

Architecture

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                     NexProtocol                         β”‚
β”‚                                                         β”‚
β”‚   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”     β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                  β”‚
β”‚   β”‚  NexToken   │────▢│    Escrow    β”‚                  β”‚
β”‚   β”‚   (NXT)     β”‚     β”‚  (Milestone  β”‚                  β”‚
β”‚   β”‚  ERC20 +    β”‚     β”‚   Payments)  β”‚                  β”‚
β”‚   β”‚  Burn 2%    β”‚     β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β”‚
β”‚   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                                       β”‚
β”‚          β”‚                                              β”‚
β”‚          β”‚            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                  β”‚
β”‚          └───────────▢│ VestingToken β”‚                  β”‚
β”‚                       β”‚  (Team &     β”‚                  β”‚
β”‚                       β”‚  Investors)  β”‚                  β”‚
β”‚                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                  β”‚
β”‚                                                         β”‚
β”‚   Distribution: Airdrop | Team Vesting | Ecosystem      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Smart Contracts

NexToken (NXT)

The core currency of the protocol. A deflationary ERC20 token with built-in burn mechanics, role-based access control, and emergency pause functionality.

Token Details

Property Value
Name NexToken
Symbol NXT
Max Supply 21,000,000 NXT
Decimals 18
Burn Rate 2% on every transfer
Standard ERC20 + ERC20Pausable + AccessControl

Roles

Role Permission
DEFAULT_ADMIN_ROLE Grant/revoke all roles
DISTRIBUTOR_ROLE Distribute tokens, run airdrops
PAUSER_ROLE Pause/unpause the contract
BURNER_ROLE Emergency burn while paused

Key Functions

// Distribute tokens to an address
distribute(address to, uint256 amount)

// Airdrop tokens to multiple addresses at once
airdrop(address[] calldata recipients, uint256 amount)

// Allocate vesting share (one-time)
allocateVesting(address to)

// Emergency burn β€” only when paused
emergencyBurn(uint256 amount)

Burn Mechanic

Every wallet-to-wallet transfer burns 2% of the transferred amount:

User sends 1000 NXT
β†’ 20 NXT burned πŸ”₯
β†’ 980 NXT received βœ…
β†’ total supply decreases over time

Contract-to-wallet transfers (distributions, airdrops, escrow payments) are exempt from the burn fee.


Escrow

The heart of the protocol. Clients create jobs with milestone-based payments β€” funds are locked in the contract and released only when milestones are completed and approved.

Job Lifecycle

1. Client creates job with milestones
   β†’ tokens locked in escrow

2. Freelancer completes milestone
   β†’ client reviews work

3. Client approves milestone
   β†’ NXT released to freelancer

4. All milestones complete
   β†’ job closed βœ…

Struct Definitions

struct Job {
    address     client;
    address     freelancer;
    uint256     totalAmount;
    bool        active;
    MileStone[] milestones;
}

struct MileStone {
    uint256 amount;
    bool    completed;
    bool    paid;
}

Key Functions

// Create a new job with milestone amounts
createJob(address freelancer, uint256[] memory amounts)

// Mark a milestone as complete (client only)
completeMilestone(uint256 jobId, uint256 milestoneIndex)

// Release payment for completed milestone (client only)
payMilestone(uint256 jobId, uint256 milestoneIndex)

// View full job details including milestones
getJob(uint256 jobId)

// View all jobs for a freelancer
freelancerJobs(address freelancer)

Before Creating a Job

// Step 1 β€” approve escrow to pull tokens
NexToken.approve(escrowAddress, totalAmount)

// Step 2 β€” create job
Escrow.createJob(freelancerAddress, [500, 300, 200])
// β†’ 3 milestones: 500 NXT, 300 NXT, 200 NXT
// β†’ 1000 NXT total locked in escrow

VestingToken

Manages token distribution for team members and investors with configurable cliff periods and linear vesting schedules.

How Vesting Works

Deploy VestingToken
        β”‚
        β–Ό
Cliff Period ──────────────────── No tokens claimable
        β”‚
        β–Ό
Vesting Begins ────────────────── Tokens unlock linearly
        β”‚
        β–Ό
Vesting Complete ──────────────── 100% claimable

Constructor Parameters

constructor(
    address tokenAddress,  // NXT token address
    uint256 duration,      // total vesting length
    uint256 cliff,         // cliff period
    uint8   unit           // 1=seconds 2=minutes 3=hours 4=days
)

Key Functions

// Add a beneficiary with percentage share
addBeneficiary(address recipient, uint256 percentShare, Role role)

// Claim vested tokens
claim()

// View vested amount for address
vestedAmount(address beneficiary)

// Full diagnostic view
diagnose(address beneficiary)

Roles

enum Role {
    None,
    Team,       // core team members
    Investor,   // early investors
    Advisor     // protocol advisors
}

Example Setup

// 12 month vesting, 3 month cliff, in days
VestingToken vesting = new VestingToken(NXT_ADDRESS, 365, 90, 4);

// add team member β€” 15% share
vesting.addBeneficiary(teamWallet, 15, Role.Team);

// add investor β€” 10% share
vesting.addBeneficiary(investorWallet, 10, Role.Investor);

// fund the contract
NexToken.distribute(vestingAddress, 5_000_000);

Token Distribution

Total Supply: 21,000,000 NXT

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚              NXT Token Distribution                  β”‚
β”‚                                                      β”‚
β”‚  Ecosystem & Escrow    β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ  50%         β”‚
β”‚  Team Vesting          β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ          20%         β”‚
β”‚  Investor Vesting      β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ            15%         β”‚
β”‚  Airdrop               β–ˆβ–ˆβ–ˆβ–ˆ              10%         β”‚
β”‚  Advisors              β–ˆ                  5%         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Ecosystem (10,500,000 NXT) β†’ Powers escrow payments
Team       (4,200,000 NXT) β†’ 12mo vest, 3mo cliff
Investors  (3,150,000 NXT) β†’ 24mo vest, 6mo cliff
Airdrop    (2,100,000 NXT) β†’ Community distribution
Advisors   (1,050,000 NXT) β†’ 6mo vest, 1mo cliff

Getting Started

Prerequisites

node >= 20.18.3
remix
git
foundry (optional)

Installation

# clone the repo
git clone https://github.com/somtech123/NextProtocol

# cd nexprotocol

Run Locally

# Using Remix β€” DEPLOY & RUN TRANSACTIONS

# Enviroment β€” Remix Vm 

# Deploy Contract β€” Deploy at Compiled Contract

Run On Testnet

# Using Remix β€” DEPLOY & RUN TRANSACTIONS

# Enviroment β€” Injected MetaMask

# Deploy Contract β€” Deploy at Compiled Contract

Deployment

Deploy to Testnet (Sepolia)

# set your private key
export PRIVATE_KEY=your_private_key_here

# deploy
forge script script/Deploy.s.sol \
  --rpc-url $SEPOLIA_RPC_URL \
  --private-key $PRIVATE_KEY \
  --broadcast \
  --verify

Deployment Order

1. Deploy NexToken
   β†’ copy NXT_ADDRESS

2. Deploy VestingToken(NXT_ADDRESS, duration, cliff, unit)
   β†’ copy VESTING_ADDRESS

3. Deploy Escrow(NXT_ADDRESS)
   β†’ copy ESCROW_ADDRESS

4. NexToken.allocateVesting(VESTING_ADDRESS)
   β†’ sends vesting allocation

5. NexToken.airdrop([addresses], amount)
   β†’ distributes airdrop

6. NexToken.distribute(ESCROW_ADDRESS, amount)
   β†’ funds escrow pool

Contract Addresses

Contract Network Address
NexToken Sepolia 0xD3b5B57193B13762a783510d8D7ca98d2494E7dA
Escrow Sepolia 0x3bCacacAe28cAFdC84d81d9F75a9226B26d9aC89
VestingToken Sepolia 0x02Fbf5d486d018D99D7209CC5cb976e02539F62F

Usage Guide

For Clients

1. Get NXT tokens via airdrop or purchase
2. Approve Escrow contract to spend NXT
3. Create a job with milestone amounts
4. Review freelancer work per milestone
5. Approve milestones to release NXT payment

For Freelancers

1. Receive job offer from client
2. Complete milestone work off-chain
3. Notify client for review
4. Receive NXT payment on approval

For Team / Investors

1. Wait for cliff period to pass
2. Call claim() to receive vested tokens
3. Tokens unlock linearly over vesting period
4. Call claim() anytime to collect newly vested tokens

Security

Key Security Features

  • Reentrancy Protection β€” state updated before all token transfers
  • Access Control β€” role-based permissions on all sensitive functions
  • Pause Mechanism β€” emergency pause stops all transfers instantly
  • Escrow Safety β€” funds locked until explicit milestone approval
  • Vesting Lock β€” team tokens cannot be dumped at launch
  • Burn Mechanic β€” deflationary pressure protects long-term token value
  • One-time Vesting β€” vesting allocation cannot be changed after set

Known Considerations

  • Clients must approve Escrow contract before creating jobs
  • Vesting allocations are permanent and cannot be modified
  • Emergency burn is only callable when contract is paused
  • Milestone payments are non-reversible once sent

License

MIT License β€” see LICENSE for details.


Contributing

Pull requests are welcome. For major changes please open an issue first to discuss what you would like to change.


Built with ❀️ using Solidity

Documentation Β· Report Bug Β· Request Feature

About

A decentralized freelance payment infrastructure that enables clients and freelancers to collaborate using trustless escrow, milestone-based payments, and tokenized incentives powered by blockchain smart contracts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors