diff --git a/contracts/deployer.sol b/contracts/deployer.sol index f57bc22..958abb0 100644 --- a/contracts/deployer.sol +++ b/contracts/deployer.sol @@ -1,9 +1,10 @@ // SPDX-License-Identifier: MIT + pragma solidity ^0.6.8; contract Deployer { - mapping (address => bool) public flushers; + mapping (address => address) public flushers; event LogNewFlusher(address indexed owner, address indexed flusher, address indexed logic); @@ -26,7 +27,7 @@ contract Deployer { ) proxy := create2(0, clone, 0x37, salt) } - flushers[proxy] = true; + flushers[proxy] = owner; emit LogNewFlusher(owner, proxy, logic); } diff --git a/contracts/flusher.sol b/contracts/flusher.sol index 7834cb5..115118f 100644 --- a/contracts/flusher.sol +++ b/contracts/flusher.sol @@ -4,7 +4,7 @@ pragma solidity ^0.6.8; pragma experimental ABIEncoderV2; interface RegistryInterface { - function signer(address) external view returns (bool); + function signer(address) external view returns (bool); function isConnector(address[] calldata) external view returns (bool); } diff --git a/contracts/pools/erc20.sol b/contracts/pools/erc20.sol index 7bf253b..75fc0a3 100644 --- a/contracts/pools/erc20.sol +++ b/contracts/pools/erc20.sol @@ -15,7 +15,6 @@ interface IndexInterface { interface RegistryInterface { function chief(address) external view returns (bool); function poolLogic(address) external returns (address); - function flusherLogic(address) external returns (address); function fee(address) external view returns (uint); function poolCap(address) external view returns (uint); function checkSettleLogics(address, address[] calldata) external view returns (bool); @@ -25,10 +24,6 @@ interface RateInterface { function getTotalToken() external returns (uint totalUnderlyingTkn); } -interface FlusherLogicInterface { - function isFlusher(address) external returns (bool); -} - contract PoolToken is ReentrancyGuard, ERC20Pausable, DSMath { using SafeERC20 for IERC20; @@ -61,11 +56,6 @@ contract PoolToken is ReentrancyGuard, ERC20Pausable, DSMath { _; } - modifier isFlusher() { - require(FlusherLogicInterface(registry.flusherLogic(address(this))).isFlusher(msg.sender), "not-flusher"); - _; - } - /** * @dev sets exchange rate */ @@ -128,7 +118,7 @@ contract PoolToken is ReentrancyGuard, ERC20Pausable, DSMath { * @param tknAmt token amount * @return mintAmt amount of wrap token minted */ - function deposit(uint tknAmt) public payable whenNotPaused isFlusher returns (uint mintAmt) { + function deposit(uint tknAmt) public payable whenNotPaused returns (uint mintAmt) { require(msg.value == 0, "non-eth-pool"); uint _tokenBal = wdiv(totalSupply(), exchangeRate); uint _newTknBal = add(_tokenBal, tknAmt); diff --git a/contracts/pools/eth.sol b/contracts/pools/eth.sol index 38049eb..2294402 100644 --- a/contracts/pools/eth.sol +++ b/contracts/pools/eth.sol @@ -15,7 +15,6 @@ interface IndexInterface { interface RegistryInterface { function chief(address) external view returns (bool); function poolLogic(address) external returns (address); - function flusherLogic(address) external returns (address); function fee(address) external view returns (uint); function poolCap(address) external view returns (uint); function checkSettleLogics(address, address[] calldata) external view returns (bool); @@ -25,10 +24,6 @@ interface RateInterface { function getTotalToken() external returns (uint totalUnderlyingTkn); } -interface FlusherLogicInterface { - function isFlusher(address) external returns (bool); -} - contract PoolETH is ReentrancyGuard, ERC20Pausable, DSMath { using SafeERC20 for IERC20; @@ -41,6 +36,7 @@ contract PoolETH is ReentrancyGuard, ERC20Pausable, DSMath { IERC20 public immutable baseToken; // Base token. RegistryInterface public immutable registry; // Pool Registry IndexInterface public constant instaIndex = IndexInterface(0x2971AdFa57b20E5a416aE5a708A8655A9c74f723); + DeployerInterface public constant deployer = DeployerInterface(address(0)); // TODO - Change while deploying uint public exchangeRate = 10 ** 18; // initial 1 token = 1 uint public feeAmt; // fee collected on profits @@ -60,11 +56,6 @@ contract PoolETH is ReentrancyGuard, ERC20Pausable, DSMath { _; } - modifier isFlusher() { - require(FlusherLogicInterface(registry.flusherLogic(address(this))).isFlusher(msg.sender), "not-flusher"); - _; - } - /** * @dev sets exchange rate */ @@ -127,7 +118,7 @@ contract PoolETH is ReentrancyGuard, ERC20Pausable, DSMath { * @param tknAmt token amount * @return mintAmt amount of wrap token minted */ - function deposit(uint tknAmt) public whenNotPaused payable isFlusher returns (uint mintAmt) { + function deposit(uint tknAmt) public whenNotPaused payable returns (uint mintAmt) { require(tknAmt == msg.value, "unmatched-amount"); uint _tokenBal = wdiv(totalSupply(), exchangeRate); uint _newTknBal = add(_tokenBal, tknAmt);