diff --git a/.changeset/blue-panthers-sing.md b/.changeset/blue-panthers-sing.md new file mode 100644 index 000000000..d038b9ec6 --- /dev/null +++ b/.changeset/blue-panthers-sing.md @@ -0,0 +1,5 @@ +--- +"create-eth": patch +--- + +templatise `foundry.toml` file diff --git a/contributors/TEMPLATE-FILES.md b/contributors/TEMPLATE-FILES.md index 81c87784d..7c3e0e20c 100644 --- a/contributors/TEMPLATE-FILES.md +++ b/contributors/TEMPLATE-FILES.md @@ -13,6 +13,7 @@ If you're interested in developing third-party extensions, the [THIRD-PARTY-EXTE | Template | Example args file | | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------- | | [(script) `Deploy.s.sol.template.mjs`](https://github.com/scaffold-eth/create-eth/blob/main/templates/solidity-frameworks/foundry/packages/foundry/script/Deploy.s.sol.template.mjs) | [`Deploy.s.sol.args.mjs`](https://github.com/scaffold-eth/create-eth-extensions/blob/example/extension/packages/foundry/script/Deploy.s.sol.args.mjs) | +| [(config) `foundry.toml.template.mjs`](https://github.com/scaffold-eth/create-eth/blob/main/templates/solidity-frameworks/foundry/packages/foundry/foundry.toml.template.mjs) | [`foundry.toml.args.mjs`](https://github.com/scaffold-eth/create-eth-extensions/blob/example/extension/packages/foundry/foundry.toml.args.mjs) | | [(config) `Makefile.template.mjs`](https://github.com/scaffold-eth/create-eth/blob/main/templates/solidity-frameworks/foundry/packages/foundry/Makefile.template.mjs) | [`Makefile.args.mjs`](https://github.com/scaffold-eth/create-eth-extensions/blob/example/extension/packages/foundry/Makefile.args.mjs) | #### Hardhat diff --git a/templates/solidity-frameworks/foundry/packages/foundry/Makefile.template.mjs b/templates/solidity-frameworks/foundry/packages/foundry/Makefile.template.mjs index 8638dbff8..366e9a090 100644 --- a/templates/solidity-frameworks/foundry/packages/foundry/Makefile.template.mjs +++ b/templates/solidity-frameworks/foundry/packages/foundry/Makefile.template.mjs @@ -1,7 +1,9 @@ - import { withDefaults } from "../../../../utils.js"; -const content = ({ recipes, postDeployRecipeToRun }) => `.PHONY: build deploy generate-abis verify-keystore account chain compile flatten fork format lint test verify +const content = ({ + recipes, + postDeployRecipeToRun, +}) => `.PHONY: build deploy generate-abis verify-keystore account chain compile flatten fork format lint test verify DEPLOY_SCRIPT ?= script/Deploy.s.sol @@ -27,12 +29,12 @@ deploy: fi @if [ "$(RPC_URL)" = "localhost" ]; then \ if [ "$(ETH_KEYSTORE_ACCOUNT)" = "scaffold-eth-default" ]; then \ - forge script $(DEPLOY_SCRIPT) --rpc-url localhost --password localhost --broadcast --via-ir --legacy --ffi; \ + forge script $(DEPLOY_SCRIPT) --rpc-url localhost --password localhost --broadcast --legacy --ffi; \ else \ - forge script $(DEPLOY_SCRIPT) --rpc-url localhost --broadcast --legacy --via-ir --ffi; \ + forge script $(DEPLOY_SCRIPT) --rpc-url localhost --broadcast --legacy --ffi; \ fi \ else \ - forge script $(DEPLOY_SCRIPT) --rpc-url $(RPC_URL) --broadcast --legacy --via-ir --ffi; \ + forge script $(DEPLOY_SCRIPT) --rpc-url $(RPC_URL) --broadcast --legacy --ffi; \ fi # Deploy and generate ABIs @@ -82,8 +84,7 @@ lint: verify: forge script script/VerifyAll.s.sol --ffi --rpc-url $(RPC_URL) -${recipes.filter(Boolean).join("\n")}` - +${recipes.filter(Boolean).join("\n")}`; export default withDefaults(content, { recipes: ``, diff --git a/templates/solidity-frameworks/foundry/packages/foundry/foundry.toml b/templates/solidity-frameworks/foundry/packages/foundry/foundry.toml deleted file mode 100644 index d3537f6a6..000000000 --- a/templates/solidity-frameworks/foundry/packages/foundry/foundry.toml +++ /dev/null @@ -1,42 +0,0 @@ -[profile.default] -src = 'contracts' -out = 'out' -libs = ['lib'] -fs_permissions = [{ access = "read-write", path = "./"}] - -[rpc_endpoints] -default_network = "http://127.0.0.1:8545" -localhost = "http://127.0.0.1:8545" - -mainnet = "https://eth-mainnet.alchemyapi.io/v2/${ALCHEMY_API_KEY}" -sepolia = "https://eth-sepolia.g.alchemy.com/v2/${ALCHEMY_API_KEY}" -arbitrum = "https://arb-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}" -arbitrumSepolia = "https://arb-sepolia.g.alchemy.com/v2/${ALCHEMY_API_KEY}" -optimism = "https://opt-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}" -optimismSepolia = "https://opt-sepolia.g.alchemy.com/v2/${ALCHEMY_API_KEY}" -polygon = "https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}" -polygonMumbai = "https://polygon-mumbai.g.alchemy.com/v2/${ALCHEMY_API_KEY}" -polygonZkEvm = "https://zkevm-rpc.com" -polygonZkEvmTestnet = "https://rpc.public.zkevm-test.net" -gnosis = "https://rpc.gnosischain.com" -chiado = "https://rpc.chiadochain.net" -base = "https://mainnet.base.org" -baseSepolia = "https://sepolia.base.org" -scrollSepolia = "https://sepolia-rpc.scroll.io" -scroll = "https://rpc.scroll.io" -pgn = "https://rpc.publicgoods.network" -pgnTestnet = "https://sepolia.publicgoods.network" - -[etherscan] -polygonMumbai = { key = "${ETHERSCAN_API_KEY}" } -sepolia = { key = "${ETHERSCAN_API_KEY}" } - - -[fmt] -line_length = 120 -tab_width = 4 -quote_style = "double" -bracket_spacing = true -int_types = "long" - -# See more config options https://github.com/foundry-rs/foundry/tree/master/config diff --git a/templates/solidity-frameworks/foundry/packages/foundry/foundry.toml.template.mjs b/templates/solidity-frameworks/foundry/packages/foundry/foundry.toml.template.mjs new file mode 100644 index 000000000..fed3bc8e6 --- /dev/null +++ b/templates/solidity-frameworks/foundry/packages/foundry/foundry.toml.template.mjs @@ -0,0 +1,64 @@ +import { withDefaults } from "../../../../utils.js"; + +const content = ({ + extraProfileDefaults, + extraRpcEndpoints, + extraEthercsanConfig, + extraFormattingConfig, + extraConfig, +}) => `[profile.default] +src = 'contracts' +out = 'out' +libs = ['lib'] +fs_permissions = [{ access = "read-write", path = "./"}] +${extraProfileDefaults.filter(Boolean).join("\n")} + +[rpc_endpoints] +default_network = "http://127.0.0.1:8545" +localhost = "http://127.0.0.1:8545" + +mainnet = "https://eth-mainnet.alchemyapi.io/v2/\${ALCHEMY_API_KEY}" +sepolia = "https://eth-sepolia.g.alchemy.com/v2/\${ALCHEMY_API_KEY}" +arbitrum = "https://arb-mainnet.g.alchemy.com/v2/\${ALCHEMY_API_KEY}" +arbitrumSepolia = "https://arb-sepolia.g.alchemy.com/v2/\${ALCHEMY_API_KEY}" +optimism = "https://opt-mainnet.g.alchemy.com/v2/\${ALCHEMY_API_KEY}" +optimismSepolia = "https://opt-sepolia.g.alchemy.com/v2/\${ALCHEMY_API_KEY}" +polygon = "https://polygon-mainnet.g.alchemy.com/v2/\${ALCHEMY_API_KEY}" +polygonMumbai = "https://polygon-mumbai.g.alchemy.com/v2/\${ALCHEMY_API_KEY}" +polygonZkEvm = "https://zkevm-rpc.com" +polygonZkEvmTestnet = "https://rpc.public.zkevm-test.net" +gnosis = "https://rpc.gnosischain.com" +chiado = "https://rpc.chiadochain.net" +base = "https://mainnet.base.org" +baseSepolia = "https://sepolia.base.org" +scrollSepolia = "https://sepolia-rpc.scroll.io" +scroll = "https://rpc.scroll.io" +pgn = "https://rpc.publicgoods.network" +pgnTestnet = "https://sepolia.publicgoods.network" +${extraRpcEndpoints.filter(Boolean).join("\n")} + +[etherscan] +polygonMumbai = { key = "\${ETHERSCAN_API_KEY}" } +sepolia = { key = "\${ETHERSCAN_API_KEY}" } +${extraEthercsanConfig.filter(Boolean).join("\n")} + + +[fmt] +line_length = 120 +tab_width = 4 +quote_style = "double" +bracket_spacing = true +int_types = "long" +${extraFormattingConfig.filter(Boolean).join("\n")} + +${extraConfig.filter(Boolean).join("\n")} + +# See more config options https://book.getfoundry.sh/reference/config/overview`; + +export default withDefaults(content, { + extraProfileDefaults: "", + extraRpcEndpoints: "", + extraEthercsanConfig: "", + extraFormattingConfig: "", + extraConfig: "", +});