mirror of
https://github.com/Instadapp/yield-contract.git
synced 2024-07-29 21:47:29 +00:00
removed flusher restriction from pool
This commit is contained in:
parent
92dec372d8
commit
6618bf28c3
|
@ -1,9 +1,10 @@
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
pragma solidity ^0.6.8;
|
pragma solidity ^0.6.8;
|
||||||
|
|
||||||
contract Deployer {
|
contract Deployer {
|
||||||
|
|
||||||
mapping (address => bool) public flushers;
|
mapping (address => address) public flushers;
|
||||||
|
|
||||||
event LogNewFlusher(address indexed owner, address indexed flusher, address indexed logic);
|
event LogNewFlusher(address indexed owner, address indexed flusher, address indexed logic);
|
||||||
|
|
||||||
|
@ -26,7 +27,7 @@ contract Deployer {
|
||||||
)
|
)
|
||||||
proxy := create2(0, clone, 0x37, salt)
|
proxy := create2(0, clone, 0x37, salt)
|
||||||
}
|
}
|
||||||
flushers[proxy] = true;
|
flushers[proxy] = owner;
|
||||||
emit LogNewFlusher(owner, proxy, logic);
|
emit LogNewFlusher(owner, proxy, logic);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ pragma solidity ^0.6.8;
|
||||||
pragma experimental ABIEncoderV2;
|
pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
interface RegistryInterface {
|
interface RegistryInterface {
|
||||||
function signer(address) external view returns (bool);
|
function signer(address) external view returns (bool);
|
||||||
function isConnector(address[] calldata) external view returns (bool);
|
function isConnector(address[] calldata) external view returns (bool);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,6 @@ interface IndexInterface {
|
||||||
interface RegistryInterface {
|
interface RegistryInterface {
|
||||||
function chief(address) external view returns (bool);
|
function chief(address) external view returns (bool);
|
||||||
function poolLogic(address) external returns (address);
|
function poolLogic(address) external returns (address);
|
||||||
function flusherLogic(address) external returns (address);
|
|
||||||
function fee(address) external view returns (uint);
|
function fee(address) external view returns (uint);
|
||||||
function poolCap(address) external view returns (uint);
|
function poolCap(address) external view returns (uint);
|
||||||
function checkSettleLogics(address, address[] calldata) external view returns (bool);
|
function checkSettleLogics(address, address[] calldata) external view returns (bool);
|
||||||
|
@ -25,10 +24,6 @@ interface RateInterface {
|
||||||
function getTotalToken() external returns (uint totalUnderlyingTkn);
|
function getTotalToken() external returns (uint totalUnderlyingTkn);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FlusherLogicInterface {
|
|
||||||
function isFlusher(address) external returns (bool);
|
|
||||||
}
|
|
||||||
|
|
||||||
contract PoolToken is ReentrancyGuard, ERC20Pausable, DSMath {
|
contract PoolToken is ReentrancyGuard, ERC20Pausable, DSMath {
|
||||||
using SafeERC20 for IERC20;
|
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
|
* @dev sets exchange rate
|
||||||
*/
|
*/
|
||||||
|
@ -128,7 +118,7 @@ contract PoolToken is ReentrancyGuard, ERC20Pausable, DSMath {
|
||||||
* @param tknAmt token amount
|
* @param tknAmt token amount
|
||||||
* @return mintAmt amount of wrap token minted
|
* @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");
|
require(msg.value == 0, "non-eth-pool");
|
||||||
uint _tokenBal = wdiv(totalSupply(), exchangeRate);
|
uint _tokenBal = wdiv(totalSupply(), exchangeRate);
|
||||||
uint _newTknBal = add(_tokenBal, tknAmt);
|
uint _newTknBal = add(_tokenBal, tknAmt);
|
||||||
|
|
|
@ -15,7 +15,6 @@ interface IndexInterface {
|
||||||
interface RegistryInterface {
|
interface RegistryInterface {
|
||||||
function chief(address) external view returns (bool);
|
function chief(address) external view returns (bool);
|
||||||
function poolLogic(address) external returns (address);
|
function poolLogic(address) external returns (address);
|
||||||
function flusherLogic(address) external returns (address);
|
|
||||||
function fee(address) external view returns (uint);
|
function fee(address) external view returns (uint);
|
||||||
function poolCap(address) external view returns (uint);
|
function poolCap(address) external view returns (uint);
|
||||||
function checkSettleLogics(address, address[] calldata) external view returns (bool);
|
function checkSettleLogics(address, address[] calldata) external view returns (bool);
|
||||||
|
@ -25,10 +24,6 @@ interface RateInterface {
|
||||||
function getTotalToken() external returns (uint totalUnderlyingTkn);
|
function getTotalToken() external returns (uint totalUnderlyingTkn);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface FlusherLogicInterface {
|
|
||||||
function isFlusher(address) external returns (bool);
|
|
||||||
}
|
|
||||||
|
|
||||||
contract PoolETH is ReentrancyGuard, ERC20Pausable, DSMath {
|
contract PoolETH is ReentrancyGuard, ERC20Pausable, DSMath {
|
||||||
using SafeERC20 for IERC20;
|
using SafeERC20 for IERC20;
|
||||||
|
|
||||||
|
@ -41,6 +36,7 @@ contract PoolETH is ReentrancyGuard, ERC20Pausable, DSMath {
|
||||||
IERC20 public immutable baseToken; // Base token.
|
IERC20 public immutable baseToken; // Base token.
|
||||||
RegistryInterface public immutable registry; // Pool Registry
|
RegistryInterface public immutable registry; // Pool Registry
|
||||||
IndexInterface public constant instaIndex = IndexInterface(0x2971AdFa57b20E5a416aE5a708A8655A9c74f723);
|
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 exchangeRate = 10 ** 18; // initial 1 token = 1
|
||||||
uint public feeAmt; // fee collected on profits
|
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
|
* @dev sets exchange rate
|
||||||
*/
|
*/
|
||||||
|
@ -127,7 +118,7 @@ contract PoolETH is ReentrancyGuard, ERC20Pausable, DSMath {
|
||||||
* @param tknAmt token amount
|
* @param tknAmt token amount
|
||||||
* @return mintAmt amount of wrap token minted
|
* @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");
|
require(tknAmt == msg.value, "unmatched-amount");
|
||||||
uint _tokenBal = wdiv(totalSupply(), exchangeRate);
|
uint _tokenBal = wdiv(totalSupply(), exchangeRate);
|
||||||
uint _newTknBal = add(_tokenBal, tknAmt);
|
uint _newTknBal = add(_tokenBal, tknAmt);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user