#[contractimpl] on impl blocks of this type to make those functions contract functions.
Note that a crate only ever exports a single contract. While there can be multiple types in a crate with #[contract], when built as a wasm file and deployed the combination of all contract functions and all contracts within a crate will be seen as a single contract.
Syntax
Parameters
Optional path to the Soroban SDK crate. Use this if you’ve renamed the crate in your
Cargo.toml.Generated Code
The#[contract] macro generates:
- A client type (
ContractNameClient) for calling the contract - An args type (
ContractNameArgs) for contract arguments - Test utilities when the
testutilsfeature is enabled
Example
Define a contract with one function,hello, and call it from within a test using the generated client.
See Also
#[contractimpl]- Export contract functionscontractimport!- Import external contracts