vocdoni / degen-communities

Smart contracts for Degen Communities
2 stars 0 forks source link

DISCLAIMER: THIS IS A POC UNDER DEVELOPMENT, DO NOT USE IT IN PRODUCTION ENVIRONMENTS

Foundry

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

Foundry consists of:

Documentation

https://book.getfoundry.sh/

Usage

Build

$ forge build

Test

$ forge test

Format

$ forge fmt

Gas Snapshots

$ forge snapshot

Anvil

$ anvil

Deploy

$ source .env
forge script --chain-id 84532 script/Deploy.s.sol:CommunityHubDeployScript --rpc-url ${BASE_SEPOLIA_RPC_URL} --broadcast --slow --verify --verifier-url ${BASESCAN_SEPOLIA_URL} --etherscan-api-key ${BASESCAN_SEPOLIA_API_KEY} --optimize --optimizer-runs 20000 -- --vvvv
forge script --chain-id 8453 script/Deploy.s.sol:CommunityHubDeployScript --rpc-url ${BASE_RPC_URL} --broadcast --slow --verify --verifier-url ${BASESCAN_URL} --etherscan-api-key ${BASESCAN_API_KEY} --optimize --optimizer-runs 20000 -- --vvvv

For production deployments do not use a public RPC. Use a dedicated one or things like the node mempool can cause the script to fail.

Deploying locally using anvil

$ anvil
forge script script/Deploy.s.sol:MyScript --fork-url http://localhost:8545 --broadcast

Verify

forge verify-contract --chain-id 8453 --num-of-optimizations 20000 --watch --verifier-url ${BASESCAN_URL} --etherscan-api-key ${BASESCAN_API_KEY} --compiler-version v0.8.25+commit.b61c2a9 src/.sol:

Cast

$ cast <subcommand>

Help

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

Hardhat migration script

npx hardhat --network base run ./script/migratev2.ts