From 304e2b0b6a0584453b6cccac35d9d103a400be9a Mon Sep 17 00:00:00 2001 From: owen05 Date: Tue, 6 Jul 2021 12:19:09 +0800 Subject: [PATCH] deploy script for mineV3 --- config/arb-config.js | 3 + config/bsc-config.js | 4 ++ config/eth-config.js | 3 + config/heco-config.js | 3 + config/kovan-config.js | 6 ++ config/matic-config.js | 3 + config/rinkeby-config.js | 6 +- .../{ERC20Mine.sol => ERC20MineV3.sol} | 2 +- deploy-detail-periphery.txt | 10 ++++ migrations/2_deploy_v2.js | 2 +- migrations/4_deploy_periphery.js | 60 ++++++++++++++++++- truffle-config.js | 3 +- 12 files changed, 98 insertions(+), 7 deletions(-) rename contracts/DODOToken/DODOMineV3/{ERC20Mine.sol => ERC20MineV3.sol} (97%) diff --git a/config/arb-config.js b/config/arb-config.js index 0fd60ac..bf56afb 100644 --- a/config/arb-config.js +++ b/config/arb-config.js @@ -21,6 +21,7 @@ module.exports = { DPPAdmin: "0x1dc8D1f1600B7C1D39e6b60FBC7b021Bc4F9C993", CP: "0x8F8Dd7DB1bDA5eD3da8C9daf3bfa471c12d58486", + ERC20MineV3: "", ERC20: "0xBb245F54569841906eC7eDFFf72a910557B81378", MintableERC20: "0x70eFB31271C0796833f80dA4E6538d05B2AFA72C", CustomERC20: "0xcE2a934933465E187c95AcAce60BC650a06aD373", @@ -33,6 +34,7 @@ module.exports = { CrowdPoolingFactory: "0x884E3EE9e25896c57E7d8d6FAACef22B02BCD6bE", ERC20Factory: "0x141b4497a298340E8B451ac4eeE947B00aDbe07A", ERC20V2Factory: "0xE3c91fDCe30DD5Aa95138D6c4d63f43a26e9066e", + DODOMineV3Registry: "", //Approve DODOApprove: "0xCDFD45f965De9932367833Ca7187e4c9C43A2380", @@ -48,6 +50,7 @@ module.exports = { DSPProxy: "0x3a343F2e4e142412c5dD130359edb765a6054965", CpProxy: "0x2cD18557E14aF72DAA8090BcAA95b231ffC9ea26", RouteProxy: "0x3E64F18168651d140AaE57e0cF325874d066bA9E", + DODOMineV3Proxy: "", //Account multiSigAddress: "0x1e0D4043C0CD3ed15F3c2AfE60B0F213c9b5E30d", diff --git a/config/bsc-config.js b/config/bsc-config.js index ae537f8..7b316c4 100644 --- a/config/bsc-config.js +++ b/config/bsc-config.js @@ -20,6 +20,8 @@ module.exports = { DSP: "0xE3c91fDCe30DD5Aa95138D6c4d63f43a26e9066e", DPPAdmin: "0x44D5dF24d5Ef52A791D6436Fa45A8D426f6de34e", CP: "0x5D6e6A0BFB2176AFCc4FB809822D8e009216b245", + ERC20MineV3: "", + ERC20: "0x99155E68aC1523B6f461F6427A90607ecCF7bDF5", MintableERC20: "0x6373ceb657c83c91088d328622573fb766064ac4", CustomERC20: "0x4777A6f28c8Bb260D9a945dddeFabB942aE10f1f", @@ -32,6 +34,7 @@ module.exports = { CrowdPoolingFactory: "0x778DF5B12170e8af8dF94356BfC864E57CE185DC", ERC20Factory: "0x5e84190a270333aCe5B9202a3F4ceBf11b81bB01", ERC20V2Factory: "0x652C09785c15db4adAce871eD8874b8968A19A4D", + DODOMineV3Registry: "", //Approve DODOApprove: "0xa128Ba44B2738A558A1fdC06d6303d52D3Cef8c1", @@ -51,6 +54,7 @@ module.exports = { DSPProxy: "0x2442A8B5cdf1E659F3F949A7E454Caa554D4E65a", CpProxy: "0xA867241cDC8d3b0C07C85cC06F25a0cD3b5474d8", RouteProxy: "0x6B3D817814eABc984d51896b1015C0b89E9737Ca", + DODOMineV3Proxy: "", //vDODO DODOCirculationHelper: "", diff --git a/config/eth-config.js b/config/eth-config.js index 4609862..30a3c1f 100644 --- a/config/eth-config.js +++ b/config/eth-config.js @@ -20,6 +20,7 @@ module.exports = { DSP: "0x8735AAd3BEae15487a017EE32cb11d8fd593e036", DPPAdmin: "0x5515363c0412AdD5c72d3E302fE1bD7dCBCF93Fe", CP: "0x327344B382EE1b44FB0a72945fCDCC7243200dD7", + ERC20MineV3: "", ERC20: "0x8443a5bD91C8f68582F90dD3354f750900C5E8Cc", MintableERC20: "0x0596908263ef2724fbfbcafa1c983fcd7a629038", CustomERC20: "0x9Cd85f012050FE030271dCB7c0a0C1e2043Ce4a9", @@ -32,6 +33,7 @@ module.exports = { CrowdPoolingFactory: "0xE8C9A78725D0451FA19878D5f8A3dC0D55FECF25", ERC20Factory: "0x44D5dF24d5Ef52A791D6436Fa45A8D426f6de34e", ERC20V2Factory: "0xAA810cd0363d3378F0a13e327EC2Aee7051aDa73", + DODOMineV3Registry: "", //Approve DODOApprove: "0xCB859eA579b28e02B87A1FDE08d087ab9dbE5149", @@ -50,6 +52,7 @@ module.exports = { DSPProxy: "0x4599ed18F34cFE06820E3684bF0aACB8D75c644d", CpProxy: "0x048B8926bb0eE9c52e05D61fDffbCCffbeE06Fc2", RouteProxy: "0xa2398842F37465f89540430bDC00219fA9E4D28a", + DODOMineV3Proxy: "", //vDODO DODOCirculationHelper: "0x357c5e9cfa8b834edcef7c7aabd8f9db09119d11", diff --git a/config/heco-config.js b/config/heco-config.js index 0d95773..f5cab06 100644 --- a/config/heco-config.js +++ b/config/heco-config.js @@ -20,6 +20,7 @@ module.exports = { DSP: "0xEB5470DfCF2BA5CDdC108E8B65A7ED2A77EA3c2D", DPPAdmin: "0x3232fd648997F89E614A021fdAc756d61F9030A1", CP: "0x5B67cF070ce4303Ff4d450f21Cc371F9f0549335", + ERC20MineV3: "", ERC20: "0x2870fB656C7D245dc74afbA34B0d453FA67Ce4fA", MintableERC20: "0xdd9de5ed7a11b1ed3314cd7f754f27a15dedc63f", CustomERC20: "0x2cE80F95eD3d2a76694896843F18413ae83baF40", @@ -32,6 +33,7 @@ module.exports = { CrowdPoolingFactory: "0x56133d0b63abf7A15D5697dD2dB9e04730f1A9C2", ERC20Factory: "0x2cCDF6F742afBe813B68Ec6bb421C1BEa74fBd46", ERC20V2Factory: "0x1297264617bd34270B77c2fFD3aA110D3fd2f7aF", + DODOMineV3Registry: "", //Approve DODOApprove: "0x68b6c06Ac8Aa359868393724d25D871921E97293", DODOApproveProxy: "0x91737709De4b2eDEE3a2B78A84e21a60C0b4D70b", @@ -49,6 +51,7 @@ module.exports = { DSPProxy: "0x9951CdEc21F42ab69D02daAAFEF4C3fc810B36FF", CpProxy: "0x8930101c6cFbe0f3cb31E7526a16E72255388E97", RouteProxy: "0xEc0fA5746E37dE75bDA9C1F874F2B75C12e505F6", + DODOMineV3Proxy: "", //vDODO DODOCirculationHelper: "", diff --git a/config/kovan-config.js b/config/kovan-config.js index 6f31fec..9d7051d 100644 --- a/config/kovan-config.js +++ b/config/kovan-config.js @@ -20,9 +20,12 @@ module.exports = { DSP: "0xAD4E649c1771F5175081c2CcAC183fDb91cfCd6c", DPPAdmin: "0xf63e41A459D9AEcaE4bAE1278ef0ae84F7F2DE56", CP: "0x6092eFEf82CaDcd07f3a545cBe6C83dae713aE0A", + ERC20MineV3: "", + ERC20: "0x4DdcDcCe3BCDD84c8E15d50Bd9384c25B3Ca9eff", MintableERC20: "", CustomERC20: "0xFC8fb4CD3A77F138E53F92F5EC483e9887508CCe", + //Factory DVMFactory: "0x322F8014C125Da09314d3a68d4d9F427823F17FD", DPPFactory: "0xC65F8087288aa0a118aa6F3228Ef9ecc8187F4b6", @@ -31,6 +34,7 @@ module.exports = { UpCpFactory: "0x25AE560522165eacCFbF2287493AF12B8ad718e7", ERC20Factory: "0xCb1A2f64EfB02803276BFB5a8D511C4D950282a0", ERC20V2Factory: "0xa2c1eA946dA567248c70F792b64D5F2551f29204", + DODOMineV3Registry: "", //Approve DODOApprove: "0xa375b128e139ae54EF7F189BC8fEb4624f1c2Afa", @@ -48,6 +52,8 @@ module.exports = { DODOV2Proxy: "0x85CAA68ae47f047aa01C48BCaA711CA70a950fFb", DSPProxy: "0xC5fF477667E29df8887D258CaE593e04A1961A69", CpProxy: "0x0e3DAAa1eCfBF2fA4cb990dC34D760c38279C5a8", + DODOMineV3Proxy: "", + //vDODO DODOCirculationHelper: "", diff --git a/config/matic-config.js b/config/matic-config.js index e9cd0a7..265e1a5 100644 --- a/config/matic-config.js +++ b/config/matic-config.js @@ -21,6 +21,7 @@ module.exports = { DPPAdmin: "0xB5Dc5E183c2aCf02aB879A8569aB4EDAf147d537", CP: "0xf50BDc9E90B7a1c138cb7935071b85c417C4cb8e", + ERC20MineV3: "", ERC20: "0x34b9Dc29AaDc313F2BF828B7Be1e0DEe393D28e3", MintableERC20: "0x7737fd30535c69545deeEa54AB8Dd590ccaEBD3c", CustomERC20: "0xaF49DBAaf177beE57f84731260a9eb8819d25eff", @@ -33,6 +34,7 @@ module.exports = { CrowdPoolingFactory: "0x85351262f7474Ebe23FfAcD633cf20A491F1325D", ERC20Factory: "0xaeB5CF31b97dce6134e416129845e01106fFB177", ERC20V2Factory: "0x8e2f666F316b614c76676215F16F0A9746f96a90", + DODOMineV3Registry: "", //Approve DODOApprove: "0x9aE501385Bc7996A2A4a1FBb00c8d3820611BCB5", @@ -48,6 +50,7 @@ module.exports = { DSPProxy: "0xfDDCA6ffCE24dF5bE3e8AaD32081822f86178048", CpProxy: "0x5480B32c03647ff5E5A653F0465E798DBe558B57", RouteProxy: "0x53eE28b9F0A6416857C1e7503032E27e80F52DA0", + DODOMineV3Proxy: "", //Account multiSigAddress: "0x3CD6D7F5fF977bf8069548eA1F9441b061162b42", diff --git a/config/rinkeby-config.js b/config/rinkeby-config.js index 8557e68..04f48bd 100644 --- a/config/rinkeby-config.js +++ b/config/rinkeby-config.js @@ -20,6 +20,7 @@ module.exports = { DSP: "0xe2C23cBF03930418BF97e173FE3E950aD29fdb06", DPPAdmin: "0x2FF619B4Cfe36b0F92dD933256B1581a3269a5F4", CP: "0x6850eE8cF963B913a8eC3610B5f128C3100178E5", + ERC20MineV3: "0xd5Bbb5497d0503a8d0CB5A9410EcFfF840Fe0012", ERC20: "0x7119D1Ec8235bd0a82289fDb1cCAa4bD4D1e0605", MintableERC20: "", CustomERC20: "0x0Cd57DC8367362314C510446FD106B66989Eb81a", @@ -32,6 +33,7 @@ module.exports = { UpCpFactory: "0xb09E91505347234Cb722D67042290f50F1C13749", ERC20Factory: "0x48476599281CB7DD46dbE47264C4594d1d2E19A8", ERC20V2Factory: "0x7A22e361cB74E69B5B1C800A3aAbE3E50e84F4F6", + DODOMineV3Registry: "0x3c2885e0943FDD38503593D911B34C84C814FF24", //Approve DODOApprove: "0xcC8d87A7C747eeE4242045C47Ef25e0A81D56ae3", @@ -49,8 +51,8 @@ module.exports = { DODOV2Proxy: "0xba001E96AF87bF9d8D0BDA667067A9921FE6d294", DSPProxy: "0x0f6345D1d07C134BB0973AD102F38eA9195F6f78", CpProxy: "0x2E483CBb9e76fE6543168DEd698d9244EE1ED8Dd", - DODORouteProxy: "0xe2b538a781eB5a115a1359B8f363B9703Fd19dE6", - + RouteProxy: "0xe2b538a781eB5a115a1359B8f363B9703Fd19dE6", + DODOMineV3Proxy: "0x0beC8cd51dF39f8d09a1Db5AD3A8e6ed994d889D", //vDODO DODOCirculationHelper: "0xe4Aec985debDDbbCB2358e8C8F9384DD6421d163", diff --git a/contracts/DODOToken/DODOMineV3/ERC20Mine.sol b/contracts/DODOToken/DODOMineV3/ERC20MineV3.sol similarity index 97% rename from contracts/DODOToken/DODOMineV3/ERC20Mine.sol rename to contracts/DODOToken/DODOMineV3/ERC20MineV3.sol index 996f566..330daa1 100644 --- a/contracts/DODOToken/DODOMineV3/ERC20Mine.sol +++ b/contracts/DODOToken/DODOMineV3/ERC20MineV3.sol @@ -13,7 +13,7 @@ import {SafeMath} from "../../lib/SafeMath.sol"; import {ReentrancyGuard} from "../../lib/ReentrancyGuard.sol"; import {BaseMine} from "./BaseMine.sol"; -contract ERC20Mine is ReentrancyGuard, BaseMine { +contract ERC20MineV3 is ReentrancyGuard, BaseMine { using SafeERC20 for IERC20; using SafeMath for uint256; diff --git a/deploy-detail-periphery.txt b/deploy-detail-periphery.txt index af555bb..1ac4009 100644 --- a/deploy-detail-periphery.txt +++ b/deploy-detail-periphery.txt @@ -515,3 +515,13 @@ Deploy type: ERC20V2Factory CustomERC20Address: 0x3a0e0F2EDFC0e96BD700815f953Bcb6d8a6FF0AB ERC20V2FactoryAddress: 0xce4Bdc3151bF9F9dcADAED961a65D32f7bAC5460 Init ERC20V2Factory Tx: 0x5c03786d3e12b5c9532429f83c548a892c2d1ec613a44db81a9595e3bf017490 +==================================================== +network type: rinkeby +Deploy time: 2021/7/6 上午11:45:50 +Deploy type: MineV3 +ERC20MineV3Address: 0xB1Ba664b39785eD1321Be4f6389c83c7231353aF +DODOMineV3RegistryAddress: 0x3c2885e0943FDD38503593D911B34C84C814FF24 +Init DODOMineV3Registry Tx: 0x79aa148ba0cc4f21c8525cf14442e3ffed6d702bfde64c3ab8b03928c969f1f8 +DODOMineV3ProxyAddress: 0x0beC8cd51dF39f8d09a1Db5AD3A8e6ed994d889D +Init DODOMineV3Proxy Tx: 0xd9c200aa85e16f383d0e68efa0ff889c198e017e86d3730ca162f89450d8b015 +DODOMineV3RegistryAddress Init tx: 0x30f6bf822329c02d910c4d65a234f6c9856e328da3019ee08cbf126da1fb80c2 diff --git a/migrations/2_deploy_v2.js b/migrations/2_deploy_v2.js index 24443f7..cfa87ef 100644 --- a/migrations/2_deploy_v2.js +++ b/migrations/2_deploy_v2.js @@ -331,7 +331,7 @@ module.exports = async (deployer, network, accounts) => { logger.log("Init DODOProxyV2 Tx:", tx.tx); - if (network == 'kovan' || network == 'mbtestnet' || network == 'oktest' || network == 'matic' || network == 'arb') { + if (network == 'kovan' || network == 'mbtestnet' || network == 'oktest' || network == 'matic' || network == 'arb' || network == 'rinkeby') { const DODOApproveProxyInstance = await DODOApproveProxy.at(DODOApproveProxyAddress); var tx = await DODOApproveProxyInstance.init(multiSigAddress, [DODOProxyV2.address, DODOCpProxy.address, DODODspProxy.address]); diff --git a/migrations/4_deploy_periphery.js b/migrations/4_deploy_periphery.js index 47224c2..aae7ef6 100644 --- a/migrations/4_deploy_periphery.js +++ b/migrations/4_deploy_periphery.js @@ -31,6 +31,11 @@ const ERC20V2Factory = artifacts.require("ERC20V2Factory"); const ERC20 = artifacts.require("InitializableERC20"); const CustomERC20 = artifacts.require("CustomERC20"); +const ERC20MineV3 = artifacts.require("ERC20MineV3"); +const DODOMineV3Registry = artifacts.require("DODOMineV3Registry"); +const DODOMineV3Proxy = artifacts.require("DODOMineV3Proxy"); + + const CurveAdapter = artifacts.require("CurveUnderlyingAdapter"); module.exports = async (deployer, network, accounts) => { @@ -65,6 +70,57 @@ module.exports = async (deployer, network, accounts) => { let multiSigAddress = CONFIG.multiSigAddress; let defaultMaintainer = CONFIG.defaultMaintainer; + let ERC20MineV3Address = CONFIG.ERC20MineV3; + let DODOMineV3RegistryAddress = CONFIG.DODOMineV3Registry; + let DODOMineV3ProxyAddress = CONFIG.DODOMineV3Proxy; + + + if (deploySwitch.MineV3) { + logger.log("===================================================="); + logger.log("network type: " + network); + logger.log("Deploy time: " + new Date().toLocaleString()); + logger.log("Deploy type: MineV3"); + + if (ERC20MineV3Address == "") { + await deployer.deploy(ERC20MineV3); + ERC20MineV3Address = ERC20MineV3.address; + logger.log("ERC20MineV3Address: ", ERC20MineV3Address); + } + + if (DODOMineV3RegistryAddress == "") { + await deployer.deploy(DODOMineV3Registry); + DODOMineV3RegistryAddress = DODOMineV3Registry.address; + logger.log("DODOMineV3RegistryAddress: ", DODOMineV3RegistryAddress); + + const dodoMineV3RegistryInstance = await DODOMineV3Registry.at(DODOMineV3RegistryAddress); + var tx = await dodoMineV3RegistryInstance.initOwner(multiSigAddress); + logger.log("Init DODOMineV3Registry Tx:", tx.tx); + } + + if (DODOMineV3ProxyAddress == "") { + await deployer.deploy( + DODOMineV3Proxy, + CloneFactoryAddress, + ERC20MineV3Address, + DODOApproveProxyAddress, + DODOMineV3RegistryAddress + ); + DODOMineV3ProxyAddress = DODOMineV3Proxy.address; + logger.log("DODOMineV3ProxyAddress: ", DODOMineV3ProxyAddress); + + const dodoMineV3ProxyInstance = await DODOMineV3Proxy.at(DODOMineV3ProxyAddress); + var tx = await dodoMineV3ProxyInstance.initOwner(multiSigAddress); + logger.log("Init DODOMineV3Proxy Tx:", tx.tx); + } + + if (network == 'kovan' || network == 'rinkeby') { + const dodoMineV3RegistryInstance = await DODOMineV3Registry.at(DODOMineV3RegistryAddress); + var tx = await dodoMineV3RegistryInstance.addAdminList(DODOMineV3ProxyAddress); + logger.log("DODOMineV3RegistryAddress Init tx: ", tx.tx); + } + + } + if (deploySwitch.ERC20V2Factory) { logger.log("===================================================="); logger.log("network type: " + network); @@ -91,7 +147,7 @@ module.exports = async (deployer, network, accounts) => { ); ERC20V2FactoryAddress = ERC20V2Factory.address; logger.log("ERC20V2FactoryAddress: ", ERC20V2FactoryAddress); - + const erc20V2FactoryInstance = await ERC20V2Factory.at(ERC20V2FactoryAddress); var tx = await erc20V2FactoryInstance.initOwner(multiSigAddress); logger.log("Init ERC20V2Factory Tx:", tx.tx); @@ -412,7 +468,7 @@ module.exports = async (deployer, network, accounts) => { } } - if(deploySwitch.test_ADAPTER) { + if (deploySwitch.test_ADAPTER) { logger.log("===================================================="); logger.log("network type: " + network); logger.log("Deploy time: " + new Date().toLocaleString()); diff --git a/truffle-config.js b/truffle-config.js index dc4bcbc..7124844 100644 --- a/truffle-config.js +++ b/truffle-config.js @@ -59,7 +59,8 @@ module.exports = { LockedVault: false, MULTIHOP: false, CpProxy: false, - ERC20V2Factory: false + ERC20V2Factory: false, + MineV3: false }, networks: {