Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/template simplification #15

Closed
wants to merge 67 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
aae235b
removed cw721-off-chain template
Jun 29, 2022
2b962f7
changed readme to add all new contracts including escrow
Jun 29, 2022
268314e
updated dependencies on cw721 template
Jun 29, 2022
11bd629
simplification of cw20 base
Jul 1, 2022
891517b
changes completed especially in readme
Jul 5, 2022
c3d841e
resolve issues with idea
Jul 7, 2022
99bb5a1
removed schema from base
Jul 7, 2022
5d9544a
fix test_generate
Jul 8, 2022
b41f72e
change testing
Jul 8, 2022
ce3c7dd
extra changes
Jul 8, 2022
3e14c08
cjange git branch
Jul 8, 2022
1560efc
echo of template root
Jul 8, 2022
78f1cfa
ff
Jul 8, 2022
31bb4fa
change to repo root in test_generate.sh
Jul 11, 2022
daca019
added tmate session after failure to debug error
Jul 11, 2022
d2c49ab
change in repo test generate
Jul 11, 2022
b330449
removed tmate session
Jul 11, 2022
b29505e
added top comment
Jul 11, 2022
e4733a8
fixing testing in test_generate.sh
Jul 11, 2022
f03f8ba
fixed extra differences
Jul 11, 2022
b75231a
added extra end line
Jul 11, 2022
8a3936a
added Uint128 import
Jul 11, 2022
f8aac0c
fixed Uint128 import
Jul 11, 2022
f2fbe4d
fixed space
Jul 11, 2022
f10d7f1
fixed comma
Jul 11, 2022
bd742c6
change schema to template name
Jul 11, 2022
639cc6e
remove schema run from .cargo
Jul 11, 2022
c80c49d
removed schema test from test_generate
Jul 11, 2022
623ab7d
add updates to rust with script
Jul 11, 2022
8d6662a
changed name of cw20-base to cw20-base-lib
Jul 11, 2022
aab3c2d
change dependency of version
Jul 11, 2022
03ecc16
change in check to remove pull-request test
Jul 13, 2022
10e4eae
fixed library entry point issue
Aug 4, 2022
ed67eb4
fixed issues from PR comment and testing
Aug 4, 2022
44cc1d0
fixed test_generate script and schema crate name issue
Aug 4, 2022
d8cd4e0
fixed test generate
Aug 4, 2022
badb95a
fix PR issues
Aug 8, 2022
32a977d
changed template name in workflow
Aug 8, 2022
4c9c2c2
added Random generator for project_name
Aug 8, 2022
2b2e5ad
changed name to not start with digit
Aug 8, 2022
b92a7c8
replaced slash with dash to fit name
Aug 8, 2022
ca871d3
final changes:
Aug 8, 2022
02d8fb2
Merge branch 'main' into feature/template-simplification
aelesbao Aug 8, 2022
0b47285
Add pull_request checks back again
aelesbao Aug 8, 2022
692b542
Use template path as project name for debugging
aelesbao Aug 8, 2022
f0681b2
Fix builds triggered by the pull_request event
aelesbao Aug 8, 2022
b614ea8
Try using GITHUB_REF_NAME for build
aelesbao Aug 8, 2022
f26e98f
Specifying a branch name is unnecessary for CI
aelesbao Aug 8, 2022
bd268ed
Use `--path` for `cargo generate` tests
aelesbao Aug 8, 2022
d5ff3f6
fixed git diff issue in github workflow
Aug 9, 2022
71eba45
Merge branch 'feature/template-simplification' of https://github.com/…
Aug 9, 2022
158ca44
fixed linter error in workflow
Aug 9, 2022
fbe34c8
fixed comma linter issue
Aug 9, 2022
7546b5b
fixed crate name issue in escrow
Aug 9, 2022
a5226ae
change import of msgs for escrow
Aug 9, 2022
2813ac9
fixed workflow diff issue
Aug 11, 2022
e9d5294
deriving as well:
Aug 11, 2022
0dba2ec
deriving as well:
Aug 11, 2022
839a04d
added Eq next to partialEq
Aug 15, 2022
ee80f5e
added Eq in state
Aug 15, 2022
37826f3
removed Eq from escrow
Aug 15, 2022
43acf42
added clippy configs
Aug 15, 2022
61e2dd3
added clippy to each template seperately
Aug 17, 2022
a415331
added clippy as component in stable toolchain
Aug 18, 2022
d93e266
remove clippy files
Aug 18, 2022
66d6dee
added clippy to escrow only
Aug 18, 2022
4121822
added eq only for escrow
Aug 18, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ Cargo.lock

