-
Notifications
You must be signed in to change notification settings - Fork 50
/
constants.ts
78 lines (67 loc) · 4.8 KB
/
constants.ts
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { LSP2ArrayKey } from '@lukso/lsp2-contracts';
export const INTERFACE_ID_LSP6 = '0x23f34c62';
/**
* @dev values returned by the `isValidSignature` function of the ERC1271 standard.
* Can be used to check if a signature is valid or not.
*/
export const ERC1271_VALUES = {
SUCCESS_VALUE: '0x1626ba7e',
FAIL_VALUE: '0xffffffff',
};
export const LSP6DataKeys = {
// keccak256('AddressPermissions[]')
'AddressPermissions[]': {
length: '0xdf30dba06db6a30e65354d9a64c609861f089545ca58c6b4dbe31a5f338cb0e3',
index: '0xdf30dba06db6a30e65354d9a64c60986',
} as LSP2ArrayKey,
AddressPermissionsPrefix: '0x4b80742de2bf',
// AddressPermissions:Permissions:<address> + bytes2(0)
'AddressPermissions:Permissions': '0x4b80742de2bf82acb3630000',
// AddressPermissions:AllowedERC725YDataKeys:<address> + bytes2(0)
'AddressPermissions:AllowedERC725YDataKeys': '0x4b80742de2bf866c29110000',
// AddressPermissions:AllowedCalls:<address> + bytes2(0)
'AddressPermissions:AllowedCalls': '0x4b80742de2bf393a64c70000',
};
/**
* @dev The types of calls for an AllowedCall
*/
export const CALLTYPE = {
VALUE: '0x00000001',
CALL: '0x00000002',
STATICCALL: '0x00000004',
DELEGATECALL: '0x00000008',
};
/**
* @dev `bytes32` hex value for all the LSP6 permissions excluding REENTRANCY, DELEGATECALL and SUPER_DELEGATECALL for security (these should be set manually)
*/
export const ALL_PERMISSIONS = '0x00000000000000000000000000000000000000000000000000000000007f3f7f';
/**
* @dev List of `bytes32` permissions from LSP6 Key Manager Standard
*/
// prettier-ignore
export const PERMISSIONS = {
CHANGEOWNER: '0x0000000000000000000000000000000000000000000000000000000000000001', // .... .... .... .... .... 0001
ADDCONTROLLER: '0x0000000000000000000000000000000000000000000000000000000000000002', // .... .... .... .... .... 0010
EDITPERMISSIONS: '0x0000000000000000000000000000000000000000000000000000000000000004', // .... .... .... .... .... 0100
ADDEXTENSIONS: '0x0000000000000000000000000000000000000000000000000000000000000008', // .... .... .... .... .... 1000
CHANGEEXTENSIONS: '0x0000000000000000000000000000000000000000000000000000000000000010', // .... .... .... .... 0001 0000
ADDUNIVERSALRECEIVERDELEGATE: '0x0000000000000000000000000000000000000000000000000000000000000020', // .... .... .... .... 0010 0000
CHANGEUNIVERSALRECEIVERDELEGATE: '0x0000000000000000000000000000000000000000000000000000000000000040', // .... .... .... .... 0100 0000
REENTRANCY: '0x0000000000000000000000000000000000000000000000000000000000000080', // .... .... .... .... 1000 0000
SUPER_TRANSFERVALUE: '0x0000000000000000000000000000000000000000000000000000000000000100', // .... .... .... 0001 0000 0000
TRANSFERVALUE: '0x0000000000000000000000000000000000000000000000000000000000000200', // .... .... .... 0010 0000 0000
SUPER_CALL: '0x0000000000000000000000000000000000000000000000000000000000000400', // .... .... .... 0100 0000 0000
CALL: '0x0000000000000000000000000000000000000000000000000000000000000800', // .... .... .... 1000 0000 0000
SUPER_STATICCALL: '0x0000000000000000000000000000000000000000000000000000000000001000', // .... .... 0001 0000 0000 0000
STATICCALL: '0x0000000000000000000000000000000000000000000000000000000000002000', // .... .... 0010 0000 0000 0000
SUPER_DELEGATECALL: '0x0000000000000000000000000000000000000000000000000000000000004000', // .... .... 0100 0000 0000 0000
DELEGATECALL: '0x0000000000000000000000000000000000000000000000000000000000008000', // .... .... 1000 0000 0000 0000
DEPLOY: '0x0000000000000000000000000000000000000000000000000000000000010000', // .... 0001 0000 0000 0000 0000
SUPER_SETDATA: '0x0000000000000000000000000000000000000000000000000000000000020000', // .... 0010 0000 0000 0000 0000
SETDATA: '0x0000000000000000000000000000000000000000000000000000000000040000', // .... 0100 0000 0000 0000 0000
ENCRYPT: '0x0000000000000000000000000000000000000000000000000000000000080000', // .... 1000 0000 0000 0000 0000
DECRYPT: '0x0000000000000000000000000000000000000000000000000000000000100000', // 0001 0000 0000 0000 0000 0000
SIGN: '0x0000000000000000000000000000000000000000000000000000000000200000', // 0010 0000 0000 0000 0000 0000
EXECUTE_RELAY_CALL: '0x0000000000000000000000000000000000000000000000000000000000400000', // 0100 0000 0000 0000 0000 0000
}
export type LSP6PermissionName = keyof typeof PERMISSIONS;