changeTreasury() Lack of check and remove old
changeTreasury() Lack of check and remove old\\nchangeTreasury() used to set new treasury The code is as follows：\\n```\\n    function changeTreasury(uint256 _marketId, address _treasury)\\n        public\\n        onlyTimeLocker\\n    {\\n        if (_treasury == address(0)) revert AddressZero();\\n\\n        address[2] memory vaults = marketIdToVaults[_marketId];\\n\\n        if (vaults[0] == address(0) || vaults[1] == address(0)) {\\n            revert MarketDoesNotExist(_marketId);\\n        }\\n        IVaultV2(vaults[0]).whiteListAddress(_treasury);\\n        IVaultV2(vaults[1]).whiteListAddress(_treasury);\\n        IVaultV2(vaults[0]).setTreasury(treasury);\\n        IVaultV2(vaults[1]).setTreasury(treasury);\\n\\n        emit AddressWhitelisted(_treasury, _marketId);\\n    }\\n```\\n\\nThe above code has the following problem:\\nno check whether the new treasury same as the old. If it is the same, the whitelist will be canceled.\\nUse setTreasury(VaultFactoryV2.treasury), it should be setTreasury(_treasury)\\nnot cancel old treasury from the whitelist
```\\n    function changeTreasury(uint256 _marketId, address _treasury)\\n        public\\n        onlyTimeLocker\\n    {\\n        if (_treasury == address(0)) revert AddressZero();\\n\\n        address[2] memory vaults = marketIdToVaults[_marketId];\\n\\n        if (vaults[0] == address(0) || vaults[1] == address(0)) {\\n            revert MarketDoesNotExist(_marketId);\\n        }\\n\\n+       require(vaults[0].treasury() !=_treasury,"same"); //check same\\n+       IVaultV2(vaults[0]).whiteListAddress(vaults[0].treasury()); //cancel old whitelist\\n+       IVaultV2(vaults[1]).whiteListAddress(vaults[1].treasury()); //cancel old whitelist\\n\\n        IVaultV2(vaults[0]).whiteListAddress(_treasury);\\n        IVaultV2(vaults[1]).whiteListAddress(_treasury);\\n+       IVaultV2(vaults[0]).setTreasury(_treasury);\\n+       IVaultV2(vaults[1]).setTreasury(_treasury);\\n-       IVaultV2(vaults[0]).setTreasury(treasury);\\n-       IVaultV2(vaults[1]).setTreasury(treasury);\\n\\n        emit AddressWhitelisted(_treasury, _marketId);\\n    }\\n```\\n
whiteListAddress abnormal
```\\n    function changeTreasury(uint256 _marketId, address _treasury)\\n        public\\n        onlyTimeLocker\\n    {\\n        if (_treasury == address(0)) revert AddressZero();\\n\\n        address[2] memory vaults = marketIdToVaults[_marketId];\\n\\n        if (vaults[0] == address(0) || vaults[1] == address(0)) {\\n            revert MarketDoesNotExist(_marketId);\\n        }\\n        IVaultV2(vaults[0]).whiteListAddress(_treasury);\\n        IVaultV2(vaults[1]).whiteListAddress(_treasury);\\n        IVaultV2(vaults[0]).setTreasury(treasury);\\n        IVaultV2(vaults[1]).setTreasury(treasury);\\n\\n        emit AddressWhitelisted(_treasury, _marketId);\\n    }\\n```\\n