# These are backup files generated by rustfmt
**/*.rs.bk

.idea
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ Archway Smart Contract template projects used by the [Archway Developer CLI](htt
## List of templates

- [Default](./default): a blank slate project
- [Increment](./increment): a simple smart contract that increments and resets a counter
- [Increment](./increment): a simple smart contrct that increments and resets a counter
- [CW20-base](./cw20/base): the base smart contract for the CW20 Fungible Tokens standard
- [CW20-escrow](./cw20/escrow): a smart contract representing an escrow for depositing and withdrawing CW20 tokens.
- [CW721-on-chain-metdata](./cw721/on-chain-metadata/): the CW721 standard smart contract with an extension to store NFT metadata on chain.

## Creating a new project from a template

Expand Down
1 change: 0 additions & 1 deletion cw20/base/.cargo/config
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[alias]
wasm = "build --release --target wasm32-unknown-unknown"
wasm-debug = "build --target wasm32-unknown-unknown"
unit-test = "test --lib"
schema = "run --example schema"
1 change: 0 additions & 1 deletion cw20/base/.genignore

This file was deleted.

24 changes: 8 additions & 16 deletions cw20/base/.github/workflows/Basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ jobs:
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
toolchain: 1.58.1
target: wasm32-unknown-unknown
override: true
profile: minimal

- name: Run unit tests
uses: actions-rs/cargo@v1
Expand Down Expand Up @@ -47,9 +47,9 @@ jobs:
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
toolchain: 1.58.1
override: true
components: rustfmt, clippy

- name: Run cargo fmt
Expand All @@ -64,20 +64,12 @@ jobs:
command: clippy
args: -- -D warnings

- name: Generate schema
- name: Generate Schema
uses: actions-rs/cargo@v1
with:
command: schema
args: --locked

- name: Verify schema
uses: tj-actions/verify-changed-files@v8
id: verify-schema
with:
files: schema/.*\.json

- name: Display changed schemas
if: steps.verify-schema.outputs.files_changed == 'true'
run: |
echo "The schema files are not in sync with the repository. Please, run 'cargo schema' to generate them again and commit the changes."
exit 1
gachouchani1999 marked this conversation as resolved.
Show resolved Hide resolved
- name: Schema Changes
# fails if any changes not committed
run: git diff --exit-code schema
1 change: 0 additions & 1 deletion cw20/base/.gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Build results
/target
/artifacts
gachouchani1999 marked this conversation as resolved.
Show resolved Hide resolved
gachouchani1999 marked this conversation as resolved.
Show resolved Hide resolved

# Cargo+Git helper file (https://github.com/rust-lang/cargo/blob/0.44.1/src/cargo/sources/git/utils.rs#L320-L327)
.cargo-ok

Expand Down
27 changes: 14 additions & 13 deletions cw20/base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ edition = "2018"

exclude = [
# Those files are rust-optimizer artifacts. You might want to commit them for convenience but they should not be part of the source code publication.
"artifacts/*",
gachouchani1999 marked this conversation as resolved.
Show resolved Hide resolved
"contract.wasm",
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
Expand All @@ -33,22 +34,22 @@ library = []

[package.metadata.scripts]
optimize = """docker run --rm -v "$(pwd)":/code \
-e CARGO_TERM_COLOR=always \
--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.12.5
cosmwasm/rust-optimizer:0.12.6
"""

[dependencies]
cosmwasm-std = "1.0.0-beta"
cosmwasm-storage = "1.0.0-beta"
cw-storage-plus = "0.12"
cw0 = "0.10"
cw2 = "0.12"
cw20 = "0.12"
schemars = "0.8"
serde = { version = "1.0", default-features = false, features = ["derive"] }
thiserror = "1.0"
cosmwasm-std = "1.0.0"
cosmwasm-storage = "1.0.0"
cw-storage-plus = "0.13.2"
cw2 = "0.13.2"
cw20 = "0.13.4"
cw20-base = "0.13.2"
schemars = "0.8.8"
serde = { version = "1.0.137", default-features = false, features = ["derive"] }
thiserror = { version = "1.0.31" }

[dev-dependencies]
cosmwasm-schema = "1.0.0-beta"
cosmwasm-schema = "1.0.0"
cw-multi-test = "0.13.2"
14 changes: 11 additions & 3 deletions cw20/base/Developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
If you have recently created a contract with this template, you probably could use some
help on how to build and test the contract, as well as prepare it for production. This
file attempts to provide a brief overview, assuming you have installed a recent
version of Rust already (eg. 1.51.0+).
version of Rust already (eg. 1.58.1+).

## Prerequisites

Before starting, make sure you have [rustup](https://rustup.rs/) along with a
recent `rustc` and `cargo` version installed. Currently, we are testing on 1.51.0+.
recent `rustc` and `cargo` version installed. Currently, we are testing on 1.58.1+.

And you need to have the `wasm32-unknown-unknown` target installed as well.

Expand Down Expand Up @@ -74,7 +74,15 @@ to run it is this:
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.11.4
cosmwasm/rust-optimizer:0.12.4
```

Or, If you're on an arm64 machine, you should use a docker image built with arm64.
```sh
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-arm64:0.12.4
```

We must mount the contract code to `/code`. You can use a absolute path instead
Expand Down
2 changes: 1 addition & 1 deletion cw20/base/Publishing.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ multiple contracts and label it like `escrow-0.1.0`. Don't forget a
### Note on build results

Build results like Wasm bytecode or expected hash don't need to be updated since
the don't belong to the source publication. However, they are excluded from packaging
they don't belong to the source publication. However, they are excluded from packaging
in `Cargo.toml` which allows you to commit them to your git repository if you like.

```toml
Expand Down
11 changes: 1 addition & 10 deletions cw20/base/examples/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@ use std::fs::create_dir_all;

use cosmwasm_schema::{export_schema, remove_schemas, schema_for};

use cw20::{
AllAccountsResponse, AllAllowancesResponse, AllowanceResponse, BalanceResponse,
TokenInfoResponse,
};
use {{crate_name}}::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};
use cw20_base::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};

fn main() {
let mut out_dir = current_dir().unwrap();
Expand All @@ -18,9 +14,4 @@ fn main() {
export_schema(&schema_for!(InstantiateMsg), &out_dir);
export_schema(&schema_for!(ExecuteMsg), &out_dir);
export_schema(&schema_for!(QueryMsg), &out_dir);
export_schema(&schema_for!(AllowanceResponse), &out_dir);
export_schema(&schema_for!(BalanceResponse), &out_dir);
export_schema(&schema_for!(TokenInfoResponse), &out_dir);
export_schema(&schema_for!(AllAllowancesResponse), &out_dir);
export_schema(&schema_for!(AllAccountsResponse), &out_dir);
}
16 changes: 0 additions & 16 deletions cw20/base/meta/README.md

This file was deleted.

61 changes: 0 additions & 61 deletions cw20/base/meta/appveyor.yml

This file was deleted.

37 changes: 0 additions & 37 deletions cw20/base/meta/test_generate.sh

This file was deleted.

16 changes: 0 additions & 16 deletions cw20/base/schema/all_accounts_response.json

This file was deleted.

Loading