Advanced
DeFi Reentrancy Attack Analysis
Identify vulnerabilities and write secure Solidity code for a decentralized lending protocol.
📝 Prompt Inhoud
Analyze a provided Solidity smart contract for a decentralized lending protocol. Identify potential reentrancy vulnerabilities, logic errors in price oracle integration, and gas limit issues. Once identified, rewrite the contract to be secure against these attacks. Your solution must implement the 'Checks-Effects-Interactions' pattern, use ReentrancyGuard modifiers, and explain how to integrate a decentralized oracle (like Chainlink) securely. Additionally, write a unit test using Foundry or Hardhat that specifically attempts to exploit the original vulnerability.