Platform: Code4rena
Start Date: 08/12/2021
Pot Size: $30,000 ETH
Total HM: 12
Participants: 26
Period: 3 days
Judge: leastwood
Total Solo HM: 9
Id: 65
League: ETH
Rank: 10/26
Findings: 1
Award: $511.74
🌟 Selected for report: 1
🚀 Solo Findings: 0
🌟 Selected for report: gpersoon
511.7399 USDC - $511.74
gpersoon
The function changeLicenseFee() update the value for licenseFee. The next time handleFees() is call is uses the new version of licenseFee. However the previous time when handleFees() was called might be some time ago.
Now the new licenseFee is applied to a period in the past. This might lead to slightly inaccurate fees.
function changeLicenseFee(uint256 newLicenseFee) onlyPublisher public override { ... licenseFee = newLicenseFee;
function handleFees(uint256 startSupply) private { ... uint256 timeDiff = (block.timestamp - lastFee); uint256 feePct = timeDiff * licenseFee / ONE_YEAR; uint256 fee = startSupply * feePct / (BASE - feePct); _mint(publisher, fee * (BASE - factory.ownerSplit()) / BASE); _mint(Ownable(address(factory)).owner(), fee * factory.ownerSplit() / BASE);
Consider calling handleFees() at the beginning of changeLicenseFee()