forked from stellar/soroban-template-astro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The `stellar contract init` command no longer works with `--frontend-template` (stellar/stellar-cli#1625) This means that templates like this one need to hard-code their own list of contracts.
- Loading branch information
Showing
10 changed files
with
3,409 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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,29 @@ | ||
[package] | ||
name = "soroban-hello-world-contract" | ||
version = "0.0.0" | ||
edition = "2021" | ||
publish = false | ||
|
||
[lib] | ||
crate-type = ["cdylib"] | ||
doctest = false | ||
|
||
[dependencies] | ||
soroban-sdk = { version = "22.0.1" } | ||
|
||
[dev-dependencies] | ||
soroban-sdk = { version = "22.0.1", features = ["testutils"] } | ||
|
||
[profile.release] | ||
opt-level = "z" | ||
overflow-checks = true | ||
debug = 0 | ||
strip = "symbols" | ||
debug-assertions = false | ||
panic = "abort" | ||
codegen-units = 1 | ||
lto = true | ||
|
||
[profile.release-with-logs] | ||
inherits = "release" | ||
debug-assertions = true |
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,16 @@ | ||
default: build | ||
|
||
all: test | ||
|
||
test: build | ||
cargo test | ||
|
||
build: | ||
stellar contract build | ||
@ls -l target/wasm32-unknown-unknown/release/*.wasm | ||
|
||
fmt: | ||
cargo fmt --all | ||
|
||
clean: | ||
cargo clean |
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, vec, Env, String, Vec}; | ||
|
||
#[contract] | ||
pub struct HelloContract; | ||
|
||
#[contractimpl] | ||
impl HelloContract { | ||
pub fn hello(env: Env, to: String) -> Vec<String> { | ||
vec![&env, String::from_str(&env, "Hello"), to] | ||
} | ||
} | ||
|
||
mod test; |
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,21 @@ | ||
#![cfg(test)] | ||
|
||
use super::*; | ||
use soroban_sdk::{vec, Env, String}; | ||
|
||
#[test] | ||
fn test() { | ||
let env = Env::default(); | ||
let contract_id = env.register(HelloContract, ()); | ||
let client = HelloContractClient::new(&env, &contract_id); | ||
|
||
let words = client.hello(&String::from_str(&env, "Dev")); | ||
assert_eq!( | ||
words, | ||
vec![ | ||
&env, | ||
String::from_str(&env, "Hello"), | ||
String::from_str(&env, "Dev"), | ||
] | ||
); | ||
} |
Oops, something went wrong.