From cca361ec30d5fbf76cfdc31aac2993b94ece0c75 Mon Sep 17 00:00:00 2001 From: ReposCollector Date: Thu, 2 Jan 2025 18:10:42 +0900 Subject: [PATCH] Prevent 'initializeOnUpgrade' of LiquidityPool from being called twice, add the unused gap var and add initialization for added variables --- src/LiquidityPool.sol | 2 +- src/WithdrawRequestNFT.sol | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/LiquidityPool.sol b/src/LiquidityPool.sol index 8a95400f..13f2d6e0 100644 --- a/src/LiquidityPool.sol +++ b/src/LiquidityPool.sol @@ -138,7 +138,7 @@ contract LiquidityPool is Initializable, OwnableUpgradeable, UUPSUpgradeable, IL } function initializeOnUpgrade(address _auctionManager, address _liquifier) external onlyOwner { - require(_auctionManager != address(0) && _liquifier != address(0), "Invalid params"); + require(_auctionManager != address(0) && _liquifier != address(0) && address(auctionManager) == address(0) && address(liquifier) == address(0), "Invalid"); auctionManager = IAuctionManager(_auctionManager); liquifier = ILiquifier(_liquifier); diff --git a/src/WithdrawRequestNFT.sol b/src/WithdrawRequestNFT.sol index 96a5213a..0c3088cd 100644 --- a/src/WithdrawRequestNFT.sol +++ b/src/WithdrawRequestNFT.sol @@ -29,6 +29,7 @@ contract WithdrawRequestNFT is ERC721Upgradeable, UUPSUpgradeable, OwnableUpgrad uint32 public nextRequestId; uint32 public lastFinalizedRequestId; uint16 public shareRemainderSplitToTreasuryInBps; + uint16 public _unused_gap; // inclusive uint32 public currentRequestIdToScanFromForShareRemainder; @@ -78,10 +79,15 @@ contract WithdrawRequestNFT is ERC721Upgradeable, UUPSUpgradeable, OwnableUpgrad paused = true; // make sure the contract is paused after the upgrade pauser = _pauser; + _unused_gap = 0; + shareRemainderSplitToTreasuryInBps = _shareRemainderSplitToTreasuryInBps; currentRequestIdToScanFromForShareRemainder = 1; lastRequestIdToScanUntilForShareRemainder = nextRequestId - 1; + + aggregateSumOfEEthShare = 0; + totalRemainderEEthShares = 0; } /// @notice creates a withdraw request and issues an associated NFT to the recipient