This is a template to build smart contracts in Rust to run inside a [Soarchain Node].
To understand the framework better, please read the overview in the Soarchain Documentation, and dig into the template smart contracts docs. This assumes you understand the theory and just want to get coding.
Assuming you have a recent version of Rust and Cargo installed (via rustup), then the following should get you a new repo to start a contract:
Install cargo-generate and cargo-run-script. Unless you did that before, run this line now:
cargo install cargo-generate --features vendored-openssl
cargo install cargo-run-script
Now, use it to create your new contract. Go to the folder in which you want to place it and run:
Latest
cargo generate --git https://github.com/soar-robotics/soarchain-contract-template.git --name PROJECT_NAME
For cloning minimal code repo:
cargo generate --git https://github.com/soar-robotics/soarchain-contract-template.git --name PROJECT_NAME -d minimal=true
You will now have a new folder called PROJECT_NAME
(I hope you changed that to something else)
containing a simple working contract and build system that you can customize.
After generating, you have a initialized local git repo, but no commits, and no remote.
Go to a server (eg. github) and create a new upstream repo (called YOUR-GIT-URL
below).
Then run the following:
# this is needed to create a valid Cargo.lock file (see below)
cargo check
git branch -M main
git add .
git commit -m 'Initial Commit'
git remote add origin YOUR-GIT-URL
git push -u origin main
Once you have your custom repo, you should check out Developing to explain more on how to run tests and develop code. Or go through the online tutorial to get a better feel of how to develop.
Publishing contains useful information on how to publish your contract to the world, once you are ready to deploy it on a running blockchain. And
Please replace this README file with information about your specific project. You can keep
the Developing.md
and Publishing.md
files as useful references, but please set some
proper description in the README.