diff --git a/solidity/contracts/ConnextVestingWallet.sol b/solidity/contracts/ConnextVestingWallet.sol index a00ecd2..d5a0999 100644 --- a/solidity/contracts/ConnextVestingWallet.sol +++ b/solidity/contracts/ConnextVestingWallet.sol @@ -103,7 +103,7 @@ contract ConnextVestingWallet is Ownable2Step, IConnextVestingWallet { function sendDust(IERC20 _token, uint256 _amount, address _to) external onlyOwner { if (_to == address(0)) revert ZeroAddress(); - if (_token == NEXT_TOKEN && released != TOTAL_AMOUNT) { + if (_token == NEXT_TOKEN && (released != TOTAL_AMOUNT || block.timestamp < UNLOCK_END)) { revert NotAllowed(); } diff --git a/solidity/test/integration/ConnextVestingWallet.t.sol b/solidity/test/integration/ConnextVestingWallet.t.sol index b1373c0..1018f25 100644 --- a/solidity/test/integration/ConnextVestingWallet.t.sol +++ b/solidity/test/integration/ConnextVestingWallet.t.sol @@ -210,9 +210,17 @@ contract UnitConnextVestingWallet is Test, Constants { assertEq(_randomAddress.balance, _dustAmount); // Collect vesting token after the vesting period has ended - vm.warp(_firstMilestoneTimestamp + 365 days * 3 + 10 days); + vm.warp(_connextVestingWallet.UNLOCK_END()); assertEq(_nextToken.balanceOf(_randomAddress), 0); _connextVestingWallet.release(); + + // Can't collect the vesting token before the unlock period has ended + vm.warp(_connextVestingWallet.UNLOCK_END() - 1); + vm.expectRevert(abi.encodeWithSelector(IConnextVestingWallet.NotAllowed.selector)); + vm.prank(owner); + _connextVestingWallet.sendDust(_nextToken, _dustAmount, _randomAddress); + // After all tokens were released AND the unlock period has ended, the dust can be collected + vm.warp(_connextVestingWallet.UNLOCK_END()); vm.prank(owner); _connextVestingWallet.sendDust(_nextToken, _dustAmount, _randomAddress); assertEq(_nextToken.balanceOf(_randomAddress), _dustAmount);