@rootzero/contracts 1.8.0 → 1.10.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/Core.sol +2 -1
  3. package/Endpoints.sol +2 -2
  4. package/Events.sol +2 -1
  5. package/README.md +14 -13
  6. package/blocks/Cursors.sol +61 -61
  7. package/blocks/Keys.sol +4 -4
  8. package/blocks/Schema.sol +8 -7
  9. package/blocks/Writers.sol +2 -2
  10. package/commands/Burn.sol +1 -1
  11. package/commands/Credit.sol +1 -1
  12. package/commands/Debit.sol +1 -1
  13. package/commands/Deposit.sol +2 -2
  14. package/commands/Payout.sol +2 -2
  15. package/commands/Provision.sol +2 -2
  16. package/commands/Recover.sol +21 -20
  17. package/commands/Relay.sol +11 -11
  18. package/commands/Withdraw.sol +1 -1
  19. package/commands/admin/AllowAssets.sol +1 -1
  20. package/commands/admin/Allowance.sol +1 -1
  21. package/commands/admin/Appoint.sol +1 -1
  22. package/commands/admin/Authorize.sol +1 -1
  23. package/commands/admin/DenyAssets.sol +1 -1
  24. package/commands/admin/Destroy.sol +1 -0
  25. package/commands/admin/Dismiss.sol +1 -1
  26. package/commands/admin/Execute.sol +2 -2
  27. package/commands/admin/Init.sol +1 -0
  28. package/commands/admin/Label.sol +1 -1
  29. package/commands/admin/Unauthorize.sol +1 -1
  30. package/core/Access.sol +1 -0
  31. package/core/Calls.sol +12 -1
  32. package/core/Payable.sol +8 -1
  33. package/core/Pipeline.sol +1 -1
  34. package/core/Portal.sol +39 -0
  35. package/docs/Schema.md +15 -11
  36. package/events/Dispatch.sol +5 -5
  37. package/events/Recovered.sol +17 -0
  38. package/events/Route.sol +5 -5
  39. package/events/Undelivered.sol +18 -0
  40. package/guards/Revoke.sol +1 -1
  41. package/package.json +1 -1
  42. package/ports/AllowAssets.sol +1 -1
  43. package/ports/Allowance.sol +1 -1
  44. package/ports/Credit.sol +1 -1
  45. package/ports/Debit.sol +1 -1
  46. package/ports/DenyAssets.sol +1 -1
  47. package/ports/Dispatch.sol +8 -8
  48. package/ports/Pipe.sol +1 -1
  49. package/ports/Redeem.sol +1 -1
  50. package/ports/Settle.sol +1 -1
  51. package/queries/Assets.sol +1 -1
  52. package/queries/Balances.sol +1 -1
  53. package/queries/Positions.sol +2 -1
  54. package/core/Commitments.sol +0 -19
  55. package/events/Commitment.sol +0 -19
