@rootzero/contracts 1.3.0 → 1.4.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/CHANGELOG.md CHANGED
@@ -3,6 +3,19 @@
3
3
  Until the protocol reaches integration-stable status, minor versions may include
4
4
  breaking API changes. Breaking changes are called out explicitly.
5
5
 
6
+ ## 1.4.0
7
+
8
+ ### Breaking Changes
9
+
10
+ - Replaced the `Chain` discovery event with `Commander(uint indexed host, uint chain, bytes32 native, bytes32 admin)`.
11
+ - Removed the `Transfer` flow event; account flows should be represented with `Spent` and `Received`.
12
+ - Renamed the indexed `Labeled` event parameter from `id` to `entity` in the published ABI string.
13
+
14
+ ### Added
15
+
16
+ - Added `Route(uint indexed host, uint chain, uint context)` for generic cross-chain route discovery.
17
+ - Added `Actions.Refund` for unused payable command value returned through settlement hooks.
18
+
6
19
  ## 1.3.0
7
20
 
8
21
  ### Breaking Changes
package/Events.sol CHANGED
@@ -8,7 +8,7 @@ import { AdminEvent } from "./events/Admin.sol";
8
8
  import { AssetStatusEvent } from "./events/Asset.sol";
9
9
  import { Actions } from "./utils/Actions.sol";
10
10
  import { BalanceEvent } from "./events/Balance.sol";
11
- import { ChainEvent } from "./events/Chain.sol";
11
+ import { CommanderEvent } from "./events/Commander.sol";
12
12
  import { CommandEvent } from "./events/Command.sol";
13
13
  import { PositionEvent } from "./events/Position.sol";
14
14
  import { ReceivedEvent } from "./events/Received.sol";
@@ -22,8 +22,8 @@ import { NodeEvent } from "./events/Node.sol";
22
22
  import { PeerEvent } from "./events/Peer.sol";
23
23
  import { QueryEvent } from "./events/Query.sol";
24
24
  import { RootedEvent } from "./events/Rooted.sol";
25
+ import { RouteEvent } from "./events/Route.sol";
25
26
  import { SpentEvent } from "./events/Spent.sol";
26
- import { TransferEvent } from "./events/Transfer.sol";
27
27
  import { UnlockedEvent } from "./events/Unlocked.sol";
28
28
 
29
29
 
@@ -0,0 +1,19 @@
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 commander is announced for a chain/domain.
7
+ abstract contract CommanderEvent is EventEmitter {
8
+ string private constant ABI = "event Commander(uint indexed host, uint chain, bytes32 native, bytes32 admin)";
9
+
10
+ /// @param host Commander host node ID for the chain.
11
+ /// @param chain Chain/domain node ID.
12
+ /// @param native Native asset ID for the chain.
13
+ /// @param admin Admin account for the commander host on the chain.
14
+ event Commander(uint indexed host, uint chain, bytes32 native, bytes32 admin);
15
+
16
+ constructor() {
17
+ emit EventAbi(ABI);
18
+ }
19
+ }
@@ -3,17 +3,17 @@ pragma solidity ^0.8.33;
3
3
 
4
4
  import {EventEmitter} from "./Emitter.sol";
5
5
 
6
- /// @notice Emitted to attach a human-readable namespaced label to a node ID.
6
+ /// @notice Emitted to attach a human-readable namespaced label to an entity.
7
7
  /// @dev Labels are claims by the emitting contract. Any contract may emit a
8
- /// label for any ID, so off-chain indexers must decide which emitters are
9
- /// trusted for each labeled ID or namespace.
8
+ /// label for any entity, so off-chain indexers must decide which emitters are
9
+ /// trusted for each labeled entity or namespace.
10
10
  abstract contract LabeledEvent is EventEmitter {
11
- string private constant ABI = "event Labeled(uint indexed id, bytes32 namespace, string name)";
11
+ string private constant ABI = "event Labeled(uint indexed entity, bytes32 namespace, string name)";
12
12
 
13
- /// @param id Node or capability ID being labeled.
13
+ /// @param entity Entity being labeled.
14
14
  /// @param namespace Label namespace.
15
15
  /// @param name Human-readable name within the namespace.
16
- event Labeled(uint indexed id, bytes32 namespace, string name);
16
+ event Labeled(uint indexed entity, bytes32 namespace, string name);
17
17
 
18
18
  constructor() {
19
19
  emit EventAbi(ABI);
@@ -0,0 +1,18 @@
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 announces a route to another chain/domain.
7
+ abstract contract RouteEvent is EventEmitter {
8
+ string private constant ABI = "event Route(uint indexed host, uint chain, uint context)";
9
+
10
+ /// @param host Host node ID that owns the route.
11
+ /// @param chain Destination chain/domain node ID.
12
+ /// @param context Route context identifier.
13
+ event Route(uint indexed host, uint chain, uint context);
14
+
15
+ constructor() {
16
+ emit EventAbi(ABI);
17
+ }
18
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rootzero/contracts",
3
- "version": "1.3.0",
3
+ "version": "1.4.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/utils/Actions.sol CHANGED
@@ -15,4 +15,5 @@ library Actions {
15
15
  uint32 constant Borrow = 10;
16
16
  uint32 constant Repay = 11;
17
17
  uint32 constant Liquidate = 12;
18
+ uint32 constant Refund = 13;
18
19
  }
package/events/Chain.sol DELETED
@@ -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 chain/domain node is announced.
7
- abstract contract ChainEvent is EventEmitter {
8
- string private constant ABI = "event Chain(uint indexed chain, bytes32 native, uint commander, bytes32 admin)";
9
-
10
- /// @param chain Chain node ID.
11
- /// @param native Native asset ID for the chain.
12
- /// @param commander Commander host node ID for the chain.
13
- /// @param admin Admin account for the commander host on the chain.
14
- event Chain(uint indexed chain, bytes32 native, uint commander, bytes32 admin);
15
-
16
- constructor() {
17
- emit EventAbi(ABI);
18
- }
19
- }
@@ -1,22 +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 an asset moves from one account to another.
7
- abstract contract TransferEvent is EventEmitter {
8
- string private constant ABI = "event Transfer(bytes32 indexed account, bytes32 to, bytes32 asset, bytes32 meta, uint amount, uint32 action, uint context)";
9
-
10
- /// @param account Source account identifier.
11
- /// @param to Destination account identifier.
12
- /// @param asset Asset identifier.
13
- /// @param meta Asset metadata slot.
14
- /// @param amount Amount transferred.
15
- /// @param action Primary operation hint from `Actions`.
16
- /// @param context Reserved context value for future use.
17
- event Transfer(bytes32 indexed account, bytes32 to, bytes32 asset, bytes32 meta, uint amount, uint32 action, uint context);
18
-
19
- constructor() {
20
- emit EventAbi(ABI);
21
- }
22
- }