Skip to content
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ test_snapshots/
.vscode/
.idea/
.DS_Store

# Per-run state from e2e-real-tansu-testnet.sh setup
contracts/registry-tansu-manager/e2e-real-tansu-state-*.env
24 changes: 24 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ default-members = ["crates/*"]
members = [
"crates/*",
"contracts/registry",
"contracts/registry-tansu-manager",
"contracts/hello",
"contracts/test/*",
"crates/stellar-scaffold-test/fixtures/contracts/*",
Comment on lines 6 to 10

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems weird to me that we can't list contracts/* here. It makes me wonder if there's a more natural place to put these new tests, and everything in contracts/test/*.

But also w/e ¯\_(ツ)_/¯

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue is that contracts/* will fail on the contracts/tests/* because that folder doesn't have a Cargo.toml. I do agree we need to move the hello to the test folder.

]
Expand Down
20 changes: 20 additions & 0 deletions contracts/hello/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "hello"
description = "Hello world example contract used by the registry-tansu-manager e2e script."
version = "0.1.0"
license = "Apache-2.0"
edition = "2021"
publish = false

[lib]
crate-type = ["cdylib"]
doctest = false

[dependencies]
soroban-sdk = { workspace = true }

[dev-dependencies]
soroban-sdk = { workspace = true, features = ["testutils"] }

[package.metadata.stellar]
cargo_inherit = true
40 changes: 40 additions & 0 deletions contracts/hello/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#![no_std]

use soroban_sdk::{contract, contractimpl, Address, Env, String};

#[contract]
pub struct Hello;

#[contractimpl]
impl Hello {
pub fn __constructor(env: &Env, admin: &Address) {
env.storage().instance().set(&"admin", admin);
}

pub fn admin(env: &Env) -> Address {
env.storage().instance().get(&"admin").unwrap()
}

pub fn hello(_env: &Env, to: String) -> String {
to
}
}

#[cfg(test)]
mod test {
use super::*;
use soroban_sdk::testutils::Address as _;

#[test]
fn hello_echoes() {
let env = Env::default();
let admin = Address::generate(&env);
let id = env.register(Hello, (admin.clone(),));
let c = HelloClient::new(&env, &id);
assert_eq!(
c.hello(&String::from_str(&env, "world")),
String::from_str(&env, "world")
);
assert_eq!(c.admin(), admin);
}
}
29 changes: 29 additions & 0 deletions contracts/registry-tansu-manager/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[package]
name = "registry-tansu-manager"
description = "Tansu-DAO-gated manager for the stellar registry."
version = "0.1.0"
license = "Apache-2.0"
edition = "2021"
publish = false
repository = "https://github.com/theahaco/scaffold-stellar/tree/main/contracts/registry-tansu-manager"

[lib]
crate-type = ["cdylib"]
doctest = false

[dependencies]
soroban-sdk = { workspace = true }
soroban-sdk-tools = "0.1.2"
stellar-registry = { workspace = true }
# Build-order signal so `stellar scaffold build` produces `tansu_stub.wasm`
# before this crate compiles `import_contract_client!(tansu_stub)`. The stub
# is the single source of truth for the Tansu proposal types — pattern mirrors
# `contracts/registry`'s dev-dep on `hello_world`.
tansu-stub = { path = "../test/tansu-stub" }

[dev-dependencies]
soroban-sdk = { workspace = true, features = ["testutils"] }
soroban-sdk-tools = { version = "0.1.2", features = ["testutils"] }

[package.metadata.stellar]
cargo_inherit = true
Loading
Loading