From 05af20e2e8eb9fcfdac0b97d12d307081093fb27 Mon Sep 17 00:00:00 2001 From: Boris Date: Mon, 16 Oct 2023 13:15:42 +0800 Subject: [PATCH] a --- contracts/CTF/Damn-Vulnerable-DeFi/02.Naive-Receiver.sol | 4 ---- .../{03.Truster/TrusterLenderPool.sol => 03.Truster.sol} | 7 +++---- foundry/test/CTF/Damn-Vulnerable-DeFi/03.Truster.t.sol | 5 ++--- 3 files changed, 5 insertions(+), 11 deletions(-) rename contracts/CTF/Damn-Vulnerable-DeFi/{03.Truster/TrusterLenderPool.sol => 03.Truster.sol} (82%) diff --git a/contracts/CTF/Damn-Vulnerable-DeFi/02.Naive-Receiver.sol b/contracts/CTF/Damn-Vulnerable-DeFi/02.Naive-Receiver.sol index 6eec15f..be3af19 100644 --- a/contracts/CTF/Damn-Vulnerable-DeFi/02.Naive-Receiver.sol +++ b/contracts/CTF/Damn-Vulnerable-DeFi/02.Naive-Receiver.sol @@ -127,10 +127,6 @@ contract NaiveReceiverLenderPool is ReentrancyGuard, IERC3156FlashLender { receive() external payable { } } -interface IPool { - function flashLoan(address receiver, address token, uint256 amount, bytes calldata data) external returns (bool); -} - contract NaiveReceiverHack { address private constant ETH = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE; NaiveReceiverLenderPool pool; diff --git a/contracts/CTF/Damn-Vulnerable-DeFi/03.Truster/TrusterLenderPool.sol b/contracts/CTF/Damn-Vulnerable-DeFi/03.Truster.sol similarity index 82% rename from contracts/CTF/Damn-Vulnerable-DeFi/03.Truster/TrusterLenderPool.sol rename to contracts/CTF/Damn-Vulnerable-DeFi/03.Truster.sol index 99fe89b..bba0305 100644 --- a/contracts/CTF/Damn-Vulnerable-DeFi/03.Truster/TrusterLenderPool.sol +++ b/contracts/CTF/Damn-Vulnerable-DeFi/03.Truster.sol @@ -1,10 +1,9 @@ // SPDX-License-Identifier: MIT - pragma solidity ^0.8.0; -import { Address } from "@openzeppelin/contracts/utils/Address.sol"; -import { ReentrancyGuard } from "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; -import { DamnValuableToken } from "@contracts/CTF/Damn-Vulnerable-DeFi/00.Base/DamnVulnerableDeFi.sol"; +import { Address } from "@openzeppelin/contracts-v4.7.1/utils/Address.sol"; +import { ReentrancyGuard } from "@openzeppelin/contracts-v4.7.1/security/ReentrancyGuard.sol"; +import { DamnValuableToken } from "@contracts/CTF/Damn-Vulnerable-DeFi/00.Base/DamnValuableToken.sol"; /** * @title TrusterLenderPool diff --git a/foundry/test/CTF/Damn-Vulnerable-DeFi/03.Truster.t.sol b/foundry/test/CTF/Damn-Vulnerable-DeFi/03.Truster.t.sol index 640a28d..a04100f 100644 --- a/foundry/test/CTF/Damn-Vulnerable-DeFi/03.Truster.t.sol +++ b/foundry/test/CTF/Damn-Vulnerable-DeFi/03.Truster.t.sol @@ -3,11 +3,10 @@ pragma solidity ^0.8.0; import { Test } from "forge-std/Test.sol"; import { Vm } from "forge-std/Vm.sol"; -import { DamnValuableToken } from "@contracts/CTF/Damn-Vulnerable-DeFi/00.Base/DamnVulnerableDeFi.sol"; -import { TrusterLenderPool } from "@contracts/CTF/Damn-Vulnerable-DeFi/03.Truster/TrusterLenderPool.sol"; +import { DamnValuableToken } from "@contracts/CTF/Damn-Vulnerable-DeFi/00.Base/DamnValuableToken.sol"; +import { TrusterLenderPool } from "@contracts/CTF/Damn-Vulnerable-DeFi/03.Truster.sol"; /* - https://www.damnvulnerabledefi.xyz/challenges/naive-receiver/ forge test --match-path foundry/test/CTF/Damn-Vulnerable-DeFi/03.Truster.t.sol -vvvvv */