-
Notifications
You must be signed in to change notification settings - Fork 5.4k
/
Copy pathconstants.sw
52 lines (49 loc) · 1.22 KB
/
constants.sw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
//! Definitions for constant values in Sway.
library;
/// A b256 of zero value.
///
/// # Additional Information
///
/// **WARNING** This constant has been deprecated. `b256::zero()` should be used instead.
///
/// # Examples
///
/// ```sway
/// use std::{call_frames::msg_asset_id, constants::ZERO_B256};
///
/// fn foo() {
/// assert(ZERO_B256 == msg_asset_id().bits());
/// }
/// ```
#[deprecated(note = "Please use `b256::zero()`")]
pub const ZERO_B256 = 0x0000000000000000000000000000000000000000000000000000000000000000;
/// A u256 of zero value.
///
/// # Additional Information
///
/// **WARNING** This constant has been deprecated. `u256::zero()` should be used instead.
///
/// # Examples
///
/// ```sway
/// use std::constants::ZERO_U256;
///
/// fn foo() {
/// assert(ZERO_U256 == u256::from(0_u64));
/// }
/// ```
#[deprecated(note = "Please use `u256::zero()`")]
pub const ZERO_U256 = 0x00u256;
/// The default Sub Id for assets.
///
/// # Examples
///
/// ```sway
/// use std::{call_frames::contract_id, constants::DEFAULT_SUB_ID};
///
/// fn foo() {
/// let asset = AssetId::default();
/// assert(AssetId::new(contract_id(), DEFAULT_SUB_ID) == msg_asset_id());
/// }
/// ```
pub const DEFAULT_SUB_ID = b256::zero();