package/ports/Redeem.sol CHANGED
@@ -30,7 +30,7 @@ abstract contract PortRedeemBalance is PortBase, RedeemBalanceHook {
30
30
  /// @param data BALANCE block stream supplied by the trusted peer.
31
31
  /// @return Empty response bytes.
32
32
  function portRedeemBalance(bytes calldata data) external onlyPeer returns (bytes memory) {
33
- (Cur memory input, , ) = Cursors.init(data, 1);
33
+ (Cur memory input, ) = Cursors.init(data, 1);
34
34
  uint peer = caller();
35
35
 
36
36
  while (input.i < input.len) {
package/ports/Settle.sol CHANGED
@@ -23,7 +23,7 @@ abstract contract PortSettle is PortBase, DebitAccountHook, CreditAccountHook {
23
23
  /// @param data TRANSACTION block stream supplied by the trusted peer.
24
24
  /// @return Empty response bytes.
25
25
  function portSettle(bytes calldata data) external onlyPeer returns (bytes memory) {
26
- (Cur memory state, , ) = Cursors.init(data, 1);
26
+ (Cur memory state, ) = Cursors.init(data, 1);
27
27
 
28
28
  while (state.i < state.len) {
29
29
  (bytes32 from, bytes32 to, bytes32 asset, uint amount) = state.unpackTransaction();
@@ -32,7 +32,7 @@ abstract contract AssetStatus is QueryBase, AssetStatusHook {
32
32
  /// @param request Block-stream request consisting of `#asset { bytes32 asset }` blocks.
33
33
  /// @return Block-stream response containing one `#status { uint code }` per asset block.
34
34
  function assetStatus(bytes calldata request) external view returns (bytes memory) {
35
- (Cur memory query, uint groups, ) = Cursors.init(request, 1);
35
+ (Cur memory query, uint groups) = Cursors.init(request, 1);
36
36
  Writer memory response = Writers.allocStatuses(groups);
37
37
 
38
38
  while (query.i < query.len) {
@@ -32,7 +32,7 @@ abstract contract GetBalances is QueryBase, GetBalancesHook {
32
32
  /// @param request Block-stream request consisting of `accountAsset(account, asset)*`.
33
33
  /// @return Block-stream response containing one `accountAmount(account, asset, amount)` block per request block.
34
34
  function getBalances(bytes calldata request) external view returns (bytes memory) {
35
- (Cur memory query, uint groups, ) = Cursors.init(request, 1);
35
+ (Cur memory query, uint groups) = Cursors.init(request, 1);
36
36
  Writer memory response = Writers.allocAccountAmounts(groups);
37
37
 
38
38
  while (query.i < query.len) {
@@ -29,6 +29,7 @@ abstract contract GetPositionHook {
29
29
  abstract contract GetPosition is QueryBase, GetPositionHook {
30
30
  uint public immutable getPositionId = queryId(this.getPosition.selector);
31
31
 
32
+ /// @param output Response schema advertised for each position output block.
32
33
  constructor(string memory output) {
33
34
  emit Query(host, getPositionId, "1:1", Forms.AccountAsset, output);
34
35
  emit Labeled(getPositionId, bytes32(0), "getPosition");
@@ -39,7 +40,7 @@ abstract contract GetPosition is QueryBase, GetPositionHook {
39
40
  /// @param request Block-stream request consisting of `accountAsset(account, asset)*`.
40
41
  /// @return Block-stream response containing one output-schema block per position block.
41
42
  function getPosition(bytes calldata request) external view returns (bytes memory) {
42
- (Cur memory query, uint groups, ) = Cursors.init(request, 1);
43
+ (Cur memory query, uint groups) = Cursors.init(request, 1);
43
44
  Writer memory response = Writers.allocAny(groups);
44
45
 
45
46
  while (query.i < query.len) {
@@ -1,19 +0,0 @@
1
- // SPDX-License-Identifier: GPL-3.0-only
2
- pragma solidity ^0.8.33;
3
-
4
- import {CommitmentEvent} from "../events/Commitment.sol";
5
-
6
- /// @title Commitments
7
- /// @notice On-chain registry for digest commitments.
8
- abstract contract Commitments is CommitmentEvent {
9
- /// @dev key -> committed digest.
10
- mapping(bytes32 key => bytes32 digest) internal commitments;
11
-
12
- /// @notice Clear the commitment under `key` and return the removed digest.
13
- /// @param key Commitment lookup key.
14
- /// @return digest Removed digest.
15
- function uncommit(bytes32 key) internal returns (bytes32 digest) {
16
- digest = commitments[key];
17
- delete commitments[key];
18
- }
19
- }
@@ -1,19 +0,0 @@
1
- // SPDX-License-Identifier: GPL-3.0-only
2
- pragma solidity ^0.8.33;
3
-
4
- import { EventEmitter } from "./Emitter.sol";
5
-
6
- /// @notice Emitted when a host-scoped commitment is updated.
7
- abstract contract CommitmentEvent is EventEmitter {
8
- string private constant ABI = "event Commitment(uint indexed host, bytes32 key, bytes32 digest, uint status)";
9
-
10
- /// @param host Host node ID that manages the commitment.
11
- /// @param key Commitment lookup key.
12
- /// @param digest Committed digest. Zero may be used when clearing without revealing the previous digest.
13
- /// @param status Commitment status. Zero means cleared; nonzero means committed or application-defined.
14
- event Commitment(uint indexed host, bytes32 key, bytes32 digest, uint status);
15
-
16
- constructor() {
17
- emit EventAbi(ABI);
18
- }
19
- }