Skip to content

Commit

Permalink
add how to register ICQ contract
Browse files Browse the repository at this point in the history
  • Loading branch information
sotnikov-s committed Oct 27, 2024
1 parent 0406eae commit cc29b8d
Show file tree
Hide file tree
Showing 14 changed files with 1,188 additions and 1 deletion.
18 changes: 18 additions & 0 deletions Cargo.lock

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

22 changes: 21 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
[workspace]
members = ["contracts/*"]
members = [
"contracts/balance-tracker",
"contracts/before-send-hook",
"contracts/client_updater",
"contracts/dex",
"contracts/dex_stargate",
"contracts/echo",
"contracts/ibc_transfer",
"contracts/marketmap",
"contracts/msg_receiver",
"contracts/neutron_interchain_queries",
"contracts/neutron_interchain_txs",
"contracts/neutron_validator_test",
"contracts/oracle",
"contracts/price-feed",
"contracts/reflect",
"contracts/stargate_querier",
"contracts/tokenfactory",
"contracts/docs/interchainqueries/howto/*",
]

[profile.release]
opt-level = 3
Expand All @@ -14,6 +33,7 @@ overflow-checks = true

[workspace.dependencies]
neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", branch = "main" }
neutron-std = { git = "https://github.com/neutron-org/neutron-std", branch = "feat/clean-bindings" }
prost = "0.12.4"
prost-types = "0.12.4"
cosmos-sdk-proto = { version = "0.20.0", default-features = false }
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[alias]
wasm = "build --release --target wasm32-unknown-unknown"
wasm-debug = "build --target wasm32-unknown-unknown"
unit-test = "test --lib"
integration-test = "test --test integration"
schema = "run --example contracts/docs/interchainqueries/howto/register_kv_icq-schema"
34 changes: 34 additions & 0 deletions contracts/docs/interchainqueries/howto/register_kv_icq/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
[package]
name = "howto_register_kv_icq"
version = "0.1.0"
edition = "2021"

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.
"contract.wasm",
"hash.txt",
]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["cdylib", "rlib"]

[features]
library = []

[dependencies]
cosmwasm-std = { workspace = true, features = ["stargate", "staking"] }
cw2 = { workspace = true }
schemars = { workspace = true }
serde = { workspace = true }
neutron-sdk = { workspace = true }
neutron-std = { workspace = true }
cosmos-sdk-proto = { workspace = true }
cw-storage-plus = { workspace = true }
prost = { workspace = true }
serde-json-wasm = { workspace = true }

[dev-dependencies]
base64 = { workspace = true }
cosmwasm-schema = { workspace = true }
11 changes: 11 additions & 0 deletions contracts/docs/interchainqueries/howto/register_kv_icq/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Validators Registry

CURRENT_DIR = $(shell pwd)
CURRENT_DIR_RELATIVE = $(notdir $(shell pwd))

clippy:
rustup component add clippy || true
cargo clippy --all-targets --all-features --workspace -- -D warnings

test: clippy
cargo unit-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# HowTo register a KV Interchain Query contract

A simple contract that implements the flow described in the [How to register an Interchain Query using neutron-sdk](https://docs.neutron.org/neutron/modules/interchain-queries/how-to#how-to-register-an-interchain-query-using-neutron-sdk) documentation section.
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// Copyright 2022 Neutron
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

use std::env::current_dir;
use std::fs::create_dir_all;

use cosmwasm_schema::{export_schema, remove_schemas, schema_for};
use neutron_interchain_queries::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};

fn main() {
let mut out_dir = current_dir().unwrap();
out_dir.push("schema");
create_dir_all(&out_dir).unwrap();
remove_schemas(&out_dir).unwrap();

export_schema(&schema_for!(InstantiateMsg), &out_dir);
export_schema(&schema_for!(ExecuteMsg), &out_dir);
export_schema(&schema_for!(QueryMsg), &out_dir);
}
Loading

0 comments on commit cc29b8d

Please sign in to comment.