The joinDAO
function in the MembershipFactory
contract fails to account for varying decimal places of supported tokens (USDC, WETH, WBTC) when calculating platform fees. This leads to incorrect fee calculations and potential financial discrepancies in the membership system.
The current implementation handles fee calculation uniformly without considering token-specific decimals:
The supported tokens have different decimal places:
USDC
operates with 6 decimal places
WETH
operates with 18 decimal places
WBTC
operates with 8 decimal places
The contract assumes uniform decimal handling across all supported tokens. The fee calculation (20 * tierPrice) / 100
is performed without considering the decimal places of the underlying token. This creates a mismatch between intended and actual fee amounts, particularly problematic when switching between tokens with different decimal places.
Consider a membership tier priced at 100 units:
The decimal mismatch creates significant financial implications for the DAO platform. The platform fees are severely undervalued when using tokens with higher decimal places. For WETH transactions, the fee calculation could be off by a factor of 10^18, resulting in negligible fees instead of the intended 20%. This impacts platform revenue and creates inconsistencies in the membership pricing structure across different payment tokens.
Manual Review
Include personalized decimals for each token too so that fees are calculated accordingly.
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.