diff --git a/config/rinkeby-config.js b/config/rinkeby-config.js index 7eb9287..be6134b 100644 --- a/config/rinkeby-config.js +++ b/config/rinkeby-config.js @@ -73,20 +73,20 @@ module.exports = { //DODOMineV2Factory: "0x3932E00a51d0D3b85C8Eb7C3ED0FcCB0dF98B3FF" //================== NFT ==================== - BuyoutModel: "0x98F5aF1E7Fb03A085D2a28713995e4A923860288", - Fragment: "0xDF7eccee9f5C92D1Baf036DB9410456f9382E045", - NFTCollateralVault: "0x23d72eA97a9E43411Eeb908d128DF337aD334582", - DODONFTRouteHelper: "0xb0Ca341b6fbdC607A507D821780e29f9601a58B3", + BuyoutModel: "0x1A18Ccf68040f660Ac7f83B4911d17398eDbC79f", + Fragment: "0xd0578C69e3455a7836456FfEEcd31934bda088d1", + NFTCollateralVault: "0x9d9A560661eD783F99188EFC2cFd5F37bCC30609", + DODONFTRouteHelper: "0xf3194Dcbba7dDC1F8Cf1bC97AD502BC25581Ba0d", InitializableERC721: "0xC0ccfC832BD45Cd3A2d62e47FE92Fc50DD2210ac", InitializableERC1155: "0x9DC9086B65cCBec43F92bFa37Db81150Ed1DDDed", NFTTokenFactory: "0xd2BffcCBC1F2a7356f8DaBB55B33E47D62de1bB1", - DodoNftErc721: "0x3Bc20358B31aD498d5a245B36bC993DDBE9A4405", - DodoNftErc1155: "0xc498F36eF82Aa5dBE0ecF6DD56DD55398E80E13D", + DodoNftErc721: "", + DodoNftErc1155: "", - DODONFTRegistry: "0x69efeCA5070Cb22c1094cffEbacafC09c058c139", - DODONFTProxy: "0x0CF019E13C6527BD34eC6c8323F11aB5DF6f0922", + DODONFTRegistry: "0x3DEf969E84FEAa9Dd2a29E1008D0426c8d89D5C5", + DODONFTProxy: "0xBF243C5626A0766031d57269c01F6eFd57B603fc", //================= DropsV1 ================= MysteryBoxV1: "", @@ -100,5 +100,14 @@ module.exports = { //DODODropsV2: "0x4A2b9f63AE41cF3003A494F2d8Fcd9Ed850b9A6f" // DropsERC721: "0x3df8d553275781C777f432A74EEE9099226B9d13", // DropsERC1155: "0x3a8EcF30428bd4e33Cd7011533DFd596F7705c8F", + + //=================== NFTPool ================== + DODONFTApprove: "0xe4915ABF03d56743c7e66B1CFda4C58bAAc0963C", + FilterAdmin: "0x3893c38aFa42E492b134888c79CAE52744Eb3ab0", + FilterERC721V1: "0x3F87f3d4EeD2C466CCA6E722a3153875C3f2822b", + FilterERC1155V1: "0xf71F758e2c4417758588CA6ff803036cA1EeB396", + DODONFTPoolProxy: "0x4587F2039bfb47D76000b23743993962518Ee0c2", + NFTPoolController: "0xf5d24499dD76C3791ee6D19aa206f55b72270415" + } } \ No newline at end of file diff --git a/contracts/external/ERC20/InitializableFragERC20.sol b/contracts/external/ERC20/InitializableFragERC20.sol index 63f3495..c4c12af 100644 --- a/contracts/external/ERC20/InitializableFragERC20.sol +++ b/contracts/external/ERC20/InitializableFragERC20.sol @@ -39,7 +39,7 @@ contract InitializableFragERC20 { emit Transfer(address(0), _creator, _totalSupply); } - function decimals() public view returns (uint8) { + function decimals() public pure returns (uint8) { return 18; } diff --git a/migrations/7_deploy_nftPool.js b/migrations/7_deploy_nftPool.js index e69de29..6559caa 100644 --- a/migrations/7_deploy_nftPool.js +++ b/migrations/7_deploy_nftPool.js @@ -0,0 +1,104 @@ +const fs = require("fs"); +const { deploySwitch } = require('../truffle-config.js') +const file = fs.createWriteStream("../deploy-nft.txt", { 'flags': 'a' }); +let logger = new console.Console(file, file); +const { GetConfig } = require("../configAdapter.js") + +const DODONFTApprove = artifacts.require("DODONFTApprove"); +const FilterAdmin = artifacts.require("FilterAdmin"); +const FilterERC721V1 = artifacts.require("FilterERC721V1"); +const FilterERC1155V1 = artifacts.require("FilterERC1155V1"); +const DODONFTPoolProxy = artifacts.require("DODONFTPoolProxy") +const Controller = artifacts.require("Controller"); + +module.exports = async (deployer, network, accounts) => { + let CONFIG = GetConfig(network, accounts) + if (CONFIG == null) return; + //Need Deploy first + let DODOApproveAddress = CONFIG.DODOApprove; + let CloneFactoryAddress = CONFIG.CloneFactory; + + if (DODOApproveAddress == "" || CloneFactoryAddress == "") return; + + let DODONFTApproveAddress = CONFIG.DODONFTApprove; + let FilterAdminAddress = CONFIG.FilterAdmin; + let FilterERC721V1Address = CONFIG.FilterERC721V1; + let FilterERC1155V1Address = CONFIG.FilterERC1155V1; + + let DODONFTPoolProxyAddress = CONFIG.DODONFTPoolProxy; + let ControllerAddress = CONFIG.NFTPoolController; + + let multiSigAddress = CONFIG.multiSigAddress; + + if (deploySwitch.NFT_POOL) { + logger.log("===================================================="); + logger.log("network type: " + network); + logger.log("Deploy time: " + new Date().toLocaleString()); + logger.log("Deploy type: NFT_POOL"); + + if (FilterAdminAddress == "") { + await deployer.deploy(FilterAdmin); + FilterAdminAddress = FilterAdmin.address; + logger.log("FilterAdminAddress: ", FilterAdminAddress); + } + + if (FilterERC721V1Address == "") { + await deployer.deploy(FilterERC721V1); + FilterERC721V1Address = FilterERC721V1.address; + logger.log("FilterERC721V1Address: ", FilterERC721V1Address); + } + + if (FilterERC1155V1Address == "") { + await deployer.deploy(FilterERC1155V1); + FilterERC1155V1Address = FilterERC1155V1.address; + logger.log("FilterERC1155V1Address: ", FilterERC1155V1Address); + } + + if (ControllerAddress == "") { + await deployer.deploy(Controller); + ControllerAddress = Controller.address; + logger.log("ControllerAddress: ", ControllerAddress); + const ControllerInstance = await Controller.at(ControllerAddress); + var tx = await ControllerInstance.initOwner(multiSigAddress); + logger.log("Init Controller Tx:", tx.tx); + } + + if (DODONFTApproveAddress == "") { + await deployer.deploy(DODONFTApprove); + DODONFTApproveAddress = DODONFTApprove.address; + logger.log("DODONFTApproveAddress: ", DODONFTApproveAddress); + } + + if (DODONFTPoolProxyAddress == "") { + await deployer.deploy( + DODONFTPoolProxy, + CloneFactoryAddress, + FilterAdminAddress, + ControllerAddress, + multiSigAddress, + DODONFTApproveAddress, + DODOApproveAddress + ); + DODONFTPoolProxyAddress = DODONFTPoolProxy.address; + logger.log("DODONFTPoolProxyAddress: ", DODONFTPoolProxyAddress); + + const DODONFTPoolProxyInstance = await DODONFTPoolProxy.at(DODONFTPoolProxyAddress); + var tx = await DODONFTPoolProxyInstance.initOwner(multiSigAddress); + logger.log("Init DODONFTPoolProxy Tx:", tx.tx); + } + + + if (network == 'kovan' || network == 'rinkeby') { + var tx; + const DODONFTPoolProxyInstance = await DODONFTPoolProxy.at(DODONFTPoolProxyAddress); + tx = await DODONFTPoolProxyInstance.setFilterTemplate(1, FilterERC721V1Address); + logger.log("DODONFTPoolProxy SetFilterTemplate 1 tx: ", tx.tx); + tx = await DODONFTPoolProxyInstance.setFilterTemplate(2, FilterERC1155V1Address); + logger.log("DODONFTPoolProxy SetFilterTemplate 2 tx: ", tx.tx); + + const DODONFTApproveInstance = await DODONFTApprove.at(DODONFTApproveAddress); + var tx = await DODONFTApproveInstance.init(multiSigAddress, [DODONFTPoolProxyAddress]); + logger.log("DODONFTApprove init tx: ", tx.tx); + } + } +}; diff --git a/truffle-config.js b/truffle-config.js index 169c003..2e2dbc7 100644 --- a/truffle-config.js +++ b/truffle-config.js @@ -63,7 +63,8 @@ module.exports = { COLLECTIONS: false, MYSTERYBOX_V1: false, Drops_V2: false, - MineV3: false + MineV3: false, + NFT_POOL: false }, networks: {