-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finished to fix integration tests
- Loading branch information
Showing
6 changed files
with
96 additions
and
143 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,90 +1,21 @@ | ||
# CosmWasm Starter Pack | ||
# Bonsai contract | ||
|
||
This is a contract that I made for study purposes of the cosmWASM framework. | ||
The idea behind it is a bonsai 🌳 shop platform, nothing serious, probably it contains some bugs too (🐜). | ||
|
||
CosmWASM allows you to create, compile and build smart contracts on a | ||
cosmosSDK based blockchain. | ||
|
||
This is a template to build smart contracts in Rust to run inside a | ||
[Cosmos SDK](https://github.com/cosmos/cosmos-sdk) module on all chains that enable it. | ||
To understand the framework better, please read the overview in the | ||
[cosmwasm repo](https://github.com/CosmWasm/cosmwasm/blob/master/README.md), | ||
and dig into the [cosmwasm docs](https://www.cosmwasm.com). | ||
This assumes you understand the theory and just want to get coding. | ||
|
||
## Creating a new repo from template | ||
|
||
Assuming you have a recent version of rust and cargo installed (via [rustup](https://rustup.rs/)), | ||
then the following should get you a new repo to start a contract: | ||
|
||
First, install | ||
[cargo-generate](https://github.com/ashleygwilliams/cargo-generate). | ||
Unless you did that before, run this line now: | ||
|
||
```sh | ||
cargo install cargo-generate --features vendored-openssl | ||
``` | ||
|
||
Now, use it to create your new contract. | ||
Go to the folder in which you want to place it and run: | ||
|
||
**0.10 (latest)** | ||
|
||
```sh | ||
cargo generate --git https://github.com/CosmWasm/cosmwasm-template.git --name PROJECT_NAME | ||
``` | ||
|
||
**0.9** | ||
|
||
```sh | ||
cargo generate --git https://github.com/CosmWasm/cosmwasm-template.git --branch 0.9 --name PROJECT_NAME | ||
``` | ||
|
||
**0.8** | ||
|
||
```sh | ||
cargo generate --git https://github.com/CosmWasm/cosmwasm-template.git --branch 0.8 --name PROJECT_NAME | ||
``` | ||
|
||
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. | ||
|
||
## Create a Repo | ||
|
||
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: | ||
|
||
```sh | ||
# this is needed to create a valid Cargo.lock file (see below) | ||
cargo check | ||
git checkout -b master # in case you generate from non-master | ||
git add . | ||
git commit -m 'Initial Commit' | ||
git remote add origin YOUR-GIT-URL | ||
git push -u origin master | ||
``` | ||
|
||
## CI Support | ||
|
||
We have template configurations for both [GitHub Actions](.github/workflows/Basic.yml) | ||
and [Circle CI](.circleci/config.yml) in the generated project, so you can | ||
get up and running with CI right away. | ||
|
||
One note is that the CI runs all `cargo` commands | ||
with `--locked` to ensure it uses the exact same versions as you have locally. This also means | ||
you must have an up-to-date `Cargo.lock` file, which is not auto-generated. | ||
The first time you set up the project (or after adding any dep), you should ensure the | ||
`Cargo.lock` file is updated, so the CI will test properly. This can be done simply by | ||
running `cargo check` or `cargo unit-test`. | ||
|
||
## Using your project | ||
|
||
Once you have your custom repo, you should check out [Developing](./Developing.md) to explain | ||
more on how to run tests and develop code. Or go through the | ||
[online tutorial](https://www.cosmwasm.com/docs/getting-started/intro) to get a better feel | ||
of how to develop. | ||
|
||
[Publishing](./Publishing.md) contains useful information on how to publish your contract | ||
to the world, once you are ready to deploy it on a running blockchain. And | ||
[Importing](./Importing.md) contains information about pulling in other contracts or crates | ||
that have been published. | ||
|
||
Please replace this README file with information about your specific project. You can keep | ||
the `Developing.md` and `Publishing.md` files as useful referenced, but please set some | ||
proper description in the README. | ||
# How to try it | ||
1. [Install the requested components and set up the environment](https://docs.cosmwasm.com/getting-started/installation.html). | ||
2. Clone the project: from your CLI `git clone https://github.com/bragaz/wasm-test-contract.git` | ||
3. Move inside the project folder: `cd ../wasm-test-contract` | ||
4. Run the docker command to compile the contract: `docker run --rm -v "$(pwd)":/code \ | ||
--mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ | ||
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ | ||
cosmwasm/rust-optimizer:0.10.4` | ||
5. Inside the contract `helper.ts` file there is an example of how to try out the contract |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.