@bloxchain/contracts 1.0.0-alpha → 1.0.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/README.md +55 -18
  2. package/abi/{ControlBlox.abi.json → AccountBlox.abi.json} +699 -2974
  3. package/abi/BareBlox.abi.json +127 -90
  4. package/abi/BaseStateMachine.abi.json +127 -90
  5. package/abi/EngineBlox.abi.json +11 -31
  6. package/abi/GuardController.abi.json +217 -895
  7. package/abi/GuardControllerDefinitions.abi.json +380 -0
  8. package/abi/IDefinition.abi.json +19 -0
  9. package/abi/RoleBlox.abi.json +818 -2404
  10. package/abi/RuntimeRBAC.abi.json +122 -328
  11. package/abi/RuntimeRBACDefinitions.abi.json +243 -0
  12. package/abi/SecureBlox.abi.json +620 -1952
  13. package/abi/SecureOwnable.abi.json +469 -1801
  14. package/abi/SecureOwnableDefinitions.abi.json +57 -0
  15. package/abi/SimpleRWA20.abi.json +486 -1999
  16. package/abi/SimpleRWA20Definitions.abi.json +19 -0
  17. package/abi/SimpleVault.abi.json +884 -2685
  18. package/abi/SimpleVaultDefinitions.abi.json +19 -0
  19. package/components/README.md +8 -0
  20. package/core/access/RuntimeRBAC.sol +184 -0
  21. package/core/access/interface/IRuntimeRBAC.sol +55 -0
  22. package/{contracts/core → core}/access/lib/definitions/RuntimeRBACDefinitions.sol +121 -1
  23. package/{contracts/core → core}/base/BaseStateMachine.sol +187 -54
  24. package/{contracts/core → core}/base/interface/IBaseStateMachine.sol +7 -0
  25. package/{contracts/core → core}/execution/GuardController.sol +89 -155
  26. package/{contracts/core → core}/execution/interface/IGuardController.sol +52 -12
  27. package/{contracts/core → core}/execution/lib/definitions/GuardControllerDefinitions.sol +91 -2
  28. package/{contracts/core → core}/lib/EngineBlox.sol +167 -64
  29. package/{contracts → core/lib}/interfaces/IDefinition.sol +15 -6
  30. package/{contracts → core/lib}/interfaces/IEventForwarder.sol +1 -1
  31. package/{contracts → core/lib}/utils/SharedValidation.sol +490 -486
  32. package/core/pattern/Account.sol +75 -0
  33. package/core/research/BloxchainWallet.sol +133 -0
  34. package/core/research/FactoryBlox/FactoryBlox.sol +344 -0
  35. package/core/research/FactoryBlox/FactoryBloxDefinitions.sol +144 -0
  36. package/core/research/erc1155-blox/ERC1155Blox.sol +170 -0
  37. package/core/research/erc1155-blox/lib/definitions/ERC1155BloxDefinitions.sol +203 -0
  38. package/core/research/erc20-blox/ERC20Blox.sol +135 -0
  39. package/core/research/erc20-blox/lib/definitions/ERC20BloxDefinitions.sol +185 -0
  40. package/core/research/erc721-blox/ERC721Blox.sol +131 -0
  41. package/core/research/erc721-blox/lib/definitions/ERC721BloxDefinitions.sol +172 -0
  42. package/core/research/lending-blox/.gitkeep +1 -0
  43. package/core/research/p2p-blox/P2PBlox.sol +266 -0
  44. package/core/research/p2p-blox/README.md +85 -0
  45. package/core/research/p2p-blox/lib/definitions/P2PBloxDefinitions.sol +19 -0
  46. package/{contracts/core → core}/security/SecureOwnable.sol +390 -419
  47. package/{contracts/core → core}/security/interface/ISecureOwnable.sol +27 -40
  48. package/{contracts/core → core}/security/lib/definitions/SecureOwnableDefinitions.sol +786 -757
  49. package/package.json +49 -47
  50. package/standards/README.md +12 -0
  51. package/standards/behavior/ICopyable.sol +36 -0
  52. package/standards/hooks/IOnActionHook.sol +21 -0
  53. package/contracts/core/access/RuntimeRBAC.sol +0 -344
  54. package/contracts/core/access/interface/IRuntimeRBAC.sol +0 -108
  55. package/contracts/interfaces/IOnActionHook.sol +0 -79
