mod vm_types;
pub use self::vm_types::*;
mod public_key;
pub use self::public_key::{CurveType, PublicKey};
mod primitives;
pub use self::primitives::*;
mod contract_code;
pub use contract_code::*;
pub use near_account_id::{self as account_id, AccountId, AccountIdRef};
pub use near_gas::NearGas as Gas;
pub use near_token::NearToken;
mod error;
pub use self::error::Abort;
pub use self::error::FunctionError;
pub type Duration = u64;
pub type Timestamp = u64;
pub type CryptoHash = [u8; 32];
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[repr(transparent)]
pub struct GasWeight(pub u64);
impl Default for GasWeight {
fn default() -> Self {
Self(1)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_gas_weight_clone() {
let weight = GasWeight(42);
#[allow(clippy::clone_on_copy)]
let cloned = weight.clone();
assert_eq!(weight, cloned);
}
#[test]
fn test_gas_weight_copy() {
let weight = GasWeight(42);
let copied = weight; assert_eq!(weight.0, copied.0);
assert_eq!(weight.0, 42);
}
#[test]
fn test_gas_weight_default() {
let weight = GasWeight::default();
assert_eq!(weight.0, 1);
}
#[test]
fn test_gas_weight_debug() {
let weight = GasWeight(100);
assert_eq!(format!("{:?}", weight), "GasWeight(100)");
}
#[test]
fn test_gas_weight_hash() {
use std::collections::HashSet;
let mut set = HashSet::new();
set.insert(GasWeight(1));
set.insert(GasWeight(2));
set.insert(GasWeight(1)); assert_eq!(set.len(), 2);
}
}