Skip to main content

neo_devpack_solidity/runtime/spec/
native_contracts.rs

1use super::*;
2
3/// Known native contract hashes as pushed onto the VM stack (UInt160 internal
4/// little-endian byte order).
5pub static NATIVE_CONTRACTS: Lazy<HashMap<[u8; 20], NativeContractSpec>> = Lazy::new(|| {
6    let entries = [
7        (
8            *b"\xf5\x63\xea\x40\xbc\x28\x3d\x4d\x0e\x05\xc4\x8e\xa3\x05\xb3\xf2\xa0\x73\x40\xef",
9            "NEO",
10        ),
11        (
12            *b"\xcf\x76\xe2\x8b\xd0\x06\x2c\x4a\x47\x8e\xe3\x55\x61\x01\x13\x19\xf3\xcf\xa4\xd2",
13            "GAS",
14        ),
15        (
16            *b"\xfd\xa3\xfa\x43\x46\xea\x53\x2a\x25\x8f\xc4\x97\xdd\xad\xdb\x64\x37\xc9\xfd\xff",
17            "ContractManagement",
18        ),
19        (
20            *b"\x7b\xc6\x81\xc0\xa1\xf7\x1d\x54\x34\x57\xb6\x8b\xba\x8d\x5f\x9f\xdd\x4e\x5e\xcc",
21            "Policy",
22        ),
23        (
24            *b"\x58\x87\x17\x11\x7e\x0a\xa8\x10\x72\xaf\xab\x71\xd2\xdd\x89\xfe\x7c\x4b\x92\xfe",
25            "Oracle",
26        ),
27        (
28            *b"\xe2\x95\xe3\x91\x54\x4c\x17\x8a\xd9\x4f\x03\xec\x4d\xcd\xff\x78\x53\x4e\xcf\x49",
29            "RoleManagement",
30        ),
31        (
32            *b"\x3b\xec\x35\x31\x11\x9b\xba\xd7\x6d\xd0\x44\x92\x0b\x0d\xe6\xc3\x19\x4f\xe1\xc1",
33            "Notary",
34        ),
35        (
36            *b"\xc1\x3a\x56\xc9\x83\x53\xa7\xea\x6a\x32\x4d\x9a\x83\x5d\x1b\x5b\xf2\x26\x63\x15",
37            "Treasury",
38        ),
39        (
40            *b"\xbe\xf2\x04\x31\x40\x36\x2a\x77\xc1\x50\x99\xc7\xe6\x4c\x12\xf7\x00\xb6\x65\xda",
41            "Ledger",
42        ),
43        (
44            *b"\x1b\xf5\x75\xab\x11\x89\x68\x84\x13\x61\x0a\x35\xa1\x28\x86\xcd\xe0\xb6\x6c\x72",
45            "CryptoLib",
46        ),
47        (
48            *b"\xc0\xef\x39\xce\xe0\xe4\xe9\x25\xc6\xc2\xa0\x6a\x79\xe1\x44\x0d\xd8\x6f\xce\xac",
49            "StdLib",
50        ),
51    ];
52
53    let mut m = HashMap::new();
54    for (hash, name) in entries {
55        m.insert(hash, NativeContractSpec { hash, name });
56    }
57    m
58});
59
60pub fn native_contract_name(hash: &[u8; 20]) -> Option<&'static str> {
61    NATIVE_CONTRACTS.get(hash).map(|s| s.name)
62}