From e810adaffe4d48348a2dbd7ce60381674a0a55ea Mon Sep 17 00:00:00 2001 From: owen05 Date: Tue, 28 Sep 2021 14:10:54 +0800 Subject: [PATCH] fix --- config/rinkeby-config.js | 8 ++++---- contracts/SmartRoute/proxies/DODONFTPoolProxy.sol | 12 ++++++++++-- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/config/rinkeby-config.js b/config/rinkeby-config.js index 16e78c1..c2e7687 100644 --- a/config/rinkeby-config.js +++ b/config/rinkeby-config.js @@ -102,11 +102,11 @@ module.exports = { // DropsERC1155: "0x3a8EcF30428bd4e33Cd7011533DFd596F7705c8F", //=================== NFTPool ================== - DODONFTApprove: "0x9CA2A5FB3771d824FAc3a307ff6B0fbb992C00Bc", + DODONFTApprove: "0x40F3bBe2f8C5F2E5f4adFf7d51f652F2B9F77315", FilterAdmin: "0x729f7f44bf64Ce814716b6261e267DbE6cdf021c", - FilterERC721V1: "0x72d220cE168C4f361dD4deE5D826a01AD8598f6C", - FilterERC1155V1: "0x80930Cb1849F7D42531506fF45E66724338A821b", - DODONFTPoolProxy: "0x888B9d4C25664F8B1BF744e8F4397d1429314155", + FilterERC721V1: "0x47E2C563cDCd7F36B4E77cc33a6A5c152663f915", + FilterERC1155V1: "0x55e2e1fe50FfaBd4fE3712Bd1aBfc9307a44c7F4", + DODONFTPoolProxy: "0xb23150F62D3089BB3Fa181ee6185324cdECE1942", NFTPoolController: "0xf5d24499dD76C3791ee6D19aa206f55b72270415" } diff --git a/contracts/SmartRoute/proxies/DODONFTPoolProxy.sol b/contracts/SmartRoute/proxies/DODONFTPoolProxy.sol index c19cbaf..351e518 100644 --- a/contracts/SmartRoute/proxies/DODONFTPoolProxy.sol +++ b/contracts/SmartRoute/proxies/DODONFTPoolProxy.sol @@ -30,6 +30,7 @@ contract DODONFTPoolProxy is InitializableOwnable, ReentrancyGuard { address public immutable _DODO_NFT_APPROVE_; address public immutable _DODO_APPROVE_; + mapping (address => bool) public isWhiteListed; // ============ Event ============== event SetFilterTemplate(uint256 idx, address filterTemplate); @@ -44,6 +45,7 @@ contract DODONFTPoolProxy is InitializableOwnable, ReentrancyGuard { event ChangeMaintainer(address newMaintainer); event ChangeContoller(address newController); event ChangeFilterAdminTemplate(address newFilterAdminTemplate); + event ChangeWhiteList(address contractAddr, bool isWhiteListed); constructor( address cloneFactory, @@ -177,6 +179,9 @@ contract DODONFTPoolProxy is InitializableOwnable, ReentrancyGuard { uint256[] memory spreadIds ) public returns(address newFilterV1) { newFilterV1 = ICloneFactory(_CLONE_FACTORY_).clone(_FILTER_TEMPLATES_[key]); + + emit CreateFilterV1(filterAdmin, newFilterV1, nftCollection, key); + IFilter(newFilterV1).init( filterAdmin, nftCollection, @@ -186,8 +191,6 @@ contract DODONFTPoolProxy is InitializableOwnable, ReentrancyGuard { priceRules, spreadIds ); - - emit CreateFilterV1(filterAdmin, newFilterV1, nftCollection, key); } @@ -213,6 +216,7 @@ contract DODONFTPoolProxy is InitializableOwnable, ReentrancyGuard { _generalApproveMax(filterAdmin, _DODO_APPROVE_, receivedFragAmount); + require(isWhiteListed[dodoProxy], "Not Whitelist Proxy Contract"); (bool success, ) = dodoProxy.call(dodoSwapData); require(success, "API_SWAP_FAILED"); @@ -245,6 +249,10 @@ contract DODONFTPoolProxy is InitializableOwnable, ReentrancyGuard { emit SetFilterTemplate(idx, newFilterTemplate); } + function changeWhiteList(address contractAddr, bool isWhiteListed) external onlyOwner { + isWhiteListed[contractAddr] = isWhiteListed; + emit ChangeWhiteList(contractAddr, isWhiteListed); + } //======================= Internal ===================== function _generalApproveMax(