@bananapus/router-terminal-v6 0.0.47 → 0.0.49
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 +2 -4
- package/src/JBRouterTerminal.sol +2 -2
- package/CHANGELOG.md +0 -117
package/package.json
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bananapus/router-terminal-v6",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.49",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/Bananapus/nana-router-terminal-v6"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
|
-
"CHANGELOG.md",
|
|
11
10
|
"foundry.toml",
|
|
12
11
|
"references/",
|
|
13
12
|
"remappings.txt",
|
|
14
|
-
"script/
|
|
15
|
-
"script/helpers/",
|
|
13
|
+
"script/",
|
|
16
14
|
"src/"
|
|
17
15
|
],
|
|
18
16
|
"engines": {
|
package/src/JBRouterTerminal.sol
CHANGED
|
@@ -847,8 +847,8 @@ contract JBRouterTerminal is
|
|
|
847
847
|
|
|
848
848
|
// Decode only the buyback field used for route scoring. `minimumSwapAmountOut` is executable because the
|
|
849
849
|
// hook will enforce it; the later raw quote word is diagnostic and can overstate what execution can prove.
|
|
850
|
-
(uint256 minimumSwapAmountOut
|
|
851
|
-
abi.decode(specification.metadata, (uint256, uint256, uint256, int24, uint128, PoolId, uint256));
|
|
850
|
+
(uint256 minimumSwapAmountOut,,,,,,,) =
|
|
851
|
+
abi.decode(specification.metadata, (uint256, uint256, uint256, int24, uint128, PoolId, uint256, bool));
|
|
852
852
|
|
|
853
853
|
// Keep whichever understood executable hook commitment implies the strongest cash-out output.
|
|
854
854
|
if (minimumSwapAmountOut > effectiveAmount) effectiveAmount = minimumSwapAmountOut;
|
package/CHANGELOG.md
DELETED
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## Scope
|
|
4
|
-
|
|
5
|
-
This file describes the verified change from `nana-swap-terminal-v5` to the current `nana-router-terminal-v6` repo. In-v6 behavior changes that have semantic implications for integrators are also captured here.
|
|
6
|
-
|
|
7
|
-
## In-v6 changes
|
|
8
|
-
|
|
9
|
-
### Chain-same CREATE2 address for `JBRouterTerminal`
|
|
10
|
-
|
|
11
|
-
`JBRouterTerminal` now deploys to the same address on every chain via CREATE2. The four chain-specific
|
|
12
|
-
immutables (`WRAPPED_NATIVE_TOKEN`, `FACTORY`, `POOL_MANAGER`, `UNIV4_HOOK`) moved from `immutable` to public
|
|
13
|
-
storage and are wired in after deployment via a new one-shot `setChainSpecificConstants(wrappedNativeToken, factory, poolManager, univ4Hook)` setter, gated by a `_DEPLOYER` internal immutable (same pattern as `JBBuybackHook` and `JBUniswapV4LPSplitHookDeployer`).
|
|
14
|
-
|
|
15
|
-
- Constructor signature changed: `(IJBDirectory directory, IJBTokens tokens, IPermit2 permit2, address buybackHook, address trustedForwarder, address deployer)` — was 9 args, now 6. The four chain-different dependencies are no longer ctor inputs.
|
|
16
|
-
- New external function: `setChainSpecificConstants(IWETH9 wrappedNativeToken, IUniswapV3Factory factory, IPoolManager poolManager, address univ4Hook)`. Reverts with `JBRouterTerminal_Unauthorized(caller)` if msg.sender != `_DEPLOYER`; reverts with `JBRouterTerminal_AlreadyConfigured()` if `WRAPPED_NATIVE_TOKEN` has already been set.
|
|
17
|
-
- `BUYBACK_HOOK` stays as `public immutable` because `JBBuybackHook` is itself chain-same as of `@bananapus/buyback-hook-v6@0.0.44`.
|
|
18
|
-
|
|
19
|
-
`JBPayRouteResolver` also lost its `WRAPPED_NATIVE_TOKEN` immutable but does NOT call back into the router for it. Instead, the router passes its `WRAPPED_NATIVE_TOKEN` storage value as a parameter (`address wrappedNativeToken`) on every external resolver call (`previewBestPayRoute`, `previewPayRouteForCandidate`, `previewFallbackRoute`, `resolveTokenOut`), and the resolver threads it through internal helpers (`_normalizedTokenOf`, `_hasSameRoutingAsset`, `_discoverAcceptedToken`, `_resolveTokenOut`, `_previewAmountToToken`, `_previewRoute`). `_normalizedTokenOf` and `_hasSameRoutingAsset` are `pure` again. This avoids an extra external call per normalization step (which would compound inside the loops in `_discoverAcceptedToken`).
|
|
20
|
-
|
|
21
|
-
The resolver is still deployed in the router's constructor (chain-same input: just `directory`); its CREATE address is `router.address + nonce 1`, which is chain-same once the router itself is chain-same.
|
|
22
|
-
|
|
23
|
-
Integrator impact: deployers must call `setChainSpecificConstants` once after construction (the script in `script/Deploy.s.sol` does this in the same transaction as the deploy). Tests and the local deploy script have been updated accordingly.
|
|
24
|
-
|
|
25
|
-
Size: `JBRouterTerminal` 23,706 → 23,468 B (-238 B; headroom 870 → 1,108 B against the EIP-170 24,576 B limit). `JBPayRouteResolver` 10,438 → 10,398 B (-40 B).
|
|
26
|
-
|
|
27
|
-
### Removed: credit cash-out input path
|
|
28
|
-
|
|
29
|
-
The router no longer accepts unclaimed Juicebox credits as a payment input. The `cashOutSource` metadata key, the `sourceProjectIdOverride` parameter on `previewCashOutLoopOf`, the `IJBController.transferCreditsFrom` pull in `_acceptFundsFor`, and the `_cashOutSourceFrom` helper have all been removed. Credit holders should call `JBTokens.claimFor` to materialize their credits as an ERC-20 first, then route through the router as a normal ERC-20 payment.
|
|
30
|
-
|
|
31
|
-
- Removed: `IJBController` import + `_CASH_OUT_SOURCE_ID` immutable.
|
|
32
|
-
- Removed: 3 test files (`RouterTerminalCreditCashout.t.sol`, `regression/CreditCashoutSpoofedPayer.t.sol`, `regression/CreditCashoutPreferredTokenBypass.t.sol`, `regression/PreviewCashOutShortcircuitDivergence.t.sol`).
|
|
33
|
-
- Changed: `IJBPayRoutePreviewer.previewCashOutLoopOf` signature — dropped the `uint256 sourceProjectIdOverride` parameter (now 5 args).
|
|
34
|
-
- Frees ~580 B of runtime size; reduces attack surface (no msg.sender-vs-originalPayer ambiguity in the credit pull).
|
|
35
|
-
|
|
36
|
-
Integrator impact: any frontend or backend that constructs the `cashOutSource` metadata key and routes JB credits via the router must switch to a two-step flow (`claimFor` → `router.pay`).
|
|
37
|
-
|
|
38
|
-
### Threshold-protected `setDefaultTerminal`
|
|
39
|
-
|
|
40
|
-
The registry owner's `setDefaultTerminal(IJBTerminal)` call now applies only to projects created AFTER the call. Existing projects without an explicit `setTerminalFor` override keep resolving to the default that was current when their project-ID cohort was active. The outgoing default is snapshotted into an append-only `_defaultTerminalHistory` array on every `setDefaultTerminal` call.
|
|
41
|
-
|
|
42
|
-
- New view: `defaultTerminalFor(uint256 projectId)` returns the default applicable to a specific project (walks history if the project is in a legacy cohort).
|
|
43
|
-
- New view: `defaultTerminalProjectIdThreshold()` returns `PROJECTS.count()` at the time of the most recent `setDefaultTerminal`.
|
|
44
|
-
- New views: `defaultTerminalHistoryAt(uint256 index)` and `defaultTerminalHistoryLength()` expose the snapshot history.
|
|
45
|
-
- New struct: `DefaultTerminalSegment { uint256 maxProjectId; IJBTerminal terminal; }` in `src/structs/`.
|
|
46
|
-
- `lockTerminalFor` now snapshots the *cohort-correct* default into `_terminalOf` (via `_defaultTerminalFor(projectId)`) when locking a project that has no explicit terminal — not the current registry-wide default.
|
|
47
|
-
|
|
48
|
-
Indexer impact: read `defaultTerminalFor(projectId)` rather than `defaultTerminal()` when computing the effective default for any specific project.
|
|
49
|
-
|
|
50
|
-
Admin impact: the registry owner can no longer silently reroute payments for already-deployed projects by changing the default. See `ADMINISTRATION.md` for the updated boundary description.
|
|
51
|
-
|
|
52
|
-
### `0.0.41` — Document multi-hop forwarding-cycle as accepted risk
|
|
53
|
-
|
|
54
|
-
`JBRouterTerminalRegistry._requireNonCircularTerminalFor` only walks one hop of `IJBForwardingTerminal.terminalOf` when admitting a new explicit or default terminal. A multi-hop `A → B → registry` chain passes admission (the registry only sees `downstream == B ≠ self`), but once locked in, a subsequent `pay`/`addToBalanceOf` recurses through the registry until OOG. The `JBPayRouteResolver` swap-routing path already uses the bounded multi-hop helper `JBForwardingCheck.isCircularTerminal`; the registry admission path does not.
|
|
55
|
-
|
|
56
|
-
This is documented as accepted in `RISKS.md` (§Registry & Forwarding Risks). Impact is bounded to a self-locking DoS on the project that constructs the multi-hop chain — external actors cannot trigger it, and the project owner can rotate the registry default to recover. Per-PR retrofit cost was judged non-trivial relative to that impact. Project owners installing chained forwarding terminals should run a manual `JBForwardingCheck.isCircularTerminal({target: registry, projectId: …, terminal: candidate})` simulation before approving the candidate.
|
|
57
|
-
|
|
58
|
-
No runtime code change in this release — documentation only.
|
|
59
|
-
|
|
60
|
-
## Current v6 surface
|
|
61
|
-
|
|
62
|
-
- `JBRouterTerminal`
|
|
63
|
-
- `JBRouterTerminalRegistry`
|
|
64
|
-
- `JBPayRouteResolver`
|
|
65
|
-
- `IJBRouterTerminal`
|
|
66
|
-
- `IJBRouterTerminalRegistry`
|
|
67
|
-
- `IJBPayRouteResolver`
|
|
68
|
-
- `IJBPayRoutePreviewer`
|
|
69
|
-
- `IJBForwardingTerminal`
|
|
70
|
-
- `JBSwapLib`
|
|
71
|
-
- `CashOutPathCandidates`
|
|
72
|
-
|
|
73
|
-
## Summary
|
|
74
|
-
|
|
75
|
-
- The deployed terminal model changed from a swap terminal to a router terminal. That is a real conceptual change, not just a rename.
|
|
76
|
-
- Route discovery is now part of the product. The current repo is built around discovering paths and destination-token requirements instead of depending on the v5 manual pool-and-TWAP configuration style.
|
|
77
|
-
- The router terminal can reason about JB token cash-out flows as part of routing, which did not match the old swap-terminal mental model.
|
|
78
|
-
- The registry and terminal now share routing vocabulary with the v6 buyback hook through `JBSwapLib`.
|
|
79
|
-
- The repo moved from the v5 `0.8.23` baseline to `0.8.28`.
|
|
80
|
-
|
|
81
|
-
## Verified deltas
|
|
82
|
-
|
|
83
|
-
- The old admin surface around `addDefaultPool(...)` and `addTwapParamsFor(...)` is gone from the main interface.
|
|
84
|
-
- `IJBRouterTerminal` now extends `IJBTerminal`.
|
|
85
|
-
- `discoverPool(...)` and `discoverBestPool(...)` are first-class query methods in the interface.
|
|
86
|
-
- The current repo includes `previewPayFor(...)` routing behavior and JB-token cash-out path handling in its implementation and tests.
|
|
87
|
-
|
|
88
|
-
## Breaking ABI changes
|
|
89
|
-
|
|
90
|
-
- `IJBSwapTerminal` was replaced by `IJBRouterTerminal`.
|
|
91
|
-
- The old pool-configuration functions are gone from the main terminal interface.
|
|
92
|
-
- The terminal now inherits the broader `IJBTerminal` surface rather than exposing a narrow swap-only ABI.
|
|
93
|
-
- Discovery functions replaced manual pool/TWAP configuration as the public model.
|
|
94
|
-
|
|
95
|
-
## Indexer impact
|
|
96
|
-
|
|
97
|
-
- Event topology changed with the router-terminal and registry model; do not assume swap-terminal event families map one-to-one.
|
|
98
|
-
- Off-chain route computation can now rely on explicit discovery and preview methods instead of stored default-pool config.
|
|
99
|
-
|
|
100
|
-
## Migration notes
|
|
101
|
-
|
|
102
|
-
- Replace both terminology and ABI assumptions: `JBSwapTerminal` is not the right reference point for a v6 integration.
|
|
103
|
-
- Re-check any off-chain service that used manually configured pool metadata as the primary source of truth.
|
|
104
|
-
- Regenerate ABIs and re-index events from the current router-terminal contracts.
|
|
105
|
-
|
|
106
|
-
## ABI appendix
|
|
107
|
-
|
|
108
|
-
- Replaced interface
|
|
109
|
-
- `IJBSwapTerminal` -> `IJBRouterTerminal`
|
|
110
|
-
- Removed swap-terminal-style admin/config functions
|
|
111
|
-
- `addDefaultPool(...)`
|
|
112
|
-
- `addTwapParamsFor(...)`
|
|
113
|
-
- Added router-oriented query functions
|
|
114
|
-
- `discoverPool(...)`
|
|
115
|
-
- `discoverBestPool(...)`
|
|
116
|
-
- Surface expansion
|
|
117
|
-
- now inherits the broader `IJBTerminal` interface
|