Skip to content
Merged
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
20 changes: 10 additions & 10 deletions docs/build/smart-contracts/getting-started/hello-world.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ The `init` command will create a Rust workspace project, using the recommended s

```
.
├── Cargo.lock
├── AGENTS.md
├── Cargo.toml
├── README.md
└── contracts
├── hello_world
├── hello-world
│   ├── Cargo.toml
│   ├── Makefile
│   ├── src
Expand All @@ -52,7 +52,7 @@ members = [
]

[workspace.dependencies]
soroban-sdk = "26"
soroban-sdk = "28"
```

:::info
Expand Down Expand Up @@ -95,27 +95,27 @@ See the [logging example] for more information about how to log.

### Contracts Directory

The `contracts` directory is where Soroban contracts will live, each in their own directory. There is already a `hello_world` contract in there to get you started.
The `contracts` directory is where Soroban contracts will live, each in their own directory. There is already a `hello-world` contract in there to get you started.

#### Contract-specific Cargo.toml file

Each contract should have its own `Cargo.toml` file, which relies on the top-level `Cargo.toml` that we just discussed.

This is where we can specify contract-specific package information.

```toml title="contracts/hello_world/Cargo.toml"
```toml title="contracts/hello-world/Cargo.toml"
[package]
name = "hello-world"
version = "0.0.0"
edition = "2021"
publish = false
```

The `crate-type` is configured to `cdylib` which is required for building contracts.
The `crate-type` includes `cdylib`, which is required for building contracts. It also includes `lib`, so other crates, such as a [fuzz target](../../guides/testing/fuzzing.mdx), can import the contract as a Rust library.

```toml
[lib]
crate-type = ["cdylib"]
crate-type = ["lib", "cdylib"]
doctest = false
```

Expand Down Expand Up @@ -169,7 +169,7 @@ impl Contract {

Putting those pieces together a simple contract looks like this.

```rust title="contracts/hello_world/src/lib.rs"
```rust title="contracts/hello-world/src/lib.rs"
#![no_std]
use soroban_sdk::{contract, contractimpl, vec, Env, String, Vec};

Expand All @@ -195,7 +195,7 @@ Writing tests for Soroban contracts involves writing Rust code using the test fa
Given our `Contract`, a simple test will look like this.

<Tabs>
<TabItem value="lib.rs" label="contracts/hello_world/src/lib.rs">
<TabItem value="lib.rs" label="contracts/hello-world/src/lib.rs">

```rust
#![no_std]
Expand All @@ -215,7 +215,7 @@ mod test;
```

</TabItem>
<TabItem value="test.rs" label="contracts/hello_world/src/test.rs" default>
<TabItem value="test.rs" label="contracts/hello-world/src/test.rs" default>

```rust
#![cfg(test)]
Expand Down
Loading