git clone https://github.com/Men6d656e/DEX.git cd DEX make install
This installs Foundry dependencies (forge install) and frontend npm packages.
make build-contracts
# All tests make test # Just contract tests (182+ Solidity tests) make test-contracts # Just frontend tests make test-frontend # Coverage report (LCOV) make coverage
Start a local Anvil node in Terminal 1:
make anvil
In Terminal 2, deploy contracts (one command does it all):
make deploy-anvil
This will:
--interactives 1)frontend/src/lib/constants.tsđĄ For Anvil, use one of the default private keys printed when Anvil starts (e.g., 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80).
make dev
This installs any missing frontend dependencies and starts the dev server at http://localhost:3000 with hot reload.
Create contracts/.env from the template:
cp contracts/.env.example contracts/.env
Edit contracts/.env with your Sepolia RPC URL and Etherscan API key:
# Sepolia RPC URL (from Alchemy, Infura, or your provider) SEPOLIA_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/YOUR_API_KEY # Etherscan API key (for contract verification) ETHERSCAN_API_KEY=YOUR_ETHERSCAN_API_KEY
make deploy-sepolia
This will:
SEPOLIA_RPC_URL and ETHERSCAN_API_KEY from contracts/.env--verify)frontend/src/lib/constants.tsMake sure your wallet has Sepolia test ETH for gas. You can get it from sepoliafaucet.com.
The --verify flag automatically submits your source code to Etherscan after deployment. You can then view your contracts with a "Verified" badge on the Sepolia Etherscan explorer.
If you need to re-capture addresses without redeploying (e.g., after a git checkout reverted constants.ts):
make update-addresses CHAIN_ID=31337 # For Anvil make update-addresses CHAIN_ID=11155111 # For Sepolia
This parses the latest broadcast/Deploy.s.sol/run-latest.json and writes to frontend/src/lib/constants.ts.
make prod
This builds the frontend (npm run build) and starts the production server at http://localhost:3000.
The frontend is ready for Vercel deployment:
frontendNEXT_PUBLIC_COINGECKO_API_KEY (optional, for CoinGecko market data)To use live market data instead of simulated charts:
frontend/.env.local:
NEXT_PUBLIC_COINGECKO_API_KEY=your_api_key_here
Without a CoinGecko API key, the frontend falls back to simulated market data. The app works fine either way.
| Command | Description |
|---|---|
make install | Install all dependencies (forge + npm) |
make build | Build contracts + frontend |
make test | Run all tests |
make anvil | Start local Anvil node (port 8545) |
make deploy-anvil | Deploy to Anvil + auto-update addresses |
make deploy-sepolia | Deploy to Sepolia + verify + auto-update |
make update-addresses | Re-capture addresses from broadcast JSON |
make dev | Install frontend deps + start dev server |
make prod | Build + serve production |
make coverage | Generate Foundry coverage report |
make fmt | Format Solidity + TypeScript |
make generate-abi | Generate wagmi type-safe hooks |
make clean | Clean all artifacts |