Skip to content

Latest commit

 

History

History

README.md

Stylus Deep Logic Example

This is a simple example showing how a Rust (Stylus) smart contract talks to a Solidity contract (FinalVerifier).

How to run

We have a deploy.sh script that automatically builds and deploys everything for you.

What the script does:

  1. Compiles the Solidity contract (FinalVerifier.sol).
  2. Deploys the Solidity contract to your local network.
  3. Builds and deploys the Stylus contract (DeepCalculator).
  4. Runs test transactions to trigger internal logic and cross-contract calls.
  5. Creates a deployment.env file where you can see all the deployed contract addresses and test transaction hashes.

Prerequisites:

Make sure you have these installed:

  • solc (Solidity compiler)
  • cast (from Foundry, to send transactions)
  • cargo stylus tool (Installation guide)
  • soldb (walnuthq/soldb) for tracing interop contracts. Start it by running soldb bridge in 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,debug

Running the deployment:

Open your terminal in this folder and run:

chmod +x deploy.sh
./deploy.sh

After it finishes, you will see a deployment.env file with your addresses and hashes. Your contracts are ready to use!