Platform: Code4rena
Start Date: 06/09/2022
Pot Size: $90,000 USDC
Total HM: 33
Participants: 168
Period: 9 days
Judge: GalloDaSballo
Total Solo HM: 10
Id: 157
League: ETH
Rank: 168/168
Findings: 1
Award: $5.61
🌟 Selected for report: 0
🚀 Solo Findings: 0
🌟 Selected for report: MEP
Also found by: 0xSky, CertoraInc, MiloTruck, PwnPatrol, R2, Tointer, V_B, __141345__, antonttc, azephiar, cccz, d3e4, datapunk, davidbrai, easy_peasy, hansfriese, minhtrng, neumo, pcarranzav, peritoflores, scaraven, teawaterwire, tonisives, unforgiven, wagmi, zkhorse, zzzitron
5.6134 USDC - $5.61
When adding more than one founder, if the first founder has more than 50% of the allocation then if the second founder has more than 2% they will be missing tokens
adding this test in Token.t.sol
function test_Ownership2Founders() public { createUsers(2, 1 ether); address[] memory wallets = new address[](2); uint256[] memory percents = new uint256[](2); uint256[] memory vestExpirys = new uint256[](2); uint256 end = 4 weeks; unchecked { for (uint256 i; i < 2; ++i) { wallets[i] = otherUsers[i]; percents[i] = i == 0 ? 60 : 40; vestExpirys[i] = end; } } deployWithCustomFounders(wallets, percents, vestExpirys); assertEq(token.totalFounders(), 2); Founder memory founder; unchecked { for (uint256 i; i < 100; ++i) { founder = token.getScheduledRecipient(i); if (i < 60) assertEq(founder.wallet, otherUsers[0]); else assertEq(founder.wallet, otherUsers[1]); } } }
in that case the allocation is 60% / 40% and we can see that the second founder gets only 20 tokens instead of 40 (when running the test)
forge test --match test_Ownership2Founders
foundry forge
it has to do with the vesting schedule and the way the next token is not computed modulo 100.
maybe easier to drop the vesting schedule and just mint "linearly" from first founder to last founder (this would improve gas cost as well)
#0 - GalloDaSballo
2022-09-20T12:58:53Z