Skip to content

Commit

Permalink
Prevent 'initializeOnUpgrade' of LiquidityPool from being called twic…
Browse files Browse the repository at this point in the history
…e, add the unused gap var and add initialization for added variables
  • Loading branch information
seongyun-ko committed Jan 2, 2025
1 parent c85e920 commit cca361e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/LiquidityPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions src/WithdrawRequestNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cca361e

Please sign in to comment.