Experimenting with layered function calling using Arbiturm Stylus (Rust)
There are two branches:
Supposedly, this smart contract would be the one that will be visible to the public
only allow execution of functions from specific smart contracts (which is set by the owner)
Here are the general steps:
- Deploy Receiver Smart Contract (Remember the deployment address)
- call the init() method
- change the RECEIVER_SMART_CONTRACT constant variable inside the communicator smart contract rust file source code.
- Deploy the communicator smart contract (remember the deployment address)
- call the setSmartContract function and set the contract address
Note that, the private key supplied is the dev node private key that is made available on Arbitrum Quickstart Page
- Make sure you have launched the docker engine before you deploy
cargo stylus deploy \
--endpoint='http://localhost:8547' \
--private-key="0xb6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659"
cast send --rpc-url "http://localhost:8547" --private-key 0xb6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659 [deployed-address-of-receiver-contract] "init()"
cast call --rpc-url "http://localhost:8547" --private-key 0xb6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659 [deployed-address-of-receiver-contract] "viewNumber()(uint256)"
cast send --rpc-url "http://localhost:8547" --private-key 0xb6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659 [your-received-smart-contract] "setSmartContract(address)" [your-deployed-communicator-smart-contract]
cast send --rpc-url "http://localhost:8547" --private-key 0xb6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659 0x408da76e87511429485c32e4ad647dd14823fdc4 "execute()"
cast call --rpc-url "http://localhost:8547" --private-key 0xb6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659 0x408da76e87511429485c32e4ad647dd14823fdc4 "view()"