Added isFlusher for deposit function

This commit is contained in:
Thrilok Kumar 2020-09-07 02:42:03 +05:30
parent 4efb6a2fc7
commit 71081aaa7b

View File

@ -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);