levana_perpswap_cosmos/
lib.rs

1//! Messages and helper data types for the perps protocol.
2#![deny(missing_docs)]
3#![deny(clippy::as_conversions)]
4
5/// Address Helpers
6pub mod cosmwasm;
7
8pub mod error;
9pub mod event;
10
11/// Contract result helpers
12pub mod result;
13
14pub(crate) mod addr;
15pub(crate) mod auth;
16pub mod compat;
17pub mod direction;
18pub mod ibc;
19pub mod leverage;
20pub mod market_type;
21pub mod max_gains;
22pub mod namespace;
23/// Number type and helpers
24pub mod number;
25/// Exports very commonly used items into the prelude glob
26pub mod prelude;
27pub mod price;
28pub(crate) mod response;
29pub mod storage;
30pub mod time;
31
32#[cfg(feature = "bridge")]
33pub mod bridge;
34pub mod constants;
35pub mod contracts;
36pub mod shutdown;
37pub mod token;
38
39#[test]
40fn test_allow_unknown_fields() {
41    #[cosmwasm_schema::cw_serde]
42    struct Expanded {
43        foo: String,
44        bar: String,
45    }
46
47    impl Default for Expanded {
48        fn default() -> Self {
49            Expanded {
50                foo: "hello".to_string(),
51                bar: "world".to_string(),
52            }
53        }
54    }
55
56    #[cosmwasm_schema::cw_serde]
57    struct Minimal {
58        foo: String,
59    }
60
61    let expanded_str = serde_json::to_string(&Expanded::default()).unwrap();
62    let expanded: Expanded = serde_json::from_str(&expanded_str).unwrap();
63    let minimal: Minimal = serde_json::from_str(&expanded_str).unwrap();
64
65    assert_eq!(expanded.foo, minimal.foo);
66}