mirror of
https://github.com/Instadapp/yield-contract.git
synced 2024-07-29 21:47:29 +00:00
added auth condition in eth pool also
This commit is contained in:
parent
1b6e03ebd2
commit
5335fb7189
|
|
@ -9,7 +9,7 @@ import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
|
||||||
import { DSMath } from "../libs/safeMath.sol";
|
import { DSMath } from "../libs/safeMath.sol";
|
||||||
|
|
||||||
interface AccountInterface {
|
interface AccountInterface {
|
||||||
function enable(address authority) external;
|
function isAuth(address) external view returns(bool);
|
||||||
function cast(address[] calldata _targets, bytes[] calldata _datas, address _origin) external payable;
|
function cast(address[] calldata _targets, bytes[] calldata _datas, address _origin) external payable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -66,6 +66,7 @@ contract PoolToken is ReentrancyGuard, ERC20Pausable, DSMath {
|
||||||
|
|
||||||
function deploy(address _dsa, address token, uint amount) external isChief {
|
function deploy(address _dsa, address token, uint amount) external isChief {
|
||||||
require(registry.isDsa(address(this), _dsa), "not-autheticated-dsa");
|
require(registry.isDsa(address(this), _dsa), "not-autheticated-dsa");
|
||||||
|
require(AccountInterface(_dsa).isAuth(address(this)), "token-pool-not-auth");
|
||||||
if (token == address(0)) {
|
if (token == address(0)) {
|
||||||
payable(_dsa).transfer(amount);
|
payable(_dsa).transfer(amount);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -101,9 +102,11 @@ contract PoolToken is ReentrancyGuard, ERC20Pausable, DSMath {
|
||||||
|
|
||||||
function settle(address _dsa, address[] calldata _targets, bytes[] calldata _datas, address _origin) external isChief {
|
function settle(address _dsa, address[] calldata _targets, bytes[] calldata _datas, address _origin) external isChief {
|
||||||
require(registry.isDsa(address(this), _dsa), "not-autheticated-dsa");
|
require(registry.isDsa(address(this), _dsa), "not-autheticated-dsa");
|
||||||
|
AccountInterface dsaWallet = AccountInterface(_dsa);
|
||||||
if (_targets.length > 0 && _datas.length > 0) {
|
if (_targets.length > 0 && _datas.length > 0) {
|
||||||
AccountInterface(_dsa).cast(_targets, _datas, _origin);
|
dsaWallet.cast(_targets, _datas, _origin);
|
||||||
}
|
}
|
||||||
|
require(dsaWallet.isAuth(address(this)), "token-pool-not-auth");
|
||||||
setExchangeRate();
|
setExchangeRate();
|
||||||
|
|
||||||
emit LogSettle(block.timestamp);
|
emit LogSettle(block.timestamp);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user