update timelock

This commit is contained in:
owen05
2020-12-14 18:43:35 +08:00
parent a7cfde52e0
commit 505d007731
4 changed files with 52 additions and 22 deletions

View File

@@ -11,11 +11,19 @@ import {IERC20} from "../intf/IERC20.sol";
import {SafeERC20} from "../lib/SafeERC20.sol";
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
/**
* @title DODOApprove
* @author DODO Breeder
*
* @notice Handle authorizations in DODO platform
*/
contract DODOApprove is InitializableOwnable {
using SafeERC20 for IERC20;
// ============ Storage ============
uint256 private constant _TIMELOCK_DURATION_ = 3 days;
uint256 private constant _TIMELOCK_EMERGENCY_DURATION_ = 2 hours;
uint256 public _TIMELOCK_;
address public _PENDING_DODO_PROXY_;
address public _DODO_PROXY_;
@@ -34,9 +42,14 @@ contract DODOApprove is InitializableOwnable {
_;
}
function init(address owner, address initProxyAddress) external {
initOwner(owner);
_DODO_PROXY_ = initProxyAddress;
}
function unlockSetProxy(address newDodoProxy) public onlyOwner {
if(newDodoProxy == address(0) || _DODO_PROXY_ == address(0))
_TIMELOCK_ = block.timestamp;
if(_DODO_PROXY_ == address(0))
_TIMELOCK_ = block.timestamp + _TIMELOCK_EMERGENCY_DURATION_;
else
_TIMELOCK_ = block.timestamp + _TIMELOCK_DURATION_;
_PENDING_DODO_PROXY_ = newDodoProxy;

View File

@@ -17,10 +17,16 @@ import {IChi} from "./intf/IChi.sol";
import {IUni} from "./intf/IUni.sol";
import {IDODOApprove} from "../intf/IDODOApprove.sol";
import {IDODOV1Proxy01} from "./intf/IDODOV1Proxy01.sol";
import {ReentrancyGuard} from "../lib/ReentrancyGuard.sol";
import {InitializableOwnable} from "../lib/InitializableOwnable.sol";
contract DODOV1Proxy01 is IDODOV1Proxy01, ReentrancyGuard, InitializableOwnable {
/**
* @title DODOV1Proxy01
* @author DODO Breeder
*
* @notice Entrance of trading in DODO platform
*/
contract DODOV1Proxy01 is IDODOV1Proxy01, InitializableOwnable {
using SafeMath for uint256;
using UniversalERC20 for IERC20;

View File

@@ -20,3 +20,21 @@ DODOApprove setProxy tx: 0xb00c07780c0a6a6d2cd03430ae0cc69590b9aebb581bbb3556d2
AddWhiteList tx1: 0xb3e5cbd55c0de94916820a4cccfe4e72d48faeeb73a922f07e088c3634a37c54
AddWhiteList tx2: 0xc078005b280677d1da032c69adba7d95b28500492b447334bb77151b595a171b
AddWhiteList tx3: 0xe80dbdfc8855677c6bc94cc810e16e36a707c6ca0fd9a56abc625d0940d927a7
====================================================
network type: kovan
Deploy time: 2020/12/14 下午6:09:05
Deploy type: Proxy
DODOApprove Address: 0xdD666863E8eF7E9a3d2F47B5336F07d104040951
Set DODOApprove Owner tx: 0x94c841208b277e3cbd39a347da8a91cb5c26a884c801c085725057b6a22bcc66
DODOProxyV1 Address: 0x6720Aa404ce9dbf2fE1b6aB1A259663eB21Ce625
Set DODOProxyV1 Owner tx: 0xa7db5a8fef91b614304ea10e897b1eb4ca2eaf410da1b39d749427cba894ed93
DODOApprove unlockSetProxy tx: 0x0d33567cda1cf322090efcfb7e247be8069ac3f7090ae449dab35a8e2718b2fa
DODOApprove triggerSetProxy tx: 0xb3bb062ade1c0174dcd71934cff3fb666fb7ba0c678ce99900d87dad87fdf4c4
====================================================
network type: kovan
Deploy time: 2020/12/14 下午6:41:46
Deploy type: Proxy
DODOApprove Address: 0x7Ef9DCE3EB7CE03de5E98dB0AA7Da70B71B15ff7
DODOProxyV1 Address: 0x69dD38A07e50F4E4F571b89EAB12Ef2745aF8670
Set DODOProxyV1 Owner tx: 0xb5124a76363d999fe265e9e9dfab99f04052de613bd32d22b3fee1725f429abd
Set DODOApprove Owner And Init Set Proxy tx: 0x19d9f159b1a676bfa00a7c9edb1e251300d1d7319ec61d6fbb074ceae9a28c73

View File

@@ -20,7 +20,8 @@ module.exports = async (deployer, network, accounts) => {
DODOSellHelperAddress = "0xbdEae617F2616b45DCB69B287D52940a76035Fe3";
WETHAddress = "0x5eca15b12d959dfcf9c71c59f8b467eb8c6efd0b";
DODOSwapCalcHelperAddress = "";
DODOApproveAddress = "0x0C4a80B2e234448E5f6fD86e7eFA733d985004c8";
// DODOApproveAddress = "0x0C4a80B2e234448E5f6fD86e7eFA733d985004c8";
DODOApproveAddress = "";
chiAddress = "0x0000000000004946c0e9f43f4dee607b0ef1fa1c";
ownerAddress = accounts[0];
} else if (network == "live") {
@@ -52,9 +53,6 @@ module.exports = async (deployer, network, accounts) => {
await deployer.deploy(DODOApprove);
DODOApproveAddress = DODOApprove.address;
logger.log("DODOApprove Address: ", DODOApproveAddress);
const DODOApproveInstance = await DODOApprove.at(DODOApproveAddress);
var tx = await DODOApproveInstance.initOwner(ownerAddress);
logger.log("Set DODOApprove Owner tx: ", tx.tx);
}
if (DODOSellHelperAddress == "") {
await deployer.deploy(DODOSellHelper);
@@ -77,20 +75,15 @@ module.exports = async (deployer, network, accounts) => {
tx = await DODOProxyV1Instance.initOwner(ownerAddress);
logger.log("Set DODOProxyV1 Owner tx: ", tx.tx);
const DODOApproveInstance = await DODOApprove.at(DODOApproveAddress);
tx = await DODOApproveInstance.init(ownerAddress, DODOProxyV1.address);
logger.log("Set DODOApprove Owner And Init Set Proxy tx: ", tx.tx);
if (network == "kovan") {
const DODOApproveInstance = await DODOApprove.at(DODOApproveAddress);
tx = await DODOApproveInstance.unlockSetProxy(DODOProxyV1.address);
logger.log("DODOApprove unlockSetProxy tx: ", tx.tx);
tx = await DODOApproveInstance.setDODOProxy();
logger.log("DODOApprove triggerSetProxy tx: ", tx.tx);
// var tx1 = await DODOProxyV1Instance.addWhiteList("0x111111125434b319222cdbf8c261674adb56f3ae");
// var tx2 = await DODOProxyV1Instance.addWhiteList("0xf740b67da229f2f10bcbd38a7979992fcc71b8eb");
// var tx3 = await DODOProxyV1Instance.addWhiteList("0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D");
// logger.log("AddWhiteList tx1: ", tx1.tx);
// logger.log("AddWhiteList tx2: ", tx2.tx);
// logger.log("AddWhiteList tx3: ", tx3.tx);
}
// var tx1 = await DODOProxyV1Instance.addWhiteList("0x111111125434b319222cdbf8c261674adb56f3ae");
// var tx2 = await DODOProxyV1Instance.addWhiteList("0xf740b67da229f2f10bcbd38a7979992fcc71b8eb");
// var tx3 = await DODOProxyV1Instance.addWhiteList("0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D");
// logger.log("AddWhiteList tx1: ", tx1.tx);
// logger.log("AddWhiteList tx2: ", tx2.tx);
// logger.log("AddWhiteList tx3: ", tx3.tx);
}
};