This example demonstrates how a standard Solidity smart contract can safely call methods on a Rust (Stylus) smart contract.
The deploy.sh script compiles and deploys both parts of the system.
- Checks for or Deploys the Stylus Counter contract.
- Compiles the Solidity Caller contract with the Stylus Counter's address in its constructor.
- Deploys the Solidity Caller contract.
- Tests the connection by triggering an update from the Solidity contract to the Stylus Counter.
- Creates a
deployment.envfile with all addresses and transaction hashes.
Make sure you have these installed:
solc(Solidity compiler)cast(from Foundry)cargo stylustool (Installation guide)soldb(walnuthq/soldb) for tracing interop contracts. Start it by runningsoldb bridgein a separate terminal.
Nitro Dev Node: A local Nitro node is required. Start it using Docker:
docker run -it --rm --name nitro-dev -p 8547:8547 offchainlabs/nitro-node:v3.9.5-rc.2-762ee40 --dev --http.addr 0.0.0.0 --http.api=net,web3,eth,arb,arbdebug,debugFrom your terminal inside this folder, run:
chmod +x deploy.sh
./deploy.shOnce done, check out deployment.env for the generated addresses.