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

feat: fake-vault #18

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
13 changes: 13 additions & 0 deletions Cargo.lock

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

6 changes: 6 additions & 0 deletions contracts/fake-vault/.cargo/config
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 --features backtraces"
integration-test = "test --test integration"
schema = "run --example schema"
44 changes: 44 additions & 0 deletions contracts/fake-vault/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
[package]
name = "fake-vault"
version = "0.1.0"
edition = "2021"
authors = ["Sergey Ratiashvili <[email protected]>"]


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"]

[profile.release]
opt-level = 3
debug = false
rpath = false
lto = true
debug-assertions = false
codegen-units = 1
panic = 'abort'
incremental = false
overflow-checks = true

[features]
# for quicker tests, cargo test --lib
# for more explicit tests, cargo test --features=backtraces
backtraces = ["cosmwasm-std/backtraces"]
library = []

[dependencies]
cosmwasm-std = "1.2.5"
cw2 = "1.0.1"
schemars = "0.8.10"
cw-storage-plus = "1.0.1"
serde = { version = "1.0.103", default-features = false, features = ["derive"] }
neutron-sdk = "0.5.0"
[dev-dependencies]
cosmwasm-schema = { version = "1.0.0", default-features = false }
3 changes: 3 additions & 0 deletions contracts/fake-vault/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Reflect

This contract is used for tests in the main neutron repository.
30 changes: 30 additions & 0 deletions contracts/fake-vault/examples/schema.rs
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 fake_vault::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);
}
32 changes: 32 additions & 0 deletions contracts/fake-vault/schema/execute_msg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "ExecuteMsg",
"oneOf": [
{
"type": "object",
"required": [
"set_power"
],
"properties": {
"set_power": {
"type": "object",
"required": [
"address",
"power"
],
"properties": {
"address": {
"type": "string"
},
"power": {
"type": "integer",
"format": "uint64",
"minimum": 0.0
}
}
}
},
"additionalProperties": false
}
]
}
25 changes: 25 additions & 0 deletions contracts/fake-vault/schema/instantiate_msg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "InstantiateMsg",
"type": "object",
"required": [
"dao",
"description",
"info",
"name"
],
"properties": {
"dao": {
"type": "string"
},
"description": {
"type": "string"
},
"info": {
"type": "string"
},
"name": {
"type": "string"
}
}
}
116 changes: 116 additions & 0 deletions contracts/fake-vault/schema/query_msg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "QueryMsg",
"oneOf": [
{
"type": "object",
"required": [
"dao"
],
"properties": {
"dao": {
"type": "object"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"description"
],
"properties": {
"description": {
"type": "object"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"name"
],
"properties": {
"name": {
"type": "object"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"config"
],
"properties": {
"config": {
"type": "object"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"voting_power_at_height"
],
"properties": {
"voting_power_at_height": {
"type": "object",
"required": [
"address"
],
"properties": {
"address": {
"type": "string"
},
"height": {
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
}
}
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"total_power_at_height"
],
"properties": {
"total_power_at_height": {
"type": "object",
"properties": {
"height": {
"type": [
"integer",
"null"
],
"format": "uint64",
"minimum": 0.0
}
}
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"info"
],
"properties": {
"info": {
"type": "object"
}
},
"additionalProperties": false
}
]
}
Loading