Skip to content

Commit

Permalink
templatise foundry.toml and remove --via-ir flag (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
technophile-04 authored Jan 6, 2025
1 parent ed2d89a commit f983396
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 49 deletions.
5 changes: 5 additions & 0 deletions .changeset/blue-panthers-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"create-eth": patch
---

templatise `foundry.toml` file
1 change: 1 addition & 0 deletions contributors/TEMPLATE-FILES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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: ``,
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -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: "",
});

0 comments on commit f983396

Please sign in to comment.