The Stylus SDK.
The Stylus SDK makes it easy to develop Solidity ABI-equivalent Stylus contracts in Rust. Included is a full suite of types and shortcuts that abstract away the details of Solidity’s storage layout, method selectors, affordances, and more, making it easy to just write Rust. For a guided exploration of the features, please see the comprehensive Feature Overview.
Some of the features available in the SDK include:
- Generic, storage-backed Rust types for programming Solidity-equivalent smart contracts with optimal storage caching.
- Simple macros for writing language-agnostic methods and entrypoints.
- Automatic export of Solidity interfaces for interoperability across programming languages.
- Powerful primitive types backed by the feature-rich Alloy.
Rust programs written with the Stylus SDK can call and be called by Solidity smart contracts due to ABI equivalence with Ethereum programming languages. In fact, existing Solidity DEXs can list Rust tokens without modification, and vice versa.
pub use alloy_primitives;
pub use alloy_sol_types;
pub use hex;
pub use keccak_const;
pub use stylus_proc;
- Solidity ABIs for Rust types.
- VM affordances for inspecting the current block.
- Call other contracts.
- VM affordances for inspecting the contract itself.
- VM-accelerated cryptography.
- Debug-only items for printing to the console.
- Deploy other contracts.
- Affordances for the Ethereum Virtual Machine.
- VM affordances for inspecting the current call.
- Common imports for Stylus contracts.
- Solidity compatible storage types and persistent storage access.
- VM affordances for inspecting the current tx.
- Traits for common types.
- Prints to the console when executing in a debug environment. Otherwise does nothing.
- Generates a function selector for the given method and its args.
- Represents a contract invocation outcome.