I am trying to use one pallet function inside my own pallet... but the argument types have problems...
#[pallet::config]
pub trait Config: frame_system::Config + pallet_vesting::Config {
...}
#[pallet::call]
impl<T: Config> Pallet<T> {
...
pub fn vested_transfer(
origin: OriginFor<T>,
target: <T::Lookup as StaticLookup>::Source,
locked: BalanceOf<T>,
per_block: BalanceOf<T>,
starting_block: BlockNumberFor<T>,
) -> DispatchResultWithPostInfo {
let vesting_info = pallet_vesting::VestingInfo::<BalanceOf<T>, BlockNumberFor<T>>::new(
locked,
per_block,
starting_block,
);
let is_valid = vesting_info.is_valid();
ensure!(is_valid, "invalid vesting_info");
let res = pallet_vesting::Pallet::<T>::vested_transfer(origin, target, vesting_info);
Then the error message for the 3rd argument vesting_info: ... vesting_info... expected pallet_vesting::Config::Currency, found pallet::Config::Currency
Then I tried this to cast the vesting_info type:
vesting_info as pallet_vesting::Config::Currency
... error message: use fully-qualified syntax: <Type as pallet_vesting::Config>::Currency
Then I tried this to fix that the 3rd argument:
vesting_info as <<T as pallet::Config>::Currency as pallet_vesting::Config>::Currency,
... error message: use of undeclared crate or module pallet
Then I tried this to fix that the 3rd argument:
vesting_info as <<T as Config>::Currency as pallet_vesting::Config>::Currency,
... error message: the trait pallet_vesting::Config
is not implemented for <T as pallet::Config>::Currency
... an as
expression can only be used to convert between primitive types or to coerce to a specific trait object
Then I tried this to fix that the 3rd argument:
vesting_info as <<T as Self::Config>::Currency as pallet_vesting::Config>::Currency,
... error message: the name Config
is defined multiple times; cannot find associated type Currency
in Self::Config
how to use "pallet" or different pallet function argument types ?
vested_transfer
function or just use this within your pallet? 2. Are you tightly coupling your pallets Config with the one ofpallet_vesting::Config
? docs.substrate.io/how-to-guides/v3/pallet-design/tight-coupling