Skip to content

Latest commit

 

History

History

README.md

Stylus Calls Solidity Example

This is a straightforward project demonstrating how a Rust (Stylus) smart contract can send data and call methods on a standard Solidity smart contract.

How to run

You can use the deploy.sh script to set up the entire example.

What the script does:

  1. Compiles the Solidity Calculator contract.
  2. Deploys the Solidity Calculator contract.
  3. Builds and deploys the Stylus Caller contract.
  4. Links the contracts by setting the Solidity address inside the Stylus contract.
  5. Tests the link by sending an add/increment operation from Stylus to Solidity.
  6. Creates a deployment.env file detailing deployment steps and addresses.

Prerequisites:

Make sure you have these installed:

  • solc (Solidity compiler)
  • cast (from Foundry)
  • 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:

Run this command in the terminal from this folder:

chmod +x deploy.sh
./deploy.sh

Your environment addresses will be mapped in the deployment.env file.