Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/fix-folio-v6-rebalances.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@reserve-protocol/sdk": patch
"@reserve-protocol/react-sdk": patch
---

Sync the Folio v6 ABI with `reserve-index-dtf` main and encode v6 basket proposals with the expected rebalance nonce and required execution deadline. V6 fee-recipient calls now require both mutable and immutable recipient tables; higher-level revenue proposals reject v6 until they can preserve the immutable table.
12 changes: 10 additions & 2 deletions apps/docs/src/pages/index-dtf/contracts-and-versions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ Current SDK settings/proposal write builders support `5.0.0` and `6.0.0` ABI tar

Version-specific areas include:

- basket rebalance proposals
- allowlist settings
- self-fee settings
- auction length settings
- mutable and immutable fee-recipient tables

## Why This Matters

Expand All @@ -25,12 +27,18 @@ startRebalance(address[] newTokens, BasketRange[] newLimits, Prices[] newPrices,
SDK/Register ABIs can use newer signatures like:

```solidity
// v5
startRebalance(TokenRebalanceParams[] tokens, RebalanceLimits limits, ...)

// v6
startRebalance(uint256 rebalanceNonce, TokenRebalanceParams[] tokens, RebalanceLimits limits, ..., uint256 deadline)
```

Use SDK builders unless you have a specific reason to hand-encode a call.
Use SDK builders unless you have a specific reason to hand-encode a call. The v6 basket proposal builder reads the current rebalance nonce, encodes the next nonce, and requires an explicit Unix-seconds `deadline` so a stale proposal cannot start a rebalance.

Raw v6 fee-recipient calls require both the mutable and full immutable tables. The higher-level revenue-distribution proposal remains v5-only until the SDK can read and preserve the immutable table.

Current rebalance/open-auction and issuance helpers are v5-shaped unless the specific function explicitly accepts a version. Do not assume every write helper supports every deployed Folio version.
Open-auction and issuance helpers remain version-sensitive. Do not assume every write helper supports every deployed Folio version.

## Address Normalization

Expand Down
1 change: 1 addition & 0 deletions apps/docs/src/pages/llm-guide.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ That address is LCAP from `indexDtfCatalog`.
- Always pass `call.chainId` through to simulation and wallet layers when supported.
- Use SDK builders for versioned writes instead of hand-encoding ABI calldata.
- DTF settings builders often need `version: "5.0.0" | "6.0.0"`; read it with `sdk.index.getVersion({ address, chainId })`.
- V6 basket proposals require an explicit Unix-seconds `deadline`; the SDK reads the current rebalance nonce and encodes the next nonce.
- Raw version-sensitive `prepare*` helpers should receive the target DTF version explicitly. Higher-level proposal builders may fetch the DTF version when omitted.
- Proposal action builders prepare vote, queue, execute, and cancel calls. They do not invalidate queries after a transaction.

Expand Down
19 changes: 10 additions & 9 deletions docs/index-dtf/contracts-and-versions.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,25 +45,26 @@ Register may label roles differently. Encode the contract role, not the UI label

Only include version deltas verified from source, changelogs, or SDK ABIs. Older public docs and local contract source may not describe every deployed SDK target.

| Version | Important Deltas |
| ------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
| `1.0.0` | Initial release. |
| `2.0.0` | Repeatable auctions, dust limits, minimum mint output. |
| `3.0.0` | Skipped/deprecated path around individual repeatable auctions against target weights. |
| `4.0.0` | Trusted fillers, rebalance targets, auction overhaul, daily fee accounting, `AUCTION_APPROVER` replaced by `REBALANCE_MANAGER`. |
| `5.0.0` | SDK-supported write ABI for current deployed Index DTF settings and rebalance proposal flows. |
| `6.0.0` | SDK-supported write ABI with v6-specific settings names such as `setMaxAuctionLength`; verify function support from ABI before encoding. |
| Version | Important Deltas |
| ------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `1.0.0` | Initial release. |
| `2.0.0` | Repeatable auctions, dust limits, minimum mint output. |
| `3.0.0` | Skipped/deprecated path around individual repeatable auctions against target weights. |
| `4.0.0` | Trusted fillers, rebalance targets, auction overhaul, daily fee accounting, `AUCTION_APPROVER` replaced by `REBALANCE_MANAGER`. |
| `5.0.0` | SDK-supported write ABI for current deployed Index DTF settings and rebalance proposal flows. |
| `6.0.0` | SDK-supported write ABI with explicit rebalance nonce/deadline, mutable and immutable fee-recipient tables, and settings names such as `setMaxAuctionLength`. |

## SDK Version Handling

The SDK handles version-specific write calls where the affected builder encodes the calldata. Example:

- v5 auction length setter: `setAuctionLength`.
- v6 auction length setter: `setMaxAuctionLength`.
- v6 basket proposal: `startRebalance(rebalanceNonce, tokens, limits, auctionLauncherWindow, ttl, deadline)`.

Product builders should accept a known DTF version or fetch it when needed. Keep version checks local to the affected write/read handler instead of adding a central operation registry.

Current rebalance/open-auction and issuance helpers are v5-shaped unless the builder explicitly accepts a version. Do not assume every write helper supports every listed version.
The basket proposal builder supports v5 and v6. For v6 it reads the current nonce, encodes the next nonce, and requires an explicit Unix-seconds deadline. Raw v6 fee-recipient calls require both mutable and full immutable tables; the higher-level revenue-distribution proposal remains v5-only until the immutable table can be read and preserved. Open-auction and issuance helpers remain version-sensitive; do not assume every write helper supports every listed version.

Source owner: SDK calldata builders are owned by `dtf-sdk/packages/sdk/src/index-dtf/governance/propose/calls.ts`; protocol mechanics are owned by the Index DTF contract repo.

Expand Down
3 changes: 2 additions & 1 deletion docs/known-gotchas.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ This file collects facts that are easy to get wrong. Check it before changing SD
- `reserve-index-dtf` source may be ahead of live deployed versions.
- Current SDK write builders support v5 and v6 ABI targets. Do not assume every deployed DTF uses the latest ABI.
- Older docs and comments can mention v3 or v4 signatures. Verify against the ABI/version being encoded.
- `startRebalance`, `openAuction`, and `bid` signatures have changed across versions.
- `startRebalance`, `openAuction`, and `bid` signatures have changed across versions. V6 `startRebalance` requires the expected next nonce, an execution deadline, and at least two rebalance tokens.
- V6 `setFeeRecipients` replaces both tables at once. Callers must preserve the full immutable recipient table; the high-level revenue-distribution proposal is therefore v5-only for now.

## Subgraph Mismatches

Expand Down
6 changes: 3 additions & 3 deletions docs/wiki/domains/sdk.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Core SDK Domain
updated: 2026-07-22
updated: 2026-08-25
type: domain
sources:
- packages/sdk/src/**
Expand All @@ -25,7 +25,7 @@ sources:
- On-chain integer amounts are `Amount`; display-class values may be numbers.
- Proposal vote success is OZ strict majority for both products: a for/against tie is DEFEATED. Subgraph proposal state lags time-based transitions, so proposal-state surfaces derive from votes, quorum, and deadline instead of returning the raw field — except Yield proposal detail, which reads authoritative governor state (last bullet).
- Index DTF proposal IDs are globally unique and do not need DTF-membership checks.
- Public call builders require exact calldata and value assertions when changed.
- Public call builders require exact calldata and value assertions when changed. Folio v6 basket proposals require at least two tokens, read and increment the current rebalance nonce, and require an explicit execution deadline; v5 remains the four-argument call. V6 fee-recipient writes must preserve the full immutable table.
- GraphQL-generated output must match the configured deployed schemas; ordinary CI and `release:ci` rerun codegen and reject drift.
- Account balance snapshots bind through both the namespace and DTF ref. `selectPriceAtMark(points, mark?)` requires timestamped points, never selects a future or non-positive price when a mark is provided, and preserves latest-positive selection when it is omitted.
- Yield proposal lists combine indexed vote totals with the latest chain-native timepoint, so they can be eventually consistent near `voteEnd`; proposal detail reads authoritative governor state.
Expand All @@ -34,4 +34,4 @@ sources:

Register adoption lags the published SDK. Add new core reads only when a concrete consumer cannot be migrated with the existing namespace. The full/current DTF route fields and rebalance-health boundary are implemented; current pressure is consuming them in Register and filling the consumption-driven Yield gaps in `docs/SDK_AUDIT_2026-07-09.md`.

The package preserves internal modules while retaining one ergonomic root API. A consumer price reader is 15.41 kB minified/5.12 kB gzip and excludes Zod, rebalance-lib, and Decimal; `check:sdk-bundle` protects that boundary.
The package preserves internal modules while retaining one ergonomic root API. The generated Folio v6 ABI is the single source used for v6 reads, writes, and proposal decoding; do not restore a duplicate `dtf-index-abi-v6` copy. A consumer price reader is 15.41 kB minified/5.12 kB gzip and excludes Zod, rebalance-lib, and Decimal; `check:sdk-bundle` protects that boundary.
1 change: 1 addition & 0 deletions docs/wiki/log.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,4 @@ Append-only chronological record: lessons, corrections, friction. Newest section
## 2026-08-25

- The release workflow's `workflow_run` checkout allowed a successful fork workflow to select code executed with repository write permissions and npm OIDC. Publishing now starts only from `main` pushes or manual `main` dispatches, while the existing Changesets v1 release-PR and trusted-publishing flow remains unchanged.
- The advertised Folio v6 write target was only partial: its generated ABI and basket proposal path still encoded v5 `startRebalance`. Syncing the Folio artifact from `reserve-index-dtf` main exposed the six-argument nonce/deadline call, the two-token minimum, and two-table fee-recipient setter. The SDK now uses rebalance-lib 3.3.1, reads nonce+1 for v6 proposals, requires an explicit deadline, preserves the v5 path, and reuses one generated v6 ABI instead of two drifting copies. Raw v6 fee-recipient calls require the full immutable table; the high-level revenue proposal rejects v6 rather than emitting calldata that can discard it. PR CI also caught deployed Index subgraph schema drift, so the committed generated types were refreshed and the live codegen check rerun green.
Loading