@@ -58,122 +58,46 @@
58
58
  "type": "error"
59
59
  },
60
60
  {
61
- "anonymous": false,
62
- "inputs": [
63
- {
64
- "indexed": false,
65
- "internalType": "uint64",
66
- "name": "version",
67
- "type": "uint64"
68
- }
69
- ],
70
- "name": "Initialized",
71
- "type": "event"
72
- },
73
- {
74
- "anonymous": false,
75
61
  "inputs": [
76
62
  {
77
- "indexed": true,
78
- "internalType": "uint256",
79
- "name": "txId",
80
- "type": "uint256"
81
- },
82
- {
83
- "indexed": true,
84
63
  "internalType": "bytes32",
85
- "name": "operationType",
64
+ "name": "resourceId",
86
65
  "type": "bytes32"
87
- },
88
- {
89
- "indexed": true,
90
- "internalType": "address",
91
- "name": "approver",
92
- "type": "address"
93
- }
94
- ],
95
- "name": "TransactionApproved",
96
- "type": "event"
97
- },
98
- {
99
- "anonymous": false,
100
- "inputs": [
101
- {
102
- "indexed": true,
103
- "internalType": "uint256",
104
- "name": "txId",
105
- "type": "uint256"
106
- },
107
- {
108
- "indexed": true,
109
- "internalType": "bytes32",
110
- "name": "operationType",
111
- "type": "bytes32"
112
- },
113
- {
114
- "indexed": true,
115
- "internalType": "address",
116
- "name": "canceller",
117
- "type": "address"
118
66
  }
119
67
  ],
120
- "name": "TransactionCancelled",
121
- "type": "event"
68
+ "name": "ResourceNotFound",
69
+ "type": "error"
122
70
  },
123
71
  {
124
72
  "anonymous": false,
125
73
  "inputs": [
126
74
  {
127
75
  "indexed": true,
128
- "internalType": "uint256",
129
- "name": "txId",
130
- "type": "uint256"
131
- },
132
- {
133
- "indexed": true,
134
- "internalType": "bytes32",
135
- "name": "operationType",
136
- "type": "bytes32"
76
+ "internalType": "bytes4",
77
+ "name": "functionSelector",
78
+ "type": "bytes4"
137
79
  },
138
80
  {
139
81
  "indexed": false,
140
- "internalType": "bool",
141
- "name": "success",
142
- "type": "bool"
82
+ "internalType": "bytes",
83
+ "name": "data",
84
+ "type": "bytes"
143
85
  }
144
86
  ],
145
- "name": "TransactionExecuted",
87
+ "name": "ComponentEvent",
146
88
  "type": "event"
147
89
  },
148
90
  {
149
91
  "anonymous": false,
150
92
  "inputs": [
151
- {
152
- "indexed": true,
153
- "internalType": "uint256",
154
- "name": "txId",
155
- "type": "uint256"
156
- },
157
- {
158
- "indexed": true,
159
- "internalType": "address",
160
- "name": "requester",
161
- "type": "address"
162
- },
163
- {
164
- "indexed": true,
165
- "internalType": "bytes32",
166
- "name": "operationType",
167
- "type": "bytes32"
168
- },
169
93
  {
170
94
  "indexed": false,
171
- "internalType": "uint256",
172
- "name": "releaseTime",
173
- "type": "uint256"
95
+ "internalType": "uint64",
96
+ "name": "version",
97
+ "type": "uint64"
174
98
  }
175
99
  ],
176
- "name": "TransactionRequested",
100
+ "name": "Initialized",
177
101
  "type": "event"
178
102
  },
179
103
  {
@@ -822,6 +746,100 @@
822
746
  "stateMutability": "view",
823
747
  "type": "function"
824
748
  },
