Exports the publicly accessible functions to the Soroban environment. Functions that are publicly accessible in the implementation are invocable by other contracts, or directly by transactions, when deployed.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/stellar/rs-soroban-sdk/llms.txt
Use this file to discover all available pages before exploring further.
Syntax
Parameters
Optional path to the Soroban SDK crate. Use this if you’ve renamed the crate in your
Cargo.toml.Set to
true when implementing a trait marked with #[contracttrait]. This enables proper trait implementation and client generation.Generated Code
The#[contractimpl] macro generates:
- Contract function exports for the Soroban environment
- Client implementations for each public function
- Argument types for each function
- Contract specification entries
- Function registration code for test utilities
Visibility
Onlypub functions within the impl block are exported as contract functions. Private functions are not accessible from outside the contract.
Example
Define a contract with one function,hello, and call it from within a test using the generated client.
See Also
#[contract]- Mark the contract type- Writing Contracts Guide - Complete contract development guide