-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
main.sw
46 lines (38 loc) · 964 Bytes
/
main.sw
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
contract;
// #region simple-enum-1
// #region enum-of-enums-1
pub enum StateError {
Void: (),
Pending: (),
Completed: (),
}
// #endregion simple-enum-1
pub enum UserError {
Unauthorized: (),
InsufficientPermissions: (),
}
pub enum Error {
StateError: StateError,
UserError: UserError,
}
// #endregion enum-of-enums-1
abi EchoEnum {
fn echo_state_error_enum(state_error: StateError) -> StateError;
fn echo_user_error_enum(state_error: UserError) -> UserError;
fn echo_error_enum(error: Error) -> Error;
}
impl EchoEnum for Contract {
// #region simple-enum-2
fn echo_state_error_enum(state_error: StateError) -> StateError {
state_error
}
// #endregion simple-enum-2
fn echo_user_error_enum(user_error: UserError) -> UserError {
user_error
}
// #region enum-of-enums-2
fn echo_error_enum(error: Error) -> Error {
error
}
// #endregion enum-of-enums-2
}