88refs :
99 - https://github.com/foundry-rs/foundry
1010 - https://book.getfoundry.sh/
11- date : 2023-08-14
11+ date : 2025-03-28
1212draft : false
1313---
1414
@@ -28,8 +28,6 @@ We can set the environment variable for **Ethereum RPC URL** to interact the Eth
2828export ETH_RPC_URL=" http://10.0.0.1:12345/path/to/rpc"
2929```
3030
31- <br />
32-
3331## Investigating a Chain
3432
3533** ` cast ` ** command of Foundry performs Ethereum RPC calls.
@@ -51,8 +49,6 @@ cast block-number
5149cast block
5250```
5351
54- <br />
55-
5652## Investigating Account
5753
5854``` bash
@@ -62,17 +58,22 @@ cast balance 0x123...
6258cast balance beer.eth
6359```
6460
65- <br />
66-
6761## Investigating Contract
6862
6963``` sh
7064# Get the source code of a contract from Etherscan
71- cast etherscan-source < contract_address>
72- cast etherscan-source 0x123...
65+ cast source < contract_address> -e < etherscan_api_key>
7366```
7467
75- <br />
68+ ## Call Functions
69+
70+ If we know the functions of a target contract, we can simply call them. Note that these command do NOT send transactions, so cannot change states or values in the contract.
71+
72+ ``` bash
73+ cast call --private-key < private_key_addr> < contract_addr> " getFlag()(string memory)"
74+
75+ cast call --private-key < private_key_addr> < contract_addr> " isSolved()(bool)"
76+ ```
7677
7778## Send Transactions
7879
@@ -92,4 +93,6 @@ cast send --private-key 0x123... 0xabc... "dummy()"
9293# Send Ether to call the receive function
9394cast send --private-key < private_key_addr> < contract_addr> --value 10gwei
9495cast send --private-key 0x123... 0xabc... --value 10gwei
95- ```
96+ ```
97+
98+ If we got error like unsupported feature: eip1559 , add ` --legacy ` flag for the command.
0 commit comments