@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
@@ -63,17 +63,6 @@
63
63
  "name": "InvalidRange",
64
64
  "type": "error"
65
65
  },
66
- {
67
- "inputs": [
68
- {
69
- "internalType": "uint256",
70
- "name": "provided",
71
- "type": "uint256"
72
- }
73
- ],
74
- "name": "MaxWalletsZero",
75
- "type": "error"
76
- },
77
66
  {
78
67
  "inputs": [
79
68
  {
@@ -146,31 +135,6 @@
146
135
  {
147
136
  "anonymous": false,
148
137
  "inputs": [
149
- {
150
- "indexed": false,
151
- "internalType": "uint64",
152
- "name": "version",
153
- "type": "uint64"
154
- }
155
- ],
156
- "name": "Initialized",
157
- "type": "event"
158
- },
159
- {
160
- "anonymous": false,
161
- "inputs": [
162
- {
163
- "indexed": true,
164
- "internalType": "enum RuntimeRBAC.RoleConfigActionType",
165
- "name": "actionType",
166
- "type": "uint8"
167
- },
168
- {
169
- "indexed": true,
170
- "internalType": "bytes32",
171
- "name": "roleHash",
172
- "type": "bytes32"
173
- },
174
138
  {
175
139
  "indexed": true,
176
140
  "internalType": "bytes4",
@@ -184,113 +148,20 @@
184
148
  "type": "bytes"
185
149
  }
186
150
  ],
187
- "name": "RoleConfigApplied",
188
- "type": "event"
189
- },
190
- {
191
- "anonymous": false,
192
- "inputs": [
193
- {
194
- "indexed": true,
195
- "internalType": "uint256",
196
- "name": "txId",
197
- "type": "uint256"
198
- },
199
- {
200
- "indexed": true,
201
- "internalType": "bytes32",
202
- "name": "operationType",
203
- "type": "bytes32"
204
- },
205
- {
206
- "indexed": true,
207
- "internalType": "address",
208
- "name": "approver",
209
- "type": "address"
210
- }
211
- ],
212
- "name": "TransactionApproved",
151
+ "name": "ComponentEvent",
213
152
  "type": "event"
214
153
  },
215
154
  {
216
155
  "anonymous": false,
217
156
  "inputs": [
218
- {
219
- "indexed": true,
220
- "internalType": "uint256",
221
- "name": "txId",
222
- "type": "uint256"
223
- },
224
- {
225
- "indexed": true,
226
- "internalType": "bytes32",
227
- "name": "operationType",
228
- "type": "bytes32"
229
- },
230
- {
231
- "indexed": true,
232
- "internalType": "address",
233
- "name": "canceller",
234
- "type": "address"
235
- }
236
- ],
237
- "name": "TransactionCancelled",
238
- "type": "event"
239
- },
240
- {
241
- "anonymous": false,
242
- "inputs": [
243
- {
244
- "indexed": true,
245
- "internalType": "uint256",
246
- "name": "txId",
247
- "type": "uint256"
248
- },
249
- {
250
- "indexed": true,
251
- "internalType": "bytes32",
252
- "name": "operationType",
253
- "type": "bytes32"
254
- },
255
- {
256
- "indexed": false,
257
- "internalType": "bool",
258
- "name": "success",
259
- "type": "bool"
260
- }
261
- ],
262
- "name": "TransactionExecuted",
263
- "type": "event"
264
- },
265
- {
266
- "anonymous": false,
267
- "inputs": [
268
- {
269
- "indexed": true,
270
- "internalType": "uint256",
271
- "name": "txId",
272
- "type": "uint256"
273
- },
274
- {
275
- "indexed": true,
276
- "internalType": "address",
277
- "name": "requester",
278
- "type": "address"
279
- },
280
- {
281
- "indexed": true,
282
- "internalType": "bytes32",
283
- "name": "operationType",
284
- "type": "bytes32"
285
- },
286
157
  {
287
158
  "indexed": false,
288
- "internalType": "uint256",
289
- "name": "releaseTime",
290
- "type": "uint256"
159
+ "internalType": "uint64",
160
+ "name": "version",
161
+ "type": "uint64"
291
162
  }
292
163
  ],
293
- "name": "TransactionRequested",
164
+ "name": "Initialized",
294
165
  "type": "event"
295
166
  },
296
167
  {
@@ -939,6 +810,100 @@
939
810
  "stateMutability": "view",
940
811
  "type": "function"
941
812
  },
813
+ {
814
+ "inputs": [
815
+ {
816
+ "internalType": "bytes4",
817
+ "name": "functionSelector",
818
+ "type": "bytes4"
819
+ }
820
+ ],
821
+ "name": "getFunctionSchema",
822
+ "outputs": [
823
+ {
824
+ "components": [
825
+ {
826
+ "internalType": "string",
827
+ "name": "functionSignature",
828
+ "type": "string"
829
+ },
830
+ {
831
+ "internalType": "bytes4",
832
+ "name": "functionSelector",
833
+ "type": "bytes4"
834
+ },
835
+ {
836
+ "internalType": "bytes32",
837
+ "name": "operationType",
838
+ "type": "bytes32"
839
+ },
840
+ {
841
+ "internalType": "string",
842
+ "name": "operationName",
843
+ "type": "string"
844
+ },
845
+ {
846
+ "internalType": "uint16",
847
+ "name": "supportedActionsBitmap",
848
+ "type": "uint16"
849
+ },
850
+ {
851
+ "internalType": "bool",
852
+ "name": "isProtected",
853
+ "type": "bool"
854
+ },
855
+ {
856
+ "internalType": "bytes4[]",
857
+ "name": "handlerForSelectors",
858
+ "type": "bytes4[]"
859
+ }
860
+ ],
861
+ "internalType": "struct EngineBlox.FunctionSchema",
862
+ "name": "",
863
+ "type": "tuple"
864
+ }
865
+ ],
866
+ "stateMutability": "view",
867
+ "type": "function"
868
+ },
869
+ {
870
+ "inputs": [
871
+ {
872
+ "internalType": "bytes4",
873
+ "name": "functionSelector",
874
+ "type": "bytes4"
875
+ }
876
+ ],
877
+ "name": "getFunctionWhitelistTargets",
878
+ "outputs": [
879
+ {
880
+ "internalType": "address[]",
881
+ "name": "",
882
+ "type": "address[]"
883
+ }
884
+ ],
885
+ "stateMutability": "view",
886
+ "type": "function"
887
+ },
888
+ {
889
+ "inputs": [
890
+ {
891
+ "internalType": "bytes4",
892
+ "name": "functionSelector",
893
+ "type": "bytes4"
894
+ }
895
+ ],
896
+ "name": "getHooks",
897
+ "outputs": [
898
+ {
899
+ "internalType": "address[]",
900
+ "name": "hooks",
901
+ "type": "address[]"
902
+ }
903
+ ],
904
+ "stateMutability": "view",
905
+ "type": "function"
906
+ },
942
907
  {
943
908
  "inputs": [],
944
909
  "name": "getPendingTransactions",
@@ -1329,6 +1294,25 @@
1329
1294
  "stateMutability": "view",
1330
1295
  "type": "function"
1331
1296
  },
1297
+ {
1298
+ "inputs": [
1299
+ {
1300
+ "internalType": "bytes32",
1301
+ "name": "roleHash",
1302
+ "type": "bytes32"
1303
+ }
1304
+ ],
1305
+ "name": "getWalletsInRole",
1306
+ "outputs": [
1307
+ {
1308
+ "internalType": "address[]",
1309
+ "name": "",
1310
+ "type": "address[]"
1311
+ }
1312
+ ],
1313
+ "stateMutability": "view",
1314
+ "type": "function"
1315
+ },
1332
1316
  {
1333
1317
  "inputs": [
1334
1318
  {
@@ -1455,37 +1439,6 @@
1455
1439
  "stateMutability": "view",
1456
1440
  "type": "function"
1457
1441
  },
1458
- {
1459
- "inputs": [
1460
- {
1461
- "components": [
1462
- {
1463
- "internalType": "enum RuntimeRBAC.RoleConfigActionType",
1464
- "name": "actionType",
1465
- "type": "uint8"
1466
- },
1467
- {
1468
- "internalType": "bytes",
1469
- "name": "data",
1470
- "type": "bytes"
1471
- }
1472
- ],
1473
- "internalType": "struct RuntimeRBAC.RoleConfigAction[]",
1474
- "name": "actions",
1475
- "type": "tuple[]"
1476
- }
1477
- ],
1478
- "name": "roleConfigBatchExecutionParams",
1479
- "outputs": [
1480
- {
1481
- "internalType": "bytes",
1482
- "name": "",
1483
- "type": "bytes"
1484
- }
1485
- ],
1486
- "stateMutability": "pure",
1487
- "type": "function"
1488
- },
1489
1442
  {
1490
1443
  "inputs": [
1491
1444
  {
@@ -1662,105 +1615,9 @@
1662
1615
  "name": "roleConfigBatchRequestAndApprove",
1663
1616
  "outputs": [
1664
1617
  {
1665
- "components": [
1666
- {
1667
- "internalType": "uint256",
1668
- "name": "txId",
1669
- "type": "uint256"
1670
- },
1671
- {
1672
- "internalType": "uint256",
1673
- "name": "releaseTime",
1674
- "type": "uint256"
1675
- },
1676
- {
1677
- "internalType": "enum EngineBlox.TxStatus",
1678
- "name": "status",
1679
- "type": "uint8"
1680
- },
1681
- {
1682
- "components": [
1683
- {
1684
- "internalType": "address",
1685
- "name": "requester",
1686
- "type": "address"
1687
- },
1688
- {
1689
- "internalType": "address",
1690
- "name": "target",
1691
- "type": "address"
1692
- },
1693
- {
1694
- "internalType": "uint256",
1695
- "name": "value",
1696
- "type": "uint256"
1697
- },
1698
- {
1699
- "internalType": "uint256",
1700
- "name": "gasLimit",
1701
- "type": "uint256"
1702
- },
1703
- {
1704
- "internalType": "bytes32",
1705
- "name": "operationType",
1706
- "type": "bytes32"
1707
- },
1708
- {
1709
- "internalType": "bytes4",
1710
- "name": "executionSelector",
1711
- "type": "bytes4"
1712
- },
1713
- {
1714
- "internalType": "bytes",
1715
- "name": "executionParams",
1716
- "type": "bytes"
1717
- }
1718
- ],
1719
- "internalType": "struct EngineBlox.TxParams",
1720
- "name": "params",
1721
- "type": "tuple"
1722
- },
1723
- {
1724
- "internalType": "bytes32",
1725
- "name": "message",
1726
- "type": "bytes32"
1727
- },
1728
- {
1729
- "internalType": "bytes",
1730
- "name": "result",
1731
- "type": "bytes"
1732
- },
1733
- {
1734
- "components": [
1735
- {
1736
- "internalType": "address",
1737
- "name": "recipient",
1738
- "type": "address"
1739
- },
1740
- {
1741
- "internalType": "uint256",
1742
- "name": "nativeTokenAmount",
1743
- "type": "uint256"
1744
- },
1745
- {
1746
- "internalType": "address",
1747
- "name": "erc20TokenAddress",
1748
- "type": "address"
1749
- },
1750
- {
1751
- "internalType": "uint256",
1752
- "name": "erc20TokenAmount",
1753
- "type": "uint256"
1754
- }
1755
- ],
1756
- "internalType": "struct EngineBlox.PaymentDetails",
1757
- "name": "payment",
1758
- "type": "tuple"
1759
- }
1760
- ],
1761
- "internalType": "struct EngineBlox.TxRecord",
1618
+ "internalType": "uint256",
1762
1619
  "name": "",
1763
- "type": "tuple"
1620
+ "type": "uint256"
1764
1621
  }
1765
1622
  ],
1766
1623
  "stateMutability": "nonpayable",
@@ -1771,7 +1628,7 @@
1771
1628
  {
1772
1629
  "components": [
1773
1630
  {
1774
- "internalType": "enum RuntimeRBAC.RoleConfigActionType",
1631
+ "internalType": "enum IRuntimeRBAC.RoleConfigActionType",
1775
1632
  "name": "actionType",
1776
1633
  "type": "uint8"
1777
1634
  },
@@ -1781,7 +1638,7 @@
1781
1638
  "type": "bytes"
1782
1639
  }
1783
1640
  ],
1784
- "internalType": "struct RuntimeRBAC.RoleConfigAction[]",
1641
+ "internalType": "struct IRuntimeRBAC.RoleConfigAction[]",
1785
1642
  "name": "actions",
1786
1643
  "type": "tuple[]"
1787
1644
  }
@@ -1790,68 +1647,5 @@
1790
1647
  "outputs": [],
1791
1648
  "stateMutability": "nonpayable",
1792
1649
  "type": "function"
1793
- },
1794
- {
1795
- "inputs": [
1796
- {
1797
- "internalType": "bytes4",
1798
- "name": "functionSelector",
1799
- "type": "bytes4"
1800
- }
1801
- ],
1802
- "name": "getFunctionSchema",
1803
- "outputs": [
1804
- {
1805
- "internalType": "string",
1806
- "name": "functionSignature",
1807
- "type": "string"
1808
- },
1809
- {
1810
- "internalType": "bytes4",
1811
- "name": "functionSelectorReturn",
1812
- "type": "bytes4"
1813
- },
1814
- {
1815
- "internalType": "bytes32",
1816
- "name": "operationType",
1817
- "type": "bytes32"
1818
- },
1819
- {
1820
- "internalType": "string",
1821
- "name": "operationName",
1822
- "type": "string"
1823
- },
1824
- {
1825
- "internalType": "enum EngineBlox.TxAction[]",
1826
- "name": "supportedActions",
1827
- "type": "uint8[]"
1828
- },
1829
- {
1830
- "internalType": "bool",
1831
- "name": "isProtected",
1832
- "type": "bool"
1833
- }
1834
- ],
1835
- "stateMutability": "view",
1836
- "type": "function"
1837
- },
1838
- {
1839
- "inputs": [
1840
- {
1841
- "internalType": "bytes32",
1842
- "name": "roleHash",
1843
- "type": "bytes32"
1844
- }
1845
- ],
1846
- "name": "getWalletsInRole",
1847
- "outputs": [
1848
- {
1849
- "internalType": "address[]",
1850
- "name": "",
1851
- "type": "address[]"
1852
- }
1853
- ],
1854
- "stateMutability": "view",
1855
- "type": "function"
1856
1650
  }
1857
1651
  ]