mirror of
https://github.com/Instadapp/yield-contract.git
synced 2024-07-29 21:47:29 +00:00
Added isFlusher for deposit function
This commit is contained in:
parent
4efb6a2fc7
commit
71081aaa7b
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user