Vanguard

First Flight #56
Beginner FriendlyDeFiFoundry
0 EXP
Submission Details
Impact: high
Likelihood: high

`_resetPerAddressTracking()` should reset `sender` not `address(0)`

Author Revealed upon completion

Description

_resetPerAddressTracking() should reset sender not address(0).

https://github.com/CodeHawks-Contests/2026-01-vanguard/blob/main/src/TokenLaunchHook.sol#L189

function _resetPerAddressTracking() internal {
addressSwappedAmount[address(0)] = 0;
addressLastSwapBlock[address(0)] = 0;
}

Here the reset doesn't do anything for the user/sender.

The mappings that track the user's activity are never reset:

mapping(address => uint256) public addressSwappedAmount;
mapping(address => uint256) public addressLastSwapBlock;

When the phase changes, the stored state for each user remains unchanged.

As a result, the penalties and limits calculated in _beforeSwap continue to apply based on the previous phase.

Mitigation:

Use this code instead :

function _resetPerAddressTracking(address sender) internal {
addressSwappedAmount[sender] = 0;
addressLastSwapBlock[sender] = 0;
}

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.

Give us feedback!