From 09cda361d10d27df78e839cc74497ba01a94d8be Mon Sep 17 00:00:00 2001 From: lemunozm Date: Tue, 30 Jul 2024 09:30:45 +0200 Subject: [PATCH] lib/* compiling and passing --- libs/mocks/src/pools.rs | 3 ++- libs/test-utils/src/mocks/nav.rs | 5 +++-- libs/traits/src/lib.rs | 5 +++-- libs/types/src/pools.rs | 2 -- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libs/mocks/src/pools.rs b/libs/mocks/src/pools.rs index d1849b345b..d163707117 100644 --- a/libs/mocks/src/pools.rs +++ b/libs/mocks/src/pools.rs @@ -1,7 +1,8 @@ #[frame_support::pallet(dev_mode)] pub mod pallet { + use cfg_primitives::Seconds; use cfg_traits::{ - investments::InvestmentAccountant, PoolInspect, PoolReserve, Seconds, TrancheTokenPrice, + investments::InvestmentAccountant, PoolInspect, PoolReserve, TrancheTokenPrice, }; use cfg_types::investments::InvestmentInfo; use frame_support::pallet_prelude::*; diff --git a/libs/test-utils/src/mocks/nav.rs b/libs/test-utils/src/mocks/nav.rs index ac0e3dd8d9..4bb0a6fe92 100644 --- a/libs/test-utils/src/mocks/nav.rs +++ b/libs/test-utils/src/mocks/nav.rs @@ -14,7 +14,8 @@ pub use pallet::*; #[frame_support::pallet] pub mod pallet { - use cfg_traits::{PoolNAV, Seconds}; + use cfg_primitives::Seconds; + use cfg_traits::PoolNAV; use frame_support::pallet_prelude::*; use parity_scale_codec::HasCompact; use sp_runtime::traits::{AtLeast32BitUnsigned, Zero}; @@ -53,7 +54,7 @@ pub mod pallet { } pub fn latest(pool_id: T::PoolId) -> (T::Balance, Seconds) { - Nav::::get(pool_id).unwrap_or((T::Balance::zero(), 0)) + Nav::::get(pool_id).unwrap_or((T::Balance::zero(), Seconds::zero())) } } diff --git a/libs/traits/src/lib.rs b/libs/traits/src/lib.rs index 398a4b8d8d..4ec33f52d9 100644 --- a/libs/traits/src/lib.rs +++ b/libs/traits/src/lib.rs @@ -18,6 +18,7 @@ // Ensure we're `no_std` when compiling for WebAssembly. #![cfg_attr(not(feature = "std"), no_std)] +use cfg_primitives::Seconds; use frame_support::{ dispatch::DispatchResult, pallet_prelude::{RuntimeDebug, TypeInfo}, @@ -62,7 +63,7 @@ pub trait PoolNAV { type ClassId; type RuntimeOrigin; // nav returns the nav and the last time it was calculated - fn nav(pool_id: PoolId) -> Option<(Amount, u64)>; + fn nav(pool_id: PoolId) -> Option<(Amount, Seconds)>; fn update_nav(pool_id: PoolId) -> Result; fn initialise( origin: Self::RuntimeOrigin, @@ -384,7 +385,7 @@ pub trait TryConvert { /// Trait to obtain the time as seconds pub trait TimeAsSecs: UnixTime { - fn now() -> cfg_primitives::Seconds { + fn now() -> Seconds { ::now().as_secs().into() } } diff --git a/libs/types/src/pools.rs b/libs/types/src/pools.rs index 4e9902469e..36695f435f 100644 --- a/libs/types/src/pools.rs +++ b/libs/types/src/pools.rs @@ -262,8 +262,6 @@ mod tests { use super::*; use crate::fixed_point::{Quantity, Rate}; - type Balance = u128; - #[test] fn rate_zero() { assert_eq!(