FeeCollector contract defines 7 FeeType
structs, handling fee shares proportion between veRAAC holders, burn, repair fund and treasury for various types of fees (protocol fees, lending fees, performance fees, insurance fees, mint/redeem fees, vault fees, swap taxes and NFT royalties.
The sum of all shares for a specific FeeType
should be equal to 10_000 (i.e., 100% in basis points).
The problem arises because _initializeFeeTypes
doesnt set properly feeTypes[6]
and feeTypes[7]
:
feeTypes
from index 0 to 5 are correctly set, but index 6 and 7 have a total shares equal to 2000, which is not correct.
The "2% total" refers to the fee percentage on swap tx and NFT transfers, like 3% for insurance fees for example. The sum of all shares should not be 2000 (which is not even 2% but 20% in basis points) but 10 000 instead.
_initializeFeeTypes
is called in constructor, hence setting feeTypes[6]
and feeTypes[7]
to incorrect values.
There is an updateFeeType
public function that can only be called by the fee manager. This function confirms that all shares for a fee type should be 100%:
As specified in the comment, fee shares total should be 100%, i.e., 10 000
.
This means that as long as updateFeeType
is not called by the fee manager to restore correct fee type share values for feeTypes[6]
and feeTypes[7]
, there is a loss of fees for veRAAC holders and repaid funds, and less fees burned, but more fees for the treasury.
Indeed, _calculateDistribution
internal function adds remainder
to the share for the treasury:
shares[3]
correspond to the sum of the 8 fee types shares for the treasury. Because feeTypes[6]
and feeTypes[7]
don't have 100% (10_000) total fee shares, the whole shares[0] + shares[1] + shares[2] + shares[3]
will be less than totalFees
. This means remainder
is a positive non null value that is ultimately added to the treasury share.
The impact of this issue is high, as it leads to incorrect calculation of fees and loss of:
fees for veRAAC holders
fees for repair fund.
fees for burning
In the same time, the treasury fees are increased, because the remainder
will include the missing fees for previous purpose
Manual review.
Correctly set all FeeType
in constructor so that fee shares total is 100% or 10 000 for each FeeType
, or make sure to call updateFeeType
function right after deployment.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.