I want to write a function which a user can call with an asset id and the amount of which it wants to deposit. I need to check if said asset id is within a list of allowable assets, which can change over time.
Something like this
pub fn add_margin( origin: OriginFor<T>, asset: AssetIdOf<T>, amount: T::Balance, ) -> DispatchResult { let acc = ensure_signed(origin)?; SupportedAssets<T>::contains(asset)?; // do stuff ... I've checked the frame_support::storage::types docs and couldn't find a storage type that directly implements what I'm looking for.
I've thought of two alternatives:
- Using a
StorageValuewith aHashSetin it, getting the set and checking if it contains the asset id - Using a
StorageMapwhich maps asset id to the unit type, thus checking if it contains the asset id as key and ignoring the stored value.
Any recommendations?