@rootzero/contracts 1.12.0 → 1.13.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rootzero/contracts",
3
- "version": "1.12.0",
3
+ "version": "1.13.0",
4
4
  "description": "Solidity contracts and protocol building blocks for rootzero hosts and commands.",
5
5
  "private": false,
6
6
  "license": "GPL-3.0-only",
package/ports/Credit.sol CHANGED
@@ -2,7 +2,7 @@
2
2
  pragma solidity ^0.8.33;
3
3
 
4
4
  import { PortBase } from "./Base.sol";
5
- import { CreditAccountHook } from "../commands/Credit.sol";
5
+ import { CreditAccountHook } from "../core/Settlement.sol";
6
6
  import { Cursors, Cur, Keys } from "../Cursors.sol";
7
7
 
8
8
  using Cursors for Cur;
package/ports/Debit.sol CHANGED
@@ -2,7 +2,7 @@
2
2
  pragma solidity ^0.8.33;
3
3
 
4
4
  import { PortBase } from "./Base.sol";
5
- import { DebitAccountHook } from "../commands/Debit.sol";
5
+ import { DebitAccountHook } from "../core/Settlement.sol";
6
6
  import { Cursors, Cur, Keys } from "../Cursors.sol";
7
7
 
8
8
  using Cursors for Cur;
package/ports/Settle.sol CHANGED
@@ -2,8 +2,7 @@
2
2
  pragma solidity ^0.8.33;
3
3
 
4
4
  import { PortBase } from "./Base.sol";
5
- import { CreditAccountHook } from "../commands/Credit.sol";
6
- import { DebitAccountHook } from "../commands/Debit.sol";
5
+ import { Settlement } from "../core/Settlement.sol";
7
6
  import { Cursors, Cur, Keys } from "../Cursors.sol";
8
7
 
9
8
  using Cursors for Cur;
@@ -11,7 +10,7 @@ using Cursors for Cur;
11
10
  /// @title PortSettle
12
11
  /// @notice Port that consumes peer-supplied TRANSACTION blocks through debit and credit hooks.
13
12
  /// Each TRANSACTION block calls `debitAccount` for `from` and `creditAccount` for `to`.
14
- abstract contract PortSettle is PortBase, DebitAccountHook, CreditAccountHook {
13
+ abstract contract PortSettle is PortBase, Settlement {
15
14
  bytes32 private immutable descriptor;
16
15
 
17
16
  constructor() {
@@ -26,8 +25,7 @@ abstract contract PortSettle is PortBase, DebitAccountHook, CreditAccountHook {
26
25
 
27
26
  while (input.i < input.len) {
28
27
  (bytes32 from, bytes32 to, bytes32 asset, uint amount) = input.unpackTransaction();
29
- if (from != 0) debitAccount(from, asset, amount);
30
- if (to != 0) creditAccount(to, asset, amount);
28
+ settle(from, to, asset, amount);
31
29
  }
32
30
  return "";
33
31
  }