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
pub mod account;
pub mod hash;
pub mod signature;
pub mod type_info;
use move_deps::{
move_core_types::{account_address::AccountAddress, identifier::Identifier},
move_vm_runtime::native_functions::{NativeFunction, NativeFunctionTable},
};
pub mod cost {
pub const APTOS_LIB_TYPE_OF: u64 = 10;
pub const APTOS_SIP_HASH: u64 = 10;
}
pub mod status {
pub const NFE_EXPECTED_STRUCT_TYPE_TAG: u64 = 0x1;
}
pub fn all_natives(framework_addr: AccountAddress) -> NativeFunctionTable {
const NATIVES: &[(&str, &str, NativeFunction)] = &[
("Account", "create_signer", account::native_create_signer),
(
"Signature",
"ed25519_validate_pubkey",
signature::native_ed25519_publickey_validation,
),
(
"Signature",
"ed25519_verify",
signature::native_ed25519_signature_verification,
),
("TypeInfo", "type_of", type_info::type_of),
("Hash", "sip_hash", hash::native_sip_hash),
];
NATIVES
.iter()
.cloned()
.map(|(module_name, func_name, func)| {
(
framework_addr,
Identifier::new(module_name).unwrap(),
Identifier::new(func_name).unwrap(),
func,
)
})
.collect()
}