The ThunderLoan::getCalculatedFee function calculates the borrowing fee based on the token's price in WETH, which it fetches directly from the TSwap DEX pool:
Solidity
Because getPriceInWeth queries the current reserves of the TSwapPool, it returns the instant spot price. An attacker can take a flash loan, swap a large amount of tokenA for WETH within the TSwap pool to heavily devalue tokenA, and subsequently take further flash loans with near-zero fees.
Likelihood: High. Anyone can execute this within a single transaction using flash loans or flash swaps without price slippage risk.
Impact: Medium. Liquidity providers lose fee revenue, undermining the protocol's economic incentives.
Add the following test to your test suite:
Solidity
Decentralized Oracle (Primary Recommendation): Use Chainlink Price Feeds instead of decentralized exchange spot reserves to get reliable, manipulation-resistant pricing.
TWAP (Alternative): If AMM pricing is required, use a Time-Weighted Average Price (TWAP) with a sufficiently large window (e.g., Uniswap v3 TWAP / 30-minute observation window) rather than instant spot reserves.
The contest is live. Earn rewards by submitting a finding.
Submissions are being reviewed by our AI judge. Results will be available in a few minutes.
View all submissionsThe contest is complete and the rewards are being distributed.