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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
use odra::casper_types::U256;
use odra::prelude::*;
use odra::Address;

use crate::cep18::utils::SecurityBadge;

/// An event emitted when a mint operation is performed.
#[odra::event]
pub struct Mint {
    /// The recipient of the minted tokens.
    pub recipient: Address,
    /// The amount of tokens minted.
    pub amount: U256
}

/// An event emitted when a burn operation is performed.
#[odra::event]
pub struct Burn {
    /// The owner of the tokens that are burned.
    pub owner: Address,
    /// The amount of tokens burned.
    pub amount: U256
}

/// An event emitted when an allowance is set.
#[odra::event]
pub struct SetAllowance {
    /// The owner of the tokens.
    pub owner: Address,
    /// The spender that is allowed to spend the tokens.
    pub spender: Address,
    /// The allowance amount.
    pub allowance: U256
}

/// An event emitted when an allowance is increased.
#[odra::event]
pub struct IncreaseAllowance {
    /// The owner of the tokens.
    pub owner: Address,
    /// The spender that is allowed to spend the tokens.
    pub spender: Address,
    /// The final allowance amount.
    pub allowance: U256,
    /// The amount by which the allowance was increased.
    pub inc_by: U256
}

/// An event emitted when an allowance is decreased.
#[odra::event]
pub struct DecreaseAllowance {
    /// The owner of the tokens.
    pub owner: Address,
    /// The spender that is allowed to spend the tokens.
    pub spender: Address,
    /// The final allowance amount.
    pub allowance: U256,
    /// The amount by which the allowance was decreased.
    pub decr_by: U256
}

/// An event emitted when a transfer is performed.
#[odra::event]
pub struct Transfer {
    /// The sender of the tokens.
    pub sender: Address,
    /// The recipient of the tokens.
    pub recipient: Address,
    /// The amount of tokens transferred.
    pub amount: U256
}

/// An event emitted when a transfer_from is performed.
#[odra::event]
pub struct TransferFrom {
    /// The spender that is allowed to spend the tokens.
    pub spender: Address,
    /// The sender of the tokens.
    pub owner: Address,
    /// The recipient of the tokens.
    pub recipient: Address,
    /// The amount of tokens transferred.
    pub amount: U256
}

/// An event emitted when a security rules change is performed.
#[odra::event]
pub struct ChangeSecurity {
    /// The address of the administrator which perfomed the change.
    pub admin: Address,
    /// The map of changes made to the security rules.
    pub sec_change_map: BTreeMap<Address, SecurityBadge>
}