Skip to content

bperin/Tradecraft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

179 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tradecraft Platform

A decentralized marketplace platform with integrated token vault mechanics for revenue sharing and DeFi composability.

Overview

Tradecraft is a comprehensive decentralized marketplace platform that enables:

  • Decentralized commerce with geographic market segmentation
  • Secure escrow-based transactions
  • Vendor verification and licensing
  • Revenue sharing through tokenized vault mechanics
  • DeFi composability with ERC-4626 standard

Architecture

Core Components

  1. TradecraftManager

    • Central contract registry
    • Access control management
    • Contract address resolution
    • Cross-contract communication hub
  2. Domain Contracts

    • UserContract: User management and authentication
    • VendorContract: Vendor profiles and verification
    • ProductContract: Product listings and inventory
    • OrderContract: Transaction and escrow management
    • MarketContract: Geographic market segmentation
    • StoresContract: Physical location management
    • TradecraftVaultToken: ERC-4626 compliant token with bonding curve
  3. Support Contracts

    • StatsContract: Platform analytics
    • KYBContract: Business verification
    • MessageContract: Encrypted communication

Token Economics

The TRADE token implements ERC-4626 vault mechanics with:

  • Bonding curve for price discovery
  • Revenue sharing for stakers (40% of platform fees)
  • Monthly distribution tranches
  • Creator allocation with time lock
  • DeFi composability

Tokenomics

Overview

The TRADE token is designed to align incentives between platform stakeholders through a bonding curve mechanism and stake-to-earn revenue sharing model.

Token Distribution

  • Total Supply: 77,000,000 TRADE
  • Creator Allocation: 20% (15,400,000 TRADE) - locked for 6 months
  • Public Sale: 80% (61,600,000 TRADE) - released monthly over 12 months

Bonding Curve Mechanics

The token uses a linear bonding curve where price increases with each purchase:

Price = basePrice + (slope * totalTokensSold)
Initial Price: 0.001 ETH
Slope: 0.000000001 ETH per token

Bonding Curve Visualization

Price (ETH)
   │
0.002 │                                          ╱
      │                                      ╱
0.0015│                                 ╱
      │                            ╱
0.001 │⎯⎯⎯⎯⎯⎯╱
      │
      └──────────────────────────────────────────────
        0     20k    40k    60k    80k    100k  Tokens Sold

Token Distribution Timeline

Supply
   │
77M │                    Total Supply (77M)
   │    ╭─────────────────────────────────────
61.6M│    │   Public Sale (80%)
   │    │   Monthly Release = 5.13M
   │    │
15.4M│────┤   Creator Lock (20%)
   │    │   6-month lock
   │    │
0  │────┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───┼───►
   0    1   2   3   4   5   6   7   8   9   10  11  12 Months

Staking and Revenue Flow

                   Platform Fees (10%)
                          │
                          ▼
┌─────────────┐    ┌──────────────┐    ┌─────────────┐
│  Purchase   │    │   Revenue    │    │   Staked    │
│   Tokens    │───►│     Pool     │◄───│   Tokens    │
└─────────────┘    └──────────────┘    └─────────────┘
                          │                    ▲
                          │                    │
                          ▼                    │
                   ┌──────────────┐           │
                   │Distribution to│           │
                   │   Stakers    │───────────┘
                   └──────────────┘

Staking Duration vs. Revenue Share

Revenue
Share    7d    30d    90d    365d
Factor   │     │      │       │
   │     │     │      │       │
1.0│─────┴─────┴──────┴───────┴────►
   │     Stake Duration
   │
0.0│
   └─────────────────────────────────►
        Duration

Example Revenue Distribution

Total Platform Revenue: 100 ETH
Total Staked: 500,000 TRADE
                                        Revenue Share
┌──────────────────┐ 100k TRADE (20%) ┌──────────────┐
│  Large Staker    │─────────────────►│    20 ETH    │
└──────────────────┘                  └──────────────┘

┌──────────────────┐ 50k TRADE (10%)  ┌──────────────┐
│  Medium Staker   │─────────────────►│    10 ETH    │
└──────────────────┘                  └──────────────┘

┌──────────────────┐ 5k TRADE (1%)    ┌──────────────┐
│  Small Staker    │─────────────────►│     1 ETH    │
└──────────────────┘                  └──────────────┘

Revenue Sharing Model

The platform takes 10% of all marketplace transactions as fees. Of these fees, 40% is distributed to token stakers proportionally based on their stake amount and duration.

Staking Mechanics:

  • Minimum Stake: 7 days
  • Maximum Stake: 365 days
  • Revenue Share: 40% of platform fees distributed to stakers
  • Distribution: Proportional to staked amount
  • Claims: Revenue can be claimed at any time during active stake
  • Unstaking: Tokens are locked until stake duration ends

