Decentralized job marketplace with WETH escrow and Work Credential NFTs on Scroll Sepolia.
You can access the Mintwork DApp Frontend repository here.
- Overview
- Contracts
- Prerequisites
- Setup
- Deployment
- Development
- Architecture
- Smart Contract Functions
- Security Features
- Troubleshooting
Mintwork is a smart contract system that enables:
- Job Creation: Requesters create jobs and lock WETH in escrow
- Work Submission: Workers claim jobs and submit their work
- Payment & NFT Minting: Upon approval, workers receive WETH payment and a Work Credential NFT
WorkNFT.sol: ERC-721 NFT that serves as a verifiable credential of completed workWorkMarketplace.sol: Escrow-based marketplace that manages jobs and payments
- Foundry
- Private key with ETH on Scroll Sepolia
- WETH contract address on Scroll Sepolia
- Clone and install dependencies:
git clone <your-repo>
cd devconnect-mintwork
forge install- Configure environment variables:
# Copy the example file
cp env.example .env
# Edit .env with your values
PRIVATE_KEY=your_private_key_here
WETH_ADDRESS=0x5300000000000000000000000000000000000004- Build:
forge buildOption 1: Using Makefile (Recommended)
# Export environment variables
export PRIVATE_KEY="your_private_key_here"
export WETH_ADDRESS="0x5300000000000000000000000000000000000004"
# Deploy contracts
make deployOption 2: Using .env file
# Load environment variables
source .env
# Deploy contracts
forge script script/DeployWorkNFT.s.sol:DeployMintwork \
--rpc-url https://sepolia-rpc.scroll.io \
--broadcast \
--verify \
-vvvvOption 3: Using export directly
# Export environment variables
export PRIVATE_KEY="your_private_key_here"
export WETH_ADDRESS="0x5300000000000000000000000000000000000004"
# Deploy contracts
forge script script/DeployWorkNFT.s.sol:DeployMintwork \
--rpc-url https://sepolia-rpc.scroll.io \
--broadcast \
--verify \
-vvvvmake build # Build the project
make test # Run tests
make fmt # Format code
make deploy # Deploy to Scroll Sepolia (with verification)
make deploy-no-verify # Deploy without verification (faster)
make deploy-local # Deploy to local Anvil node
make help # Show all available commandsScroll Sepolia Testnet:
- RPC URL:
https://sepolia-rpc.scroll.io - Chain ID:
534351 - Currency: ETH
- Explorer: https://sepolia.scrollscan.com
forge buildforge testforge fmtforge snapshot# Start local node
anvil
# Deploy to local node
forge script script/DeployWorkNFT.s.sol:DeployMintwork \
--rpc-url http://localhost:8545 \
--broadcastdevconnect-mintwork/
ββ src/
β ββ Mintwork_Escrow.sol # Contract for escrow custody and management of funds/payments
β ββ Mintwork_NFT.sol # Main NFT contract (ERC-721 or ERC-1155), representing the "Work"
ββ script/
β ββ DeployWorkNFT.sol # Hardhat/Foundry script for deploying the contracts
ββ .env.example # Example environment variables (private keys, RPC URLs, etc.)
ββ flattens/
β ββ WorkMarketplace.flatten.sol # Flattened version of the WorkMarketplace contract (for verification or auditing)
β ββ WorkNFT.flatten.sol # Flattened version of the WorkNFT contract (all dependencies in one file)
ββ Makefile # Shortcuts for common commands (compile, test, deploy)
ββ out/
β ββ Mintwork_Escrow.sol/ # Compilation artifacts generated by Foundry (ABI, bytecode, metadata)
β ββ Mintwork_NFT.sol/ # Compilation artifacts for the NFT contract (ABI, bytecode, metadata)
ββ ...
- Deploy
WorkNFTcontract - Deploy
WorkMarketplacecontract with WETH and WorkNFT addresses - Transfer WorkNFT ownership to WorkMarketplace (allows marketplace to mint NFTs)
- Create Job: Requester creates job and locks WETH in escrow
- Take Job: Worker claims the job
- Submit Work: Worker submits delivery URL
- Approve Work: Requester approves β Worker receives WETH + Work Credential NFT
- Cancel Job: Requester can cancel before job is taken (refund)
createJob(reward, deadline, title, description)- Create a new job with WETH escrowtakeJob(jobId)- Claim a jobsubmitWork(jobId, deliveryUrl)- Submit completed workapproveWork(jobId)- Approve work and trigger payment + NFT mintcancelJob(jobId)- Cancel job and refund WETH (only if not taken)
mintWorkNft(...)- Mint Work Credential NFT (only callable by WorkMarketplace)
- β ReentrancyGuard on payment functions
- β Ownable access control
- β WETH held in escrow until approval
- β Only marketplace can mint NFTs
Error: "contract source info format must be..."
- Make sure to specify the contract name:
script/DeployWorkNFT.s.sol:DeployMintwork
Error: "WETH address zero"
- Ensure
WETH_ADDRESSenvironment variable is set
Verification fails:
- You may need a Scrollscan API key for contract verification
- Add to .env:
ETHERSCAN_API_KEY=your_scrollscan_api_key
MIT