Skip to content
Merged
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
4 changes: 2 additions & 2 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions artifacts/checksums.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
d565fcb50e8379e218e8896f90a9f1e02aa737bd0eb7c1b77756f918c0d38ec0 dex_aggregator.wasm
f33d353816a46e3219f95c046682efeef68408252c9a31ce15599b2de9ba7aaa mock_swap.wasm
c3afe3612d96ba2a7f45296b5cd03e7c785593eb899ad7fc6af21ca61c077698 dex_aggregator.wasm
fca25ee84ed0903921574c9efef0144880a81f7533e952f6ce8cb3ea4f8e57b4 mock_swap.wasm
Binary file modified artifacts/dex_aggregator.wasm
Binary file not shown.
Binary file modified artifacts/mock_swap.wasm
Binary file not shown.
3 changes: 3 additions & 0 deletions contracts/dex_aggregator/.cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[alias]
unit-test = "test --lib"
schema = "run --example schema"
2 changes: 1 addition & 1 deletion contracts/dex_aggregator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "dex_aggregator"
version = "0.1.0"
version = "1.0.0"
edition = "2021"

[lib]
Expand Down
26 changes: 26 additions & 0 deletions contracts/dex_aggregator/examples/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, export_schema_with_title, remove_schemas, schema_for};

use dex_aggregator::msg::{
AllFeesResponse, ExecuteMsg, FeeResponse, InstantiateMsg, QueryMsg, SimulateRouteResponse,
};
use dex_aggregator::state::Config;

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_with_title(&schema_for!(ExecuteMsg), &out_dir, "ExecuteMsg");
export_schema_with_title(&schema_for!(QueryMsg), &out_dir, "QueryMsg");
export_schema(&schema_for!(SimulateRouteResponse), &out_dir);
export_schema(&schema_for!(Config), &out_dir);
export_schema(&schema_for!(FeeResponse), &out_dir);
export_schema(&schema_for!(AllFeesResponse), &out_dir);

println!("JSON schemas generated to the an aggregated directory: ./schema");
}
39 changes: 39 additions & 0 deletions contracts/dex_aggregator/schema/all_fees_response.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "AllFeesResponse",
"type": "object",
"required": [
"fees"
],
"properties": {
"fees": {
"type": "array",
"items": {
"$ref": "#/definitions/FeeInfo"
}
}
},
"additionalProperties": false,
"definitions": {
"Decimal": {
"description": "A fixed-point decimal value with 18 fractional digits, i.e. Decimal(1_000_000_000_000_000_000) == 1.0\n\nThe greatest possible value that can be represented is 340282366920938463463.374607431768211455 (which is (2^128 - 1) / 10^18)",
"type": "string"
},
"FeeInfo": {
"type": "object",
"required": [
"fee_percent",
"pool_address"
],
"properties": {
"fee_percent": {
"$ref": "#/definitions/Decimal"
},
"pool_address": {
"type": "string"
}
},
"additionalProperties": false
}
}
}
28 changes: 28 additions & 0 deletions contracts/dex_aggregator/schema/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Config",
"type": "object",
"required": [
"admin",
"cw20_adapter_address",
"fee_collector"
],
"properties": {
"admin": {
"$ref": "#/definitions/Addr"
},
"cw20_adapter_address": {
"$ref": "#/definitions/Addr"
},
"fee_collector": {
"$ref": "#/definitions/Addr"
}
},
"additionalProperties": false,
"definitions": {
"Addr": {
"description": "A human readable address.\n\nIn Cosmos, this is typically bech32 encoded. But for multi-chain smart contracts no assumptions should be made other than being UTF-8 encoded and of reasonable length.\n\nThis type represents a validated address. It can be created in the following ways 1. Use `Addr::unchecked(input)` 2. Use `let checked: Addr = deps.api.addr_validate(input)?` 3. Use `let checked: Addr = deps.api.addr_humanize(canonical_addr)?` 4. Deserialize from JSON. This must only be done from JSON that was validated before such as a contract's state. `Addr` must not be used in messages sent by the user because this would result in unvalidated instances.\n\nThis type is immutable. If you really need to mutate it (Really? Are you sure?), create a mutable copy using `let mut mutable = Addr::to_string()` and operate on that `String` instance.",
"type": "string"
}
}
}
Loading