Lab 1: write, test and deploy a contract with Foundry (anvil)

Time: ~40 min. Goal: the forge build / test / script loop on a local chain.

Steps

Exercises are the numbered comments in the starter files.

anvil --port 18513 --chain-id 31337

forge script script/Deploy.s.sol --rpc-url anvil --broadcast --private-key <anvil account #0 key>

XDC note: same commands work on XDC (chain 50) / Apothem (51) by changing --rpc-url; in this workshop we never broadcast outside anvil.

Solution: lab1-solution.tar.gz (download link below; same layout, run the same forge install step first).

Download starter · Download solution · All workshop material