1pub mod accumulator;
2pub mod asset;
3pub mod borrow;
4pub mod chunked_append_only_list;
5pub mod event;
6pub mod fee;
7pub mod incoming_deposit;
8pub mod interest_rate_strategy;
9pub mod market;
10pub mod number;
11pub mod oracle;
12pub mod price;
13pub mod registry;
14pub mod snapshot;
15pub mod supply;
16pub mod time_chunk;
17#[cfg(feature = "rpc")]
18pub mod utils;
19pub mod vault;
20pub mod withdrawal_queue;
21
22pub use primitive_types;
23pub use schemars;
24
25#[cfg(target_arch = "wasm32")]
30#[inline]
31pub fn panic_with_message(msg: &str) -> ! {
32 near_sdk::env::panic_str(msg);
33}
34
35#[cfg(not(target_arch = "wasm32"))]
40#[inline]
41pub fn panic_with_message(msg: &str) -> ! {
42 panic!("{}", msg);
43}
44
45pub static YEAR_PER_MS: number::Decimal =
52 number::Decimal::from_repr([0x40FC_AB61_4AE4_B2B5, 0x22D7_9641, 0, 0, 0, 0, 0, 0]);
53
54pub mod contract {
55 pub fn list<T, U: FromIterator<T>>(
56 i: impl IntoIterator<Item = T>,
57 offset: Option<u32>,
58 count: Option<u32>,
59 ) -> U {
60 let offset = offset.map_or(0, |o| o as usize);
61 let count = count.map_or(usize::MAX, |c| c as usize);
62 i.into_iter().skip(offset).take(count).collect()
63 }
64
65 #[macro_export]
66 macro_rules! self_ext {
67 ($gas:expr) => {
68 Self::ext(::near_sdk::env::current_account_id()).with_static_gas($gas)
69 };
70 }
71}