Suggestion: Default events

Currently events are not mandatory on resource creation or movement. It is up to contract developer to emit or not, even if they are defined in the contract. It would be nice to fire some default events, like:

  • Resource Creation (for minting for example)
  • Resource Movement
  • Saving to storage
  • Linking to storage

I am not 100% sure what is necessary and what is not, but as Cadence resources are stored in user’s storage, there is currently no way to reliably verify, let’s say if NFT is really minted 100 times, or there is some duplicate NFT with same id etc.

Thank you for the suggestion! I think this could definitely be useful.

Would the events just be empty, or could they have some parameters?
It would be nice to have some sort of data that goes along with each event, but Cadence can’t really know any data about a specific resource since that is user defined.

If there isn’t much useful metadata, how useful could these be?

Is there a performance or state bloat issue with this? I could see this potentially getting a bit out of hand if so many events are being emitted.

To be honest I was mostly thinking in line of resources, some resource with udid, type created, some resource with udid,type moved (changed owner) kind of events.

Main problem I see currently, there is no way to force emitting event at interface level. You can force to define, but it is totally up to contract to emit or not.

With upcoming changes allowing access to anyones storage, enumeration of storage, technically you can know where is resource (then you can access resource for metadata)

We discussed with Bastian about this, on that time my point was, there is no chance to prove (currently) supplyAmount is correct, or there is no way to prove that NFT you got it unique (technically you can mint NFT with exact same properties including id)

Also there is a possibility here, this can be solved without events of course, something that can be queried. (Though I have higher hopes from cadence side)