From 8f7e18d17a385c93fb32f63dd195a5075d50df6d Mon Sep 17 00:00:00 2001 From: kyriediculous Date: Tue, 23 Jul 2024 23:56:47 +0200 Subject: [PATCH] periphery: fix bug in pre-launch claimVeTokens --- src/periphery/PreLaunch.sol | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/periphery/PreLaunch.sol b/src/periphery/PreLaunch.sol index 5851c26..2f7ac63 100644 --- a/src/periphery/PreLaunch.sol +++ b/src/periphery/PreLaunch.sol @@ -208,7 +208,11 @@ contract PreLaunch is Initializable, OwnableUpgradeable, UUPSUpgradeable { uint256 epochsElapsedSinceClaimable = (block.timestamp - claimableTimestamp) / EPOCH_LENGTH; uint256 lpEthAmount = lockup.amount * lpEthReceived / totalDeposits; SafeTransferLib.safeApprove(lpEth, votingEscrow, lpEthAmount); - VotingEscrow(votingEscrow).lockFor(msg.sender, lpEthAmount, lockup.duration - epochsElapsedSinceClaimable); + if (lockup.duration > epochsElapsedSinceClaimable) { + VotingEscrow(votingEscrow).lockFor(msg.sender, lpEthAmount, lockup.duration - epochsElapsedSinceClaimable); + } else { + ERC20(LpETH(lpEth).lpToken()).transfer(msg.sender, lpEthAmount); + } delete lockups[msg.sender]; }