diff --git a/.gitignore b/.gitignore index 5470f58..297d8ce 100644 --- a/.gitignore +++ b/.gitignore @@ -16,6 +16,7 @@ deploy-detail-v2.0.txt deploy-detail-periphery.txt deploy-drops.txt deploy-nft.txt +deploy-starter.txt kovan-mock-v2.0.txt deploy-detail-erc20V3.txt diff --git a/config/matic-config.js b/config/matic-config.js index eb148ea..445024f 100644 --- a/config/matic-config.js +++ b/config/matic-config.js @@ -3,7 +3,7 @@ module.exports = { //TOKEN WETH: "0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270", CHI: "0x0000000000000000000000000000000000000000", - DODO: "0x6B208E08dcF6BD51F50C5Da09d15B2D8E5C46Cf2", + DODO: "0xe4bf2864ebec7b7fdf6eeca9bacae7cdfdaffe78", //Helper DODOSellHelper: "0xDfaf9584F5d229A9DBE5978523317820A8897C5A", diff --git a/config/moonriver-config.js b/config/moonriver-config.js index 51ff19f..1be4552 100644 --- a/config/moonriver-config.js +++ b/config/moonriver-config.js @@ -1,7 +1,7 @@ module.exports = { MOONRIVER_CONFIG: { //TOKEN - WETH: "0xf50225a84382c74CbdeA10b0c176f71fc3DE0C4d", + WETH: "0x98878b06940ae243284ca214f92bb71a2b032b8a",//0xf50225a84382c74CbdeA10b0c176f71fc3DE0C4d CHI: "0x0000000000000000000000000000000000000000", DODO: "", @@ -12,7 +12,7 @@ module.exports = { //DODO: "0xB5397B2210f49e96a5EB2c9747Aa2bD9397d90C0", //ERC20Helper: "0x6373ceB657C83C91088d328622573FB766064Ac4", DODOSellHelper: "0x5e84190a270333aCe5B9202a3F4ceBf11b81bB01", - DODOCalleeHelper: "0xc4436fBAE6eBa5d95bf7d53Ae515F8A707Bd402A", // replace weth need to redeploy + DODOCalleeHelper: "0x533AF8ad419fB3082df9C80BE2ad903912a817FB", // replace weth need to redeploy DODOV1PmmHelper: "0x3CD6D7F5fF977bf8069548eA1F9441b061162b42", DODOV2RouteHelper: "0x8a6998b9A4E4f63c8aDB46ceEB01857A956A8122", CurveSample: "", diff --git a/config/rinkeby-config.js b/config/rinkeby-config.js index 9d65724..f5f1422 100644 --- a/config/rinkeby-config.js +++ b/config/rinkeby-config.js @@ -114,7 +114,14 @@ module.exports = { FilterERC721V1: "0x47E2C563cDCd7F36B4E77cc33a6A5c152663f915", FilterERC1155V1: "0x55e2e1fe50FfaBd4fE3712Bd1aBfc9307a44c7F4", DODONFTPoolProxy: "0x81AD954B2Ed65d85d3023Eeb2D8DF6A512D4cd59", - NFTPoolController: "0xf5d24499dD76C3791ee6D19aa206f55b72270415" + NFTPoolController: "0xf5d24499dD76C3791ee6D19aa206f55b72270415", + + //=================== Starter =================== + DODOStarterProxy: "0x451E07405B79eDEEA87ccFa57e1BaF184Bea6773", + DODOStarterFactory: "0xa28D60c3eCDc52521c8219bd6a4eba0AA8900F88", + FairFunding: "0x5D1f0d091B3Fe5F79908F232c50CfC3D9084c59d", + InstantFunding: "0x9297C04D4F8B47cCf7F2733b0F8f151aE1cb4615" + } } \ No newline at end of file diff --git a/contracts/DODOStarter/impl/Storage.sol b/contracts/DODOStarter/impl/Storage.sol index d338d84..60d093c 100644 --- a/contracts/DODOStarter/impl/Storage.sol +++ b/contracts/DODOStarter/impl/Storage.sol @@ -59,6 +59,9 @@ contract Storage is InitializableOwnable, ReentrancyGuard { uint256 public _BIDDING_DURATION_; + // ============ Events ============ + event SetQuota(address quota); + // ============ Modifiers ============ modifier isNotForceStop() { require(!_FORCE_STOP_, "FORCE_STOP"); @@ -73,4 +76,9 @@ contract Storage is InitializableOwnable, ReentrancyGuard { uint256 tokenAmount = IERC20(_TOKEN_ADDRESS_).balanceOf(address(this)); IERC20(_TOKEN_ADDRESS_).safeTransfer(_OWNER_, tokenAmount); } + + function setQuota(address quota) external onlyOwner { + _QUOTA_ = quota; + emit SetQuota(quota); + } } \ No newline at end of file diff --git a/migrations/2_deploy_starter.js b/migrations/2_deploy_starter.js new file mode 100644 index 0000000..b7dc006 --- /dev/null +++ b/migrations/2_deploy_starter.js @@ -0,0 +1,73 @@ +const fs = require("fs"); +const { deploySwitch } = require('../truffle-config.js') +const file = fs.createWriteStream("../deploy-starter.txt", { 'flags': 'a' }); +let logger = new console.Console(file, file); +const { GetConfig } = require("../configAdapter.js") + +const DODOStarterProxy = artifacts.require("DODOStarterProxy"); +const DODOStarterFactory = artifacts.require("DODOStarterFactory"); +const FairFunding = artifacts.require("FairFunding"); +const InstantFunding = artifacts.require("InstantFunding"); + +module.exports = async (deployer, network, accounts) => { + let CONFIG = GetConfig(network, accounts) + if (CONFIG == null) return; + //Need Deploy first + let DODOApproveProxyAddress = CONFIG.DODOApproveProxy; + let CloneFactoryAddress = CONFIG.CloneFactory; + let WETHAddress = CONFIG.WETH; + + if (DODOApproveProxyAddress == "" || CloneFactoryAddress == "" || WETHAddress == "") return; + + let FairFundingTemplate = CONFIG.FairFunding; + let InstantFundingTemplate = CONFIG.InstantFunding; + let DODOStarterFactoryAddress = CONFIG.DODOStarterFactory; + let DODOStarterProxyAddress = CONFIG.DODOStarterProxy; + + let multiSigAddress = CONFIG.multiSigAddress; + + if (deploySwitch.STARTER) { + logger.log("===================================================="); + logger.log("network type: " + network); + logger.log("Deploy time: " + new Date().toLocaleString()); + logger.log("Deploy type: STARTER"); + + if (FairFundingTemplate == "") { + await deployer.deploy(FairFunding); + FairFundingTemplate = FairFunding.address; + logger.log("FairFundingTemplate: ", FairFundingTemplate); + } + + if (InstantFundingTemplate == "") { + await deployer.deploy(InstantFunding); + InstantFundingTemplate = InstantFunding.address; + logger.log("InstantFundingTemplate: ", InstantFundingTemplate); + } + + if (DODOStarterFactoryAddress == "") { + await deployer.deploy( + DODOStarterFactory, + CloneFactoryAddress, + FairFundingTemplate, + InstantFundingTemplate + ); + DODOStarterFactoryAddress = DODOStarterFactory.address; + logger.log("DODOStarterFactoryAddress: ", DODOStarterFactoryAddress); + + const instance = await DODOStarterFactory.at(DODOStarterFactoryAddress); + var tx = await instance.initOwner(multiSigAddress); + logger.log("Init DODOStarterFactory Tx:", tx.tx); + } + + + if (DODOStarterProxyAddress == "") { + await deployer.deploy( + DODOStarterProxy, + WETHAddress, + DODOApproveProxyAddress + ); + DODOStarterProxyAddress = DODOStarterProxy.address; + logger.log("DODOStarterProxyAddress: ", DODOStarterProxyAddress); + } + } +}; diff --git a/migrations/7_deploy_nftPool.js b/migrations/4_deploy_nftPool.js similarity index 100% rename from migrations/7_deploy_nftPool.js rename to migrations/4_deploy_nftPool.js diff --git a/migrations/4_deploy_periphery.js b/migrations/6_deploy_periphery.js similarity index 100% rename from migrations/4_deploy_periphery.js rename to migrations/6_deploy_periphery.js diff --git a/migrations/6_deploy_dropsV2.js b/migrations/7_deploy_dropsV2.js similarity index 100% rename from migrations/6_deploy_dropsV2.js rename to migrations/7_deploy_dropsV2.js diff --git a/migrations/3_deploy_v2_mock.js b/migrations/8_deploy_v2_mock.js similarity index 100% rename from migrations/3_deploy_v2_mock.js rename to migrations/8_deploy_v2_mock.js diff --git a/truffle-config.js b/truffle-config.js index ce28c3a..45634fc 100755 --- a/truffle-config.js +++ b/truffle-config.js @@ -65,7 +65,8 @@ module.exports = { Drops_V2: false, MineV3: false, NFT_POOL: false, - UserQuota: false + UserQuota: false, + STARTER: true }, networks: { @@ -98,14 +99,13 @@ module.exports = { networkCheckTimeout: 100000, provider: function () { return new HDWalletProvider(privKey, "https://rinkeby.infura.io/v3/" + infuraId); - // return new HDWalletProvider(privKey, "https://eth-rinkeby.dodoex.io"); }, gas: 10000000, gasPrice: 1500000000, network_id: 4, skipDryRun: true, - confirmations: 2, - timeoutBlocks: 200, + // confirmations: 10, + // timeoutBlocks: 200, }, live: {