1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
//
// Copyright (c) DUSK NETWORK. All rights reserved.
//! Contract building tools for Dusk smart contracts.
/// Contract schema types and utilities.
/// Re-export the contract proc macro.
pub use contract;
/// Declares the topics under which an event type is emitted.
///
/// Event authors implement this trait once per event struct, then list the
/// types in the `#[contract(events = [...])]` module attribute. The macro
/// reads [`TOPICS`](ContractEvent::TOPICS) at compile time to populate the
/// contract schema and to dispatch `decode_event` in the data driver.
///
/// A single struct may carry multiple topics — the topic conveys the
/// operation while the struct carries the data — so `TOPICS` is a slice.
///
/// # Example
///
/// ```
/// use dusk_forge::ContractEvent;
///
/// struct OwnershipTransferred;
///
/// impl ContractEvent for OwnershipTransferred {
/// const TOPICS: &'static [&'static str] =
/// &["ownership_transferred", "ownership_renounced"];
/// }
/// ```