From 1d054e4bf707bae01126af6d9d309817b53d59bd Mon Sep 17 00:00:00 2001 From: owen05 Date: Fri, 9 Jul 2021 10:26:07 +0800 Subject: [PATCH] update mineV3Registry --- config/heco-config.js | 2 ++ config/matic-config.js | 2 ++ config/rinkeby-config.js | 4 +-- .../Factory/Registries/DODOMineV3Registry.sol | 29 ++++++++----------- deploy-detail-periphery.txt | 16 ++++++++++ migrations/4_deploy_periphery.js | 1 + 6 files changed, 35 insertions(+), 19 deletions(-) diff --git a/config/heco-config.js b/config/heco-config.js index f5cab06..9a56baa 100644 --- a/config/heco-config.js +++ b/config/heco-config.js @@ -62,5 +62,7 @@ module.exports = { //Account multiSigAddress: "0xD93c8D2429a6b0269527f148F3A0e5D187B0b1Ca", defaultMaintainer: "0xD93c8D2429a6b0269527f148F3A0e5D187B0b1Ca", + + //DODOTreasury Address: "0x6ed2B1aFB1483b150fF428178F1aE5b8e7367A26" } } \ No newline at end of file diff --git a/config/matic-config.js b/config/matic-config.js index 265e1a5..c56af8b 100644 --- a/config/matic-config.js +++ b/config/matic-config.js @@ -55,5 +55,7 @@ module.exports = { //Account multiSigAddress: "0x3CD6D7F5fF977bf8069548eA1F9441b061162b42", defaultMaintainer: "0x3CD6D7F5fF977bf8069548eA1F9441b061162b42", + + //Treasury Address: "0x65C5e6F299656CB2458DC18f46b3DF7E1e7e2776" } } \ No newline at end of file diff --git a/config/rinkeby-config.js b/config/rinkeby-config.js index 04f48bd..2929e83 100644 --- a/config/rinkeby-config.js +++ b/config/rinkeby-config.js @@ -33,7 +33,7 @@ module.exports = { UpCpFactory: "0xb09E91505347234Cb722D67042290f50F1C13749", ERC20Factory: "0x48476599281CB7DD46dbE47264C4594d1d2E19A8", ERC20V2Factory: "0x7A22e361cB74E69B5B1C800A3aAbE3E50e84F4F6", - DODOMineV3Registry: "0x3c2885e0943FDD38503593D911B34C84C814FF24", + DODOMineV3Registry: "0xeA12A4F762B6D8e2a122847aB1ecF60BB690fEd8", //Approve DODOApprove: "0xcC8d87A7C747eeE4242045C47Ef25e0A81D56ae3", @@ -52,7 +52,7 @@ module.exports = { DSPProxy: "0x0f6345D1d07C134BB0973AD102F38eA9195F6f78", CpProxy: "0x2E483CBb9e76fE6543168DEd698d9244EE1ED8Dd", RouteProxy: "0xe2b538a781eB5a115a1359B8f363B9703Fd19dE6", - DODOMineV3Proxy: "0x0beC8cd51dF39f8d09a1Db5AD3A8e6ed994d889D", + DODOMineV3Proxy: "0xcb15BBb59AC8a4B64A4db9B8d9F66c397d89Bd22", //vDODO DODOCirculationHelper: "0xe4Aec985debDDbbCB2358e8C8F9384DD6421d163", diff --git a/contracts/Factory/Registries/DODOMineV3Registry.sol b/contracts/Factory/Registries/DODOMineV3Registry.sol index 46457ba..88f3bd4 100644 --- a/contracts/Factory/Registries/DODOMineV3Registry.sol +++ b/contracts/Factory/Registries/DODOMineV3Registry.sol @@ -25,13 +25,12 @@ interface IDODOMineV3Registry { contract DODOMineV3Registry is InitializableOwnable, IDODOMineV3Registry { mapping (address => bool) public isAdminListed; - mapping (address => bool) public singleTokenList; // ============ Registry ============ // minePool -> stakeToken mapping(address => address) public _MINE_REGISTRY_; // lpToken -> minePool - mapping(address => address) public _LP_REGISTRY_; + mapping(address => address[]) public _LP_REGISTRY_; // singleToken -> minePool mapping(address => address[]) public _SINGLE_REGISTRY_; @@ -41,8 +40,6 @@ contract DODOMineV3Registry is InitializableOwnable, IDODOMineV3Registry { event RemoveMineV3(address mine, address stakeToken); event addAdmin(address admin); event removeAdmin(address admin); - event addSingleToken(address token); - event removeSingleToken(address token); function addMineV3( @@ -53,9 +50,8 @@ contract DODOMineV3Registry is InitializableOwnable, IDODOMineV3Registry { require(isAdminListed[msg.sender], "ACCESS_DENIED"); _MINE_REGISTRY_[mine] = stakeToken; if(isLpToken) { - _LP_REGISTRY_[stakeToken] = mine; + _LP_REGISTRY_[stakeToken].push(mine); }else { - require(_SINGLE_REGISTRY_[stakeToken].length == 0 || singleTokenList[stakeToken], "ALREADY_EXSIT_POOL"); _SINGLE_REGISTRY_[stakeToken].push(mine); } @@ -71,7 +67,16 @@ contract DODOMineV3Registry is InitializableOwnable, IDODOMineV3Registry { ) external onlyOwner { _MINE_REGISTRY_[mine] = address(0); if(isLpToken) { - _LP_REGISTRY_[stakeToken] = address(0); + uint256 len = _LP_REGISTRY_[stakeToken].length; + for (uint256 i = 0; i < len; i++) { + if (mine == _LP_REGISTRY_[stakeToken][i]) { + if(i != len - 1) { + _LP_REGISTRY_[stakeToken][i] = _LP_REGISTRY_[stakeToken][len - 1]; + } + _LP_REGISTRY_[stakeToken].pop(); + break; + } + } }else { uint256 len = _SINGLE_REGISTRY_[stakeToken].length; for (uint256 i = 0; i < len; i++) { @@ -97,14 +102,4 @@ contract DODOMineV3Registry is InitializableOwnable, IDODOMineV3Registry { isAdminListed[contractAddr] = false; emit removeAdmin(contractAddr); } - - function addSingleTokenList(address token) external onlyOwner { - singleTokenList[token] = true; - emit addSingleToken(token); - } - - function removeSingleTokenList(address token) external onlyOwner { - singleTokenList[token] = false; - emit removeSingleToken(token); - } } \ No newline at end of file diff --git a/deploy-detail-periphery.txt b/deploy-detail-periphery.txt index 1ac4009..4aab95e 100644 --- a/deploy-detail-periphery.txt +++ b/deploy-detail-periphery.txt @@ -525,3 +525,19 @@ Init DODOMineV3Registry Tx: 0x79aa148ba0cc4f21c8525cf14442e3ffed6d702bfde64c3ab8 DODOMineV3ProxyAddress: 0x0beC8cd51dF39f8d09a1Db5AD3A8e6ed994d889D Init DODOMineV3Proxy Tx: 0xd9c200aa85e16f383d0e68efa0ff889c198e017e86d3730ca162f89450d8b015 DODOMineV3RegistryAddress Init tx: 0x30f6bf822329c02d910c4d65a234f6c9856e328da3019ee08cbf126da1fb80c2 +==================================================== +network type: rinkeby +Deploy time: 2021/7/8 上午11:16:51 +Deploy type: MineV3 +DODOMineV3RegistryAddress: 0xeA12A4F762B6D8e2a122847aB1ecF60BB690fEd8 +Init DODOMineV3Registry Tx: 0x69015e802dfe452c1358203789bde48c073294c8fab0b47fff5ce90fd078c3a8 +DODOMineV3ProxyAddress: 0xcb15BBb59AC8a4B64A4db9B8d9F66c397d89Bd22 +Init DODOMineV3Proxy Tx: 0x36267d6e0231235d7be2d83546af371cce5fe73bd9e2fc99807fcbfd96e74de4 +DODOMineV3RegistryAddress Init tx: 0x89bcbd0d40d5c4596cb16953b236ee7c013086dbc1bbe2f07fe443c977800ffe +==================================================== +network type: rinkeby +Deploy time: 2021/7/8 上午11:26:11 +Deploy type: MineV3 +DODOMineV3RegistryAddress Init tx: 0x907607d1b96595c1ceba9d515a02bea5197c9db86f5e23a5097073d0adcf9a63 +DODOApproveProxy Unlock tx: 0x64b4e96618a6dad94575f3fb162389e8ae10e90903460d7740d45cc0fc8a8dc6 +DODOApproveProxy AddProxy tx: 0x23416aa911f38a3babcb22226765a553c8458f68914906506f3acab675a75661 diff --git a/migrations/4_deploy_periphery.js b/migrations/4_deploy_periphery.js index 166cd51..95f17a8 100644 --- a/migrations/4_deploy_periphery.js +++ b/migrations/4_deploy_periphery.js @@ -19,6 +19,7 @@ const MultiCall = artifacts.require("Multicall"); const LockedTokenVault = artifacts.require("LockedTokenVault"); const DODORouteProxy = artifacts.require("DODORouteProxy"); const DODOCpProxy = artifacts.require("DODOCpProxy"); +const DODOApproveProxy = artifacts.require("DODOApproveProxy"); const DspTemplate = artifacts.require("DSP"); const DspFactory = artifacts.require("DSPFactory");