Contracts
Smart Contracts
On-chain infrastructure for PRIV Protocol on Base.
Overview
PRIV Protocol is built on Base (Chain ID: 8453) using Solidity 0.8.24. The protocol consists of 22 smart contracts that work together to enable privacy-preserving data exchange, advertising, staking, and governance.
| Contract | Purpose |
|---|---|
| PRIVToken | ERC-20 token with ERC20Votes for governance |
| PRIVStaking | Stake PRIV tokens to earn rewards |
| DataXchange | Marketplace for privacy-preserving data exchange |
| AdNetwork | Decentralized advertising with multi-oracle consensus |
| DataContribution | Rewards for data contributions (photos, videos, voice) |
| LabelingRewards | AI training labeling tasks with staking |
| PRIVGovernor | DAO governance with proposal management |
| PRIVTimelock | Timelock controller for governance execution |
| FeeManagerV2 | Central fee distribution (40% burn / 35% stakers / 25% treasury) |
| DataWalletMarketplace | Bulk purchase marketplace for data wallet media |
| TokenDistributionV2 | Multi-tier token vesting and distribution (Founder, Treasury, Ecosystem) |
| FounderVesting | |
| MintingController | Phase-based minting caps (10M/5M/2M) |
| FounderPerformanceBond | TVL milestone-based token releases |
| PrivPresale | 10-stage presale with ETH/USDC/Card, Chainlink oracle, vesting |
| PriceOracle | Chainlink price feeds with staleness checks and manual override |
| PricingEngine | PRIV/USD conversions and USDC integration |
| Treasury | Protocol treasury with multi-sig threshold management |
| TreasuryManager | Automated treasury operations |
| BountyEscrow | Data bounty escrow with 3 payment tiers and auto-payout |
| ApproverRegistry | Game-theory QA with stake-to-approve, consensus voting, slashing |
| PRIVStakingV2 | ve-PRIV staking with 5 lock tiers (Flex/Bronze/Silver/Gold/Diamond), weighted rewards, auto-compound |
Network Information
| Property | Value |
|---|---|
| Network | Base |
| Chain ID | 8453 |
| Solidity Version | 0.8.24 |
| Block Time | ~2 seconds |
Deployment Order
The contracts must be deployed in a specific order due to dependencies:
graph TD
A[1. PRIVToken] --> B[2. PRIVTimelock]
A --> C[3. PRIVGovernor]
B --> C
A --> D[4. PRIVStaking]
A --> E[5. FeeManager]
E --> F[6. DataXchange]
E --> G[7. AdNetwork]
A --> H[8. DataContribution]
A --> I[9. LabelingRewards]
E --> J[10. DataWalletMarketplace]
A --> K[11. TokenDistributionV2]
A --> M[12. MintingController]
A --> N[13. FounderPerformanceBond]
A -.-> L[14. FounderVesting ARCHIVED]
subgraph "Token Layer"
A
end
subgraph "Governance Layer"
B
C
end
subgraph "Fee Infrastructure"
E
end
subgraph "Application Layer"
D
F
G
H
I
J
end
subgraph "Distribution Layer"
K
M
N
L
endDeployment Steps:
- PRIVToken - Deploy first as the base token for the ecosystem
- PRIVTimelock - Deploy with initial delay (2 days recommended)
- PRIVGovernor - Deploy with PRIVToken and PRIVTimelock addresses
- PRIVStaking - Deploy with PRIVToken address
- FeeManagerV2 - Deploy with PRIVToken, staking, and treasury addresses
- DataXchange - Deploy with PRIVToken and FeeManagerV2 addresses
- AdNetwork - Deploy with PRIVToken, FeeManager, and oracle addresses
- DataContribution - Deploy with PRIVToken and oracle addresses
- LabelingRewards - Deploy with PRIVToken and oracle addresses
- DataWalletMarketplace - Deploy with PRIVToken and FeeManager addresses
- TokenDistributionV2 - Deploy with PRIVToken and beneficiary addresses
- MintingController - Deploy with PRIVToken address; configure phase caps (10M/5M/2M)
- FounderPerformanceBond - Deploy with PRIVToken and TVL oracle addresses; configure milestone amounts ($1M/$5M/$10M/$25M)
- FounderVesting - (Archived -- will NOT be deployed to mainnet) Standalone founder vesting, superseded by TokenDistributionV2
- PriceOracle - Deploy with Chainlink feed addresses
- PricingEngine - Deploy with PRIVToken, PriceOracle, and USDC addresses
- Treasury - Deploy with multi-sig configuration
- TreasuryManager - Deploy with Treasury and PRIVToken addresses
- BountyEscrow - Deploy with PRIVToken, FeeManagerV2, and oracle addresses
- ApproverRegistry - Deploy with PRIVToken address; register as BountyEscrow oracle
- PRIVStakingV2 - Deploy with PRIVToken address and reward rate; fund rewards pool
Deployments
Base Mainnet
| Contract | Address |
|---|---|
| PRIVToken | Coming Soon |
| PRIVStaking | Coming Soon |
| FeeManager | Coming Soon |
| DataXchange | Coming Soon |
| AdNetwork | Coming Soon |
| DataContribution | Coming Soon |
| LabelingRewards | Coming Soon |
| DataWalletMarketplace | Coming Soon |
| TokenDistributionV2 | Coming Soon |
| MintingController | Coming Soon |
| FounderPerformanceBond | Coming Soon |
| FounderVesting | (Archived -- will not be deployed) |
| PRIVGovernor | Coming Soon |
| PRIVTimelock | Coming Soon |
Base Sepolia (Testnet)
All 22 contracts deployed and verified. See packages/contracts/deployments/base-sepolia.json for full address list.
| Contract | Address |
|---|---|
| PRIVToken | 0x323BB0b9d047378fdd2fC2ea30780a123f98C9c5 |
| BountyEscrow | 0xac973946325750b73BAB26bc7D978AFcFB62591e |
| ApproverRegistry | 0xB1536f831242bCa3357458dfCD6157e3F8e16227 |
| PRIVStakingV2 | 0xFd0b01756178DADCBCfCc1ED337c0e6Dde29B62E |
| PrivPresale | 0xcD582BeE71c52e363EBb994BB7d87D5c774A59Fe |
| FeeManagerV2 | 0x48beF02731eB12c18fc36a65e77e88F0ccc58CFD |
Architecture
+-----------------+
| PRIVToken |
| (ERC20Votes) |
+--------+--------+
|
+------------+------------+------------+------------+
| | | | |
v v v v v
+-------------+ +----------+ +----------+ +----------+ +----------+
| PRIVStaking | | DataX- | | AdNetwork| | Data- | | Labeling |
| | | change | | | | Contrib | | Rewards |
+-------------+ +----------+ +----------+ +----------+ +----------+
^
|
+--------+--------+
| |
+----+----+ +-----+-----+
| PRIV | | PRIV |
| Governor|----->| Timelock |
+---------+ +-----------+Token Flow:
- All contracts use PRIV tokens for payments and rewards
- The token contract manages supply and minting
- Governance controls protocol parameters through timelock
Security Features
All contracts implement robust security patterns:
| Feature | Description |
|---|---|
| ReentrancyGuard | Protection against reentrancy attacks |
| SafeERC20 | Safe token transfer handling |
| Ownable | Access control for admin functions |
| Pausable | Emergency pause functionality |
| Multi-Oracle Consensus | M-of-N confirmation for critical operations |
| Timelock Protection | Delayed execution for governance and price updates |
| Custom Errors | Gas-efficient error handling |
Development
Local Setup
cd packages/contracts
forge install
forge buildRunning Tests
# Run all tests
forge test
# Run with verbosity
forge test -vvv
# Gas report
forge test --gas-reportDeploy
# Deploy to Base Sepolia
forge script script/Deploy.s.sol --rpc-url base-sepolia --broadcast
# Deploy to Base Mainnet
forge script script/Deploy.s.sol --rpc-url base --broadcastContract Documentation
Core Token
- PRIV Token - Native protocol token with governance voting
DeFi
- StakingV2 - ve-PRIV staking with 5 lock tiers and weighted rewards
Fee Infrastructure
- FeeManagerV2 - Central hub for processing and distributing protocol fees (40% burn / 35% stakers / 25% treasury)
Marketplaces
- DataXchange - Data marketplace with timelock protection
- AdNetwork - Advertising network with multi-oracle consensus
- DataWalletMarketplace - Bulk purchase marketplace for data wallet media (3% fee)
Data Rewards
- Data Contribution - Rewards for data uploads
- Labeling Rewards - AI training task marketplace
Token Distribution
- TokenDistributionV2 - Multi-tier vesting for Founder (3M TGE / 27M vested), Treasury, and Ecosystem allocations
- FounderVesting (archived -- see TokenDistributionV2) - Standalone founder vesting contract. Will NOT be deployed to mainnet.
Data Bounty Board
- BountyEscrow - Data bounty escrow with 3 payment tiers (Standard, DirectPRIV, StakedPRIV), auto-payout, FeeManagerV2 integration
- ApproverRegistry - Game-theory QA with 500 PRIV stake, 3-vote quorum, 66.67% consensus, slashing
Governance
- Governance - DAO governance with PRIVGovernor and PRIVTimelock