@rootzero/contracts 0.9.9 → 1.0.0
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.
- package/Endpoints.sol +2 -0
- package/Events.sol +1 -0
- package/README.md +19 -18
- package/blocks/Cursors.sol +54 -26
- package/blocks/Keys.sol +6 -0
- package/blocks/Schema.sol +4 -2
- package/blocks/Writers.sol +4 -4
- package/commands/Burn.sol +4 -1
- package/commands/Credit.sol +4 -1
- package/commands/Debit.sol +4 -1
- package/commands/Deposit.sol +8 -2
- package/commands/Payout.sol +7 -3
- package/commands/Provision.sol +8 -2
- package/commands/Relay.sol +58 -0
- package/commands/Withdraw.sol +4 -1
- package/commands/admin/AllowAssets.sol +6 -1
- package/commands/admin/Allowance.sol +4 -1
- package/commands/admin/Appoint.sol +4 -1
- package/commands/admin/Authorize.sol +4 -1
- package/commands/admin/DenyAssets.sol +6 -1
- package/commands/admin/Destroy.sol +4 -2
- package/commands/admin/Dismiss.sol +4 -1
- package/commands/admin/Execute.sol +5 -2
- package/commands/admin/Init.sol +4 -2
- package/commands/admin/Unauthorize.sol +4 -1
- package/core/Host.sol +10 -1
- package/core/Pipeline.sol +2 -1
- package/core/Runtime.sol +3 -3
- package/events/Admin.sol +5 -5
- package/events/Chain.sol +20 -0
- package/events/Command.sol +5 -5
- package/guards/Revoke.sol +1 -1
- package/package.json +1 -1
- package/peer/AllowAssets.sol +3 -1
- package/peer/Allowance.sol +3 -1
- package/peer/BalancePull.sol +3 -1
- package/peer/DenyAssets.sol +3 -1
- package/peer/Dispatch.sol +51 -0
- package/peer/Pipe.sol +5 -3
- package/peer/Settle.sol +3 -1
- package/queries/Assets.sol +1 -1
- package/queries/Balances.sol +1 -1
- package/queries/Positions.sol +1 -1
- package/utils/Accounts.sol +1 -34
- package/utils/Assets.sol +21 -21
- package/utils/Ids.sol +12 -2
- package/utils/Layout.sol +21 -17
- package/utils/Utils.sol +2 -2
package/utils/Layout.sol
CHANGED
|
@@ -6,19 +6,24 @@ pragma solidity ^0.8.33;
|
|
|
6
6
|
/// layout of 256-bit IDs used throughout the rootzero protocol.
|
|
7
7
|
///
|
|
8
8
|
/// IDs are structured as:
|
|
9
|
-
/// `[
|
|
10
|
-
/// where
|
|
9
|
+
/// `[uint32 type][uint32 chainid][192-bit payload]`
|
|
10
|
+
/// where `type` is `[uint8 vm][uint8 width][uint8 category][uint8 subtype]`.
|
|
11
11
|
library Layout {
|
|
12
12
|
// -------------------------------------------------------------------------
|
|
13
|
-
//
|
|
13
|
+
// VM and data-width tags (top 2 bytes of the ID type field)
|
|
14
14
|
// -------------------------------------------------------------------------
|
|
15
15
|
|
|
16
|
-
/// @dev
|
|
17
|
-
|
|
16
|
+
/// @dev EVM-compatible value; payloads are built around 20-byte addresses.
|
|
17
|
+
uint8 constant Evm = 0x01;
|
|
18
|
+
/// @dev 32-byte ID; no paired metadata word is required.
|
|
19
|
+
uint8 constant Width32 = 0x20;
|
|
20
|
+
/// @dev 64-byte ID; a paired metadata word completes the identity.
|
|
21
|
+
uint8 constant Width64 = 0x40;
|
|
22
|
+
|
|
18
23
|
/// @dev 32-byte EVM-compatible value; lower 20 bytes hold an address.
|
|
19
|
-
uint16 constant Evm32 =
|
|
24
|
+
uint16 constant Evm32 = (uint16(Evm) << 8) | uint16(Width32);
|
|
20
25
|
/// @dev 64-byte EVM-compatible value; used when a paired metadata word completes the identity.
|
|
21
|
-
uint16 constant Evm64 =
|
|
26
|
+
uint16 constant Evm64 = (uint16(Evm) << 8) | uint16(Width64);
|
|
22
27
|
|
|
23
28
|
// -------------------------------------------------------------------------
|
|
24
29
|
// Category tags (uint8, third byte of the ID type field)
|
|
@@ -41,30 +46,29 @@ library Layout {
|
|
|
41
46
|
uint8 constant Guardian = 0x02;
|
|
42
47
|
/// @dev User account — chain-agnostic, backed by an EVM address.
|
|
43
48
|
uint8 constant User = 0x03;
|
|
44
|
-
/// @dev Keccak account — opaque 28-byte keccak commitment.
|
|
45
|
-
uint8 constant Keccak = 0x04;
|
|
46
|
-
|
|
47
49
|
// -------------------------------------------------------------------------
|
|
48
50
|
// Node subtype tags (uint8, fourth byte of the ID type field)
|
|
49
51
|
// -------------------------------------------------------------------------
|
|
50
52
|
|
|
53
|
+
/// @dev Node is a chain/domain identifier.
|
|
54
|
+
uint8 constant Chain = 0x01;
|
|
51
55
|
/// @dev Node is a host contract.
|
|
52
|
-
uint8 constant Host =
|
|
56
|
+
uint8 constant Host = 0x02;
|
|
53
57
|
/// @dev Node is a command contract.
|
|
54
|
-
uint8 constant Command =
|
|
58
|
+
uint8 constant Command = 0x03;
|
|
55
59
|
/// @dev Node is a peer contract.
|
|
56
|
-
uint8 constant Peer =
|
|
60
|
+
uint8 constant Peer = 0x04;
|
|
57
61
|
/// @dev Node is a query contract.
|
|
58
|
-
uint8 constant Query =
|
|
62
|
+
uint8 constant Query = 0x05;
|
|
59
63
|
/// @dev Node is a guardian-only direct action.
|
|
60
|
-
uint8 constant Guard =
|
|
64
|
+
uint8 constant Guard = 0x06;
|
|
61
65
|
|
|
62
66
|
// -------------------------------------------------------------------------
|
|
63
67
|
// Asset subtype tags (uint8, fourth byte of the ID type field)
|
|
64
68
|
// -------------------------------------------------------------------------
|
|
65
69
|
|
|
66
|
-
/// @dev Native chain
|
|
67
|
-
uint8 constant
|
|
70
|
+
/// @dev Native chain coin/token asset.
|
|
71
|
+
uint8 constant Native = 0x01;
|
|
68
72
|
/// @dev ERC-20 fungible token; lower 20 bytes of the ID hold the contract address.
|
|
69
73
|
uint8 constant Erc20 = 0x02;
|
|
70
74
|
/// @dev ERC-721 non-fungible token; lower 20 bytes of the ID hold the collection address.
|
package/utils/Utils.sol
CHANGED
|
@@ -4,9 +4,9 @@ pragma solidity ^0.8.33;
|
|
|
4
4
|
// Basis-points denominator: 10_000 BPS == 100.00%.
|
|
5
5
|
uint16 constant MAX_BPS = 10_000;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
/// @dev Thrown by max* helpers when a value exceeds the target integer width.
|
|
8
8
|
error ValueOverflow();
|
|
9
|
-
|
|
9
|
+
/// @dev Thrown by `divisible` when `n` is not evenly divisible by `divisor`.
|
|
10
10
|
error NotDivisible();
|
|
11
11
|
|
|
12
12
|
/// @notice Assert that `value` fits in uint8 and return it unchanged.
|