问题
I am trying to use deposit_event_indexed
method when depositing an event with a specific topic so that I can use something like the polkadot.js' api.query.system.eventTopics to fetched indexed events.
However, I get the following error
63 | | Self::deposit_event_indexed(&eventHashArray, RawEvent::TestIndexedEvent());
| | ^^^^^^^^^^^^^^^^^^^^^ function or associated item not found in `Module<T>`
I am also quite new to rust, so from my understanding, according to the doc, this method is part of the Module's trait. Please help!
回答1:
Assuming you are calling deposit_event_indexed
from your custom pallet, you simply need to target the function which is located in the frame_system
pallet.
frame_system::Module::<T>::deposit_event_indexed(...)
Unlike the more commonly used deposit_event
feature, we do not automatically import this into your pallet, which is why you see this error.
来源:https://stackoverflow.com/questions/60720925/how-do-we-use-topics-in-events