Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cantina fix/lp unlock #297

Merged
merged 4 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion script/DeployFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ contract DeployFactoriesWorldChain is Script {
uniswapV2LiquidityMigrator = new UniswapV2Migrator(
address(airlock),
IUniswapV2Factory(uniFactoryV2),
IUniswapV2Router02(0x541aB7c31A119441eF3575F6973277DE0eF460bd)
IUniswapV2Router02(0x541aB7c31A119441eF3575F6973277DE0eF460bd),
address(0)
);
console2.log("Migrator: ", address(uniswapV2LiquidityMigrator));
console2.log(airlock.owner());
Expand Down
5 changes: 3 additions & 2 deletions script/DeployFactoryUnichainSepolia.sol
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ contract DeployDopplerV3FactoryUnichainSepolia is Script {
console2.log("UniswapV3Initializer: ", address(uniswapV3Initializer));
governanceFactory = new GovernanceFactory(address(airlock));
console2.log("GovernanceFactory: ", address(governanceFactory));
uniswapV2LiquidityMigrator =
new UniswapV2Migrator(address(airlock), IUniswapV2Factory(uniFactoryV2), IUniswapV2Router02(uniRouterV2));
uniswapV2LiquidityMigrator = new UniswapV2Migrator(
address(airlock), IUniswapV2Factory(uniFactoryV2), IUniswapV2Router02(uniRouterV2), address(0)
);
console2.log("Migrator: ", address(uniswapV2LiquidityMigrator));
console2.log("StateView: ", address(stateView));
console2.log("Quoter: ", address(quoter));
Expand Down
7 changes: 6 additions & 1 deletion src/UniswapV2Locker.sol
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ contract UniswapV2Locker is Ownable {
/**
* @param factory_ Address of the Uniswap V2 factory
*/
constructor(Airlock airlock_, IUniswapV2Factory factory_, UniswapV2Migrator migrator_) Ownable(msg.sender) {
constructor(
Airlock airlock_,
IUniswapV2Factory factory_,
UniswapV2Migrator migrator_,
address owner_
) Ownable(owner_) {
airlock = airlock_;
factory = factory_;
migrator = migrator_;
Expand Down
4 changes: 2 additions & 2 deletions src/UniswapV2Migrator.sol
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ contract UniswapV2Migrator is ILiquidityMigrator {
/**
* @param factory_ Address of the Uniswap V2 factory
*/
constructor(address airlock_, IUniswapV2Factory factory_, IUniswapV2Router02 router) {
constructor(address airlock_, IUniswapV2Factory factory_, IUniswapV2Router02 router, address owner) {
airlock = airlock_;
factory = factory_;
weth = IWETH(payable(router.WETH()));
locker = new UniswapV2Locker(Airlock(payable(airlock)), factory, this);
locker = new UniswapV2Locker(Airlock(payable(airlock)), factory, this, owner);
}

function initialize(address asset, address numeraire, bytes calldata) external returns (address) {
Expand Down
3 changes: 2 additions & 1 deletion test/integration/V3.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ contract V3Test is Test {
uniswapV2LiquidityMigrator = new UniswapV2Migrator(
address(airlock),
IUniswapV2Factory(UNISWAP_V2_FACTORY_MAINNET),
IUniswapV2Router02(UNISWAP_V2_ROUTER_MAINNET)
IUniswapV2Router02(UNISWAP_V2_ROUTER_MAINNET),
address(0)
);
tokenFactory = new TokenFactory(address(airlock));
governanceFactory = new GovernanceFactory(address(airlock));
Expand Down
3 changes: 2 additions & 1 deletion test/shared/V3PocTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ contract V3PocTest is Test {
uniswapV2LiquidityMigrator = new UniswapV2Migrator(
address(airlock),
IUniswapV2Factory(UNISWAP_V2_FACTORY_MAINNET),
IUniswapV2Router02(UNISWAP_V2_ROUTER_MAINNET)
IUniswapV2Router02(UNISWAP_V2_ROUTER_MAINNET),
address(0)
);
tokenFactory = new TokenFactory(address(airlock));
governanceFactory = new GovernanceFactory(address(airlock));
Expand Down
3 changes: 2 additions & 1 deletion test/unit/Airlock.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ contract AirlockTest is Test, Deployers {
uniswapV2LiquidityMigrator = new UniswapV2Migrator(
address(airlock),
IUniswapV2Factory(UNISWAP_V2_FACTORY_MAINNET),
IUniswapV2Router02(UNISWAP_V2_ROUTER_MAINNET)
IUniswapV2Router02(UNISWAP_V2_ROUTER_MAINNET),
address(0)
);

address[] memory modules = new address[](5);
Expand Down
2 changes: 1 addition & 1 deletion test/unit/UniswapV2Locker.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ contract UniswapV2LockerTest is Test {
tokenFoo = new TestERC20(1e25);
tokenBar = new TestERC20(1e25);

locker = new UniswapV2Locker(airlock, IUniswapV2Factory(UNISWAP_V2_FACTORY_MAINNET), migrator);
locker = new UniswapV2Locker(airlock, IUniswapV2Factory(UNISWAP_V2_FACTORY_MAINNET), migrator, address(0));

pool = IUniswapV2Pair(
IUniswapV2Factory(UNISWAP_V2_FACTORY_MAINNET).createPair(address(tokenFoo), address(tokenBar))
Expand Down
5 changes: 4 additions & 1 deletion test/unit/UniswapV2Migrator.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ contract UniswapV2MigratorTest is Test {
function setUp() public {
vm.createSelectFork(vm.envString("MAINNET_RPC_URL"), 21_093_509);
migrator = new UniswapV2Migrator(
address(this), IUniswapV2Factory(UNISWAP_V2_FACTORY_MAINNET), IUniswapV2Router02(UNISWAP_V2_ROUTER_MAINNET)
address(this),
IUniswapV2Factory(UNISWAP_V2_FACTORY_MAINNET),
IUniswapV2Router02(UNISWAP_V2_ROUTER_MAINNET),
address(0)
);
}

Expand Down
2 changes: 1 addition & 1 deletion test/unit/UniswapV4Initializer.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ contract UniswapV4InitializerTest is Test, Deployers {
initializer = new UniswapV4Initializer(address(airlock), manager, deployer);
tokenFactory = new TokenFactory(address(airlock));
governanceFactory = new GovernanceFactory(address(airlock));
migrator = new UniswapV2Migrator(address(airlock), uniswapV2Factory, uniswapV2Router);
migrator = new UniswapV2Migrator(address(airlock), uniswapV2Factory, uniswapV2Router, address(0));

address[] memory modules = new address[](4);
modules[0] = address(tokenFactory);
Expand Down
Loading