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
#[cfg(test)]
#[macro_export]
macro_rules! check_func_signature {
    ($interface:ident, $signature:expr) => {
        assert_eq!(
            $interface::FUNC_SIG.to_vec(),
            $signature.from_hex::<Vec<u8>>().unwrap(),
            "Test solidity signature for {}",
            $interface::NAME_AND_PARAMS
        );
    };
}

#[cfg(test)]
#[macro_export]
macro_rules! check_event_signature {
    ($interface:ident, $signature:expr) => {
        assert_eq!(
            $interface::EVENT_SIG.0.to_vec(),
            $signature.from_hex::<Vec<u8>>().unwrap(),
            "Test solidity event signature"
        );
    };
}

#[macro_export]
macro_rules! internal_bail {
    ($e:expr) => {
        return Err(cfx_vm_types::Error::InternalContract($e.into()));
    };
    ($fmt:expr, $($arg:tt)+) => {
        return Err(cfx_vm_types::Error::InternalContract(format!($fmt, $($arg)+)));
    };
}