Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update template contract to be the same as soroban-examples #1857

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cmd/soroban-cli/src/utils/contract-template/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use soroban_sdk::{contract, contractimpl, vec, Env, String, Vec};

#[contract]
pub struct Contract;
pub struct HelloContract;

// This is a sample contract. Replace this placeholder with your own contract logic.
// A corresponding test example is available in `test.rs`.
Expand All @@ -14,10 +14,10 @@ pub struct Contract;
// Refer to the official documentation:
// <https://developers.stellar.org/docs/build/smart-contracts/overview>.
#[contractimpl]
impl Contract {
impl HelloContract {
pub fn hello(env: Env, to: String) -> Vec<String> {
vec![&env, String::from_str(&env, "Hello"), to]
}
}

mod test;
mod test;
6 changes: 3 additions & 3 deletions cmd/soroban-cli/src/utils/contract-template/src/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ use soroban_sdk::{vec, Env, String};
#[test]
fn test() {
let env = Env::default();
let contract_id = env.register(Contract, ());
let client = ContractClient::new(&env, &contract_id);
let contract_id = env.register(HelloContract, ());
let client = HelloContractClient::new(&env, &contract_id);

let words = client.hello(&String::from_str(&env, "Dev"));
assert_eq!(
Expand All @@ -18,4 +18,4 @@ fn test() {
String::from_str(&env, "Dev"),
]
);
}
}