Revenue Distribution Example:

If the platform processes 1000 ETH in transactions:

Transaction Volume: 1000 ETH
Platform Fee (10%): 100 ETH
Staking Revenue (40% of fees): 40 ETH

Distribution for stakers:
- If total staked = 1000 TRADE tokens:
- A user staking 100 TRADE (10%) would earn:
  40 ETH × 10% = 4 ETH in revenue

Monthly Token Release:

  • Monthly Base Amount: 5.13M TRADE
  • Unsold tokens roll over to next month
  • Example Monthly Pool:
    Month 1: 5.13M TRADE available
    If 3M sold: 2.13M rolls to Month 2
    Month 2 Pool: 5.13M + 2.13M = 7.26M TRADE
    

Staking Strategies

  1. Short-term Staking (30 days):

    Investment: 50 TRADE tokens
    Platform Monthly Revenue: 100 ETH
    Total Staked: 500 TRADE
    Expected Monthly Revenue: 4 ETH
    (Assuming 40% to staking pool and proportional share)
    
  2. Medium-term Staking (90 days):

    Investment: 100 TRADE tokens
    Platform Quarterly Revenue: 300 ETH
    Total Staked: 500 TRADE
    Expected Quarterly Revenue: 24 ETH
    (Assuming consistent platform volume)
    
  3. Long-term Staking (180+ days):

    Investment: 200 TRADE tokens
    Platform 6-Month Revenue: 600 ETH
    Total Staked: 500 TRADE
    Expected 6-Month Revenue: 96 ETH
    (Assuming consistent platform volume)
    

Key Features

  1. Active Staking Required:

    • Must stake tokens to earn revenue
    • Revenue is claimable during active stake
    • Must restake after period ends to continue earning
  2. Price Discovery:

    • Bonding curve ensures fair price discovery
    • Price formula: basePrice + (slope × totalTokensSold)
    • Initial price: 0.001 ETH
    • Slope: 0.000000001 ETH per token
  3. Revenue Distribution:

    • 40% of platform fees go to staking pool
    • Distribution proportional to stake amount
    • Claims processed in real-time
    • Revenue must be claimed before unstaking

Risk Considerations

  1. Staking Period:

    • Tokens locked for chosen duration
    • No early withdrawal
    • Plan stake duration carefully
  2. Revenue Variability:

    • Returns depend on platform volume
    • More stakers = smaller individual share
    • Platform growth affects revenue
  3. Price Impact:

    • Token price follows bonding curve
    • Larger purchases move price more
    • Consider entry and exit timing

Getting Started

Prerequisites

  • Node.js v16+
  • Hardhat
  • TypeScript

Installation

# Clone the repository
git clone https://github.com/your-org/tradecraft.git

# Install dependencies
npm install

# Copy environment file
cp .env.example .env

# Configure environment variables
# Edit .env with your settings

Development Setup

# Compile contracts
npx hardhat compile

# Run tests
npx hardhat test

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

Smart Contract Architecture

Base Contracts

  1. BaseContract.sol

    • Common utilities and access control
    • Pagination support
    • Cross-contract communication
  2. TradecraftVaultToken.sol

    • ERC-4626 vault implementation
    • Bonding curve mechanics
    • Revenue distribution
    • Monthly tranche management

Domain Contracts

Each domain contract handles specific functionality:

  1. UserContract.sol

    • User registration and profiles
    • Authentication
    • Role management
  2. VendorContract.sol

    • Vendor profiles
    • License management
    • Market participation
  3. ProductContract.sol

    • Product listings
    • Pricing
    • Inventory management
  4. OrderContract.sol

    • Order creation
    • Escrow management
    • Payment processing
    • Order state management
  5. MarketContract.sol

    • Market definition
    • Geographic boundaries
    • Market-specific rules

Testing

# Run all tests
npm test

# Run specific test suite
npx hardhat test test/TokenContract.test.ts

# Run tests with gas reporting
REPORT_GAS=true npx hardhat test

Deployment

Local Development

npx hardhat node
npx hardhat run scripts/deploy.ts --network localhost

Test Networks

npx hardhat run scripts/deploy.ts --network goerli

Production Deployment

npx hardhat run scripts/deploy.ts --network mainnet

Security

  • All contracts use OpenZeppelin's secure implementations
  • ReentrancyGuard protection on state-changing functions
  • Access control through TradecraftManager
  • Regular security audits
  • Bug bounty program

Contributing

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a new Pull Request

License

MIT License - see LICENSE.md

Contact

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published