Skip to content

Commit

Permalink
feat: cargo schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
emidev98 committed Jun 16, 2023
1 parent 22c0739 commit 3b1ca1c
Show file tree
Hide file tree
Showing 21 changed files with 1,045 additions and 28 deletions.
5 changes: 5 additions & 0 deletions .cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[alias]
wasm = "build --release --target wasm32-unknown-unknown"
wasm-debug = "build --target wasm32-unknown-unknown"
unit-test = "test --lib"
schema = "run --example schema"
37 changes: 35 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
members = [
#"contracts/alliance-hub",
"contracts/alliance-hub",
"contracts/alliance-oracle",
"packages/alliance-protocol",
]
Expand Down Expand Up @@ -30,12 +30,12 @@ incremental = false
overflow-checks = false

[workspace.dependencies]
cosmwasm-std = "1.1.10"
cosmwasm-storage = "1.1.10"
cosmwasm-schema = "1.1.10"
cw-storage-plus = "1.1.0"
cosmwasm-std = "1.1.3"
cosmwasm-storage = "1.1.3"
cosmwasm-schema = "1.1.3"
cw-storage-plus = "1.0.1"
cw-asset = "2.4.0"
schemars = "0.8.12"
schemars = "0.8.11"
serde = { version = "1.0.152", default-features = false, features = ["derive"] }
terra-proto-rs = { version = "3.0.1", default-features = false}
thiserror = { version = "1.0.38" }
Expand Down
19 changes: 12 additions & 7 deletions Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,17 @@ args = ["clippy", "--tests", "--", "-D", "warnings"]

[tasks.build]
command = "cargo"
args = [
"build",
"--release",
"--locked",
"--target", "wasm32-unknown-unknown",
]
args = ["build", "--release", "--locked", "--target", "wasm32-unknown-unknown"]

[tasks.schema]
script = """
for d in contracts/alliance-oracle; do
if [ -d "$d" ]; then
cd $d
cargo schema
fi
done
"""

[tasks.optimize]
script = """
Expand All @@ -44,4 +49,4 @@ docker run --rm -v "$(pwd)":/code \
script = """
npm install -g ts-node
ts-node ./scripts/deploy-oracle.ts
"""
"""
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ Lint the code
$ cargo make lint
```

Generate json Schemas for each smart contract
```sh
$ cargo make schema
```

Build the code
```sh
$ cargo make build
Expand Down
5 changes: 5 additions & 0 deletions contracts/alliance-hub/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[alias]
wasm = "build --release --target wasm32-unknown-unknown"
wasm-debug = "build --target wasm32-unknown-unknown"
unit-test = "test --lib"
schema = "run --example schema"
5 changes: 5 additions & 0 deletions contracts/alliance-oracle/.cargo/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[alias]
wasm = "build --release --target wasm32-unknown-unknown"
wasm-debug = "build --target wasm32-unknown-unknown"
unit-test = "test --lib"
schema = "run --example schema"
11 changes: 11 additions & 0 deletions contracts/alliance-oracle/examples/schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use alliance_protocol::alliance_oracle_types::{InstantiateMsg, ExecuteMsg, QueryMsg};
use cosmwasm_schema::write_api;


fn main() {
write_api! {
instantiate: InstantiateMsg,
execute: ExecuteMsg,
query: QueryMsg,
}
}
Loading

0 comments on commit 3b1ca1c

Please sign in to comment.