749
+ {
750
+ "inputs": [
751
+ {
752
+ "internalType": "bytes4",
753
+ "name": "functionSelector",
754
+ "type": "bytes4"
755
+ }
756
+ ],
757
+ "name": "getFunctionSchema",
758
+ "outputs": [
759
+ {
760
+ "components": [
761
+ {
762
+ "internalType": "string",
763
+ "name": "functionSignature",
764
+ "type": "string"
765
+ },
766
+ {
767
+ "internalType": "bytes4",
768
+ "name": "functionSelector",
769
+ "type": "bytes4"
770
+ },
771
+ {
772
+ "internalType": "bytes32",
773
+ "name": "operationType",
774
+ "type": "bytes32"
775
+ },
776
+ {
777
+ "internalType": "string",
778
+ "name": "operationName",
779
+ "type": "string"
780
+ },
781
+ {
782
+ "internalType": "uint16",
783
+ "name": "supportedActionsBitmap",
784
+ "type": "uint16"
785
+ },
786
+ {
787
+ "internalType": "bool",
788
+ "name": "isProtected",
789
+ "type": "bool"
790
+ },
791
+ {
792
+ "internalType": "bytes4[]",
793
+ "name": "handlerForSelectors",
794
+ "type": "bytes4[]"
795
+ }
796
+ ],
797
+ "internalType": "struct EngineBlox.FunctionSchema",
798
+ "name": "",
799
+ "type": "tuple"
800
+ }
801
+ ],
802
+ "stateMutability": "view",
803
+ "type": "function"
804
+ },
805
+ {
806
+ "inputs": [
807
+ {
808
+ "internalType": "bytes4",
809
+ "name": "functionSelector",
810
+ "type": "bytes4"
811
+ }
812
+ ],
813
+ "name": "getFunctionWhitelistTargets",
814
+ "outputs": [
815
+ {
816
+ "internalType": "address[]",
817
+ "name": "",
818
+ "type": "address[]"
819
+ }
820
+ ],
821
+ "stateMutability": "view",
822
+ "type": "function"
823
+ },
824
+ {
825
+ "inputs": [
826
+ {
827
+ "internalType": "bytes4",
828
+ "name": "functionSelector",
829
+ "type": "bytes4"
830
+ }
831
+ ],
832
+ "name": "getHooks",
833
+ "outputs": [
834
+ {
835
+ "internalType": "address[]",
836
+ "name": "hooks",
837
+ "type": "address[]"
838
+ }
839
+ ],
840
+ "stateMutability": "view",
841
+ "type": "function"
842
+ },
825
843
  {
826
844
  "inputs": [],
827
845
  "name": "getPendingTransactions",
@@ -1212,6 +1230,25 @@
1212
1230
  "stateMutability": "view",
1213
1231
  "type": "function"
1214
1232
  },
