-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use hello-world instead of increment as default contract
- Loading branch information
1 parent
409cf35
commit 4f7eac4
Showing
6 changed files
with
49 additions
and
84 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
cmd/soroban-cli/src/utils/contract-init-template/contracts/hello_world/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
[package] | ||
name = "soroban-hello-world-contract" | ||
version = "0.0.0" | ||
authors = ["Stellar Development Foundation <info@stellar.org>"] | ||
license = "Apache-2.0" | ||
edition = "2021" | ||
rust-version = "1.74.0" | ||
publish = false | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
doctest = false | ||
|
||
[dependencies] | ||
soroban-sdk = { workspace = true } | ||
|
||
[dev_dependencies] | ||
soroban-sdk = { workspace = true } |
14 changes: 14 additions & 0 deletions
14
cmd/soroban-cli/src/utils/contract-init-template/contracts/hello_world/src/lib.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#![no_std] | ||
use soroban_sdk::{contract, contractimpl, symbol_short, vec, Env, Symbol, Vec}; | ||
|
||
#[contract] | ||
pub struct HelloContract; | ||
|
||
#[contractimpl] | ||
impl HelloContract { | ||
pub fn hello(env: Env, to: Symbol) -> Vec<Symbol> { | ||
vec![&env, symbol_short!("Hello"), to] | ||
} | ||
} | ||
|
||
mod test; |
17 changes: 17 additions & 0 deletions
17
cmd/soroban-cli/src/utils/contract-init-template/contracts/hello_world/src/test.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#![cfg(test)] | ||
|
||
use super::*; | ||
use soroban_sdk::{symbol_short, vec, Env}; | ||
|
||
#[test] | ||
fn test() { | ||
let env = Env::default(); | ||
let contract_id = env.register_contract(None, HelloContract); | ||
let client = HelloContractClient::new(&env, &contract_id); | ||
|
||
let words = client.hello(&symbol_short!("Dev")); | ||
assert_eq!( | ||
words, | ||
vec![&env, symbol_short!("Hello"), symbol_short!("Dev"),] | ||
); | ||
} |
31 changes: 0 additions & 31 deletions
31
cmd/soroban-cli/src/utils/contract-init-template/contracts/increment/Cargo.toml
This file was deleted.
Oops, something went wrong.
34 changes: 0 additions & 34 deletions
34
cmd/soroban-cli/src/utils/contract-init-template/contracts/increment/src/lib.rs
This file was deleted.
Oops, something went wrong.
19 changes: 0 additions & 19 deletions
19
cmd/soroban-cli/src/utils/contract-init-template/contracts/increment/src/test.rs
This file was deleted.
Oops, something went wrong.