Uniswap-Style Multi-Chain Swap Contract

Job ID: 40040080

Budget: $30 – $250 USD

I need a Uniswap V2–inspired smart contract that focuses purely on token swapping. The contract should mirror the core swap mechanics—constant-product market-making, support for fee collection, and on-chain price querying—while omitting any extra yield-farming or liquidity-mining layers.

Target chains
The solution must compile and run on Ethereum mainnet, Binance Smart Chain, and Polygon without code changes beyond network addresses. Hard-coding of chain IDs is fine so long as they can be set during deployment.

Technical expectations
• Language: Solidity ≥0.8.x
• Tooling: Hardhat or Foundry for compilation, testing, and deployment scripts
• Gas considerations: match or beat Uniswap V2 swap gas where possible
• Security: re-entrancy protection, overflow checks (using Solidity 0.8’s built-ins), and clear handling of fee-on-transfer tokens

Deliverables
1. Well-commented Solidity contracts implementing the swap pair, factory, and router logic
2. Migration scripts (JavaScript/TypeScript or Foundry) for the three target networks
3. Hardhat/Foundry test suite demonstrating successful swaps, fee accounting, and edge-case handling
4. README with deployment steps and parameter explanations

Acceptance criteria
• Swaps execute correctly for any ERC-20 pair on Ethereum, BSC, and Polygon testnets
• Reserves update exactly as Uniswap V2’s reference implementation
• All unit tests pass and coverage exceeds 90 %
• Contract bytecode verified on a public block explorer for at least one network

If you have audited or forked Uniswap V2 before, that experience will be a plus.