Example contracts for Soroban using smartdeploy.
First need to install the binaries locally:
cargo install soroban-cli --version 20.0.0-rc4 --root target --debug
cargo install smartdeploy-cli --version 0.4.2 --root target --debugcreate a new testnet account
./target/bin/soroban config identity generate test_smartdeploy --network testnetNext change into a project:
e.g.
cd hello_world
cargo add smartdeploy-sdkAdd the following line to a src/lib.rs:
smartdeploy_sdk::core_riff!();make
This calls smartdeploy's contract with the call subcommand to call the publish contract method. "contract_name" is the name of the published contract.
../target/bin/smartdeploy call smartdeploy --fee 10000 --source test_smartdeploy -- publish --contract_name hello_test1 --author test_smartdeploy --wasm-file-path ./target/wasm32-unknown-unknown/release/soroban_hello_world_contract.wasm../target/bin/smartdeploy deploy --deployed-name hello_test_contract --published-name hello_testNote, if your contract needs initialization you can add -- --help, to see the list of possible methods you can invoke when deploying.
../target/bin/smartdeploy call hell_test_contract -- hello --to world#[contracterror]
#[derive(Copy, Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
#[repr(u32)]
pub enum Error {
/// No such Contract has been published
NoSuchContractPublished = 1,
/// No such version of the contact has been published
NoSuchVersion = 2,
/// Contract already published
AlreadyPublished = 3,
/// No such contract deployed
NoSuchContractDeployed = 4,
/// Contract already deployed
AlreadyDeployed = 5,
/// Contract already claimed
AlreadyClaimed = 6,
/// Failed to initialize contract
InitFailed = 7,
}Follow along with The Documentation.
Open a development environment on GitPod:
WARNING: These implementations have not been tested or audited. They are likely to have significant errors and security vulnerabilities. They should not be relied on for any purpose.
Join us In the Stellar Developers Discord server