forge build, test, fuzz, coverage, scriptsanvil local EVM node (test accounts with fake ETH)cast call / send / decode from the shellchisel Solidity REPLfoundry.toml # solc 0.8.24, evm_version = "cancun" for XDC mainnet
src/ # contracts
test/ # *.t.sol, contracts that inherit forge-std Test
script/ # *.s.sol deploy scriptsfunction test_RevertWhen_Full() public {
vm.prank(alice); seats.book();
vm.prank(bob); seats.book();
vm.expectRevert(WorkshopSeats.Full.selector);
seats.book();
}
function testFuzz_NeverOverbooked(uint8 n) public { ... }
Cheatcodes: vm.prank, vm.warp, vm.expectRevert, makeAddr, vm.createSelectFork
anvil --port 18513
forge script script/Deploy.s.sol --rpc-url http://127.0.0.1:18513 \
--broadcast --private-key <anvil test account #0>
cast call <addr> "seatsLeft()(uint256)" --rpc-url http://127.0.0.1:18513
Same commands target XDC/Apothem by changing --rpc-url (not in this workshop).
forge fmt, forge test --gas-report, forge coveragecast wallet import) for real deploys→ Lab 1