Concordium / concordium-rust-smart-contracts

Libraries and tools for writing and testing smart contracts on Concordium
https://docs.rs/concordium-std/latest/concordium_std/
Mozilla Public License 2.0
57 stars 35 forks source link

Logging custom events as well as standardized ones #307

Closed limemloh closed 1 year ago

limemloh commented 1 year ago

To include events in a smart contract schema, the developer needs to provide a single type representing all the possible events, which then implements SchemaType. This is usually done using (rust) enums. We provide a type Cis2Event in our smart contract library concordium-cis2, which represents the events logged as part of CIS-2. Now, if a smart contract logs events outside the events from CIS-2, the developer will need to implement the SchemaType manually for the type representing the contract events and requires the developer to reimplement some of the work we provide with Cis2Event.

This can be seen in the example for the wrapped CCD:

Additionally, the trait Serial and Deserial has to be implemented manually as well in this case.