use-ink / ink

Polkadot's ink! to write smart contracts.
https://use.ink
Apache License 2.0
1.34k stars 426 forks source link

Event defintions with generics #2044

Open ascjones opened 8 months ago

ascjones commented 8 months ago

Follow up from https://github.com/paritytech/ink/pull/1827#issuecomment-1625583771.

Currently the Event derive does not support generics. We should consider adding support for generic event definitions, that would allow the event definition to be used across contracts with different Environment types e.g.

#[ink::event]
pub struct Transfer<E: ink::env::Environment> {
    #[ink(topic)]
    from: Option<E::AccountId>,
    #[ink(topic)]
    to: Option<E::AccountId>,
    value: E::Balance,
}