Skip to content

Commit 53fdb8d

Browse files
authored
Add ZERO_U256 constant (#5829)
## Description We provide a `ZERO_B256` but do not provide a `ZERO_U256` convenience constant. This has added. Closes #5828 ## Checklist - [x] I have linked to any relevant issues. - [x] I have commented my code, particularly in hard-to-understand areas. - [x] I have updated the documentation where relevant (API docs, the reference, and the Sway book). - [ ] If my change requires substantial documentation changes, I have [requested support from the DevRel team](https://github.com/FuelLabs/devrel-requests/issues/new/choose) - [ ] I have added tests that prove my fix is effective or that my feature works. - [x] I have added (or requested a maintainer to add) the necessary `Breaking*` or `New Feature` labels where relevant. - [x] I have done my best to ensure that my PR adheres to [the Fuel Labs Code Review Standards](https://github.com/FuelLabs/rfcs/blob/master/text/code-standards/external-contributors.md). - [x] I have requested a review from the relevant team or maintainers.
1 parent 187146b commit 53fdb8d

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

sway-lib-std/src/constants.sw

+13
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,19 @@ pub const BASE_ASSET_ID: AssetId = AssetId::from(ZERO_B256);
3333
/// ```
3434
pub const ZERO_B256 = 0x0000000000000000000000000000000000000000000000000000000000000000;
3535

36+
/// A u256 of zero value.
37+
///
38+
/// # Examples
39+
///
40+
/// ```sway
41+
/// use std::constants::ZERO_U256;
42+
///
43+
/// fn foo() {
44+
/// assert(ZERO_U256 == u256::from(0_u64));
45+
/// }
46+
/// ```
47+
pub const ZERO_U256 = 0x00u256;
48+
3649
/// The default Sub Id for assets.
3750
///
3851
/// # Examples

0 commit comments

Comments
 (0)