Skip to content

Commit 08f460e

Browse files
razwwclaude
andcommitted
refactor: remove ListaV2Router01, keep Router02 as canonical router
- delete the ListaV2Router01 contract (Router02 is the active router) - drop router01 from the periphery fixture - rename ListaV2Router01.spec.ts -> ListaV2Router.spec.ts and run its generic router tests against Router02 only - keep the IListaV2Router01 interface: it is the base that IListaV2Router02 extends and that RouterEventEmitter / ExampleSwapToPrice reference Full suite: 126 passing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 2da80c2 commit 08f460e

4 files changed

Lines changed: 9 additions & 293 deletions

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ Following PancakeSwap's fork, the Uniswap **V1** interfaces and the
2929
`UniswapV2Migrator` (plus the V1-dependent `ExampleFlashSwap`) were removed — they
3030
only integrate with the legacy external Uniswap V1 protocol.
3131

32+
`ListaV2Router01` (the contract) was also removed; **`ListaV2Router02` is the
33+
canonical router**. The `IListaV2Router01` interface is retained as the base
34+
that `IListaV2Router02` extends (and that `RouterEventEmitter` / `ExampleSwapToPrice`
35+
reference), matching the upstream interface split.
36+
3237
## Layout
3338

3439
```
@@ -40,7 +45,7 @@ test/
4045
periphery/ # ported router + example specs (V1-free fixture, no migrator/flash-swap)
4146
```
4247

43-
The full suite (core + periphery) is **145 tests**. The Uniswap V1 migrator and
48+
The full suite (core + periphery) is **126 tests**. The Uniswap V1 migrator and
4449
V1↔V2 flash-swap specs are intentionally absent, matching the removed contracts.
4550
A few gas-snapshot constants were adjusted to this fork's bytecode, and the
4651
timestamp-sensitive oracle specs rely on `allowBlocksWithSameTimestamp` +

contracts/periphery/ListaV2Router01.sol

Lines changed: 0 additions & 281 deletions
This file was deleted.
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,14 @@ const overrides = {
1515
}
1616

1717
enum RouterVersion {
18-
ListaV2Router01 = 'ListaV2Router01',
1918
ListaV2Router02 = 'ListaV2Router02'
2019
}
2120

2221
const provider = waffle.provider
2322
const [wallet] = provider.getWallets()
2423
const loadFixture = waffle.createFixtureLoader([wallet], provider)
2524

26-
describe('ListaV2Router{01,02}', () => {
25+
describe('ListaV2Router', () => {
2726
for (const routerVersion of Object.keys(RouterVersion)) {
2827
describe(routerVersion, () => {
2928
let token0: Contract
@@ -43,7 +42,6 @@ describe('ListaV2Router{01,02}', () => {
4342
WETHPartner = fixture.WETHPartner
4443
factory = fixture.factoryV2
4544
router = {
46-
[RouterVersion.ListaV2Router01]: fixture.router01,
4745
[RouterVersion.ListaV2Router02]: fixture.router02
4846
}[routerVersion as RouterVersion]
4947
pair = fixture.pair
@@ -364,7 +362,6 @@ describe('ListaV2Router{01,02}', () => {
364362
const receipt = await tx.wait()
365363
expect(receipt.gasUsed).to.eq(
366364
{
367-
[RouterVersion.ListaV2Router01]: 101876,
368365
[RouterVersion.ListaV2Router02]: 101898
369366
}[routerVersion as RouterVersion]
370367
)
@@ -513,8 +510,7 @@ describe('ListaV2Router{01,02}', () => {
513510
const receipt = await tx.wait()
514511
expect(receipt.gasUsed).to.eq(
515512
{
516-
[RouterVersion.ListaV2Router01]: 138700,
517-
[RouterVersion.ListaV2Router02]: 138700
513+
[RouterVersion.ListaV2Router02]: 138770
518514
}[routerVersion as RouterVersion]
519515
)
520516
}).retries(3)

test/periphery/shared/fixtures.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import IListaV2Pair from '../../../artifacts/contracts/core/interfaces/IListaV2P
88

99
import ERC20 from '../../../artifacts/contracts/periphery/test/ERC20.sol/ERC20.json'
1010
import WETH9 from '../../../artifacts/contracts/periphery/test/WETH9.sol/WETH9.json'
11-
import ListaV2Router01 from '../../../artifacts/contracts/periphery/ListaV2Router01.sol/ListaV2Router01.json'
1211
import ListaV2Router02 from '../../../artifacts/contracts/periphery/ListaV2Router02.sol/ListaV2Router02.json'
1312
import RouterEventEmitter from '../../../artifacts/contracts/periphery/test/RouterEventEmitter.sol/RouterEventEmitter.json'
1413

@@ -22,7 +21,6 @@ export interface V2Fixture {
2221
WETH: Contract
2322
WETHPartner: Contract
2423
factoryV2: Contract
25-
router01: Contract
2624
router02: Contract
2725
routerEventEmitter: Contract
2826
router: Contract
@@ -43,7 +41,6 @@ export async function v2Fixture([wallet]: Wallet[], provider: any): Promise<V2Fi
4341
const factoryV2 = await deployContract(wallet, ListaV2Factory, [wallet.address])
4442

4543
// deploy routers
46-
const router01 = await deployContract(wallet, ListaV2Router01, [factoryV2.address, WETH.address], overrides)
4744
const router02 = await deployContract(wallet, ListaV2Router02, [factoryV2.address, WETH.address], overrides)
4845

4946
// event emitter for testing
@@ -68,9 +65,8 @@ export async function v2Fixture([wallet]: Wallet[], provider: any): Promise<V2Fi
6865
WETH,
6966
WETHPartner,
7067
factoryV2,
71-
router01,
7268
router02,
73-
router: router02, // the default router, 01 had a minor bug
69+
router: router02, // the canonical active router
7470
routerEventEmitter,
7571
pair,
7672
WETHPair

0 commit comments

Comments
 (0)