Skip to main content

What Are All These Files

So we now have our contract open in our preferred editor. Let's talk about the file structure.

cw-721-tutorials/ # Root
โ”œโ”€โ”€ .cargo/
โ”‚ โ””โ”€โ”€ config # Configuration for cargo commands such as cargo wasm, cargo schema, etc.
โ”œโ”€โ”€ examples/
โ”‚ โ””โ”€โ”€ schema.rs # Rust file to generate JSON schema via cargo schema. Outputs to schema/
โ”œโ”€โ”€ schema # Output folder for JSON schema
โ”œโ”€โ”€ scripts # This folder contains some bash scripts used to build contract, deploy contract, execute function.
โ”œโ”€โ”€ src/ # Where our smart contract rust files are located
โ”‚ โ”œโ”€โ”€ contract.rs # Main contract logic, instantiate, execute, query
โ”‚ โ”œโ”€โ”€ error.rs # Where we define our contract errors
โ”‚ โ”œโ”€โ”€ lib.rs # The default library, where we define the modules
โ”‚ โ”œโ”€โ”€ msg.rs # Where we define our message types
โ”‚ โ””โ”€โ”€ state.rs # Where we define any state variables
โ”œโ”€โ”€ Cargo.toml # The manifest, it contains all of the metadata that Cargo needs to compile source code