In-depth documentation on Uniswap V2 is available at uniswap.org.
The built contract artifacts can be browsed via unpkg.com.
The following assumes the use of node@>=10.
yarn
yarn compile
yarn test
A Uniswap V2 fork for the Base network.
EdgenSwap uses a unified deployment process that works across all networks defined in your hardhat.config.js. The deployment script handles network-specific safety checks and provides options for contract verification.
-
Create a
.envfile in the project root with the following variables:PRIVATE_KEY=your_wallet_private_key BASESCAN_API_KEY=your_basescan_api_key BASE_MAINNET_RPC_URL=https://mainnet.base.org BASE_SEPOLIA_RPC_URL=https://sepolia.base.org FEE_SETTER_ADDRESS=address_for_fee_control (required for mainnet) -
Install dependencies:
npm install
The unified deployment script supports the following networks already configured in hardhat.config.js:
- Base Sepolia (testnet)
- Base Mainnet
npx hardhat run scripts/deploy.js --network baseSepoliaTo deploy AND verify contracts:
npx hardhat run scripts/deploy.js --network baseSepolia --verifyFor mainnet deployments, you MUST set the FEE_SETTER_ADDRESS in your .env file:
npx hardhat run scripts/deploy.js --network baseMainnetTo deploy AND verify contracts:
npx hardhat run scripts/deploy.js --network baseMainnet --verifyIf you need to verify previously deployed contracts:
npx hardhat verify --network baseSepolia CONTRACT_ADDRESS CONSTRUCTOR_ARGSExample:
npx hardhat verify --network baseSepolia 0xYourFactoryAddress "0xFeeSetter"The deployment script includes several safety features:
- Mainnet confirmation prompts to prevent accidental deployments
- Gas price checks before mainnet deployment
- Required fee setter address for mainnet deployments
- Deployment records saved to
deployments/{network}/*.json - Verification with retry logic
To add support for additional networks:
- Add the network configuration to
hardhat.config.js - Add the appropriate API key for verification
- Use the existing deployment command with your new network name
Deployed contract addresses can be found in the deployments/{network}/ directory after running the deployment script.