Skip to content

Commit

Permalink
lib/* compiling and passing
Browse files Browse the repository at this point in the history
  • Loading branch information
lemunozm committed Jul 30, 2024
1 parent 6fc9c29 commit babfbbe
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion libs/mocks/src/pools.rs
Original file line number Diff line number Diff line change
@@ -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::*;
Expand Down
5 changes: 3 additions & 2 deletions libs/test-utils/src/mocks/nav.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -53,7 +54,7 @@ pub mod pallet {
}

pub fn latest(pool_id: T::PoolId) -> (T::Balance, Seconds) {
Nav::<T>::get(pool_id).unwrap_or((T::Balance::zero(), 0))
Nav::<T>::get(pool_id).unwrap_or((T::Balance::zero(), Seconds::zero()))
}
}

Expand Down
5 changes: 3 additions & 2 deletions libs/traits/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -62,7 +63,7 @@ pub trait PoolNAV<PoolId, Amount> {
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<Amount, DispatchError>;
fn initialise(
origin: Self::RuntimeOrigin,
Expand Down Expand Up @@ -384,7 +385,7 @@ pub trait TryConvert<A, B> {

/// Trait to obtain the time as seconds
pub trait TimeAsSecs: UnixTime {
fn now() -> cfg_primitives::Seconds {
fn now() -> Seconds {
<Self as UnixTime>::now().as_secs().into()
}
}
Expand Down
2 changes: 0 additions & 2 deletions libs/types/src/pools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,6 @@ mod tests {
use super::*;
use crate::fixed_point::{Quantity, Rate};

type Balance = u128;

#[test]
fn rate_zero() {
assert_eq!(
Expand Down

0 comments on commit babfbbe

Please sign in to comment.