@rootzero/contracts 0.9.2 → 0.9.4
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/Commands.sol +4 -3
- package/Core.sol +3 -0
- package/Cursors.sol +1 -1
- package/README.md +18 -24
- package/blocks/Cursors.sol +332 -335
- package/blocks/Keys.sol +38 -57
- package/blocks/Schema.sol +55 -114
- package/blocks/Writers.sol +361 -255
- package/commands/Base.sol +6 -48
- package/commands/Burn.sol +4 -4
- package/commands/Credit.sol +5 -4
- package/commands/Debit.sol +6 -5
- package/commands/Deposit.sol +17 -14
- package/commands/Provision.sol +17 -14
- package/commands/Transfer.sol +4 -4
- package/commands/Withdraw.sol +5 -4
- package/commands/admin/AllowAssets.sol +3 -3
- package/commands/admin/Allowance.sol +3 -3
- package/commands/admin/Authorize.sol +3 -3
- package/commands/admin/DenyAssets.sol +3 -3
- package/commands/admin/Destroy.sol +1 -1
- package/commands/admin/Execute.sol +9 -8
- package/commands/admin/Init.sol +1 -1
- package/commands/admin/Unauthorize.sol +3 -3
- package/core/Access.sol +11 -0
- package/core/Context.sol +11 -13
- package/core/Payable.sol +57 -0
- package/core/Pipeline.sol +55 -0
- package/docs/Schema.md +194 -0
- package/events/Admin.sol +5 -1
- package/events/Command.sol +6 -2
- package/events/Listing.sol +3 -4
- package/events/Peer.sol +5 -3
- package/events/Query.sol +5 -2
- package/package.json +2 -2
- package/peer/AllowAssets.sol +3 -3
- package/peer/Allowance.sol +3 -3
- package/peer/BalancePull.sol +43 -0
- package/peer/DenyAssets.sol +3 -3
- package/peer/Pipe.sol +38 -0
- package/peer/Settle.sol +3 -3
- package/queries/Assets.sol +7 -6
- package/queries/Balances.sol +5 -4
- package/queries/Positions.sol +14 -14
- package/utils/Value.sol +8 -14
- package/commands/Pipe.sol +0 -67
- package/docs/GETTING_STARTED.md +0 -294
- package/peer/AssetPull.sol +0 -43
package/blocks/Keys.sol
CHANGED
|
@@ -1,88 +1,69 @@
|
|
|
1
1
|
// SPDX-License-Identifier: GPL-3.0-only
|
|
2
2
|
pragma solidity ^0.8.33;
|
|
3
3
|
|
|
4
|
-
import {Forms} from "./Schema.sol";
|
|
5
|
-
|
|
6
4
|
/// @title Keys
|
|
7
5
|
/// @notice Block type selectors for the rootzero block stream protocol.
|
|
8
|
-
/// Each key is the first 4 bytes of the keccak256 hash of its
|
|
9
|
-
/// matching the ABI-selector convention used in `Schemas`.
|
|
6
|
+
/// Each key is the first 4 bytes of the keccak256 hash of its block name.
|
|
10
7
|
library Keys {
|
|
11
8
|
/// @dev Empty / unset key.
|
|
12
9
|
bytes4 constant Empty = bytes4(0);
|
|
13
10
|
/// @dev Input amount - (bytes32 asset, bytes32 meta, uint amount)
|
|
14
|
-
bytes4 constant Amount = bytes4(keccak256("amount
|
|
11
|
+
bytes4 constant Amount = bytes4(keccak256("#amount"));
|
|
15
12
|
/// @dev Ledger balance - (bytes32 asset, bytes32 meta, uint amount)
|
|
16
|
-
bytes4 constant Balance = bytes4(keccak256("balance
|
|
13
|
+
bytes4 constant Balance = bytes4(keccak256("#balance"));
|
|
17
14
|
/// @dev Host-scoped request amount - (uint host, bytes32 asset, bytes32 meta, uint amount)
|
|
18
|
-
bytes4 constant Allocation = bytes4(keccak256("allocation
|
|
15
|
+
bytes4 constant Allocation = bytes4(keccak256("#allocation"));
|
|
19
16
|
/// @dev Host-scoped allowance cap - (uint host, bytes32 asset, bytes32 meta, uint amount)
|
|
20
|
-
bytes4 constant Allowance = bytes4(keccak256("allowance
|
|
17
|
+
bytes4 constant Allowance = bytes4(keccak256("#allowance"));
|
|
21
18
|
/// @dev Cross-host custody state - (uint host, bytes32 asset, bytes32 meta, uint amount)
|
|
22
|
-
bytes4 constant Custody = bytes4(keccak256("custody
|
|
19
|
+
bytes4 constant Custody = bytes4(keccak256("#custody"));
|
|
23
20
|
/// @dev Minimum acceptable output - (bytes32 asset, bytes32 meta, uint amount)
|
|
24
|
-
bytes4 constant Minimum = bytes4(keccak256("minimum
|
|
21
|
+
bytes4 constant Minimum = bytes4(keccak256("#minimum"));
|
|
25
22
|
/// @dev Maximum allowable spend - (bytes32 asset, bytes32 meta, uint amount)
|
|
26
|
-
bytes4 constant Maximum = bytes4(keccak256("maximum
|
|
27
|
-
/// @dev Signed min/max bounds - (int min, int max)
|
|
28
|
-
bytes4 constant Bounds = bytes4(keccak256("bounds(int min, int max)"));
|
|
23
|
+
bytes4 constant Maximum = bytes4(keccak256("#maximum"));
|
|
29
24
|
/// @dev Fee amount - (uint amount)
|
|
30
|
-
bytes4 constant Fee = bytes4(keccak256("fee
|
|
31
|
-
/// @dev
|
|
32
|
-
bytes4 constant
|
|
33
|
-
/// @dev
|
|
34
|
-
bytes4 constant
|
|
35
|
-
/// @dev
|
|
36
|
-
bytes4 constant
|
|
37
|
-
/// @dev
|
|
38
|
-
bytes4 constant
|
|
39
|
-
/// @dev Extensible routing field - (bytes data); layout is command-defined
|
|
40
|
-
bytes4 constant Route = bytes4(keccak256("route(bytes data)"));
|
|
41
|
-
/// @dev Extensible list item field - (bytes data); layout is implementation-defined
|
|
42
|
-
bytes4 constant Item = bytes4(keccak256("item(bytes data)"));
|
|
43
|
-
/// @dev EVM-encoded payload field - (bytes data); layout follows standard ABI tuple encoding
|
|
44
|
-
bytes4 constant Evm = bytes4(keccak256("evm(bytes data)"));
|
|
45
|
-
/// @dev Extensible query field - (bytes data); layout is query-defined, key is always `Keys.Query`
|
|
46
|
-
bytes4 constant Query = bytes4(keccak256("query(bytes data)"));
|
|
47
|
-
/// @dev Extensible response field - (bytes data); layout is response-defined, key is always `Keys.Response`
|
|
48
|
-
bytes4 constant Response = bytes4(keccak256("response(bytes data)"));
|
|
49
|
-
/// @dev Plain scalar amount - (uint amount)
|
|
50
|
-
bytes4 constant Quantity = bytes4(keccak256("quantity(uint amount)"));
|
|
51
|
-
/// @dev Ratio or rate value - (uint value)
|
|
52
|
-
bytes4 constant Rate = bytes4(keccak256("rate(uint value)"));
|
|
25
|
+
bytes4 constant Fee = bytes4(keccak256("#fee"));
|
|
26
|
+
/// @dev List wrapper; payload is an embedded repeated block stream
|
|
27
|
+
bytes4 constant List = bytes4(keccak256("#list"));
|
|
28
|
+
/// @dev Extensible data field; layout is schema-defined
|
|
29
|
+
bytes4 constant Data = bytes4(keccak256("#data"));
|
|
30
|
+
/// @dev EVM-encoded payload field; layout follows standard ABI tuple encoding
|
|
31
|
+
bytes4 constant Evm = bytes4(keccak256("#evm"));
|
|
32
|
+
/// @dev Reserved raw bytes child block.
|
|
33
|
+
bytes4 constant Bytes = bytes4(keccak256("#bytes"));
|
|
53
34
|
/// @dev Account identifier - (bytes32 account)
|
|
54
|
-
bytes4 constant Account = bytes4(keccak256("account
|
|
35
|
+
bytes4 constant Account = bytes4(keccak256("#account"));
|
|
55
36
|
/// @dev Transfer payout request - (bytes32 account, bytes32 asset, bytes32 meta, uint amount)
|
|
56
|
-
bytes4 constant Payout = bytes4(keccak256("payout
|
|
37
|
+
bytes4 constant Payout = bytes4(keccak256("#payout"));
|
|
57
38
|
/// @dev Transfer record passed through the pipeline - (bytes32 from, bytes32 to, bytes32 asset, bytes32 meta, uint amount)
|
|
58
|
-
bytes4 constant Transaction = bytes4(
|
|
59
|
-
|
|
60
|
-
);
|
|
61
|
-
/// @dev
|
|
62
|
-
bytes4 constant
|
|
63
|
-
/// @dev
|
|
64
|
-
bytes4 constant
|
|
65
|
-
/// @dev Authentication proof - (uint cid, uint deadline, bytes proof); must appear last in its segment
|
|
66
|
-
bytes4 constant Auth = bytes4(keccak256("auth
|
|
39
|
+
bytes4 constant Transaction = bytes4(keccak256("#transaction"));
|
|
40
|
+
/// @dev Sub-command invocation - (uint target, uint value, #bytes as request)
|
|
41
|
+
bytes4 constant Step = bytes4(keccak256("#step"));
|
|
42
|
+
/// @dev Raw external call - (uint target, uint value, #bytes as payload)
|
|
43
|
+
bytes4 constant Call = bytes4(keccak256("#call"));
|
|
44
|
+
/// @dev Command context transport - (bytes32 account, #bytes as state, #bytes as request)
|
|
45
|
+
bytes4 constant Context = bytes4(keccak256("#context"));
|
|
46
|
+
/// @dev Authentication proof - (uint cid, uint deadline, #bytes as proof); must appear last in its segment
|
|
47
|
+
bytes4 constant Auth = bytes4(keccak256("#auth"));
|
|
67
48
|
/// @dev Asset descriptor without amount - (bytes32 asset, bytes32 meta)
|
|
68
|
-
bytes4 constant Asset = bytes4(keccak256("asset
|
|
49
|
+
bytes4 constant Asset = bytes4(keccak256("#asset"));
|
|
69
50
|
/// @dev Node identifier - (uint id)
|
|
70
|
-
bytes4 constant Node = bytes4(keccak256("node
|
|
51
|
+
bytes4 constant Node = bytes4(keccak256("#node"));
|
|
71
52
|
/// @dev Relayer bounty - (uint amount, bytes32 relayer)
|
|
72
|
-
bytes4 constant Bounty = bytes4(keccak256("bounty
|
|
53
|
+
bytes4 constant Bounty = bytes4(keccak256("#bounty"));
|
|
73
54
|
|
|
74
55
|
/// @dev Structural status form - (bool ok)
|
|
75
|
-
bytes4 constant Status = bytes4(keccak256(
|
|
56
|
+
bytes4 constant Status = bytes4(keccak256("#status"));
|
|
76
57
|
/// @dev Structural asset amount form - (bytes32 asset, bytes32 meta, uint amount)
|
|
77
|
-
bytes4 constant AssetAmount = bytes4(keccak256(
|
|
58
|
+
bytes4 constant AssetAmount = bytes4(keccak256("#assetAmount"));
|
|
78
59
|
/// @dev Structural account asset form - (bytes32 account, bytes32 asset, bytes32 meta)
|
|
79
|
-
bytes4 constant AccountAsset = bytes4(keccak256(
|
|
60
|
+
bytes4 constant AccountAsset = bytes4(keccak256("#accountAsset"));
|
|
80
61
|
/// @dev Structural account amount form - (bytes32 account, bytes32 asset, bytes32 meta, uint amount)
|
|
81
|
-
bytes4 constant AccountAmount = bytes4(keccak256(
|
|
62
|
+
bytes4 constant AccountAmount = bytes4(keccak256("#accountAmount"));
|
|
82
63
|
/// @dev Structural host amount form - (uint host, bytes32 asset, bytes32 meta, uint amount)
|
|
83
|
-
bytes4 constant HostAmount = bytes4(keccak256(
|
|
64
|
+
bytes4 constant HostAmount = bytes4(keccak256("#hostAmount"));
|
|
84
65
|
/// @dev Structural host account asset form - (uint host, bytes32 account, bytes32 asset, bytes32 meta)
|
|
85
|
-
bytes4 constant HostAccountAsset = bytes4(keccak256(
|
|
66
|
+
bytes4 constant HostAccountAsset = bytes4(keccak256("#hostAccountAsset"));
|
|
86
67
|
/// @dev Structural host account amount form - (uint host, bytes32 account, bytes32 asset, bytes32 meta, uint amount)
|
|
87
|
-
bytes4 constant HostAccountAmount = bytes4(keccak256(
|
|
68
|
+
bytes4 constant HostAccountAmount = bytes4(keccak256("#hostAccountAmount"));
|
|
88
69
|
}
|
package/blocks/Schema.sol
CHANGED
|
@@ -3,81 +3,26 @@ pragma solidity ^0.8.33;
|
|
|
3
3
|
|
|
4
4
|
// Block stream:
|
|
5
5
|
// - encoding is [bytes4 key][bytes4 payloadLen][payload]
|
|
6
|
-
// - `payloadLen` covers only the block payload
|
|
6
|
+
// - `payloadLen` is big-endian and covers only the block payload
|
|
7
7
|
// - payload layout is block-specific
|
|
8
8
|
//
|
|
9
|
-
//
|
|
10
|
-
// -
|
|
11
|
-
// -
|
|
12
|
-
// -
|
|
13
|
-
// -
|
|
14
|
-
// -
|
|
15
|
-
// -
|
|
16
|
-
//
|
|
17
|
-
// -
|
|
18
|
-
// -
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
// -
|
|
22
|
-
// -
|
|
23
|
-
// -
|
|
24
|
-
// -
|
|
25
|
-
// -
|
|
26
|
-
// - `name = a + b` introduces a named frame item with a local key derived from the raw input string
|
|
27
|
-
// - `bundle = a & b` introduces an anonymous child bundle item
|
|
28
|
-
// - `frame = a + b` introduces an anonymous child frame item, like `bundle = ...` and `list = ...`
|
|
29
|
-
// - postfix `[]` marks a repeated list in the simple suffix form, e.g. `asset(...)[]`
|
|
30
|
-
// - `name[] = a & b` introduces a named list with a local key derived from the raw input string
|
|
31
|
-
// - `list = a & b` introduces an anonymous list whose repeated item is the bundled shape `a & b`
|
|
32
|
-
// - empty entries are ignored, but structural markers are preserved after normalization
|
|
33
|
-
// - grouping parentheses are not part of the DSL; parentheses are only used in block field lists
|
|
34
|
-
// - `+` binds tighter than `&`, so `a & b + c` normalizes as `a & (b + c)`
|
|
35
|
-
// - if `&` appears, the result remains a bundle even when only one non-empty child remains
|
|
36
|
-
// - if `+` appears, the result remains a frame even when only one non-empty child remains
|
|
37
|
-
// - after ignoring empty entries, repeated adjacent separators collapse while preserving bundle/frame/list shape
|
|
38
|
-
// - bundled blocks preserve member order, so `a & b` differs from `b & a`
|
|
39
|
-
// - a bundle block's self payload is an embedded normal block stream of its bundled members
|
|
40
|
-
// - bundled members keep their ordinary block encoding, so dynamic blocks are allowed inside bundles
|
|
41
|
-
// - a list block's self payload is an embedded normal block stream representing the repeated items
|
|
42
|
-
// - a frame block's self payload is the concatenated payload fields of its framed members
|
|
43
|
-
// - framed members do not keep their ordinary block headers; the emitted schema defines the frame layout
|
|
44
|
-
// - framed members must be fixed-layout block forms because frame payloads contain no child lengths or block keys
|
|
45
|
-
// - frames may be bundled like ordinary block items, but bundles/lists cannot be framed
|
|
46
|
-
// - top-level blocks of the same type should be grouped together
|
|
47
|
-
// - primary / driving blocks should appear before auxiliary blocks
|
|
48
|
-
// - `route(<fields...>)`, `item(<fields...>)`, `evm(<fields...>)`, `query(<fields...>)`,
|
|
49
|
-
// and `response(<fields...>)` are reserved extensible schema forms whose keys are always
|
|
50
|
-
// `Keys.Route`, `Keys.Item`, `Keys.Evm`, `Keys.Query`, and `Keys.Response` respectively
|
|
51
|
-
// - these extensible forms work like dynamic `bytes` blocks: they may carry arbitrary
|
|
52
|
-
// payload bytes while keeping one fixed key per semantic block type
|
|
53
|
-
// - `evm(<fields...>)` differs from bundle/list payloads: its bytes are not an embedded block stream
|
|
54
|
-
// - `evm(uint foo, uint bar)` is a schema declaration only; on-chain the block key is still `Keys.Evm`
|
|
55
|
-
// and the payload can be decoded from `bytes data` using the local runtime's native decoder
|
|
56
|
-
// - on EVM, `evm(bool flag)` occupies one full 32-byte ABI word, exactly like `abi.encode(flag)`
|
|
57
|
-
// - anonymous `&` compiles to a `Keys.Bundle` block whose self payload is the bundled member block stream
|
|
58
|
-
// - anonymous `[]` compiles to a `Keys.List` block whose self payload is the repeated item block stream
|
|
59
|
-
// - anonymous `+` compiles to a `Keys.Frame` block whose self payload is the framed member payload fields
|
|
60
|
-
// - named lists, bundles, and frames use bytes4(keccak256(bytes(rawSchemaInput))) as their block key
|
|
61
|
-
// - named structural keys are custom/local identifiers, not global protocol keys; formatting is part of identity
|
|
62
|
-
// - `asset(...)[]` means a list whose repeated item is the block `asset(...)`
|
|
63
|
-
// - `steps[] = asset(...) & account(...)` means a named list whose repeated item is the bundle
|
|
64
|
-
// `asset(...) & account(...)`
|
|
65
|
-
// - `payment = amount(...) + fee(...)` means a named frame whose payload is
|
|
66
|
-
// `asset | meta | amount | fee` and whose on-chain key is derived from that raw schema string
|
|
67
|
-
// - `amount(...) & fee(...) + account(...)` means `amount(...) & (fee(...) + account(...))`;
|
|
68
|
-
// it compiles to a bundle containing one amount block followed by one frame block
|
|
69
|
-
// - `bundle = account(...) & evm(bytes routeData)` means an anonymous child bundle with those bundled members
|
|
70
|
-
// - `frame = amount(...) + fee(...)` means an anonymous child frame with those framed payload fields
|
|
71
|
-
// - `list = asset(...) & account(...)` means an anonymous child list whose repeated item is the
|
|
72
|
-
// bundle `asset(...) & account(...)`
|
|
73
|
-
// - `"amount(...) &"` and `"& amount(...)"` both normalize to a bundle containing one `amount(...)` child
|
|
74
|
-
// - `"amount(...) +"` and `"+ amount(...)"` both normalize to a frame containing one `amount(...)` payload
|
|
75
|
-
// - canonical blocks are `amount(...)` for request amounts, `balance(...)` for state balances,
|
|
76
|
-
// `allocation(...)` for host-scoped provision requests, `allowance(...)` for host-scoped caps,
|
|
77
|
-
// `custody(...)` for host-scoped state,
|
|
78
|
-
// `minimum(...)` for result floors, `maximum(...)` for spend ceilings, and `quantity(...)`
|
|
79
|
-
// for plain scalar amounts
|
|
80
|
-
// - `auth(uint cid, uint deadline, bytes proof)` is a proof-separator block and must be emitted last
|
|
9
|
+
// Schema:
|
|
10
|
+
// - blocks are written as `#name { fields }`
|
|
11
|
+
// - a block without braces has no payload, e.g. `#unit`
|
|
12
|
+
// - commas separate siblings at every level
|
|
13
|
+
// - braces define parent-child boundaries
|
|
14
|
+
// - top-level item 0 is the prime item; later top-level items are globals
|
|
15
|
+
// - prime items may repeat at top level for batching
|
|
16
|
+
// - `maybe #x { ... }` marks an optional block item
|
|
17
|
+
// - `many #x { ... }` emits one generic list block containing repeated `#x` items
|
|
18
|
+
// - fixed fields are packed in declaration order
|
|
19
|
+
// - blocks have fixed fields followed by a dynamic child-block tail
|
|
20
|
+
// - child block tails are embedded directly, without an extra stream wrapper
|
|
21
|
+
// - `#bytes` is a reserved child block that stores raw bytes and has no body
|
|
22
|
+
// - generic `#data` uses the stable key derived from `#data`
|
|
23
|
+
// - generic lists use the stable key derived from `#list`
|
|
24
|
+
// - keys are derived from block names, e.g. bytes4(keccak256("#amount"))
|
|
25
|
+
// - see `docs/Schema.md` for the full working spec
|
|
81
26
|
//
|
|
82
27
|
// Pipeline state:
|
|
83
28
|
// - `balance(...)` and `custody(...)` are live, linear state in the active command pipeline
|
|
@@ -91,56 +36,52 @@ pragma solidity ^0.8.33;
|
|
|
91
36
|
//
|
|
92
37
|
// Signed blocks:
|
|
93
38
|
// - an authenticated input segment ends with one trailing AUTH block
|
|
94
|
-
// - auth is typically grouped with the signed payload in one bundle, with AUTH as the final member
|
|
95
39
|
// - only the final AUTH is treated specially; earlier AUTH blocks remain ordinary signed bytes
|
|
96
40
|
// - the signed slice runs from the segment start through the AUTH head, excluding only AUTH proof bytes
|
|
97
41
|
// - `cid` binds the signature to one command; `deadline` acts as expiry and nonce
|
|
98
42
|
// - current helpers assume proof layout `[bytes20 signer][bytes65 sig]`
|
|
99
43
|
|
|
100
44
|
/// @title Schemas
|
|
101
|
-
/// @notice Human-readable
|
|
102
|
-
/// These strings
|
|
103
|
-
///
|
|
45
|
+
/// @notice Human-readable schema string constants for each block type.
|
|
46
|
+
/// These strings describe payload layout for discovery events and docs; block
|
|
47
|
+
/// keys are derived only from block names.
|
|
104
48
|
library Schemas {
|
|
105
|
-
string constant
|
|
106
|
-
string constant
|
|
107
|
-
string constant
|
|
108
|
-
string constant
|
|
109
|
-
string constant
|
|
110
|
-
string constant
|
|
111
|
-
string constant
|
|
112
|
-
string constant
|
|
113
|
-
string constant
|
|
114
|
-
string constant
|
|
115
|
-
string constant
|
|
116
|
-
string constant
|
|
117
|
-
string constant
|
|
118
|
-
string constant
|
|
119
|
-
string constant
|
|
120
|
-
string constant
|
|
121
|
-
string constant
|
|
122
|
-
string constant
|
|
123
|
-
string constant
|
|
124
|
-
string constant
|
|
125
|
-
string constant
|
|
126
|
-
string constant
|
|
127
|
-
string constant Evm = "evm
|
|
128
|
-
string constant Query = "query(bytes data)";
|
|
129
|
-
string constant Response = "response(bytes data)";
|
|
130
|
-
string constant Break = "break()";
|
|
49
|
+
string constant Unit = "#unit";
|
|
50
|
+
string constant Node = "#node { uint id }";
|
|
51
|
+
string constant Account = "#account { bytes32 account }";
|
|
52
|
+
string constant Asset = "#asset { bytes32 asset, bytes32 meta }";
|
|
53
|
+
string constant Balance = "#balance { bytes32 asset, bytes32 meta, uint amount }";
|
|
54
|
+
string constant Amount = "#amount { bytes32 asset, bytes32 meta, uint amount }";
|
|
55
|
+
string constant Minimum = "#minimum { bytes32 asset, bytes32 meta, uint amount }";
|
|
56
|
+
string constant Maximum = "#maximum { bytes32 asset, bytes32 meta, uint amount }";
|
|
57
|
+
string constant Custody = "#custody { uint host, bytes32 asset, bytes32 meta, uint amount }";
|
|
58
|
+
string constant Payout = "#payout { bytes32 account, bytes32 asset, bytes32 meta, uint amount }";
|
|
59
|
+
string constant Allocation = "#allocation { uint host, bytes32 asset, bytes32 meta, uint amount }";
|
|
60
|
+
string constant Allowance = "#allowance { uint host, bytes32 asset, bytes32 meta, uint amount }";
|
|
61
|
+
string constant Transaction = "#transaction { bytes32 from, bytes32 to, bytes32 asset, bytes32 meta, uint amount }";
|
|
62
|
+
string constant Call = "#call { uint target, uint value, #bytes as payload }";
|
|
63
|
+
string constant Step = "#step { uint target, uint value, #bytes as request }";
|
|
64
|
+
string constant Context = "#context { bytes32 account, uint value, #bytes as state, #bytes as request }";
|
|
65
|
+
string constant Bounty = "#bounty { uint amount, bytes32 relayer }";
|
|
66
|
+
string constant Fee = "#fee { uint amount }";
|
|
67
|
+
string constant Auth = "#auth { uint cid, uint deadline, #bytes as proof }";
|
|
68
|
+
string constant Bytes = "#bytes";
|
|
69
|
+
string constant Data = "#data";
|
|
70
|
+
string constant List = "#list";
|
|
71
|
+
string constant Evm = "#evm";
|
|
131
72
|
}
|
|
132
73
|
|
|
133
74
|
/// @title Forms
|
|
134
75
|
/// @notice Reusable structural block schemas for core tuple shapes.
|
|
135
76
|
/// These describe payload form without assigning command or query semantics.
|
|
136
77
|
library Forms {
|
|
137
|
-
string constant Status = "status
|
|
138
|
-
string constant AssetAmount = "assetAmount
|
|
139
|
-
string constant AccountAsset = "accountAsset
|
|
140
|
-
string constant AccountAmount = "accountAmount
|
|
141
|
-
string constant HostAmount = "hostAmount
|
|
142
|
-
string constant HostAccountAsset = "hostAccountAsset
|
|
143
|
-
string constant HostAccountAmount = "hostAccountAmount
|
|
78
|
+
string constant Status = "#status { bool ok }";
|
|
79
|
+
string constant AssetAmount = "#assetAmount { bytes32 asset, bytes32 meta, uint amount }";
|
|
80
|
+
string constant AccountAsset = "#accountAsset { bytes32 account, bytes32 asset, bytes32 meta }";
|
|
81
|
+
string constant AccountAmount = "#accountAmount { bytes32 account, bytes32 asset, bytes32 meta, uint amount }";
|
|
82
|
+
string constant HostAmount = "#hostAmount { uint host, bytes32 asset, bytes32 meta, uint amount }";
|
|
83
|
+
string constant HostAccountAsset = "#hostAccountAsset { uint host, bytes32 account, bytes32 asset, bytes32 meta }";
|
|
84
|
+
string constant HostAccountAmount = "#hostAccountAmount { uint host, bytes32 account, bytes32 asset, bytes32 meta, uint amount }";
|
|
144
85
|
}
|
|
145
86
|
|
|
146
87
|
/// @title Sizes
|
|
@@ -162,14 +103,14 @@ library Sizes {
|
|
|
162
103
|
uint constant B160 = Header + 5 * Word;
|
|
163
104
|
/// @dev AUTH proof segment only: 20-byte signer + 65-byte signature = 85 bytes
|
|
164
105
|
uint constant Proof = 85;
|
|
165
|
-
/// @dev AUTH block: 8 header + 32 cid + 32 deadline + 85 proof =
|
|
166
|
-
uint constant Auth = B64 + Proof;
|
|
106
|
+
/// @dev AUTH block: 8 header + 32 cid + 32 deadline + nested BYTES block with 85-byte proof = 165 bytes
|
|
107
|
+
uint constant Auth = B64 + Header + Proof;
|
|
108
|
+
/// @dev STATUS block: 8 header + 1 bool byte = 9 bytes
|
|
109
|
+
uint constant Status = Header + 1;
|
|
167
110
|
/// @dev AMOUNT block: 8 header + 32 asset + 32 meta + 32 amount = 104 bytes
|
|
168
111
|
uint constant Amount = B96;
|
|
169
112
|
/// @dev BALANCE block: 8 header + 32 asset + 32 meta + 32 amount = 104 bytes
|
|
170
113
|
uint constant Balance = B96;
|
|
171
|
-
/// @dev BOUNDS block: 8 header + 32 min + 32 max = 72 bytes
|
|
172
|
-
uint constant Bounds = B64;
|
|
173
114
|
/// @dev FEE block: 8 header + 32 amount = 40 bytes
|
|
174
115
|
uint constant Fee = B32;
|
|
175
116
|
/// @dev BOUNTY block: 8 header + 32 amount + 32 relayer = 72 bytes
|