-
Notifications
You must be signed in to change notification settings - Fork 1
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
5d66dd2
commit d357026
Showing
6 changed files
with
74 additions
and
15 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,50 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity ^0.8.13; | ||
|
||
import "forge-std/Script.sol"; | ||
import "forge-std/console.sol"; | ||
import "../src/Blemflarck.sol"; | ||
import "../src/Jungfrau.sol"; | ||
import "../src/BFKLoanMarket.sol"; | ||
|
||
contract MyScript is Script { | ||
Blemflarck public blemflarck; | ||
Jungfrau public jungfrau; | ||
BFKLoanMarket public bfkLoanMarket; | ||
|
||
uint256 public constant AMOUNT = 42 * 10**18; | ||
|
||
function run() external { | ||
uint256 deployerPrivateKey = vm.envUint("DEPLOYER_PRIVATE_KEY"); | ||
address exploiter = 0x08A2DE6F3528319123b25935C92888B16db8913E; | ||
address deployer = 0x02B2017c737aDC3DbAaA77bE0897A0EA76d87d4c; | ||
|
||
// Deploy the token contracts with the deployer key that isn't compromised | ||
vm.startBroadcast(deployerPrivateKey); | ||
|
||
blemflarck = new Blemflarck(); | ||
jungfrau = new Jungfrau(); | ||
|
||
// Fund this deploy address with blemflarck as collateral | ||
blemflarck.mint(deployer, AMOUNT); | ||
|
||
// Deploy the loan contract with the compromised key | ||
|
||
address eurusdOracle = 0x7d7356bF6Ee5CDeC22B216581E48eCC700D0497A; | ||
|
||
bfkLoanMarket = new BFKLoanMarket( | ||
address(blemflarck), | ||
address(jungfrau), | ||
eurusdOracle | ||
); | ||
bfkLoanMarket.setOwner(exploiter); | ||
|
||
// Fund the bfkLoanMarket with loanable jungfrau | ||
jungfrau.mint(address(bfkLoanMarket), AMOUNT * 2); | ||
|
||
// Take the loan against blemflarck | ||
blemflarck.approve(address(bfkLoanMarket), AMOUNT); | ||
bfkLoanMarket.loan(AMOUNT); | ||
vm.stopBroadcast(); | ||
} | ||
} |
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
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