1233
+ {
1234
+ "inputs": [
1235
+ {
1236
+ "internalType": "bytes32",
1237
+ "name": "roleHash",
1238
+ "type": "bytes32"
1239
+ }
1240
+ ],
1241
+ "name": "getWalletsInRole",
1242
+ "outputs": [
1243
+ {
1244
+ "internalType": "address[]",
1245
+ "name": "",
1246
+ "type": "address[]"
1247
+ }
1248
+ ],
1249
+ "stateMutability": "view",
1250
+ "type": "function"
1251
+ },
1215
1252
  {
1216
1253
  "inputs": [
1217
1254
  {
@@ -58,122 +58,46 @@
58
58
  "type": "error"
59
59
  },
60
60
  {
61
- "anonymous": false,
62
- "inputs": [
63
- {
64
- "indexed": false,
65
- "internalType": "uint64",
66
- "name": "version",
67
- "type": "uint64"
68
- }
69
- ],
70
- "name": "Initialized",
71
- "type": "event"
72
- },
73
- {
74
- "anonymous": false,
75
61
  "inputs": [
76
62
  {
77
- "indexed": true,
78
- "internalType": "uint256",
79
- "name": "txId",
80
- "type": "uint256"
81
- },
82
- {
83
- "indexed": true,
84
63
  "internalType": "bytes32",
85
- "name": "operationType",
64
+ "name": "resourceId",
86
65
  "type": "bytes32"
87
- },
88
- {
89
- "indexed": true,
90
- "internalType": "address",
91
- "name": "approver",
92
- "type": "address"
93
- }
94
- ],
95
- "name": "TransactionApproved",
96
- "type": "event"
97
- },
98
- {
99
- "anonymous": false,
100
- "inputs": [
101
- {
102
- "indexed": true,
103
- "internalType": "uint256",
104
- "name": "txId",
105
- "type": "uint256"
106
- },
107
- {
108
- "indexed": true,
109
- "internalType": "bytes32",
110
- "name": "operationType",
111
- "type": "bytes32"
112
- },
113
- {
114
- "indexed": true,
115
- "internalType": "address",
116
- "name": "canceller",
117
- "type": "address"
118
66
  }
119
67
  ],
120
- "name": "TransactionCancelled",
121
- "type": "event"
68
+ "name": "ResourceNotFound",
69
+ "type": "error"
122
70
  },
123
71
  {
124
72
  "anonymous": false,
125
73
  "inputs": [
126
74
  {
127
75
  "indexed": true,
128
- "internalType": "uint256",
129
- "name": "txId",
130
- "type": "uint256"
131
- },
132
- {
133
- "indexed": true,
134
- "internalType": "bytes32",
135
- "name": "operationType",
136
- "type": "bytes32"
76
+ "internalType": "bytes4",
77
+ "name": "functionSelector",
78
+ "type": "bytes4"
137
79
  },
138
80
  {
139
81
  "indexed": false,
140
- "internalType": "bool",
141
- "name": "success",
142
- "type": "bool"
82
+ "internalType": "bytes",
83
+ "name": "data",
84
+ "type": "bytes"
143
85
  }
144
86
  ],
145
- "name": "TransactionExecuted",
87
+ "name": "ComponentEvent",
146
88
  "type": "event"
147
89
  },
148
90
  {
149
91
  "anonymous": false,
150
92
  "inputs": [
151
- {
152
- "indexed": true,
153
- "internalType": "uint256",
154
- "name": "txId",
155
- "type": "uint256"
156
- },
157
- {
158
- "indexed": true,
159
- "internalType": "address",
160
- "name": "requester",
161
- "type": "address"
162
- },
163
- {
164
- "indexed": true,
165
- "internalType": "bytes32",
166
- "name": "operationType",
167
- "type": "bytes32"
168
- },
169
93
  {
170
94
  "indexed": false,
171
- "internalType": "uint256",
172
- "name": "releaseTime",
173
- "type": "uint256"
95
+ "internalType": "uint64",
96
+ "name": "version",
97
+ "type": "uint64"
174
98
  }
175
99
  ],
176
- "name": "TransactionRequested",
100
+ "name": "Initialized",
177
101
  "type": "event"
178
102
  },
179
103
  {
@@ -234,6 +158,25 @@
234
158
  "stateMutability": "view",
235
159
  "type": "function"
236
160
  },
161
+ {
162
+ "inputs": [
163
+ {
164
+ "internalType": "bytes4",
165
+ "name": "functionSelector",
166
+ "type": "bytes4"
167
+ }
168
+ ],
169
+ "name": "getHooks",
170
+ "outputs": [
171
+ {
172
+ "internalType": "address[]",
173
+ "name": "hooks",
174
+ "type": "address[]"
175
+ }
176
+ ],
177
+ "stateMutability": "view",
178
+ "type": "function"
179
+ },
237
180
  {
238
181
  "inputs": [
239
182
  {
@@ -1142,6 +1085,25 @@
1142
1085
  "stateMutability": "view",
1143
1086
  "type": "function"
1144
1087
  },
1088
+ {
1089
+ "inputs": [
1090
+ {
1091
+ "internalType": "bytes32",
1092
+ "name": "roleHash",
1093
+ "type": "bytes32"
1094
+ }
1095
+ ],
1096
+ "name": "getWalletsInRole",
1097
+ "outputs": [
1098
+ {
1099
+ "internalType": "address[]",
1100
+ "name": "",
1101
+ "type": "address[]"
1102
+ }
1103
+ ],
1104
+ "stateMutability": "view",
1105
+ "type": "function"
1106
+ },
1145
1107
  {
1146
1108
  "inputs": [
1147
1109
  {
@@ -1185,6 +1147,62 @@
1185
1147
  "stateMutability": "view",
1186
1148
  "type": "function"
1187
1149
  },
1150
+ {
1151
+ "inputs": [
1152
+ {
1153
+ "internalType": "bytes4",
1154
+ "name": "functionSelector",
1155
+ "type": "bytes4"
1156
+ }
1157
+ ],
1158
+ "name": "getFunctionSchema",
1159
+ "outputs": [
1160
+ {
1161
+ "components": [
1162
+ {
1163
+ "internalType": "string",
1164
+ "name": "functionSignature",
1165
+ "type": "string"
1166
+ },
1167
+ {
1168
+ "internalType": "bytes4",
1169
+ "name": "functionSelector",
1170
+ "type": "bytes4"
1171
+ },
1172
+ {
1173
+ "internalType": "bytes32",
1174
+ "name": "operationType",
1175
+ "type": "bytes32"
1176
+ },
1177
+ {
1178
+ "internalType": "string",
1179
+ "name": "operationName",
1180
+ "type": "string"
1181
+ },
1182
+ {
1183
+ "internalType": "uint16",
1184
+ "name": "supportedActionsBitmap",
1185
+ "type": "uint16"
1186
+ },
1187
+ {
1188
+ "internalType": "bool",
1189
+ "name": "isProtected",
1190
+ "type": "bool"
1191
+ },
1192
+ {
1193
+ "internalType": "bytes4[]",
1194
+ "name": "handlerForSelectors",
1195
+ "type": "bytes4[]"
1196
+ }
1197
+ ],
1198
+ "internalType": "struct EngineBlox.FunctionSchema",
1199
+ "name": "",
1200
+ "type": "tuple"
1201
+ }
1202
+ ],
1203
+ "stateMutability": "view",
1204
+ "type": "function"
1205
+ },
1188
1206
  {
1189
1207
  "inputs": [
1190
1208
  {
@@ -1304,5 +1322,24 @@
1304
1322
  ],
1305
1323
  "stateMutability": "view",
1306
1324
  "type": "function"
1325
+ },
1326
+ {
1327
+ "inputs": [
1328
+ {
1329
+ "internalType": "bytes4",
1330
+ "name": "functionSelector",
1331
+ "type": "bytes4"
1332
+ }
1333
+ ],
1334
+ "name": "getFunctionWhitelistTargets",
1335
+ "outputs": [
1336
+ {
1337
+ "internalType": "address[]",
1338
+ "name": "",
1339
+ "type": "address[]"
1340
+ }
1341
+ ],
1342
+ "stateMutability": "view",
1343
+ "type": "function"
1307
1344
  }
1308
1345
  ]
@@ -64,11 +64,6 @@
64
64
  "internalType": "bytes4",
65
65
  "name": "functionSelector",
66
66
  "type": "bytes4"
67
- },
68
- {
69
- "internalType": "string",
70
- "name": "functionSignature",
71
- "type": "string"
72
67
  }
73
68
  ],
74
69
  "name": "ContractFunctionMustBeProtected",
@@ -338,6 +333,17 @@
338
333
  "name": "MaxRolesExceeded",
339
334
  "type": "error"
340
335
  },
336
+ {
337
+ "inputs": [
338
+ {
339
+ "internalType": "uint256",
340
+ "name": "provided",
341
+ "type": "uint256"
342
+ }
343
+ ],
344
+ "name": "MaxWalletsZero",
345
+ "type": "error"
346
+ },
341
347
  {
342
348
  "inputs": [
343
349
  {
@@ -670,32 +676,6 @@
670
676
  "stateMutability": "view",
671
677
  "type": "function"
672
678
  },
673
- {
674
- "inputs": [],
675
- "name": "UPDATE_PAYMENT_OPERATION",
676
- "outputs": [
677
- {
678
- "internalType": "bytes32",
679
- "name": "",
680
- "type": "bytes32"
681
- }
682
- ],
683
- "stateMutability": "view",
684
- "type": "function"
685
- },
686
- {
687
- "inputs": [],
688
- "name": "UPDATE_PAYMENT_SELECTOR",
689
- "outputs": [
690
- {
691
- "internalType": "bytes4",
692
- "name": "",
693
- "type": "bytes4"
694
- }
695
- ],
696
- "stateMutability": "view",
697
- "type": "function"
698
- },
699
679
  {
700
680
  "inputs": [],
701
681
  "name": "VERSION_MAJOR",