Loading...
Loading...
Set up a Stellar/Soroban smart contract project with OpenZeppelin Contracts for Stellar. Use when users need to: (1) install Stellar CLI and Rust toolchain for Soroban, (2) create a new Soroban project, (3) add OpenZeppelin Stellar dependencies to Cargo.toml, or (4) understand Soroban import conventions and contract patterns for OpenZeppelin.
npx skill4agent add openzeppelin/openzeppelin-skills setup-stellar-contractscurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
rustup target add wasm32v1-nonecurl -fsSL https://github.com/stellar/stellar-cli/raw/main/install.sh | shstellar contract init my_projectcontracts/*/=Cargo.toml[workspace.dependencies][workspace.dependencies]
stellar-tokens = "=<VERSION>"
stellar-access = "=<VERSION>"
stellar-contract-utils = "=<VERSION>"
stellar-macros = "=<VERSION>"contracts/*/Cargo.toml[dependencies]
soroban-sdk = { workspace = true }
stellar-tokens = { workspace = true }
stellar-access = { workspace = true }
stellar-contract-utils = { workspace = true }
stellar-macros = { workspace = true }stellar-accessstellar-accountsstellar-contract-utilsstellar-fee-abstractionstellar-governancestellar-macrosstellar-tokensOnly add the crates the contract actually uses.provides proc-macro attributes (for example,stellar-macros,#[when_not_paused],#[only_owner]) and is needed in most contracts.#[derive(Upgradeable)]
use stellar_tokens::fungible::{Base, FungibleToken};
use stellar_tokens::fungible::burnable::FungibleBurnable;
use stellar_access::ownable::Ownable;
use stellar_contract_utils::pausable::Pausable;
use stellar_macros::when_not_paused;#[contract]#[contractimpl]soroban_sdkuse soroban_sdk::{contract, contractimpl, Env};
#[contract]
pub struct MyToken;
#[contractimpl]
impl MyToken {
// Implement trait methods here
}implFungibleTokenPausable#[when_not_paused]#[only_owner]instancestellar contract buildcargo build --target wasm32v1-none --releasetarget/wasm32v1-none/release/cargo testtestutils are automatically enabled for in-crate unit tests.soroban-sdk