mirror of
https://github.com/Instadapp/dsa-polygon-migration.git
synced 2024-07-29 22:27:58 +00:00
Merge b6617dd447
into 6e68ac1891
This commit is contained in:
commit
d8cc904fde
15
contracts/proxy/proxyMasterSigAdmin.sol
Normal file
15
contracts/proxy/proxyMasterSigAdmin.sol
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
// SPDX-License-Identifier: MIT
|
||||||
|
pragma solidity ^0.7.0;
|
||||||
|
|
||||||
|
import "@openzeppelin/contracts/proxy/ProxyAdmin.sol";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an
|
||||||
|
* explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.
|
||||||
|
*/
|
||||||
|
contract InstaMasterProxy is ProxyAdmin {
|
||||||
|
constructor(address masterAddress) {
|
||||||
|
require(masterAddress != address(0), "not-vaild-address");
|
||||||
|
transferOwnership(masterAddress);
|
||||||
|
}
|
||||||
|
}
|
|
@ -30,4 +30,5 @@ contract Events {
|
||||||
|
|
||||||
event LogVariablesUpdate(uint _safeRatioGap, uint _fee);
|
event LogVariablesUpdate(uint _safeRatioGap, uint _fee);
|
||||||
|
|
||||||
|
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
|
||||||
}
|
}
|
|
@ -3,23 +3,68 @@ pragma experimental ABIEncoderV2;
|
||||||
|
|
||||||
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
|
import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/SafeERC20.sol";
|
||||||
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
||||||
|
import { Context } from "@openzeppelin/contracts/utils/Context.sol";
|
||||||
import { TokenInterface } from "../../common/interfaces.sol";
|
import { TokenInterface } from "../../common/interfaces.sol";
|
||||||
import { Helpers } from "./helpers.sol";
|
import { Helpers } from "./helpers.sol";
|
||||||
import { AaveInterface, ATokenInterface, IndexInterface } from "./interfaces.sol";
|
import { AaveInterface, ATokenInterface, IndexInterface } from "./interfaces.sol";
|
||||||
import { Events } from "./events.sol";
|
import { Events } from "./events.sol";
|
||||||
|
|
||||||
contract LiquidityResolver is Helpers, Events {
|
contract LiquidityResolver is Helpers, Events, Context {
|
||||||
using SafeERC20 for IERC20;
|
using SafeERC20 for IERC20;
|
||||||
|
|
||||||
function updateVariables(uint _safeRatioGap, uint _fee) public {
|
/**
|
||||||
require(msg.sender == instaIndex.master(), "not-master");
|
* @dev Returns the address of the current owner.
|
||||||
|
*/
|
||||||
|
function owner() public view virtual returns (address) {
|
||||||
|
return _owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Throws if called by any account other than the owner or master.
|
||||||
|
*/
|
||||||
|
modifier onlyOwner() {
|
||||||
|
require(owner() == _msgSender() || instaIndex.master() == _msgSender(), "Ownable: caller is not the owner");
|
||||||
|
_;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Leaves the contract without owner but still master has the ownership. It will not be possible to call
|
||||||
|
* `onlyOwner` functions anymore. Can only be called by the current owner or master.
|
||||||
|
*/
|
||||||
|
function renounceOwnership() public virtual onlyOwner {
|
||||||
|
emit OwnershipTransferred(_owner, address(0));
|
||||||
|
_owner = address(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Transfers ownership of the contract to a new account (`newOwner`) along with master.
|
||||||
|
* Can only be called by the current owner or master.
|
||||||
|
*/
|
||||||
|
function transferOwnership(address newOwner) public virtual onlyOwner {
|
||||||
|
require(newOwner != address(0), "Ownable: new owner is the zero address");
|
||||||
|
emit OwnershipTransferred(_owner, newOwner);
|
||||||
|
_owner = newOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Transfers ownership of the contract to a new account (`newOwner`).
|
||||||
|
* Can only be called by the master.
|
||||||
|
*/
|
||||||
|
function setOwnership(address newOwner) public virtual {
|
||||||
|
require(instaIndex.master() == _msgSender(), "not-master");
|
||||||
|
require(newOwner != address(0), "Ownable: new owner is the zero address");
|
||||||
|
emit OwnershipTransferred(_owner, newOwner);
|
||||||
|
_owner = newOwner;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function updateVariables(uint _safeRatioGap, uint _fee) public onlyOwner {
|
||||||
safeRatioGap = _safeRatioGap;
|
safeRatioGap = _safeRatioGap;
|
||||||
fee = _fee;
|
fee = _fee;
|
||||||
emit LogVariablesUpdate(safeRatioGap, fee);
|
emit LogVariablesUpdate(safeRatioGap, fee);
|
||||||
}
|
}
|
||||||
|
|
||||||
function addTokenSupport(address[] memory _tokens) public {
|
function addTokenSupport(address[] memory _tokens) public onlyOwner {
|
||||||
require(msg.sender == instaIndex.master(), "not-master");
|
|
||||||
for (uint i = 0; i < supportedTokens.length; i++) {
|
for (uint i = 0; i < supportedTokens.length; i++) {
|
||||||
delete isSupportedToken[supportedTokens[i]];
|
delete isSupportedToken[supportedTokens[i]];
|
||||||
}
|
}
|
||||||
|
@ -32,8 +77,7 @@ contract LiquidityResolver is Helpers, Events {
|
||||||
emit LogAddSupportedTokens(_tokens);
|
emit LogAddSupportedTokens(_tokens);
|
||||||
}
|
}
|
||||||
|
|
||||||
function spell(address _target, bytes memory _data) external {
|
function spell(address _target, bytes memory _data) external onlyOwner {
|
||||||
require(msg.sender == instaIndex.master(), "not-master");
|
|
||||||
require(_target != address(0), "target-invalid");
|
require(_target != address(0), "target-invalid");
|
||||||
assembly {
|
assembly {
|
||||||
let succeeded := delegatecall(gas(), _target, add(_data, 0x20), mload(_data), 0, 0)
|
let succeeded := delegatecall(gas(), _target, add(_data, 0x20), mload(_data), 0, 0)
|
||||||
|
|
|
@ -105,4 +105,8 @@ contract Variables {
|
||||||
*/
|
*/
|
||||||
address[] public supportedTokens; // don't add ethAddr. Only add wethAddr
|
address[] public supportedTokens; // don't add ethAddr. Only add wethAddr
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dev Owner variable
|
||||||
|
*/
|
||||||
|
address internal _owner;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user