Skip to content

Commit

Permalink
Use hello-world instead of increment as default contract
Browse files Browse the repository at this point in the history
  • Loading branch information
elizabethengelman committed Jan 19, 2024
1 parent 409cf35 commit 4f7eac4
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 84 deletions.
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 }
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;
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"),]
);
}

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit 4f7eac4

Please sign in to comment.