From 71081aaa7b09630ff969d2805fa22a5fa4316272 Mon Sep 17 00:00:00 2001 From: Thrilok Kumar Date: Mon, 7 Sep 2020 02:42:03 +0530 Subject: [PATCH] Added isFlusher for deposit function --- contracts/pools/eth.sol | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/contracts/pools/eth.sol b/contracts/pools/eth.sol index 8dedd21..73dd2c4 100644 --- a/contracts/pools/eth.sol +++ b/contracts/pools/eth.sol @@ -16,6 +16,7 @@ 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,6 +26,10 @@ 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; @@ -57,6 +62,11 @@ contract PoolETH is ReentrancyGuard, ERC20Pausable, DSMath { _; } + modifier isFlusher() { + require(FlusherLogicInterface(registry.flusherLogic(address(this))).isFlusher(msg.sender), "not-flusher"); + _; + } + /** * @dev get pool token rate * @param tokenAmt total token amount @@ -128,7 +138,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 returns (uint mintAmt) { + function deposit(uint tknAmt) public whenNotPaused payable isFlusher returns (uint mintAmt) { require(tknAmt == msg.value, "unmatched-amount"); uint _tokenBal = wdiv(totalSupply(), exchangeRate); uint _newTknBal = add(_tokenBal, tknAmt);