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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
use crate::{
    scalar::{Address, AssetId, Bytes32, ContractId, MessageId, Nonce},
    type_id, TypeId, FUEL_TYPES_NAMESPACE,
};
use serde::{Deserialize, Serialize};

#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Transfer {
    pub contract_id: ContractId,
    pub to: ContractId,
    pub amount: u64,
    pub asset_id: AssetId,
    pub pc: u64,
    pub is: u64,
}

impl TypeId for Transfer {
    fn type_id() -> usize {
        type_id(FUEL_TYPES_NAMESPACE, "Transfer") as usize
    }
}

#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Log {
    pub contract_id: ContractId,
    pub ra: u64,
    pub rb: u64,
}

impl TypeId for Log {
    fn type_id() -> usize {
        type_id(FUEL_TYPES_NAMESPACE, "Log") as usize
    }
}

#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct LogData {
    pub contract_id: ContractId,
    pub data: Vec<u8>,
    pub rb: u64,
    pub len: u64,
    pub ptr: u64,
}

impl TypeId for LogData {
    fn type_id() -> usize {
        type_id(FUEL_TYPES_NAMESPACE, "LogData") as usize
    }
}

#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct ScriptResult {
    pub result: u64,
    pub gas_used: u64,
}

impl TypeId for ScriptResult {
    fn type_id() -> usize {
        type_id(FUEL_TYPES_NAMESPACE, "ScriptResult") as usize
    }
}

#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct TransferOut {
    pub contract_id: ContractId,
    pub to: Address,
    pub amount: u64,
    pub asset_id: AssetId,
    pub pc: u64,
    pub is: u64,
}

impl TypeId for TransferOut {
    fn type_id() -> usize {
        type_id(FUEL_TYPES_NAMESPACE, "TransferOut") as usize
    }
}

#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct MessageOut {
    pub message_id: MessageId,
    pub sender: Address,
    pub recipient: Address,
    pub amount: u64,
    pub nonce: Nonce,
    pub len: u64,
    pub digest: Bytes32,
    pub data: Vec<u8>,
}

impl TypeId for MessageOut {
    fn type_id() -> usize {
        type_id(FUEL_TYPES_NAMESPACE, "MessageOut") as usize
    }
}

#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Return {
    pub contract_id: ContractId,
    pub val: u64,
    pub pc: u64,
    pub is: u64,
}

impl TypeId for Return {
    fn type_id() -> usize {
        type_id(FUEL_TYPES_NAMESPACE, "Return") as usize
    }
}

#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Call {
    pub contract_id: ContractId,
    pub to: ContractId,
    pub amount: u64,
    pub asset_id: AssetId,
    pub gas: u64,
    pub fn_name: String,
}

impl TypeId for Call {
    fn type_id() -> usize {
        type_id(FUEL_TYPES_NAMESPACE, "Call") as usize
    }
}

#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Panic {
    pub contract_id: ContractId,
    pub reason: u32,
}

impl TypeId for Panic {
    fn type_id() -> usize {
        type_id(FUEL_TYPES_NAMESPACE, "Panic") as usize
    }
}

#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Revert {
    pub contract_id: ContractId,
    pub error_val: u64,
}

impl TypeId for Revert {
    fn type_id() -> usize {
        type_id(FUEL_TYPES_NAMESPACE, "Revert") as usize
    }
}

#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Mint {
    pub sub_id: AssetId,
    pub contract_id: ContractId,
    pub val: u64,
    pub pc: u64,
    pub is: u64,
}

impl TypeId for Mint {
    fn type_id() -> usize {
        type_id(FUEL_TYPES_NAMESPACE, "Mint") as usize
    }
}

#[derive(Deserialize, Serialize, Debug, Clone)]
pub struct Burn {
    pub sub_id: AssetId,
    pub contract_id: ContractId,
    pub val: u64,
    pub pc: u64,
    pub is: u64,
}

impl TypeId for Burn {
    fn type_id() -> usize {
        type_id(FUEL_TYPES_NAMESPACE, "Burn") as usize
    }
}