Long Menthol Cow
Medium
The rounding error in tax fee calculation will allow early claimers to skip tax before claiming period ends.
The tax fee calculation is rounded down, which can cause tax fee to be 0 in case maxChargeableTax * claimingTimeLeft < AIRDROP_CLAIMING_PERIOD_LENGTH
holds. So, in that case claimTaxAmount
is 0 and the tax fee is skipped.
https://github.com/sherlock-audit/2024-10-usual-labs-v1/blob/main/pegasus/packages/solidity/src/airdrop/AirdropTaxCollector.sol#L232-L233
maxChargeableTax
is set properly by airdrop operator- Prelaunch usd0++ balances are set properly for accounts
- Blocktime is within claiming period
No response
- For example, airdrop operator sets
maxChargeableTax = 1000 // 10%
- Prelaunch usd0++ balance is set properly for
Alice
(uint(182 days) / 1000) / 1 hours = 4
hours before the end of claiming period ,Alice
claims airdrop and the tax amount to be paid byAlice
is0
- Taxes can be skipped before claiming period ends, depends on value of
maxChargeableTax
: The lowermaxChargeableTax
is set, the sooner the claimer can bypass tax. And the amount of skipped tax is dependent on account's prelaunch usd0++ balance
Add the test below to test file AirdropTaxCollector.t.sol
:
function test_calculateClaim_bypass_tax()
public
withMaxChargeableTax(TEN_PERCENT)
userHasPrelaunchBalance(alice, 1000 ether)
afterClaimingPeriodStart(AIRDROP_CLAIMING_PERIOD_LENGTH - 4 hours)
{
uint256 taxAmount = airdropTaxCollector.calculateClaimTaxAmount(alice);
assertEq(taxAmount, 0);
}
Run the test and console shows:
Ran 1 test for test/airdrop/AirdropTaxCollector.t.sol:AirdropTaxCollectorTest
[PASS] test_calculateClaim_bypass_tax() (gas: 58884)
Suite result: ok. 1 passed; 0 failed; 0 skipped; finished in 11.46ms (385.00µs CPU time)
Consider rounding up instead of rounding down in the taxFee
calculation