Skip to content

Commit

Permalink
add uint64
Browse files Browse the repository at this point in the history
  • Loading branch information
hoomp3 committed Dec 29, 2022
1 parent 13796d9 commit f685571
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/uint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ pub use self::convert::AsU256;
use crate::I256;
use borsh::{BorshDeserialize, BorshSerialize};
use core::num::ParseIntError;
use cosmwasm_std::Uint128;
#[cfg(feature = "cosmwasm")]
use cosmwasm_std::{Decimal256, Uint256};
use cosmwasm_std::{Decimal256, Uint128, Uint256, Uint64};
use serde::{Deserialize, Serialize};

/// A 256-bit unsigned integer type.
Expand Down Expand Up @@ -51,6 +50,21 @@ impl Into<Uint128> for U256 {
}
}

#[cfg(feature = "cosmwasm")]
impl From<Uint64> for U256 {
fn from(u: Uint64) -> Self {
U256::from(u.u64())
}
}

#[cfg(feature = "cosmwasm")]
#[allow(clippy::from_over_into)]
impl Into<Uint64> for U256 {
fn into(self) -> Uint64 {
Uint64::new(self.as_u64())
}
}

#[cfg(feature = "cosmwasm")]
#[allow(clippy::from_over_into)]
impl Into<Uint256> for U256 {
Expand Down

0 comments on commit f685571

Please sign in to comment.