Skip to content

Commit 92b236e

Browse files
committed
Update README.md
1 parent 444b47b commit 92b236e

File tree

1 file changed

+48
-58
lines changed

1 file changed

+48
-58
lines changed

README.md

Lines changed: 48 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
1-
## Foundry-Monad
2-
3-
> [!NOTE]
4-
> In this foundry template the default chain is `monadTestnet`, if you wish to change it change the network in `foundry.toml`
5-
6-
<h4 align="center">
7-
<a href="https://docs.monad.xyz">Monad Documentation</a> | <a href="https://book.getfoundry.sh/">Foundry Documentation</a> |
8-
<a href="https://github.com/monad-developers/foundry-monad/issues">Report Issue</a>
9-
</h4>
10-
11-
_Foundry-Monad is a Foundry template with Monad configuration. So developers don't have to do the initial configuration in Foundry for Monad network._
1+
## Monad flavored Foundry
122

133
**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
144

@@ -19,87 +9,68 @@ Foundry consists of:
199
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
2010
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.
2111

22-
## Requirements
23-
24-
Before you begin, you need to install the following tools:
25-
26-
- Rust
27-
- Cargo
28-
- [Foundryup](https://book.getfoundry.sh/getting-started/installation)
29-
30-
## Quickstart
12+
## Documentation
3113

32-
To get started, follow the steps below:
14+
https://book.getfoundry.sh/
3315

34-
1. You can either clone this repo using the below command:
16+
## Usage
3517

36-
```sh
37-
git clone https://github.com/monad-developers/foundry-monad
38-
```
39-
40-
or
41-
42-
You can do it manually using the below set of commands:
18+
### Build
4319

44-
```sh
45-
mkdir [project_name] && cd [project_name] && forge init --template monad-developers/foundry-monad
20+
```shell
21+
forge build
4622
```
4723

48-
The foundry project is now ready to be used!
49-
50-
## Examples
51-
52-
### Compile
24+
### Test
5325

5426
```shell
55-
forge compile
27+
forge test
5628
```
5729

58-
### Build
30+
### Format
5931

6032
```shell
61-
forge build
33+
forge fmt
6234
```
6335

64-
### Test
36+
### Gas Snapshots
6537

6638
```shell
67-
forge test
39+
forge snapshot
6840
```
6941

70-
### Deploy
42+
### Anvil
7143

7244
```shell
73-
forge create --private-key <your_private_key> src/Counter.sol:Counter
45+
anvil
7446
```
7547

76-
### Verify Contract
48+
### Deploy to Monad Testnet
49+
50+
First, you need to create a keystore file. Do not forget to remember the password! You will need it to deploy your contract.
7751

7852
```shell
79-
forge verify-contract \
80-
<contract_address> \
81-
src/Counter.sol:Counter \
82-
--verify \
83-
--verifier sourcify \
84-
--verifier-url https://sourcify-api-monad.blockvision.org
53+
cast wallet import monad-deployer --private-key $(cast wallet new | grep 'Private key:' | awk '{print $3}')
8554
```
8655

87-
### Format
56+
After creating the keystore, you can read its address using:
8857

8958
```shell
90-
forge fmt
59+
cast wallet address --account monad-deployer
9160
```
9261

93-
### Gas Snapshots
62+
The command above will create a keystore file named `monad-deployer` in the ~/.foundry/keystores directory.
63+
64+
Then, you can deploy your contract to the Monad Testnet using the keystore file you created.
9465

9566
```shell
96-
forge snapshot
67+
forge create src/Counter.sol:Counter --rpc-url https://testnet-rpc2.monad.xyz/52227f026fa8fac9e2014c58fbf5643369b3bfc6 --account monad-deployer --broadcast
9768
```
9869

99-
### Anvil
70+
## Verify Your Contract on Monad Testnet
10071

10172
```shell
102-
anvil
73+
forge verify-contract <contract_address> <contract_name> --chain-id 10143 --verifier sourcify --verifier-url https://sourcify-api-monad.blockvision.org
10374
```
10475

10576
### Cast
@@ -112,12 +83,31 @@ cast <subcommand>
11283

11384
```shell
11485
forge --help
86+
anvil --help
87+
cast --help
11588
```
11689

90+
91+
## FAQ
92+
93+
### Error: `Error: server returned an error response: error code -32603: Signer had insufficient balance`
94+
95+
This error happens when you don't have enough balance to deploy your contract. You can check your balance with the following command:
96+
11797
```shell
118-
anvil --help
98+
cast wallet address --account monad-deployer
99+
```
100+
101+
### I have constructor arguments, how do I deploy my contract?
102+
103+
```shell
104+
forge create src/Counter.sol:Counter --rpc-url https://testnet-rpc2.monad.xyz/52227f026fa8fac9e2014c58fbf5643369b3bfc6 --account monad-deployer --broadcast --constructor-args <constructor_arguments>
119105
```
120106

107+
### I have constructor arguments, how do I verify my contract?
108+
121109
```shell
122-
cast --help
110+
forge verify-contract <contract_address> <contract_name> --chain-id 10143 --verifier sourcify --verifier-url https://sourcify-api-monad.blockvision.org --constructor-args <abi_encoded_constructor_arguments>
123111
```
112+
113+
Please refer to the [Foundry Book](https://book.getfoundry.sh/) for more information.

0 commit comments

Comments
 (0)