Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adding a timestamp check to dustcollector #12

Merged
merged 3 commits into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion solidity/contracts/ConnextVestingWallet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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 == IERC20(NEXT_TOKEN) && released != TOTAL_AMOUNT) {
if (_token == IERC20(NEXT_TOKEN) && (released != TOTAL_AMOUNT || block.timestamp < UNLOCK_END)) {
revert NotAllowed();
}

Expand Down
10 changes: 9 additions & 1 deletion solidity/test/integration/ConnextVestingWallet.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Loading