@rootzero/contracts 0.6.0 → 0.6.1

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 (2) hide show
  1. package/commands/Base.sol +14 -7
  2. package/package.json +1 -1
package/commands/Base.sol CHANGED
@@ -74,19 +74,26 @@ abstract contract CommandPayable is CommandBase {
74
74
  /// Override `settleValue` to implement refund or forwarding behavior instead.
75
75
  error UnusedValue(uint remaining);
76
76
 
77
- /// @notice Settle any remaining native value after command execution.
78
- /// The default implementation rejects leftover value by reverting with
79
- /// `UnusedValue(remaining)`. Override this hook to refund or redirect
80
- /// unused value for specific payable commands.
77
+ /// @notice Drains the command budget and settles any remaining native value.
78
+ /// @dev Calls the amount-based `settleValue` hook only when some value remains.
81
79
  /// @param account Caller's account identifier for the current invocation.
82
80
  /// @param budget Mutable native-value budget used during command execution.
83
81
  function settleValue(
84
82
  bytes32 account,
85
83
  Budget memory budget
86
- ) internal virtual {
87
- account;
84
+ ) internal {
88
85
  uint remaining = Values.drain(budget);
89
- if (remaining != 0) revert UnusedValue(remaining);
86
+ if (remaining != 0) settleValue(account, remaining);
87
+ }
88
+
89
+ /// @notice Handles leftover native value after a payable command has finished.
90
+ /// @dev Override this hook to refund or redirect unused value for a command.
91
+ /// The default implementation rejects any leftover amount.
92
+ /// @param account Caller's account identifier for the current invocation.
93
+ /// @param remaining Unspent native value left in the budget, in wei.
94
+ function settleValue(bytes32 account, uint remaining) internal virtual {
95
+ account;
96
+ revert UnusedValue(remaining);
90
97
  }
91
98
  }
92
99
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rootzero/contracts",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
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",