Skip to content

portdeveloper/hello_foundry_monad

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Monad flavored Foundry

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

Foundry consists of:

  • Forge: Ethereum testing framework (like Truffle, Hardhat and DappTools).
  • Cast: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
  • Anvil: Local Ethereum node, akin to Ganache, Hardhat Network.
  • Chisel: Fast, utilitarian, and verbose solidity REPL.

Documentation

https://book.getfoundry.sh/

Usage

Build

forge build

Test

forge test

Format

forge fmt

Gas Snapshots

forge snapshot

Anvil

anvil

Deploy to Monad Testnet

First, you need to create a keystore file. Do not forget to remember the password! You will need it to deploy your contract.

cast wallet import monad-deployer --private-key $(cast wallet new | grep 'Private key:' | awk '{print $3}')

After creating the keystore, you can read its address using:

cast wallet address --account monad-deployer

The command above will create a keystore file named monad-deployer in the ~/.foundry/keystores directory.

Then, you can deploy your contract to the Monad Testnet using the keystore file you created.

forge create src/Counter.sol:Counter --rpc-url https://testnet-rpc2.monad.xyz/52227f026fa8fac9e2014c58fbf5643369b3bfc6 --account monad-deployer --broadcast

## Verify Your Contract on Monad Testnet

forge verify-contract <contract_address> <contract_name> --chain-id 10143 --verifier sourcify --verifier-url https://sourcify-api-monad.blockvision.org 

Cast

cast <subcommand>

Help

forge --help
anvil --help
cast --help

FAQ

Error: Error: server returned an error response: error code -32603: Signer had insufficient balance

This error happens when you don't have enough balance to deploy your contract. You can check your balance with the following command:

cast wallet address --account monad-deployer

### I have constructor arguments, how do I deploy my contract?

forge create src/Counter.sol:Counter --rpc-url https://testnet-rpc2.monad.xyz/52227f026fa8fac9e2014c58fbf5643369b3bfc6 --account monad-deployer --broadcast --constructor-args <constructor_arguments>

### I have constructor arguments, how do I verify my contract?

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>

Please refer to the Foundry Book for more information.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published