Skip to content

Commit

Permalink
imdv2
Browse files Browse the repository at this point in the history
  • Loading branch information
sarangparikh22 committed Oct 10, 2022
1 parent d70348f commit f07c820
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 10 deletions.
2 changes: 0 additions & 2 deletions contracts/interfaces/IMasterDeployer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,4 @@ interface IMasterDeployer {
function pools(address pool) external view returns (bool);

function deployPool(address factory, bytes calldata deployData) external returns (address);

function owner() external returns (address);
}
22 changes: 22 additions & 0 deletions contracts/interfaces/IMasterDeployerV2.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// SPDX-License-Identifier: GPL-3.0-or-later

pragma solidity >=0.8.0;

import "./IMasterDeployer.sol";

/// @notice Trident pool deployer interface.
interface IMasterDeployerV2 is IMasterDeployer {
function barFee() external view returns (uint256);

function barFeeTo() external view returns (address);

function bento() external view returns (address);

function migrator() external view returns (address);

function pools(address pool) external view returns (bool);

function deployPool(address factory, bytes calldata deployData) external returns (address);

function owner() external returns (address);
}
4 changes: 2 additions & 2 deletions contracts/interfaces/IStablePoolFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

pragma solidity >=0.8.0;

import "./IMasterDeployer.sol";
import "./IMasterDeployerV2.sol";

interface IStablePoolFactory {
function getDeployData() external view returns (bytes memory, IMasterDeployer);
function getDeployData() external view returns (bytes memory, IMasterDeployerV2);
}
6 changes: 3 additions & 3 deletions contracts/pool/stable/StablePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity >=0.8.0;
import {ERC20} from "@rari-capital/solmate/src/tokens/ERC20.sol";
import {ReentrancyGuard} from "@rari-capital/solmate/src/utils/ReentrancyGuard.sol";
import {IBentoBoxMinimal} from "../../interfaces/IBentoBoxMinimal.sol";
import {IMasterDeployer} from "../../interfaces/IMasterDeployer.sol";
import {IMasterDeployerV2} from "../../interfaces/IMasterDeployerV2.sol";
import {IPool} from "../../interfaces/IPool.sol";
import {IStablePoolFactory} from "../../interfaces/IStablePoolFactory.sol";
import {IERC20, SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
Expand Down Expand Up @@ -39,7 +39,7 @@ contract StablePool is IPool, ERC20, ReentrancyGuard {
uint256 internal immutable MAX_FEE_MINUS_SWAP_FEE;

IBentoBoxMinimal public immutable bento;
IMasterDeployer public immutable masterDeployer;
IMasterDeployerV2 public immutable masterDeployer;
address public immutable token0;
address public immutable token1;

Expand All @@ -56,7 +56,7 @@ contract StablePool is IPool, ERC20, ReentrancyGuard {
bytes32 public constant poolIdentifier = "Trident:StablePool";

constructor() ERC20("Sushi Stable LP Token", "SSLP", 18) {
(bytes memory _deployData, IMasterDeployer _masterDeployer) = IStablePoolFactory(msg.sender).getDeployData();
(bytes memory _deployData, IMasterDeployerV2 _masterDeployer) = IStablePoolFactory(msg.sender).getDeployData();

(address _token0, address _token1, uint256 _swapFee) = abi.decode(_deployData, (address, address, uint256));

Expand Down
6 changes: 3 additions & 3 deletions contracts/pool/stable/StablePoolFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ pragma solidity >=0.8.0;
import {PoolDeployer} from "../../abstract/PoolDeployer.sol";
import {StablePool} from "./StablePool.sol";
import {IStablePoolFactory} from "../../interfaces/IStablePoolFactory.sol";
import {IMasterDeployer} from "../../interfaces/IMasterDeployer.sol";
import {IMasterDeployerV2} from "../../interfaces/IMasterDeployerV2.sol";

contract StablePoolFactory is IStablePoolFactory, PoolDeployer {
bytes32 public constant bytecodeHash = keccak256(type(StablePool).creationCode);
Expand Down Expand Up @@ -40,8 +40,8 @@ contract StablePoolFactory is IStablePoolFactory, PoolDeployer {
}

// This called in the StablePool constructor.
function getDeployData() external view override returns (bytes memory, IMasterDeployer) {
return (cachedDeployData, IMasterDeployer(masterDeployer));
function getDeployData() external view override returns (bytes memory, IMasterDeployerV2) {
return (cachedDeployData, IMasterDeployerV2(masterDeployer));
}

function calculatePoolAddress(
Expand Down

0 comments on commit f07c820

Please sign in to comment.