Summary
Wrong basis points are set for nft royalty fee while initializing.
Vulnerability Details
Following is intialize fee types function
function _initializeFeeTypes() internal {
feeTypes[0] = FeeType({
veRAACShare: 8000,
burnShare: 0,
repairShare: 0,
treasuryShare: 2000
});
feeTypes[1] = FeeType({
veRAACShare: 7000,
burnShare: 0,
repairShare: 0,
treasuryShare: 3000
});
feeTypes[2] = FeeType({
veRAACShare: 6000,
burnShare: 0,
repairShare: 0,
treasuryShare: 4000
});
feeTypes[3] = FeeType({
veRAACShare: 5000,
burnShare: 0,
repairShare: 2000,
treasuryShare: 3000
});
feeTypes[4] = FeeType({
veRAACShare: 6000,
burnShare: 0,
repairShare: 2000,
treasuryShare: 2000
});
feeTypes[5] = FeeType({
veRAACShare: 7000,
burnShare: 0,
repairShare: 0,
treasuryShare: 3000
});
feeTypes[6] = FeeType({
veRAACShare: 500,
burnShare: 500,
repairShare: 1000,
treasuryShare: 0
});
feeTypes[7] = FeeType({
veRAACShare: 500,
burnShare: 0,
repairShare: 1000,
treasuryShare: 500
});
}
As can be seen that it is written that nft royalty fee is 2% total but when setting basis points for different shares it sets them wrongly for example veRAACShare is set wrongly to 500 basis points which corresponds to 5% and not 0.5% rest values are also set wrongly.
Also these values cannot be set to 2% total because in update fee type it doesn't allow 2% total shares because 2% will not be equal to BASIS_POINTS thus the if conditon will revert.
function updateFeeType(uint8 feeType, FeeType calldata newFee) external override {
if (!hasRole(FEE_MANAGER_ROLE, msg.sender)) revert UnauthorizedCaller();
if (feeType > 7) revert InvalidFeeType();
if (newFee.veRAACShare + newFee.burnShare + newFee.repairShare + newFee.treasuryShare != BASIS_POINTS) {
revert InvalidDistributionParams();
}
feeTypes[feeType] = newFee;
emit FeeTypeUpdated(feeType, newFee);
}
Impact
Wrong NFT royalty fee used.
Tools Used
Manual Review
Recommendations
Set the correct basis points for each share in nft royatly fee types struct.