@rootzero/contracts 1.22.0 → 1.24.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 +107 -0
- package/Codec.sol +1 -1
- package/Commands.sol +1 -1
- package/Core.sol +2 -2
- package/Endpoints.sol +10 -4
- package/Events.sol +1 -1
- package/README.md +40 -32
- package/Utils.sol +1 -1
- package/annotations/Action.sol +1 -1
- package/annotations/Label.sol +1 -1
- package/annotations/Schema.sol +2 -8
- package/codec/Blocks.sol +113 -33
- package/codec/Decoders.sol +18 -1
- package/codec/Descriptors.sol +3 -1
- package/codec/Keys.sol +2 -0
- package/codec/Readers.sol +12 -0
- package/codec/Schema.sol +5 -4
- package/codec/Specs.sol +3 -0
- package/codec/Writers.sol +12 -1
- package/commands/Allocate.sol +5 -8
- package/commands/Base.sol +29 -13
- package/commands/Burn.sol +5 -7
- package/commands/Credit.sol +5 -7
- package/commands/Debit.sol +5 -7
- package/commands/Deposit.sol +10 -14
- package/commands/Payout.sol +5 -8
- package/commands/Provision.sol +10 -14
- package/commands/Recover.sol +4 -6
- package/commands/Relay.sol +14 -21
- package/commands/Repay.sol +120 -24
- package/commands/Settle.sol +10 -14
- package/commands/Withdraw.sol +5 -7
- package/commands/admin/AllowAssets.sol +5 -7
- package/commands/admin/Allowance.sol +5 -7
- package/commands/admin/Annotate.sol +5 -7
- package/commands/admin/Appoint.sol +5 -7
- package/commands/admin/Authorize.sol +5 -7
- package/commands/admin/Base.sol +12 -3
- package/commands/admin/DenyAssets.sol +5 -7
- package/commands/admin/Dismiss.sol +5 -7
- package/commands/admin/Execute.sol +5 -7
- package/commands/admin/Unauthorize.sol +5 -7
- package/core/Access.sol +8 -0
- package/core/Calls.sol +72 -3
- package/core/Portal.sol +2 -2
- package/core/Types.sol +8 -0
- package/events/Positioned.sol +22 -0
- package/execution/Execution.sol +66 -1
- package/package.json +1 -1
- package/ports/Allowance.sol +22 -12
- package/ports/Assets.sol +99 -0
- package/utils/Cursors.sol +3 -3
- package/utils/Nodes.sol +1 -1
- package/utils/Utils.sol +41 -31
- package/events/Commander.sol +0 -19
- package/ports/AllowAssets.sol +0 -34
- package/ports/DenyAssets.sol +0 -34
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,113 @@
|
|
|
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
|
+
Add all changes made after a release to `Unreleased`. Published version
|
|
7
|
+
sections are immutable and must continue to describe the tagged release.
|
|
8
|
+
|
|
9
|
+
## Unreleased
|
|
10
|
+
|
|
11
|
+
## 1.24.0
|
|
12
|
+
|
|
13
|
+
### Breaking Changes
|
|
14
|
+
|
|
15
|
+
- Renamed the existing `Position`-consuming `repay` and `repayPayable`
|
|
16
|
+
commands to `repayPosition` and `repayPositionPayable`. Their state
|
|
17
|
+
transition remains `Position` to `Balance`; the new commands using the old
|
|
18
|
+
names consume `Debt` and return empty state. Command selectors and node IDs
|
|
19
|
+
for position repayment therefore change.
|
|
20
|
+
|
|
21
|
+
### Added
|
|
22
|
+
|
|
23
|
+
- Added the standalone `Debt { liability, debt }` pipeline state, its standard
|
|
24
|
+
block key and schema, and codec support across blocks, readers, writers,
|
|
25
|
+
decoders, and execution helpers.
|
|
26
|
+
- Added `repay` and `repayPayable` commands that consume `Debt` state and return
|
|
27
|
+
empty state.
|
|
28
|
+
- Added `RepayInternal` for dispatching the non-funded `repay` command directly
|
|
29
|
+
against memory-backed pipeline state.
|
|
30
|
+
- Added unchecked `Blocks.read1`, `read2`, `read8`, and `read16` absolute
|
|
31
|
+
calldata helpers, completing the power-of-two family alongside `read4` and
|
|
32
|
+
`read32`.
|
|
33
|
+
- Added the standalone `ensureContract` utility and shared `InvalidContract`
|
|
34
|
+
error for uniformly requiring addresses with deployed bytecode.
|
|
35
|
+
- Added the free `enforceSender` access helper for requiring an exact
|
|
36
|
+
`msg.sender` with the shared `AccessDenied` error.
|
|
37
|
+
- Documented descriptor flag bits 6 and 7 as endpoint-defined custom flags;
|
|
38
|
+
bits 2 through 5 remain reserved for future protocol flags.
|
|
39
|
+
|
|
40
|
+
### Changed
|
|
41
|
+
|
|
42
|
+
- Repayment commands now publish the canonical `Actions.Repay` annotation
|
|
43
|
+
instead of `Actions.Settle`.
|
|
44
|
+
|
|
45
|
+
## 1.23.0
|
|
46
|
+
|
|
47
|
+
### Breaking Changes
|
|
48
|
+
|
|
49
|
+
- Changed every command entrypoint from
|
|
50
|
+
`(bytes32 account, bytes state, bytes input)` to one `bytes context` argument
|
|
51
|
+
containing exactly one encoded `CONTEXT` block. Canonical command selectors
|
|
52
|
+
now use `(bytes)`, so every command node ID changes. Existing command callers,
|
|
53
|
+
cached IDs, and deployed host graphs are not compatible with this release.
|
|
54
|
+
- Added the acting account to `Execution`. `CommandBase.openCommand` and
|
|
55
|
+
`AdminBase.openAdminCommand` now accept the encoded context and return only
|
|
56
|
+
the initialized execution, and command implementations close with
|
|
57
|
+
`closeCommand(exec)` instead of `close(exec, account)`.
|
|
58
|
+
- Removed the separate state argument from `RelayPayableHook.relay`. Relay
|
|
59
|
+
implementations can obtain the complete validated state with
|
|
60
|
+
`exec.rawState()` while the explicit account and nested relay input arguments
|
|
61
|
+
remain unchanged.
|
|
62
|
+
- Consolidated `AllowAssetsPort` and `DenyAssetsPort` into
|
|
63
|
+
`ports/Assets.sol`; update direct source imports to the new path.
|
|
64
|
+
- Renamed the peer `AllowancePort` and `portAllowance` selector to
|
|
65
|
+
`RequestAllowancePort` and `portRequestAllowance`. The peer port now uses a
|
|
66
|
+
distinct `RequestAllowanceHook.requestAllowance` hook; the admin `Allowance`
|
|
67
|
+
command and its authoritative `AllowanceHook.allowance` hook are unchanged.
|
|
68
|
+
- Removed the `Commander` event declaration. Commander addresses and chain
|
|
69
|
+
context are off-chain configuration; host, native-asset, and admin IDs are
|
|
70
|
+
deterministic from that information.
|
|
71
|
+
- Prefixed every typed `Blocks` factory with `create`, including calldata-copy
|
|
72
|
+
variants; for example, use `createBalance`, `createStepCopy`, `createBytes`,
|
|
73
|
+
and `createString` instead of `balance`, `stepCopy`, `data`, and `text`.
|
|
74
|
+
- Changed the `max8`, `max16`, `max24`, `max32`, `max40`, `max64`, `max96`,
|
|
75
|
+
`max128`, and `max160` bounds helpers to return their corresponding narrowed
|
|
76
|
+
integer types instead of `uint`.
|
|
77
|
+
|
|
78
|
+
### Added
|
|
79
|
+
|
|
80
|
+
- Added `PositionedEvent`, which publishes asset and liability sides together
|
|
81
|
+
with the semantic action that produced the observed position.
|
|
82
|
+
- Added `RequestAssetPort`, which passes trusted peers' batched asset and amount
|
|
83
|
+
requests to a host hook for validation and fulfillment.
|
|
84
|
+
- Added `Executions.takeBlock`, which validates and consumes a block from a
|
|
85
|
+
selected decoder lane and returns its complete calldata encoding.
|
|
86
|
+
- Added `Executions.rawState` and `Executions.rawInput` for retrieving complete
|
|
87
|
+
validated calldata lanes independently of current cursor progress.
|
|
88
|
+
- Added `Blocks.createAmount` for constructing canonical `AMOUNT` blocks.
|
|
89
|
+
|
|
90
|
+
### Changed
|
|
91
|
+
|
|
92
|
+
- Command pipeline hops now construct `command(bytes)` calldata and the nested
|
|
93
|
+
`CONTEXT` block directly in one allocation, copying memory state and calldata
|
|
94
|
+
input into the final call buffer.
|
|
95
|
+
- Added memory `callPort`/`tryCallPort` helpers and calldata-copy
|
|
96
|
+
`callPortCopy`/`tryCallPortCopy` counterparts, matching the block factory
|
|
97
|
+
naming convention. Portal forwarding and recovery use the copy variants.
|
|
98
|
+
|
|
99
|
+
### Upgrade Compatibility
|
|
100
|
+
|
|
101
|
+
- Rebuild command IDs from the new `(bytes)` selectors, redeploy command hosts,
|
|
102
|
+
and update pipeline builders and other callers to pass one encoded `CONTEXT`
|
|
103
|
+
block. Do not mix 1.22 command IDs or callers with 1.23 deployments.
|
|
104
|
+
- Update custom commands to read the acting account from `exec.account`, use
|
|
105
|
+
`openCommand(context, descriptor, batches)`, and return
|
|
106
|
+
`closeCommand(exec)`.
|
|
107
|
+
- Update relay hook implementations to remove the state parameter and use
|
|
108
|
+
`exec.rawState()` when the forwarded state is required.
|
|
109
|
+
- Update direct port imports, renamed request-allowance endpoints and hooks,
|
|
110
|
+
typed `Blocks` factory calls, and any assignments that relied on `max*`
|
|
111
|
+
returning `uint`.
|
|
112
|
+
|
|
6
113
|
## 1.22.0
|
|
7
114
|
|
|
8
115
|
### Breaking Changes
|
package/Codec.sol
CHANGED
|
@@ -4,7 +4,7 @@ pragma solidity ^0.8.33;
|
|
|
4
4
|
// Aggregator: re-exports the complete block encoding and decoding surface.
|
|
5
5
|
// Import this file for low-level codec extensions and direct stream processing.
|
|
6
6
|
|
|
7
|
-
import { AssetAmount, AccountAsset, HostAsset, AccountAmount, HostAmount, HostAccountAsset, HostAccountAmount, Position, Tx } from "./core/Types.sol";
|
|
7
|
+
import { AssetAmount, AccountAsset, HostAsset, AccountAmount, HostAmount, HostAccountAsset, HostAccountAmount, Debt, Position, Tx } from "./core/Types.sol";
|
|
8
8
|
import { Keys } from "./codec/Keys.sol";
|
|
9
9
|
import { Sizes, Specs } from "./codec/Specs.sol";
|
|
10
10
|
import { Descriptors, Flags } from "./codec/Descriptors.sol";
|
package/Commands.sol
CHANGED
|
@@ -12,4 +12,4 @@ import {Blocks} from "./codec/Blocks.sol";
|
|
|
12
12
|
import {Sizes, Specs} from "./codec/Specs.sol";
|
|
13
13
|
import {Decoders} from "./codec/Decoders.sol";
|
|
14
14
|
import {Cursors, Cur} from "./utils/Cursors.sol";
|
|
15
|
-
import {AssetAmount, AccountAsset, HostAsset, AccountAmount, HostAmount, HostAccountAsset, HostAccountAmount, Position, Tx} from "./core/Types.sol";
|
|
15
|
+
import {AssetAmount, AccountAsset, HostAsset, AccountAmount, HostAmount, HostAccountAsset, HostAccountAmount, Debt, Position, Tx} from "./core/Types.sol";
|
package/Core.sol
CHANGED
|
@@ -7,7 +7,7 @@ pragma solidity ^0.8.33;
|
|
|
7
7
|
import { Action } from "./annotations/Action.sol";
|
|
8
8
|
import { Label } from "./annotations/Label.sol";
|
|
9
9
|
import { Schema } from "./annotations/Schema.sol";
|
|
10
|
-
import { AccessDenied, AdminAccess, CallerAccess, CommanderAccess, CommanderNotAllowed, GuardianAccess, NodeAccess, TrustAccess } from "./core/Access.sol";
|
|
10
|
+
import { AccessDenied, AdminAccess, CallerAccess, CommanderAccess, CommanderNotAllowed, enforceSender, GuardianAccess, NodeAccess, TrustAccess } from "./core/Access.sol";
|
|
11
11
|
import { Balances, InsufficientFunds } from "./core/Balances.sol";
|
|
12
12
|
import { Escrows, InsufficientEscrow } from "./core/Escrows.sol";
|
|
13
13
|
import { NativeAsset, Runtime } from "./core/Runtime.sol";
|
|
@@ -18,7 +18,7 @@ import { Pipeline } from "./core/Pipeline.sol";
|
|
|
18
18
|
import { Budget, Budgets } from "./execution/Budget.sol";
|
|
19
19
|
import { CreditAccountHook, DebitAccountHook, PostHook, RepayHook, SettleHook, Settlement } from "./core/Settlement.sol";
|
|
20
20
|
import { Portal } from "./core/Portal.sol";
|
|
21
|
-
import { AssetAmount, AccountAsset, HostAsset, AccountAmount, HostAmount, HostAccountAsset, HostAccountAmount, Position, Tx } from "./core/Types.sol";
|
|
21
|
+
import { AssetAmount, AccountAsset, HostAsset, AccountAmount, HostAmount, HostAccountAsset, HostAccountAmount, Debt, Position, Tx } from "./core/Types.sol";
|
|
22
22
|
import { Validator } from "./core/Validator.sol";
|
|
23
23
|
|
|
24
24
|
|
package/Endpoints.sol
CHANGED
|
@@ -18,7 +18,14 @@ import {Deposit, DepositHook, DepositPayable, DepositPayableHook} from "./comman
|
|
|
18
18
|
import {Payout, PayoutHook} from "./commands/Payout.sol";
|
|
19
19
|
import {Provision, ProvisionHook, ProvisionPayable, ProvisionPayableHook} from "./commands/Provision.sol";
|
|
20
20
|
import {RecoverPayable, RecoverPayableHook} from "./commands/Recover.sol";
|
|
21
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
Repay,
|
|
23
|
+
RepayInternal,
|
|
24
|
+
RepayPayable,
|
|
25
|
+
RepayPayableHook,
|
|
26
|
+
RepayPosition,
|
|
27
|
+
RepayPositionPayable
|
|
28
|
+
} from "./commands/Repay.sol";
|
|
22
29
|
import {RelayPayable, RelayBalancePayable, RelayPayableHook} from "./commands/Relay.sol";
|
|
23
30
|
import {Settle, SettlePayable, SettlePayableHook, SettleInternal} from "./commands/Settle.sol";
|
|
24
31
|
import {Withdraw, WithdrawHook} from "./commands/Withdraw.sol";
|
|
@@ -37,12 +44,11 @@ import {Unauthorize} from "./commands/admin/Unauthorize.sol";
|
|
|
37
44
|
|
|
38
45
|
// Port endpoints
|
|
39
46
|
import {PortBase} from "./ports/Base.sol";
|
|
40
|
-
import {AllowAssetsPort} from "./ports/
|
|
41
|
-
import {
|
|
47
|
+
import {AllowAssetsPort, DenyAssetsPort, RequestAssetPort, RequestAssetHook} from "./ports/Assets.sol";
|
|
48
|
+
import {RequestAllowancePort, RequestAllowanceHook} from "./ports/Allowance.sol";
|
|
42
49
|
import {RedeemBalancePort, RedeemBalanceHook} from "./ports/Redeem.sol";
|
|
43
50
|
import {CreditAccountPort} from "./ports/Credit.sol";
|
|
44
51
|
import {DebitAccountPort} from "./ports/Debit.sol";
|
|
45
|
-
import {DenyAssetsPort} from "./ports/DenyAssets.sol";
|
|
46
52
|
import {PipePayablePort} from "./ports/Pipe.sol";
|
|
47
53
|
import {DispatchPayablePort, DispatchPayableHook} from "./ports/Dispatch.sol";
|
|
48
54
|
import {PostPort} from "./ports/Post.sol";
|
package/Events.sol
CHANGED
|
@@ -8,7 +8,6 @@ import { AnnotationEvent } from "./events/Annotation.sol";
|
|
|
8
8
|
import { AssetEvent, AssetStatusEvent } from "./events/Asset.sol";
|
|
9
9
|
import { Actions } from "./utils/Actions.sol";
|
|
10
10
|
import { BalanceEvent } from "./events/Balance.sol";
|
|
11
|
-
import { CommanderEvent } from "./events/Commander.sol";
|
|
12
11
|
import { DispatchEvent } from "./events/Dispatch.sol";
|
|
13
12
|
import { EndpointEvent } from "./events/Endpoint.sol";
|
|
14
13
|
import { ReceivedEvent } from "./events/Received.sol";
|
|
@@ -19,6 +18,7 @@ import { GuardianEvent } from "./events/Guardian.sol";
|
|
|
19
18
|
import { IntroductionEvent } from "./events/Introduction.sol";
|
|
20
19
|
import { LockedEvent } from "./events/Locked.sol";
|
|
21
20
|
import { NodeEvent } from "./events/Node.sol";
|
|
21
|
+
import { PositionedEvent } from "./events/Positioned.sol";
|
|
22
22
|
import { RootedEvent } from "./events/Rooted.sol";
|
|
23
23
|
import { RouteEvent } from "./events/Route.sol";
|
|
24
24
|
import { SpentEvent } from "./events/Spent.sol";
|
package/README.md
CHANGED
|
@@ -265,22 +265,24 @@ and return it, forward it intact, or revert. A command must never succeed while
|
|
|
265
265
|
silently ignoring or dropping supplied state. Commands that declare
|
|
266
266
|
`Specs.Empty` state therefore reject any non-empty state, while commands that
|
|
267
267
|
accept state validate the complete stream against their declared state schema.
|
|
268
|
-
This is especially important for `#position`, because dropping
|
|
269
|
-
silently discard
|
|
270
|
-
|
|
271
|
-
The input carries instructions; the state carries live value. While a
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
268
|
+
This is especially important for `#debt` and `#position`, because dropping
|
|
269
|
+
either could silently discard an outstanding debt requirement.
|
|
270
|
+
|
|
271
|
+
The input carries instructions; the state carries live value. While a sequence
|
|
272
|
+
of commands executes, `#balance`, `#debt`, `#custody`, and `#position` blocks in
|
|
273
|
+
the state are the value being moved — produced by one command, consumed by the
|
|
274
|
+
next. Balance carries `{ asset, amount }`, debt carries `{ liability, debt }`,
|
|
275
|
+
and position carries their flat combination
|
|
275
276
|
`{ asset, amount, liability, debt }`.
|
|
276
277
|
|
|
277
|
-
`#position`
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
278
|
+
`#debt` and `#position` are general live state rather than persisted
|
|
279
|
+
lending-specific debt records. Debt carries value owed or required; position
|
|
280
|
+
pairs that liability with value acquired or controlled. A command may preserve
|
|
281
|
+
or replace either side and return the resulting state for the next step;
|
|
282
|
+
`settle` terminally consumes a position pair. This supports swaps,
|
|
281
283
|
borrowing, refinancing, collateral changes, callback obligations, cross-host
|
|
282
|
-
claims, fees, netting, and other multi-step operations.
|
|
283
|
-
transient
|
|
284
|
+
claims, fees, netting, and other multi-step operations. Debt and position are
|
|
285
|
+
transient representations and do not themselves create or erase an obligation
|
|
284
286
|
recorded by an external system.
|
|
285
287
|
|
|
286
288
|
The standard `Deposit` mixin shows the canonical shape: open and validate both
|
|
@@ -288,19 +290,17 @@ command lanes, loop the batch, call the hook, and write the output run:
|
|
|
288
290
|
|
|
289
291
|
```solidity
|
|
290
292
|
function deposit(
|
|
291
|
-
|
|
292
|
-
bytes calldata state,
|
|
293
|
-
bytes calldata input
|
|
293
|
+
bytes calldata context
|
|
294
294
|
) external onlyCommand returns (bytes memory, bytes memory) {
|
|
295
|
-
Execution memory exec = openCommand(
|
|
295
|
+
Execution memory exec = openCommand(context, descriptor, 0);
|
|
296
296
|
|
|
297
297
|
while (exec.more()) {
|
|
298
298
|
(bytes32 asset, uint amount) = exec.unpackAmount(Lanes.Input);
|
|
299
|
-
deposit(account, asset, amount); // host policy hook
|
|
299
|
+
deposit(exec.account, asset, amount); // host policy hook
|
|
300
300
|
exec.outputBalance(asset, amount);
|
|
301
301
|
}
|
|
302
302
|
|
|
303
|
-
return
|
|
303
|
+
return closeCommand(exec);
|
|
304
304
|
}
|
|
305
305
|
```
|
|
306
306
|
|
|
@@ -317,24 +317,24 @@ abstract contract MyCommand is CommandBase {
|
|
|
317
317
|
}
|
|
318
318
|
|
|
319
319
|
function myCommand(
|
|
320
|
-
|
|
321
|
-
bytes calldata state,
|
|
322
|
-
bytes calldata input
|
|
320
|
+
bytes calldata context
|
|
323
321
|
) external onlyCommand returns (bytes memory, bytes memory) {
|
|
324
|
-
Execution memory exec = openCommand(
|
|
322
|
+
Execution memory exec = openCommand(context, descriptor, 0);
|
|
325
323
|
while (exec.more()) {
|
|
326
324
|
(bytes32 asset, uint amount) = exec.unpackAmount(Lanes.Input);
|
|
327
325
|
// Apply command-specific behavior for this group.
|
|
328
326
|
exec.outputBalance(asset, amount);
|
|
329
327
|
}
|
|
330
|
-
return
|
|
328
|
+
return closeCommand(exec);
|
|
331
329
|
}
|
|
332
330
|
}
|
|
333
331
|
```
|
|
334
332
|
|
|
335
333
|
The final argument is a packed flags byte. Pass `0` for an ordinary endpoint,
|
|
336
334
|
or compose values such as `Flags.Funded`, `Flags.Admin`, and
|
|
337
|
-
`Flags.AdminFunded` from the command or endpoint package entry point.
|
|
335
|
+
`Flags.AdminFunded` from the command or endpoint package entry point. Bits 6
|
|
336
|
+
and 7 are reserved for endpoint-defined custom flags. Bits 2 through 5 remain
|
|
337
|
+
reserved for future protocol flags.
|
|
338
338
|
|
|
339
339
|
The standard commands cover the common ledger movements: `deposit` and
|
|
340
340
|
`depositPayable` (external funds in), `settlePayable` (funded settlement),
|
|
@@ -342,7 +342,9 @@ The standard commands cover the common ledger movements: `deposit` and
|
|
|
342
342
|
`debitAccount` and `creditAccount` (internal movements), `payout` (deliver
|
|
343
343
|
state to other accounts), `allocate` (turn balance state into custody),
|
|
344
344
|
`provision` (provision custody from an external allocation), `settle` (consume
|
|
345
|
-
asset-liability position state), `
|
|
345
|
+
asset-liability position state), `repay` and `repayPayable` (consume standalone
|
|
346
|
+
debt state), `repayPosition` and `repayPositionPayable` (repay a position's debt
|
|
347
|
+
and return its asset as balance state), `relayPayable` (relay a pipeline without
|
|
346
348
|
state), and `relayBalancePayable` (relay balance state and a pipeline to another
|
|
347
349
|
portal).
|
|
348
350
|
|
|
@@ -388,12 +390,12 @@ portal adapter (on EVM, the low 128 bits are native value in wei, drawn from a
|
|
|
388
390
|
shared budget), so the same pipeline bytes are meaningful to every port.
|
|
389
391
|
|
|
390
392
|
Hosts that implement a pipeline locally can inherit `DebitAccountInternal`,
|
|
391
|
-
`CreditAccountInternal`, and `
|
|
392
|
-
endpoints while routing their local command IDs through
|
|
393
|
-
`executeCreditAccount`,
|
|
394
|
-
memory-backed pipeline state directly
|
|
395
|
-
step value into each adapter; all
|
|
396
|
-
commands are non-funded.
|
|
393
|
+
`CreditAccountInternal`, `SettleInternal`, and `RepayInternal` to advertise the
|
|
394
|
+
canonical command endpoints while routing their local command IDs through
|
|
395
|
+
`executeDebitAccount`, `executeCreditAccount`, `executeSettle`, and
|
|
396
|
+
`executeRepay`. These adapters consume the memory-backed pipeline state directly
|
|
397
|
+
and avoid an external self-call. Pass the step value into each adapter; all four
|
|
398
|
+
reject nonzero value because the commands are non-funded.
|
|
397
399
|
|
|
398
400
|
Positions also support backward-composed pipelines. In an exact-output route,
|
|
399
401
|
the asset side can represent the desired result while the liability side
|
|
@@ -435,6 +437,12 @@ central ones are batches all the way down:
|
|
|
435
437
|
- `portPost` consumes `transaction { bytes32 from, bytes32 to, bytes32 asset,
|
|
436
438
|
uint amount }` blocks, debiting `from` and crediting `to` per
|
|
437
439
|
block — how two hosts post transactions between their ledgers.
|
|
440
|
+
- `portRequestAsset` consumes `amount { bytes32 asset, uint amount }` blocks and
|
|
441
|
+
passes the authenticated peer, asset, and amount to a host hook. The hook
|
|
442
|
+
validates asset support and applies the host's request and transfer policy.
|
|
443
|
+
- `portRequestAllowance` consumes the same amount blocks and lets the
|
|
444
|
+
authenticated peer request an asset allowance. The hook decides what
|
|
445
|
+
allowance, if any, to grant.
|
|
438
446
|
- `portPipePayable` consumes `context` blocks, each carrying an account, an
|
|
439
447
|
initial state, and a run of steps — a complete pipeline delivered by another
|
|
440
448
|
host, executed locally against the port call's shared value budget.
|
package/Utils.sol
CHANGED
|
@@ -12,7 +12,7 @@ import { ECDSA } from "./utils/ECDSA.sol";
|
|
|
12
12
|
import { Ids } from "./utils/Ids.sol";
|
|
13
13
|
import { Nodes } from "./utils/Nodes.sol";
|
|
14
14
|
import { Layout } from "./utils/Layout.sol";
|
|
15
|
-
import { addrOr, applyBps, beforeBps, bytes32ToInt, bytes32ToString, clear8, clear16, clear32, clear64, divisible, ensureAddr, hash32, intToBytes32, isFamily, matchesBase, MAX_BPS, max8, max16, max24, max32, max40, max64, max96, max128, max160, NotDivisible, replace8, replace16, replace32, replace64, retryTicket, toLocalBase, toUnspecifiedBase, ValueOverflow, ZeroAddress } from "./utils/Utils.sol";
|
|
15
|
+
import { addrOr, applyBps, beforeBps, bytes32ToInt, bytes32ToString, clear8, clear16, clear32, clear64, divisible, ensureAddr, ensureContract, hash32, intToBytes32, InvalidContract, isFamily, matchesBase, MAX_BPS, max8, max16, max24, max32, max40, max64, max96, max128, max160, NotDivisible, replace8, replace16, replace32, replace64, retryTicket, toLocalBase, toUnspecifiedBase, ValueOverflow, ZeroAddress } from "./utils/Utils.sol";
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
package/annotations/Action.sol
CHANGED
|
@@ -12,6 +12,6 @@ abstract contract Action is AnnotationEvent {
|
|
|
12
12
|
/// @param entity Entity receiving the action annotation.
|
|
13
13
|
/// @param value Canonical action identifier, such as a value from `Actions`.
|
|
14
14
|
function action(uint entity, uint value) internal virtual {
|
|
15
|
-
emit Annotation(entity, Blocks.
|
|
15
|
+
emit Annotation(entity, Blocks.createAction(value));
|
|
16
16
|
}
|
|
17
17
|
}
|
package/annotations/Label.sol
CHANGED
|
@@ -14,6 +14,6 @@ abstract contract Label is AnnotationEvent {
|
|
|
14
14
|
/// @param namespace Label namespace.
|
|
15
15
|
/// @param name Human-readable name within the namespace.
|
|
16
16
|
function label(uint entity, bytes32 namespace, string memory name) internal virtual {
|
|
17
|
-
emit Annotation(entity, Blocks.
|
|
17
|
+
emit Annotation(entity, Blocks.createLabel(namespace, name));
|
|
18
18
|
}
|
|
19
19
|
}
|
package/annotations/Schema.sol
CHANGED
|
@@ -18,13 +18,7 @@ abstract contract Schema is Runtime, AnnotationEvent {
|
|
|
18
18
|
/// @param hint Initial per-block payload capacity.
|
|
19
19
|
/// @param body Schema DSL string describing the block payload body.
|
|
20
20
|
/// @return spec The context-local block specification.
|
|
21
|
-
function schema(
|
|
22
|
-
uint32 key,
|
|
23
|
-
uint32 min,
|
|
24
|
-
uint32 max,
|
|
25
|
-
uint32 hint,
|
|
26
|
-
string memory body
|
|
27
|
-
) internal returns (uint spec) {
|
|
21
|
+
function schema(uint32 key, uint32 min, uint32 max, uint32 hint, string memory body) internal returns (uint spec) {
|
|
28
22
|
return schema(key, min, max, hint, body, bytes32(0));
|
|
29
23
|
}
|
|
30
24
|
|
|
@@ -80,7 +74,7 @@ abstract contract Schema is Runtime, AnnotationEvent {
|
|
|
80
74
|
/// @param name Schema alias name, or zero for unnamed schemas.
|
|
81
75
|
/// @return The published block specification.
|
|
82
76
|
function schema(uint spec, string memory body, bytes32 name) internal returns (uint) {
|
|
83
|
-
emit Annotation(host, Blocks.
|
|
77
|
+
emit Annotation(host, Blocks.createSchema(spec, body, name));
|
|
84
78
|
return spec;
|
|
85
79
|
}
|
|
86
80
|
}
|