我有一个存储定义如下
#[pallet::storage]
#[pallet::getter(fn algos)]
pub(super) type Algo<T: Config> = StorageMap<
_,
Blake2_128Concat, (T::AccountId, Vec<u8>),
(T::Moment,Vec<u8>, T::BlockNumber),
ValueQuery
>;
但是当我检查的时候
ensure!(
Algo::<T>::containkey(
&(origin_account, algo_hash)
), Error::<T>::Exists);
它抛出以下错误
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `EncodeLike<(<T as frame_system::Config>::AccountId, Vec<u8>)>` is not implemented for `&(Result<<T as frame_system::Config>::AccountId, frame_support::error::BadOrigin>, Vec<u8>)`
|
= note: required by `frame_support::pallet_prelude::StorageMap::<Prefix, Hasher, Key, Value, QueryKind, OnEmpty>::contains_key`
help: consider introducing a `where` bound, but there might be an alternative better way to express this requirement
impl<T: Config> Pallet<T> where &(Result<<T as frame_system::Config>::AccountId, frame_support::error::BadOrigin>, Vec<u8>): EncodeLike<(<T as frame_system::Config>::AccountId, Vec<u8>)> {
|
如何修复此错误以支持检查StorageMap中的内容?