Fork of Uniswap V2 core and periphery contracts, rebranded to Lista V2 and built with Hardhat instead of the original Waffle/Foundry tooling.
Solidity versions and third-party dependency versions are unchanged from upstream:
- core contracts compile with Solidity
0.5.16 - periphery contracts compile with Solidity
0.6.6 @uniswap/libis pinned to4.0.1-alpha(as upstream)
All protocol types were renamed UniswapV2* → ListaV2* (e.g. ListaV2Factory,
ListaV2Pair, ListaV2Router02, IListaV2Pair, ListaV2Library). Alongside:
- LP token
name = "Lista V2",symbol = "LISTA-V2" - revert-message prefix
UniswapV2:→ListaV2: - flash-swap callback keeps its original name
uniswapV2Call(unchanged, for compatibility with existing flash-swap integrations) - pair init code hash in
ListaV2Library.pairForrecomputed for the renamedListaV2Paircreation code:0x20adb33eb0c20d289945602eca3d6797bfe1b2555b1f251a8855fc5bb3ceea3d
Following PancakeSwap's fork, the Uniswap V1 interfaces and the
UniswapV2Migrator (plus the V1-dependent ExampleFlashSwap) were removed — they
only integrate with the legacy external Uniswap V1 protocol.
ListaV2Router01 (the contract) was also removed; ListaV2Router02 is the
canonical router. The IListaV2Router01 interface is retained as the base
that IListaV2Router02 extends (and that RouterEventEmitter / ExampleSwapToPrice
reference), matching the upstream interface split.
contracts/
core/ # forked from Uniswap/v2-core (solc 0.5.16)
periphery/ # forked from Uniswap/v2-periphery (solc 0.6.6)
test/
core/ # ported Uniswap V2 core specs (Hardhat + ethers v5 + waffle matchers)
periphery/ # ported router + example specs (V1-free fixture, no migrator/flash-swap)
The full suite (core + periphery) is 126 tests. The Uniswap V1 migrator and
V1↔V2 flash-swap specs are intentionally absent, matching the removed contracts.
A few gas-snapshot constants were adjusted to this fork's bytecode, and the
timestamp-sensitive oracle specs rely on allowBlocksWithSameTimestamp +
initialDate (set in hardhat.config.ts) to reproduce the ganache clock model
they were written against.
Periphery imports that originally referenced the @uniswap/v2-core npm package
have been rewired to the local contracts/core fork. @uniswap/lib imports are
resolved from node_modules as before.
npm install
npm run compile # hardhat compile
npm test # hardhat testScripts live in scripts/ and record addresses to deployments/<network>.json.
Configure .env (see the keys read by hardhat.config.ts): PRIVATE_KEY_TESTNET,
BSC_TESTNET_RPC_URL, and ETHERSCAN_API_KEY (Etherscan V2 unified key, used for
BscScan verification).
# deploy Factory + Router02 and write deployments/<net>.json
npx hardhat run scripts/deploy.ts --network bscTestnet
# create a pair (defaults WBNB/USDT; override TOKEN_A / TOKEN_B)
npx hardhat run scripts/create-pair.ts --network bscTestnet
# verify on the block explorer (Etherscan V2 API)
npx hardhat verify --network bscTestnet <factory> <feeToSetter>
npx hardhat verify --network bscTestnet <router> <factory> <WETH>
# read-only smoke tests + init-code-hash check
npx hardhat run scripts/smoke-test.ts --network bscTestnet
# live end-to-end (adds liquidity + swaps; spends testnet funds)
npx hardhat run scripts/smoke-swap.ts --network bscTestnetListaV2Pair is never deployed directly — the factory creates it via CREATE2, so
scripts/deploy.ts verifies keccak256(type(ListaV2Pair).creationCode) matches the
hash hardcoded in ListaV2Library.pairFor. Production deployments must use the exact
compiler settings in hardhat.config.ts (solc 0.5.16, optimizer 999999, istanbul),
or that hash — and every derived pair address — changes.
| Contract | Address |
|---|---|
| ListaV2Factory | 0xD5397504095C424325416f0c83c42F5805626c54 |
| ListaV2Router02 | 0x0B8306e6ad72Bf95538feB9fc29C8673eAe5785f |
| Pair WBNB/USDT | 0xd3ECad4ef152727581c238Fe73cE7443293Cb99B |
All three are verified on testnet.bscscan.com.
GPL-3.0-or-later (unchanged from upstream).