Package Filesystem Layout

Every new blueprint package created via scrypto new-package <PACKAGE_NAME> has the following layout of files:

├── Cargo.toml
├── src
│   └──
└── tests

The Cargo.toml file

Cargo.toml is the Cargo configuration file. Cargo is the default package manager for Scrypto. It downloads all the dependencies, compiles source code, and makes a binary executable. A typical Cargo.toml file looks like the following:

name = "test1"
version = "0.1.0"
edition = "2021"

sbor = { git = "", tag = "v0.8.0" }
scrypto = { git = "", tag = "v0.8.0" }

transaction = { git = "", tag = "v0.8.0" }
radix-engine = { git = "", tag = "v0.8.0" }
scrypto-unit = { git = "", tag = "v0.8.0" }

opt-level = 's'        # Optimize for size.
lto = true             # Enable Link Time Optimization.
codegen-units = 1      # Reduce number of codegen units to increase optimizations.
panic = 'abort'        # Abort on panic.
strip = "debuginfo"    # Strip debug info.
overflow-checks = true # Panic in the case of an overflow.

crate-type = ["cdylib", "lib"]

# Set the package crate as its own empty workspace, to hide it from any potential ancestor workspace
# Remove this [workspace] section if you intend the package to be part of a Cargo workspace

The src Folder

The src folder contains all the Scrypto source code for the blueprint package. Within the src folder…​

  • There must be one file;

  • Each other file is considered as a module and needs to be imported in

To import a module, use the mod keyword, for example:

// Assuming you have two other files named "" and ""
mod one;
mod another;

To build your source files, run:

scrypto build

For more information about how modules work, please read this doc.

The test Folder

The test folder contains all the integration tests for your Scrypto package.

Different from the src folder, you don’t have to provide a file. You can have multiple *.rs files, each of which will be compiled independently.

To run all the tests, run:

scrypto test

To run all tests with a particular prefix, run:

scrypto test -- <TEST_NAME_PREFIX>

By default, test outputs will be hidden when the test passes. You can append flag -- --nocapture to the above commands to always display output.