Skip to content

Commit a0b8244

Browse files
authored
Merge pull request #13 from choice-exchange/optimizations
Optimizations
2 parents 8eeb531 + 173ee2c commit a0b8244

23 files changed

+1265
-216
lines changed

Cargo.lock

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

artifacts/checksums.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
d565fcb50e8379e218e8896f90a9f1e02aa737bd0eb7c1b77756f918c0d38ec0 dex_aggregator.wasm
2-
f33d353816a46e3219f95c046682efeef68408252c9a31ce15599b2de9ba7aaa mock_swap.wasm
1+
c3afe3612d96ba2a7f45296b5cd03e7c785593eb899ad7fc6af21ca61c077698 dex_aggregator.wasm
2+
fca25ee84ed0903921574c9efef0144880a81f7533e952f6ce8cb3ea4f8e57b4 mock_swap.wasm

artifacts/dex_aggregator.wasm

796 Bytes
Binary file not shown.

artifacts/mock_swap.wasm

78 Bytes
Binary file not shown.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[alias]
2+
unit-test = "test --lib"
3+
schema = "run --example schema"

contracts/dex_aggregator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "dex_aggregator"
3-
version = "0.1.0"
3+
version = "1.0.0"
44
edition = "2021"
55

66
[lib]
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
use std::env::current_dir;
2+
use std::fs::create_dir_all;
3+
4+
use cosmwasm_schema::{export_schema, export_schema_with_title, remove_schemas, schema_for};
5+
6+
use dex_aggregator::msg::{
7+
AllFeesResponse, ExecuteMsg, FeeResponse, InstantiateMsg, QueryMsg, SimulateRouteResponse,
8+
};
9+
use dex_aggregator::state::Config;
10+
11+
fn main() {
12+
let mut out_dir = current_dir().unwrap();
13+
out_dir.push("schema");
14+
create_dir_all(&out_dir).unwrap();
15+
remove_schemas(&out_dir).unwrap();
16+
17+
export_schema(&schema_for!(InstantiateMsg), &out_dir);
18+
export_schema_with_title(&schema_for!(ExecuteMsg), &out_dir, "ExecuteMsg");
19+
export_schema_with_title(&schema_for!(QueryMsg), &out_dir, "QueryMsg");
20+
export_schema(&schema_for!(SimulateRouteResponse), &out_dir);
21+
export_schema(&schema_for!(Config), &out_dir);
22+
export_schema(&schema_for!(FeeResponse), &out_dir);
23+
export_schema(&schema_for!(AllFeesResponse), &out_dir);
24+
25+
println!("JSON schemas generated to the an aggregated directory: ./schema");
26+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "AllFeesResponse",
4+
"type": "object",
5+
"required": [
6+
"fees"
7+
],
8+
"properties": {
9+
"fees": {
10+
"type": "array",
11+
"items": {
12+
"$ref": "#/definitions/FeeInfo"
13+
}
14+
}
15+
},
16+
"additionalProperties": false,
17+
"definitions": {
18+
"Decimal": {
19+
"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)",
20+
"type": "string"
21+
},
22+
"FeeInfo": {
23+
"type": "object",
24+
"required": [
25+
"fee_percent",
26+
"pool_address"
27+
],
28+
"properties": {
29+
"fee_percent": {
30+
"$ref": "#/definitions/Decimal"
31+
},
32+
"pool_address": {
33+
"type": "string"
34+
}
35+
},
36+
"additionalProperties": false
37+
}
38+
}
39+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Config",
4+
"type": "object",
5+
"required": [
6+
"admin",
7+
"cw20_adapter_address",
8+
"fee_collector"
9+
],
10+
"properties": {
11+
"admin": {
12+
"$ref": "#/definitions/Addr"
13+
},
14+
"cw20_adapter_address": {
15+
"$ref": "#/definitions/Addr"
16+
},
17+
"fee_collector": {
18+
"$ref": "#/definitions/Addr"
19+
}
20+
},
21+
"additionalProperties": false,
22+
"definitions": {
23+
"Addr": {
24+
"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.",
25+
"type": "string"
26+
}
27+
}
28+
}

0 commit comments

Comments
 (0)