@bananapus/router-terminal-v6 0.0.25 → 0.0.26
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/ADMINISTRATION.md +7 -0
- package/CHANGELOG.md +5 -0
- package/README.md +1 -0
- package/RISKS.md +1 -1
- package/package.json +3 -3
- package/src/JBPayRouteResolver.sol +393 -340
- package/src/JBRouterTerminal.sol +218 -108
- package/src/JBRouterTerminalRegistry.sol +12 -10
- package/src/interfaces/IJBForwardingTerminal.sol +2 -2
- package/src/interfaces/IJBRouterTerminalRegistry.sol +0 -5
- package/test/RouterTerminalERC2771.t.sol +4 -6
- package/test/TestAuditGaps.sol +8 -12
- package/test/audit/Permit2AllowanceFailed.t.sol +1 -1
- package/test/audit/PreviewPrimaryTerminalMismatch.t.sol +1 -1
- package/test/regression/CashOutLoopLimit.t.sol +2 -3
package/ADMINISTRATION.md
CHANGED
|
@@ -111,6 +111,13 @@ The following values are set at deploy time and cannot be changed:
|
|
|
111
111
|
| `PROJECTS` | Constructor | No | JB project NFT registry |
|
|
112
112
|
| `PERMIT2` | Constructor | No | Permit2 contract for gasless approvals |
|
|
113
113
|
|
|
114
|
+
### JBPayRouteResolver
|
|
115
|
+
|
|
116
|
+
| Property | Set At | Mutable? | Description |
|
|
117
|
+
|----------|--------|----------|-------------|
|
|
118
|
+
| `DIRECTORY` | Constructor | No | JB directory for terminal and accounting-context lookups, cached from the router at construction time |
|
|
119
|
+
| `WETH` | Constructor | No | Wrapped native token used for token normalization, cached from the router at construction time |
|
|
120
|
+
|
|
114
121
|
### JBSwapLib
|
|
115
122
|
|
|
116
123
|
| Constant | Value | Description |
|
package/CHANGELOG.md
CHANGED
|
@@ -8,9 +8,14 @@ This file describes the verified change from `nana-swap-terminal-v5` to the curr
|
|
|
8
8
|
|
|
9
9
|
- `JBRouterTerminal`
|
|
10
10
|
- `JBRouterTerminalRegistry`
|
|
11
|
+
- `JBPayRouteResolver`
|
|
11
12
|
- `IJBRouterTerminal`
|
|
12
13
|
- `IJBRouterTerminalRegistry`
|
|
14
|
+
- `IJBPayRouteResolver`
|
|
15
|
+
- `IJBPayRoutePreviewer`
|
|
16
|
+
- `IJBForwardingTerminal`
|
|
13
17
|
- `JBSwapLib`
|
|
18
|
+
- `CashOutPathCandidates`
|
|
14
19
|
|
|
15
20
|
## Summary
|
|
16
21
|
|
package/README.md
CHANGED
|
@@ -28,6 +28,7 @@ This repo is best understood as an execution router attached to Juicebox, not as
|
|
|
28
28
|
| --- | --- |
|
|
29
29
|
| `JBRouterTerminal` | Main routing terminal that accepts many token types and forwards value to the destination terminal. |
|
|
30
30
|
| `JBRouterTerminalRegistry` | Registry and proxy surface that lets a project choose and optionally lock its preferred router terminal. |
|
|
31
|
+
| `JBPayRouteResolver` | Helper that evaluates pay-route candidates and selects the best route preview for the router terminal. |
|
|
31
32
|
|
|
32
33
|
## Mental Model
|
|
33
34
|
|
package/RISKS.md
CHANGED
|
@@ -65,7 +65,7 @@ This file focuses on the routing, accounting-context, and liquidity-selection ri
|
|
|
65
65
|
|
|
66
66
|
- **Registry default terminal change.** Projects without explicit terminal assignments use `defaultTerminal`. If the registry owner changes the default, all unlocked projects are silently migrated. `lockTerminalFor` mitigates this.
|
|
67
67
|
- **Locked bad-terminal risk.** `lockTerminalFor` protects projects from silent migrations, but it also freezes the current resolved terminal exactly as-is. If the locked terminal is malformed, recursively forwards, reverts on use, or otherwise cannot actually process routed payments, the project can be left permanently unroutable through the registry.
|
|
68
|
-
- **
|
|
68
|
+
- **forceApprove for terminal transfers.** `_beforeTransferFor` uses `forceApprove`, which resets the allowance to zero before setting the new value. This mitigates stale-allowance accumulation: even if a previous transaction left a non-zero allowance, `forceApprove` overwrites it rather than adding to it. The reset-then-set pattern prevents cumulative allowance drift.
|
|
69
69
|
- **Callback data trust.** `uniswapV3SwapCallback` validates the caller by reconstructing the pool address from `(tokenIn, tokenOut, fee)`. The factory `getPool` lookup makes spoofing infeasible in practice.
|
|
70
70
|
- **receive() function.** The contract accepts arbitrary ETH via `receive()`. This is necessary for WETH unwraps, cashout reclaims, and V4 PoolManager takes. Any ETH received is absorbed into the next swap's leftover refund. Since the router is stateless by design, this is acceptable — funds should not persist between transactions, and recovering accidentally-sent ETH is preferable to locking it permanently.
|
|
71
71
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bananapus/router-terminal-v6",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.26",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
"artifacts": "source ./.env && npx sphinx artifacts --org-id 'ea165b21-7cdc-4d7b-be59-ecdd4c26bee4' --project-name 'nana-router-terminal-v6'"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@bananapus/buyback-hook-v6": "^0.0.
|
|
21
|
-
"@bananapus/core-v6": "^0.0.
|
|
20
|
+
"@bananapus/buyback-hook-v6": "^0.0.26",
|
|
21
|
+
"@bananapus/core-v6": "^0.0.32",
|
|
22
22
|
"@bananapus/permission-ids-v6": "^0.0.15",
|
|
23
23
|
"@openzeppelin/contracts": "^5.6.1",
|
|
24
24
|
"@uniswap/permit2": "github:Uniswap/permit2",
|