@@ -284,7 +284,35 @@ jobs:
284284 slug : hashgraph/hedera-forking
285285
286286 foundry-example-tests :
287- name : ' Foundry example tests w/mainnet'
287+ name : ' Foundry example tests'
288+ strategy :
289+ fail-fast : false
290+ matrix :
291+ solc : [
292+ # Ensures we use the `override` specifier
293+ # https://soliditylang.org/blog/2021/09/27/solidity-0.8.8-release-announcement/
294+ ' 0.8.7' ,
295+
296+ # Ensures we do not use `string.concat`
297+ # > General: string.concat now properly takes strings as arguments and returns string memory.
298+ # > It was accidentally introduced as a copy of bytes.concat before.
299+ # https://soliditylang.org/blog/2022/02/16/solidity-0.8.12-release-announcement/
300+ ' 0.8.11' ,
301+
302+ # Ensures we do not overload/use free functions
303+ # https://soliditylang.org/blog/2022/03/16/solidity-0.8.13-release-announcement/
304+ ' 0.8.12' ,
305+
306+ # Ensures we do not use "named parameters in mapping types"
307+ # See _Language Features_ https://soliditylang.org/blog/2023/02/01/solidity-0.8.18-release-announcement/
308+ ' 0.8.17' ,
309+
310+ # Ensures we do not use "qualified access to events from other contracts"
311+ # See _Qualified access to foreign events_ https://soliditylang.org/blog/2023/07/19/solidity-0.8.21-release-announcement/
312+ ' 0.8.19' ,
313+
314+ ' 0.8.24' ,
315+ ]
288316 runs-on : smart-contracts-linux-medium
289317 steps :
290318 - name : Harden Runner
@@ -302,14 +330,16 @@ jobs:
302330 with :
303331 version : stable
304332
305- - name : Patch Foundry's config file to run only Foundry HTS examples
306- run : echo 'test="examples/foundry-hts"' >> foundry.toml
307-
308- - name : Run Forge build with custom remappings
309- run : forge build --remappings hedera-forking=.
333+ - name : Run Forge build on Foundry HTS example
334+ run : forge build
335+ working-directory : examples/foundry-hts
336+ env :
337+ # https://book.getfoundry.sh/reference/config/solidity-compiler#solc_version
338+ FOUNDRY_SOLC_VERSION : ${{ matrix.solc }}
310339
311- - name : Run Forge example tests using remote network with a pinned block number
312- run : forge test --remappings hedera-forking=. -vv --fork-url https://mainnet.hashio.io/api --fork-block-number 72433403
340+ - name : Run Forge HTS example tests using remote network with a pinned block number
341+ run : forge test -vv --fork-url mainnet --fork-block-number 72433403
342+ working-directory : examples/foundry-hts
313343
314344 hardhat-example-tests :
315345 name : ' Hardhat example tests w/mainnet'
@@ -349,6 +379,68 @@ jobs:
349379 run : npm run test
350380 working-directory : examples/hardhat-hts
351381
382+ foundry-example-scripts :
383+ name : Foundry example scripts w/local node
384+ runs-on : smart-contracts-linux-medium
385+ steps :
386+ - name : Harden Runner
387+ uses : step-security/harden-runner@5c7944e73c4c2a096b17a9cb74d65b6c2bbafbde # v2.9.1
388+ with :
389+ egress-policy : audit
390+
391+ - name : Checkout Code
392+ uses : actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
393+ with :
394+ submodules : recursive
395+
396+ - name : Set up Node.js
397+ uses : actions/setup-node@1e60f620b9541d16bece96c5465dc8ee9832be0b # v4.0.3
398+ with :
399+ node-version : 20
400+
401+ - name : Install Foundry
402+ uses : step-security/foundry-toolchain@01e2d127ea061e2ce8fa34340de71ca8518f093e # v1.2.1
403+ with :
404+ version : stable
405+
406+ - name : Run Forge build
407+ run : forge build
408+
409+ - name : Install Dependencies
410+ run : npm ci
411+
412+ - name : Start the local node
413+ run : npx hedera start --detach --verbose=trace
414+ timeout-minutes : 5
415+
416+ - name : Run Forge build on Foundry HTS example
417+ run : forge build
418+ working-directory : examples/foundry-hts
419+
420+ # Uses a local node's account private key
421+ # https://github.com/hiero-ledger/hiero-local-node?tab=readme-ov-file#hedera-start-options
422+ - name : Set up Local Node's account Private Key
423+ run : echo "PRIVATE_KEY=0x105d050185ccb907fba04dd92d8de9e32c18305e097ab41dadda21489a211524" > .env
424+ working-directory : examples/foundry-hts
425+
426+ - name : Run Foundry script on local node
427+ run : forge script script/CreateToken.s.sol -vvv --rpc-url localnode --skip-simulation --broadcast
428+ working-directory : examples/foundry-hts
429+
430+ # https://book.getfoundry.sh/guides/scripting-with-solidity
431+ - name : Verify the token was created
432+ run : |
433+ TOKEN_ADDR=`cat broadcast/CreateToken.s.sol/298/run-latest.json | jq '.receipts[0].contractAddress' --raw-output`
434+ echo "Token Address: $TOKEN_ADDR"
435+ TOKEN_CODE=`cast code --rpc-url localnode $TOKEN_ADDR`
436+ echo "Token Code: $TOKEN_CODE"
437+ test $TOKEN_CODE != "0x"
438+ working-directory : examples/foundry-hts
439+
440+ - name : Stop the local node
441+ if : ${{ !cancelled() }}
442+ run : npx hedera stop
443+
352444 e2e-test :
353445 name : ' NPM e2e validation tests'
354446 runs-on : smart-contracts-linux-medium
0 commit comments