@@ -10,7 +10,13 @@ pub type Bytes32 = ffi::evmc_bytes32;
1010pub type Uint256 = ffi:: evmc_uint256be ;
1111
1212/// EVMC message (call) kind.
13- pub type MessageKind = ffi:: evmc_call_kind ;
13+ #[ derive( Debug , PartialEq ) ]
14+ pub enum MessageKind {
15+ Call ,
16+ CallCode ,
17+ DelegateCall ,
18+ Create ,
19+ }
1420
1521/// EVMC message (call) flags.
1622pub type MessageFlags = ffi:: evmc_flags ;
@@ -24,6 +30,14 @@ pub type StorageStatus = ffi::evmc_storage_status;
2430/// EVMC VM revision.
2531pub type Revision = ffi:: evmc_revision ;
2632
33+ impl From < ffi:: evmc_call_kind > for MessageKind {
34+ fn from ( kind : ffi:: evmc_call_kind ) -> Self {
35+ match kind {
36+ EVM_CALL => MessageKind :: Call ,
37+ }
38+ }
39+ }
40+
2741#[ cfg( test) ]
2842mod tests {
2943 use super :: * ;
@@ -52,16 +66,16 @@ mod tests {
5266
5367 #[ test]
5468 fn message_kind ( ) {
55- assert_eq ! ( MessageKind :: EVMC_CALL , ffi:: evmc_call_kind:: EVMC_CALL ) ;
69+ assert_eq ! ( MessageKind :: Call , ffi:: evmc_call_kind:: EVMC_CALL ) ;
5670 assert_eq ! (
57- MessageKind :: EVMC_CALLCODE ,
71+ MessageKind :: CallCode ,
5872 ffi:: evmc_call_kind:: EVMC_CALLCODE
5973 ) ;
6074 assert_eq ! (
61- MessageKind :: EVMC_DELEGATECALL ,
75+ MessageKind :: DelegateCall ,
6276 ffi:: evmc_call_kind:: EVMC_DELEGATECALL
6377 ) ;
64- assert_eq ! ( MessageKind :: EVMC_CREATE , ffi:: evmc_call_kind:: EVMC_CREATE ) ;
78+ assert_eq ! ( MessageKind :: Create , ffi:: evmc_call_kind:: EVMC_CREATE ) ;
6579 }
6680
6781 #[ test]
0 commit comments