Skip to content

Support V6 revnets; launch new revnets on V6#136

Open
mejango wants to merge 4 commits into
mainfrom
feat/v6
Open

Support V6 revnets; launch new revnets on V6#136
mejango wants to merge 4 commits into
mainfrom
feat/v6

Conversation

@mejango

@mejango mejango commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds Juicebox V6 support end-to-end and makes V6 the only version new revnets launch on. Existing V4/V5 revnets remain fully viewable and manageable.

Depends on Bananapus/juice-sdk-v4#25 — this PR pins juice-sdk-core@^3.0.0 / juice-sdk-react@^6.0.0, which publish when that PR merges (changesets). Run yarn install to refresh yarn.lock once they're on npm.

Create flow → V6 only

  • parseDeployData builds the v6 REVDeployer.deployFor args (4-arg overload — the v6 deployer bakes in the multi terminal, router terminal registry, buyback hook, and REVLoans, and deploys a default 721 hook internally). REVConfig uses operator + scopeCashOutsToLocalBalances.
  • Reads JBProjects.creationFee() per chain and sends it as the tx value — v6 requires the exact fee; the ERC-2771 forward request and Relayr bundle carry it (SDK support added in the SDK PR).
  • Sucker configs come from parseSuckerDeployerConfig(..., { version: 6 }) — v6 per-remote-chain CCIP deployers, bytes32 peer/remoteToken shape.
  • Post-deploy redirect and homepage links use /v6:; there was no version picker to remove — the create flow's implicit version flips to 6.

View/manage flows stay multi-version

  • Where v6 renamed or reshaped functions, calls branch on the context version using the SDK's new version-suffixed ABIs: currentSurplusOf (3 surplus hooks), currentReclaimableSurplusOf (same selector-trap noted inline: empty arrays encode identically but the selector differs), borrowFrom, reallocateCollateralFromLoan, borrowableAmountFrom (v6 returns (borrowableNow, borrowableCapacity) — normalized by a new useBorrowableAmountFrom hook), auto-issuance (moved to the new REVOwner contract in v6), and the fixed loan fee (REVLoans.MIN_PREPAID_FEE_PERCENT replaces REVDeployer.FEE).
  • Paying with non-accounting tokens routes through the v6 JBRouterTerminalRegistry (replaces the swap-terminal registries).
  • Bridging: prepare uses the v6 signature (bytes32 beneficiary, opaque metadata) via a minimal vendored v6 sucker ABI. toRemote is unchanged. Manual claim UI for v6 still uses the juicerkle service, which doesn't serve v6 leaf shapes yet (bytes32 beneficiary + metadata) — the keeper auto-processes v6 claims in the meantime.
  • Homepage top-projects query widened to version_in: [5, 6] with per-row version links; $REV links point at the v6 revnet (/v6:eth:3).
  • graphql.schema.json / src/generated/* are regenerated output (yarn generate:gql against the live bendystraw schema).

Verification

  • tsc --noEmit and next build pass against the locally built SDK from the SDK PR.
  • Live Sepolia simulations of the exact args produced by parseDeployData + parseSuckerDeployerConfig({version: 6}) against the deployed v6 REVDeployer, with value = creationFee (1e14 wei): a multichain ETH revnet (Sepolia ↔ OP-Sepolia CCIP sucker, 2 stages, auto-issuance, splits) and a single-chain USDC-reserve revnet both returned a valid (revnetId, hook).

🤖 Generated with Claude Code

- Create flow deploys via the v6 REVDeployer.deployFor (4-arg overload; terminals,
  buyback hook, and loans are baked into the deployer) with the exact JBProjects
  creation fee as msg.value, v6 CCIP sucker deployers, and the v6 ERC-2771
  forwarder for Relayr. New revnets launch on V6 only.
- View/manage flows stay version-aware for existing v4/v5 revnets: version-suffixed
  ABIs where interfaces drifted (currentSurplusOf, currentReclaimableSurplusOf,
  borrowFrom, reallocateCollateralFromLoan, borrowableAmountFrom via a normalizing
  hook, autoIssueFor via REVOwner on v6, REVLoans MIN_PREPAID_FEE_PERCENT in place
  of the removed REVDeployer.FEE).
- Payments in non-accounting tokens route through the v6 JBRouterTerminalRegistry
  (replaces the swap terminal registries).
- Bridge send (sucker prepare) uses the v6 bytes32-beneficiary signature; manual
  v6 claim UI awaits juicerkle v6 support (the keeper auto-processes v6 claims).
- Homepage top projects include v5 and v6 groups and link per-row by version;
  $REV links point at the v6 revnet.
- Requires juice-sdk-core ^3.0.0 and juice-sdk-react ^6.0.0
  (Bananapus/juice-sdk-v4#25); run yarn install once those are published.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 14, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
revnet-app Ready Ready Preview Jul 16, 2026 3:48am

Request Review

The juice-sdk-core/juice-sdk-react npm names aren't publishable by the team;
the SDK now ships under the @Bananapus scope at 1.0.0.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mejango

mejango commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

Update: the SDK is being republished as @bananapus/nana-sdk-core@1.0.0 / @bananapus/nana-sdk-react@1.0.0 (Bananapus/juice-sdk-v4#27) since the old npm names aren't publishable. This PR now imports from the scoped names and pins ^1.0.0. Once #27 merges and the Release workflow publishes, run yarn install here to refresh the lockfile and Vercel should go green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Migrate the app's hand-rolled V6 protocol logic onto the SDK's
framework-agnostic action layer (nana-sdk-core 1.1.x, nana-sdk-react 2.0.0):

- BridgeDialog: build the v6 sucker `prepare` request with
  buildBridgePrepareTx (handles bytes32 beneficiary padding + zeroHash
  metadata); delete the local jbSuckerV6Abi copy in favor of the SDK's.
- create/page: read the project creation fee via getProjectCreationFee and
  drive encodeFunctionData / gas estimate / Relayr from the request returned
  by parseDeployData.
- parseDeployData: build stages with buildRevnetStageConfig, the reserve
  asset context with buildAccountingContext (token-keyed currency computed
  by the builder), and return a buildDeployRevnetTx request. Split-group
  percents now run through fillSplitPercents, fixing a latent revert when
  per-row rounding drifted the group away from an exact 1e9 total.
- useBorrowDialog: v6 borrowFrom / reallocateCollateralFromLoan writes go
  through buildBorrowTx / buildReallocateCollateralTx.
- AutoIssuance: v6 branch uses buildAutoIssueTx.
- paymentTerminal: v6 resolution goes through resolvePaymentTerminal
  (router-registry fallback); v4/v5 logic untouched.
- tsconfig: moduleResolution "node" -> "bundler" so the package's /v6
  subpath export resolves (webpack already resolved it; tsc now does too).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mejango

mejango commented Jul 16, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up commit c43e79b migrates the app's hand-rolled v6 protocol logic onto the SDK's new @bananapus/nana-sdk-core/v6 action layer (deps bumped to core ^1.1.0 / react ^2.0.0): sucker bridge prepare, creation-fee read, the whole revnet deploy encode (buildDeployRevnetTx/buildRevnetStageConfig), borrow/reallocate writes, auto-issuance, and v6 terminal resolution. A differential test showed byte-identical deployFor calldata vs the old implementation — except split groups, which previously could sum to 999,999,999 (on-chain revert) and now sum to exactly 1e9 via fillSplitPercents. Requests now carry chainId, so wagmi enforces the target chain on writes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant