Skip to content

Commit ea83660

Browse files
author
bo gao
committed
personal initialization
1 parent befcede commit ea83660

File tree

8 files changed

+6664
-111
lines changed

8 files changed

+6664
-111
lines changed

README.md

Lines changed: 11 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,23 @@
1-
## Foundry
1+
# DeFi Attack Study & Testing
22

3-
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
3+
This repository collects and documents DeFi attacks and exploits I have studied. Each attack is implemented as a testable contract in the `src` folder.
44

5-
Foundry consists of:
5+
## Structure
66

7-
- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
8-
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
9-
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
10-
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.
7+
- `src/` — Contains Solidity contracts that reproduce or demonstrate notable DeFi exploits.
118

12-
## Documentation
9+
## Getting Started
1310

14-
https://book.getfoundry.sh/
11+
This project uses [Foundry](https://book.getfoundry.sh/), a fast and modular toolkit for Ethereum application development.
1512

16-
## Usage
13+
### Prerequisites
1714

18-
### Build
15+
- [Foundry](https://book.getfoundry.sh/getting-started/installation.html) installed (`forge`, `anvil`, etc.)
1916

20-
```shell
21-
$ forge build
22-
```
23-
24-
### Test
25-
26-
```shell
27-
$ forge test
28-
```
29-
30-
### Format
31-
32-
```shell
33-
$ forge fmt
34-
```
35-
36-
### Gas Snapshots
37-
38-
```shell
39-
$ forge snapshot
40-
```
41-
42-
### Anvil
43-
44-
```shell
45-
$ anvil
46-
```
47-
48-
### Deploy
49-
50-
```shell
51-
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
52-
```
53-
54-
### Cast
55-
56-
```shell
57-
$ cast <subcommand>
58-
```
17+
### Running an Exploit Test
5918

60-
### Help
19+
To run a specific exploit test (for example, the ImpermaxV3 exploit):
6120

6221
```shell
63-
$ forge --help
64-
$ anvil --help
65-
$ cast --help
22+
forge test -vv --match-path src/ImpermaxV3_exp.sol --via-ir
6623
```

foundry.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,7 @@ out = "out"
44
libs = ["lib"]
55

66
# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
7+
8+
9+
[rpc_endpoints]
10+
base = "https://developer-access-mainnet.base.org"

script/Counter.s.sol

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/Counter.sol

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)