neo_solidity/runtime/spec/
native_contracts.rs

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