I have following config file, I added schelling game pallet as tightly coupling pallet:
use frame_support::{
traits::{Currency, ExistenceRequirement, Get, ReservableCurrency, WithdrawReasons},
};
#[pallet::config]
pub trait Config: frame_system::Config + schelling_game::Config{
type Event: From<Event<Self>> + IsType<<Self as frame_system::Config>::Event>;
type Currency: ReservableCurrency<Self::AccountId>;
type RandomnessSource: Randomness<Self::Hash, Self::BlockNumber>;
}
I have following code in the function:
#[pallet::weight(10_000 + T::DbWeight::get().reads_writes(2,2))]
pub fn add_profile_fund(origin: OriginFor<T>, citizenid: u128) -> DispatchResult {
let who = ensure_signed(origin)?;
let deposit = <RegistrationFee<T>>::get();
let imb = T::Currency::withdraw(
&who,
deposit,
WithdrawReasons::TRANSFER,
ExistenceRequirement::AllowDeath,
)?;
It gives error:
ambiguous associated type Currency in bounds of T
ambiguous associated type Currency
note: associated type T could derive from schelling_game::Config
help: use fully qualified syntax to disambiguate: <T as pallet::Config>::Currency
When I add
let imb = <T as frame_system::Config>::Currency::withdraw()
It gives error:
cannot find associated type Currency in trait frame_system::Config
not found in frame_system::Config
Edit:
The error is because I have used currency trait in both the pallet. How can I use currency trait in both pallets?