From 713befed69379ae7e6e5aee490baaafe4135534f Mon Sep 17 00:00:00 2001 From: Shiv Bhonde Date: Thu, 2 Jan 2025 12:46:54 +0530 Subject: [PATCH] templatise foundry.toml file --- .../foundry/packages/foundry/foundry.toml | 42 -------------- .../foundry/foundry.toml.template.mjs | 58 +++++++++++++++++++ 2 files changed, 58 insertions(+), 42 deletions(-) delete mode 100644 templates/solidity-frameworks/foundry/packages/foundry/foundry.toml create mode 100644 templates/solidity-frameworks/foundry/packages/foundry/foundry.toml.template.mjs 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..f7759abef --- /dev/null +++ b/templates/solidity-frameworks/foundry/packages/foundry/foundry.toml.template.mjs @@ -0,0 +1,58 @@ +import { withDefaults } from "../../../../utils.js"; + +const content = ({ profileDefaults, rpcEndpoints, etherscan, fmt, extraConfig }) => `[profile.default] +src = 'contracts' +out = 'out' +libs = ['lib'] +fs_permissions = [{ access = "read-write", path = "./"}] +${profileDefaults.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" +${rpcEndpoints.filter(Boolean).join("\n")} + +[etherscan] +polygonMumbai = { key = "\${ETHERSCAN_API_KEY}" } +sepolia = { key = "\${ETHERSCAN_API_KEY}" } +${etherscan.filter(Boolean).join("\n")} + + +[fmt] +line_length = 120 +tab_width = 4 +quote_style = "double" +bracket_spacing = true +int_types = "long" +${fmt.filter(Boolean).join("\n")} + +${extraConfig.filter(Boolean).join("\n")} + +# See more config options https://github.com/foundry-rs/foundry/tree/master/config`; + +export default withDefaults(content, { + profileDefaults: "", + rpcEndpoints: "", + etherscan: "", + fmt: "", + extraConfig: "", +});