This is a straightforward project demonstrating how a Rust (Stylus) smart contract can send data and call methods on a standard Solidity smart contract.
You can use the deploy.sh script to set up the entire example.
- Compiles the Solidity Calculator contract.
- Deploys the Solidity Calculator contract.
- Builds and deploys the Stylus Caller contract.
- Links the contracts by setting the Solidity address inside the Stylus contract.
- Tests the link by sending an add/increment operation from Stylus to Solidity.
- Creates a
deployment.envfile detailing deployment steps and addresses.
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,debugRun this command in the terminal from this folder:
chmod +x deploy.sh
./deploy.shYour environment addresses will be mapped in the deployment.env file.