Write metadata for your contract
The contractmeta! macro provided in the Rust SDK allows users to write two strings - a key and a val - within a serialized SCMetaEntry::SCMetaV0 XDR object to the custom section of Wasm contracts. The section name for this metadata is contractmetav0. Developers can utilize this macro to write metadata, and tools can then read and display this information to users.
The liquidity pool example provides a clear demonstration of how to use the contractmeta! macro:
// Metadata that is added on to the Wasm custom section
contractmeta!(
key = "Description",
val = "Constant product AMM with a .3% swap fee"
);
pub trait LiquidityPoolTrait {...
Guides in this category:
ποΈ Making cross-contract calls
Call a smart contract from within another smart contract
ποΈ Deploy a contract from installed Wasm bytecode using a deployer contract
Deploy a contract from installed Wasm bytecode using a deployer contract
ποΈ Deploy a SAC for a Stellar asset using code
Deploy a SAC for a Stellar asset using Javascript SDK
ποΈ Organize contract errors with an error enum type
Manage and communicate contract errors using an enum struct stored as Status values
ποΈ Extend a deployed contract's TTL with code
How to extend the TTL of a deployed contract's Wasm code
ποΈ Upgrading Wasm bytecode for a deployed contract
Upgrade Wasm bytecode for a deployed contract
ποΈ Write metadata for your contract
Use the contractmeta! macro in Rust SDK to write metadata in Wasm contracts
ποΈ Workspaces
Organize contracts using Cargo workspaces