Skip to content

Commit

Permalink
test: add tests cases for binPool migrator
Browse files Browse the repository at this point in the history
  • Loading branch information
chefburger committed Jul 10, 2024
1 parent 7971c3b commit c48480b
Show file tree
Hide file tree
Showing 20 changed files with 1,754 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1016136
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
976173
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1020620
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1095907
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1056008
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1093854
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1016148
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
976185
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1020617
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1093889
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1053990
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1091832
4 changes: 2 additions & 2 deletions src/pool-bin/interfaces/IBinMigrator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ interface IBinMigrator is IBaseMigrator {

function migrateFromV2(
V2PoolParams calldata v2PoolParams,
V4BinPoolParams calldata v4MintParams,
V4BinPoolParams calldata v4BinPoolParams,
// extra funds to be added
uint256 extraAmount0,
uint256 extraAmount1
) external payable;

function migrateFromV3(
V3PoolParams calldata v3PoolParams,
V4BinPoolParams calldata v4MintParams,
V4BinPoolParams calldata v4BinPoolParams,
// extra funds to be added
uint256 extraAmount0,
uint256 extraAmount1
Expand Down
18 changes: 18 additions & 0 deletions test/pool-bin/migrator/BinMigratorFromPancakeswapV2.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

import "forge-std/Test.sol";
import {BinMigratorFromV2} from "./BinMigratorFromV2.sol";

contract BinMigratorFromPancakeswapV2Test is BinMigratorFromV2 {
function _getBytecodePath() internal pure override returns (string memory) {
// Create a Pancakeswap V2 pair
// relative to the root of the project
// https://etherscan.io/address/0x1097053Fd2ea711dad45caCcc45EfF7548fCB362#code
return "./test/bin/pcsV2Factory.bytecode";
}

function _getContractName() internal pure override returns (string memory) {
return "BinMigratorFromPancakeswapV2Test";
}
}
26 changes: 26 additions & 0 deletions test/pool-bin/migrator/BinMigratorFromPancakeswapV3.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

import "forge-std/Test.sol";
import {BinMigratorFromV3} from "./BinMigratorFromV3.sol";

contract BinMigratorFromPancakeswapV3Test is BinMigratorFromV3 {
function _getDeployerBytecodePath() internal pure override returns (string memory) {
// https://etherscan.io/address/0x41ff9AA7e16B8B1a8a8dc4f0eFacd93D02d071c9#code
return "./test/bin/pcsV3Deployer.bytecode";
}

function _getFactoryBytecodePath() internal pure override returns (string memory) {
// https://etherscan.io/address/0x0BFbCF9fa4f9C56B0F40a671Ad40E0805A091865#code
return "./test/bin/pcsV3Factory.bytecode";
}

function _getNfpmBytecodePath() internal pure override returns (string memory) {
// https://etherscan.io/address/0x46A15B0b27311cedF172AB29E4f4766fbE7F4364#code
return "./test/bin/pcsV3Nfpm.bytecode";
}

function _getContractName() internal pure override returns (string memory) {
return "BinMigratorFromPancakeswapV3Test";
}
}
18 changes: 18 additions & 0 deletions test/pool-bin/migrator/BinMigratorFromUniswapV2.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

import "forge-std/Test.sol";
import {BinMigratorFromV2} from "./BinMigratorFromV2.sol";

contract BinMigratorFromUniswapV2Test is BinMigratorFromV2 {
function _getBytecodePath() internal pure override returns (string memory) {
// Create a Uniswap V2 pair
// relative to the root of the project
// https://etherscan.io/address/0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f#code
return "./test/bin/uniV2Factory.bytecode";
}

function _getContractName() internal pure override returns (string memory) {
return "BinMigratorFromUniswapV2Test";
}
}
25 changes: 25 additions & 0 deletions test/pool-bin/migrator/BinMigratorFromUniswapV3.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.19;

import "forge-std/Test.sol";
import {BinMigratorFromV3} from "./BinMigratorFromV3.sol";

contract BinMigratorFromUniswapV3Test is BinMigratorFromV3 {
function _getDeployerBytecodePath() internal pure override returns (string memory) {
return "";
}

function _getFactoryBytecodePath() internal pure override returns (string memory) {
// https://etherscan.io/address/0x1F98431c8aD98523631AE4a59f267346ea31F984#code
return "./test/bin/uniV3Factory.bytecode";
}

function _getNfpmBytecodePath() internal pure override returns (string memory) {
// https://etherscan.io/address/0xC36442b4a4522E871399CD717aBDD847Ab11FE88#code
return "./test/bin/uniV3Nfpm.bytecode";
}

function _getContractName() internal pure override returns (string memory) {
return "BinMigratorFromUniswapV3Test";
}
}
Loading

0 comments on commit c48480b

Please sign in to comment.