Skip to content

Project structure for writing smart contracts in Rust for NEAR Protocol

License

Notifications You must be signed in to change notification settings

NEARFoundation/near-smart-contract-rust-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NEAR Smart Contract Rust Template

Project structure for writing smart contracts for NEAR in Rust.

Required Software

  • Rust & Cargo
    • With the WASM target installed: rustup target add wasm32-unknown-unknown
    • cargo-make: cargo install cargo-make

Usage

Scripts

cargo make clean

Removes the target and neardev directories.

cargo make test

Runs unit tests using the default target. (Note: behavior may differ from simply running cargo test depending on the target specified in .cargo/config.toml.)

cargo make build

Compiles the smart contract to a WebAssembly binary. The binary path is ./target/wasm32-unknown-unknown/release/<package>.wasm.

cargo make optimize

Cleans up and optimizes the most recently-built WASM binary. The optimized binary path is ./deploy/<name>.wasm.

Note: In order to optimize the WASM binary, you must have wasm-tools installed:

cargo install wasm-tools

wasm-tools is also available on Homebrew:

brew install wasm-tools

Authors

About

Project structure for writing smart contracts in Rust for NEAR Protocol

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages