Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
cyborgshead committed Aug 27, 2022
1 parent 289d1e4 commit bc6a711
Show file tree
Hide file tree
Showing 19 changed files with 123 additions and 22 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ target/
.cargo-ok

artifacts
packages/*/bin
contracts/*/bin
packages/*/schema
contracts/*/schema
2 changes: 1 addition & 1 deletion Cargo.lock

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

14 changes: 9 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,18 @@ incremental = false
codegen-units = 1
incremental = false

[profile.release.package.cw1-whitelist-ng]
codegen-units = 1
incremental = false

[profile.release.package.cw3-fixed-multisig]
codegen-units = 1
incremental = false

[profile.release.package.cw3-flex-multisig]
codegen-units = 1
incremental = false
incremental = false

[profile.release]
rpath = false
lto = true
overflow-checks = true
opt-level = 3
debug = false
debug-assertions = false
2 changes: 1 addition & 1 deletion contracts/cw1-whitelist/.cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ 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 schema"
schema = "run --bin schema"
File renamed without changes.
2 changes: 1 addition & 1 deletion contracts/cw3-fixed-multisig/.cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ 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 schema"
schema = "run --bin schema"
File renamed without changes.
2 changes: 1 addition & 1 deletion contracts/cw3-flex-multisig/.cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ 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 schema"
schema = "run --bin schema"
File renamed without changes.
2 changes: 1 addition & 1 deletion contracts/ibc-reflect-send/.cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ 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 schema"
schema = "run --bin schema"
26 changes: 26 additions & 0 deletions contracts/ibc-reflect-send/src/bin/schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
use std::env::current_dir;
use std::fs::create_dir_all;

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

use cyber_std::CyberMsgWrapper;
use ibc_reflect_send::ibc_msg::PacketMsg;
use ibc_reflect_send::msg::{
AccountResponse, AdminResponse, ExecuteMsg, InstantiateMsg, ListAccountsResponse, 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!(CyberMsgWrapper), &out_dir);
export_schema(&schema_for!(ExecuteMsg), &out_dir);
export_schema(&schema_for!(InstantiateMsg), &out_dir);
export_schema(&schema_for!(QueryMsg), &out_dir);
export_schema(&schema_for!(PacketMsg), &out_dir);
export_schema(&schema_for!(AdminResponse), &out_dir);
export_schema(&schema_for!(AccountResponse), &out_dir);
export_schema(&schema_for!(ListAccountsResponse), &out_dir);
}
2 changes: 1 addition & 1 deletion contracts/ibc-reflect/.cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ 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 schema"
schema = "run --bin schema"
10 changes: 5 additions & 5 deletions contracts/ibc-reflect/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ cranelift = ["cosmwasm-vm/cranelift"]
backtraces = ["cosmwasm-std/backtraces", "cosmwasm-vm/backtraces"]

[dependencies]
cosmwasm-std = { version = "1.0.0-beta", features = ["iterator", "staking", "stargate"] }
cosmwasm-storage = { version = "1.0.0-beta", features = ["iterator"] }
cosmwasm-schema = { version = "1.0.0" }
cosmwasm-std = { version = "1.0.0", features = ["iterator", "staking", "stargate"] }
cosmwasm-storage = { version = "1.0.0", features = ["iterator"] }
schemars = "0.8.1"
serde = { version = "1.0.125", default-features = false, features = ["derive"] }
cyber-std = { path = "../../packages/cyber-std"}
cyber-std = { version = "0.2.2" }

[dev-dependencies]
cosmwasm-vm = { version = "1.0.0-beta", default-features = false, features = ["iterator", "stargate"] }
cosmwasm-schema = { version = "1.0.0-beta" }
cosmwasm-vm = { version = "1.0.0", default-features = false, features = ["iterator", "stargate"] }
cw-multi-test = { version = "0.14.0" }
37 changes: 37 additions & 0 deletions contracts/ibc-reflect/src/bin/schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
use std::env::current_dir;
use std::fs::create_dir_all;

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

use ibc_reflect::msg::{
AcknowledgementMsg, BalancesResponse, DispatchResponse, InstantiateMsg, PacketMsg, QueryMsg,
WhoAmIResponse,
};
use cyber_std::CyberMsgWrapper;

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!(CyberMsgWrapper), &out_dir);
export_schema(&schema_for!(InstantiateMsg), &out_dir);
export_schema(&schema_for!(QueryMsg), &out_dir);
export_schema(&schema_for!(PacketMsg), &out_dir);
export_schema_with_title(
&schema_for!(AcknowledgementMsg<BalancesResponse>),
&out_dir,
"AcknowledgementMsgBalances",
);
export_schema_with_title(
&schema_for!(AcknowledgementMsg<DispatchResponse>),
&out_dir,
"AcknowledgementMsgDispatch",
);
export_schema_with_title(
&schema_for!(AcknowledgementMsg<WhoAmIResponse>),
&out_dir,
"AcknowledgementMsgWhoAmI",
);
}
2 changes: 1 addition & 1 deletion contracts/reflect/.cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ 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 schema"
schema = "run --bin schema"
34 changes: 34 additions & 0 deletions contracts/reflect/src/bin/schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
use std::env::current_dir;
use std::fs::create_dir_all;

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

use reflect::msg::{
ChainResponse, ExecuteMsg, InstantiateMsg, OwnerResponse,
QueryMsg, RawResponse,
};
use reflect::state::State;
use cyber_std::CyberMsgWrapper;

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

// messages
export_schema(&schema_for!(CyberMsgWrapper), &out_dir);
export_schema(&schema_for!(InstantiateMsg), &out_dir);
export_schema(&schema_for!(ExecuteMsg), &out_dir);
export_schema(&schema_for!(Response<CyberMsgWrapper>), &out_dir);
export_schema(&schema_for!(QueryMsg), &out_dir);

// The possible return types for QueryMsg cases
export_schema(&schema_for!(OwnerResponse), &out_dir);
export_schema(&schema_for!(ChainResponse), &out_dir);
export_schema(&schema_for!(RawResponse), &out_dir);

// state
export_schema(&schema_for!(State), &out_dir);
}
2 changes: 1 addition & 1 deletion contracts/reflect/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pub mod contract;
mod errors;
pub mod errors;
pub mod msg;
pub mod state;

Expand Down
2 changes: 1 addition & 1 deletion contracts/std-test/.cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ 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"
schema = "run --bin schema"
2 changes: 1 addition & 1 deletion packages/cyber-std/.cargo/config
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
wasm = "build --release --target wasm32-unknown-unknown"
wasm-debug = "build --target wasm32-unknown-unknown"
unit-test = "test --lib --features backtraces"
schema = "run --example schema"
schema = "run --bin schema"

0 comments on commit bc6a711

Please sign in to comment.