Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
6059ca4
feat(index-dtf): explicit version contract and protocol-accurate auct…
lcamargof Sep 17, 2026
d7ae6ea
feat(index-dtf): read Folio 6.0 maxAuctionLength and accept historica…
lcamargof Sep 17, 2026
338a2a4
docs(react-sdk): list useIndexDtfMaxAuctionLength
lcamargof Sep 17, 2026
4e6c89d
fix(index-dtf): reject an explicit v6 auctionLength that diverges fro…
lcamargof Sep 17, 2026
40b67f3
fix(index-dtf): guard the settings builders with the write-version as…
lcamargof Sep 17, 2026
2328e19
feat(index-dtf): require version on every Folio write builder and exp…
lcamargof Sep 18, 2026
35451fa
feat(index-dtf): complete Folio 6.0 support: state reads, version reg…
lcamargof Sep 18, 2026
6b0db30
test(index-dtf): accept a sandbox fixture without an authority propos…
lcamargof Sep 18, 2026
b1bfaa0
feat(index-dtf): default Folio 6.0 deploys to the real 6.0.0 deployers
lcamargof Sep 30, 2026
00877b4
test(index-dtf): prove the real 6.0.0 deployers on Anvil forks of mai…
lcamargof Sep 30, 2026
852c307
feat(index-dtf): read the Folio 6.0 fields from the subgraph
lcamargof Sep 18, 2026
d34de77
fix(sdk): export ABI arrays, not { default }, from the CommonJS entry
lcamargof Sep 30, 2026
e498f24
fix(index-dtf): encode Folio 6.0.0 endRebalance with the rebalance nonce
lcamargof Sep 30, 2026
6f65e4c
fix(index-dtf): only trust deploy events emitted by the expected depl…
lcamargof Sep 30, 2026
c71ae3b
feat(index-dtf): reject v6 basket tokens missing from an enabled trad…
lcamargof Sep 30, 2026
429a3a9
feat(index-dtf): regenerate the index subgraph types against 1.11.1 a…
lcamargof Oct 1, 2026
cd26ca6
test(index-dtf): keep the indexed-sandbox fork smoke read-only
lcamargof Oct 1, 2026
352b319
test(index-dtf): run a complete Folio 6.0.0 rebalance on the real byt…
lcamargof Oct 1, 2026
72a6fff
fix(sdk): always remove the unpacked package in check:package
lcamargof Oct 1, 2026
ae9f9dc
fix(sdk): export the combined dtfCatalog, not the catalog namespace, …
lcamargof Oct 1, 2026
a641b64
fix(index-dtf): pay the empty-table pool to the DAO and guard every p…
lcamargof Oct 1, 2026
58bcbfb
refactor(index-dtf): review follow-ups for the v6 release fixes
lcamargof Oct 1, 2026
df8ff0f
docs(wiki): ingest the 0.7.0 release fixes
lcamargof Oct 1, 2026
1b811f4
fix(index-dtf): codex review follow-ups for the v6 release fixes
lcamargof Oct 1, 2026
b415c5e
feat(sdk): expose legacy vote-lock vaults and their dependents for th…
JuampiRombola Oct 5, 2026
e476103
feat(sdk): decode the 6.0.0 upgrade and governance migration spells a…
JuampiRombola Oct 5, 2026
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
5 changes: 5 additions & 0 deletions .changeset/fix-cjs-abi-exports.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reserve-protocol/sdk": patch
---

Fix the CommonJS entry: `require("@reserve-protocol/sdk")` exported `{ default: abi }` instead of the ABI array for `folioV6Abi`, `folioArtifactAbi`, `folioDeployerV6Abi`, `folioVersionRegistryAbi`, `dtfIndexAbi`, `dtfIndexAbiV1`, `dtfIndexAbiV2`, `dtfIndexAbiV4`, `dtfIndexGovernanceAbi`, `dtfIndexStakingVaultAbi` and `timelockAbi`, so encoding with them failed (`abi.filter is not a function`). ESM was unaffected. The ABI modules no longer carry a default export, and `check:package` now packs the tarball and loads it through both `import` and `require` in CI and the release gate.
6 changes: 6 additions & 0 deletions .changeset/fix-cjs-dtf-catalog-export.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@reserve-protocol/dtf-catalog": minor
"@reserve-protocol/sdk": patch
---

Fix `require("@reserve-protocol/sdk").dtfCatalog`: the CommonJS entry re-exported the catalog's module namespace (`{ default, indexDtfs, ... }`) instead of the chain-keyed catalog, because the bundler's interop for a re-exported default hands out `module.exports`. The catalog now also exports the combined catalog by name (`dtfCatalog`, same object as the default export), and the SDK re-exports that. `check:package` now compares every export's value between the ESM and CommonJS entries, not just its kind.
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
---

Generate and export the Folio v6, FolioDeployer v6, and FolioVersionRegistry ABIs from pinned `reserve-index-dtf` artifacts, 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.
5 changes: 5 additions & 0 deletions .changeset/fix-index-voting-snapshot.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reserve-protocol/sdk": patch
---

Read standard Index DTF proposal voting power at the proposal snapshot itself, matching the governor and including delegation checkpoints created at that timepoint. Preserve clamping for snapshots at or after the current clock.
10 changes: 10 additions & 0 deletions .changeset/index-dtf-deploy-event-emitter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
"@reserve-protocol/sdk": minor
"@reserve-protocol/react-sdk": minor
---

Index DTF: deploy event extraction only trusts the deployer.

- Breaking: `extractIndexDtfDeployedAddress(logs, target)` takes the deploy target (`{ chainId, version, deployer? }`, the same object the deploy builders take) and only reads `FolioDeployed` / `GovernedFolioDeployed` emitted by that version's deployer. Before, any emitter was accepted, so a basket token could emit a lookalike event during `transferFrom` and the SDK returned the attacker's address.
- Breaking: `extractIndexDtfDeployedStakingTokenAddress(logs, { chainId })` only reads `DeployedGovernedStakingToken` from the chain's `INDEX_DTF_GOVERNANCE_DEPLOYER_ADDRESS`.
- Both throw `RECORD_NOT_FOUND` without the deployer's event and `INVALID_RESPONSE` when the deployer's events name more than one address.
5 changes: 5 additions & 0 deletions .changeset/index-dtf-v6-basket-allowlist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reserve-protocol/sdk": patch
---

Index DTF: the Folio 6.0 basket proposal builder reads the trade allowlist and throws `INVALID_INPUT` (meta `tokens`) when enforcement is on and a rebalance token is missing from it, instead of building a proposal whose `startRebalance` reverts `Folio__TokenNotAllowlisted` on execution.
8 changes: 8 additions & 0 deletions .changeset/index-dtf-v6-deployer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@reserve-protocol/sdk": minor
---

Index DTF: Folio 6.0 deployments.

- `prepareIndexDtfDeploy`, `prepareIndexDtfDeployGoverned` and their plans take `version`. `"5.0.0"` keeps the registered per-chain deployer and the existing shapes. `"6.0.0"` deploys through `INDEX_DTF_V6_DEPLOYER_ADDRESS` and takes v6 additional details (`maxAuctionLength`, `feeRecipients`, `immutableFeeRecipients`, `tvlFee`, `mintFee`, `selfFee`, `mandate`) and, for governed deploys, one optimistic `governance` table instead of owner/trading pairs.
- Deploy plans approve the deployer they resolved. `getIndexDtfDeployerAddress` resolves the target for `{ chainId, version, deployer? }`. Both deploy builders now return `IndexDtfCall`, so `call.contract` is typed against the generic `Abi`.
9 changes: 9 additions & 0 deletions .changeset/index-dtf-v6-end-rebalance-nonce.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@reserve-protocol/sdk": minor
"@reserve-protocol/react-sdk": minor
---

Index DTF: Folio 6.0 ABIs re-synced to the deployed 6.0.0 (`reserve-index-dtf@7d97c80`, identical to the explorer-verified implementation on mainnet, Base and BSC).

- Breaking for 6.0.0: `prepareIndexDtfEndRebalance` / `ref.prepareEndRebalance` require `rebalanceNonce` and encode `endRebalance(uint256)`; the previous nonce-less call reverted on every real 6.0.0 Folio. 5.0.0 still encodes `endRebalance()`. New `PrepareIndexDtfEndRebalanceParams` type.
- `folioV6Abi` / `folioArtifactAbi` now carry `endRebalance(uint256 rebalanceNonce)`. A unit test compares the generated Folio and FolioDeployer ABIs item for item with the Base Blockscout verified ABIs, so drift from the deployed contracts fails CI.
5 changes: 5 additions & 0 deletions .changeset/index-dtf-v6-open-auction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reserve-protocol/sdk": patch
---

Encode Folio 6.0 `openAuction` calls with the required trailing auction length while preserving the existing Folio 5.0 call shape.
8 changes: 8 additions & 0 deletions .changeset/index-dtf-v6-real-deployer.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@reserve-protocol/sdk": minor
---

Index DTF: Folio 6.0 deploys target the real 6.0.0 `FolioDeployer`.

- New `INDEX_DTF_V6_DEPLOYER_ADDRESS` per chain (mainnet `0x2B1C…7392`, Base `0x4c89…cF67`, BSC `0x9837…1963`). `"6.0.0"` deploys go there by default, whether or not the chain's `FolioVersionRegistry` has registered 6.0.0 yet; `deployer` is an optional override for fork and sandbox deployers.
- Breaking: `prepareIndexDtfDeployAssetApproval(s)` require `version` and default the spender to that version's deployer, so a 6.0.0 deploy never approves the 5.0.0 deployer by default. `deployer` still overrides the spender.
9 changes: 9 additions & 0 deletions .changeset/index-dtf-v6-settings.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@reserve-protocol/sdk": minor
---

Index DTF: Folio 6.0 settings and revenue proposals.

- `buildIndexDtfSettingsProposal` accepts `selfFee` (percent kept for holders), `tradeAllowlist: { enabled?, add?, remove? }` and, for revenue changes on 6.0.0, `immutableFeeRecipients`. When the table is omitted the client-bound builder reads it from RPC. The mutable shares are scaled into whatever the immutable table leaves; v5 DTFs reject the v6-only fields by name.
- `prepareIndexDtfSetFeeRecipients` on 6.0.0 sorts both tables by address and rejects tables that do not total 100%, mirroring FolioLib so a bad table fails at build time. Folio 6.0 deploys apply the same check.
- New `sortIndexDtfFeeRecipients`, `scaleIndexDtfFeeRecipients`, `assertIndexDtfFeeRecipientTables` helpers.
9 changes: 9 additions & 0 deletions .changeset/index-dtf-v6-state-reads.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@reserve-protocol/sdk": minor
"@reserve-protocol/react-sdk": minor
---

Index DTF: Folio 6.0 state reads and the version registry.

- `getIndexDtfSelfFee`, `getIndexDtfImmutableFeeRecipients` (the full table `setFeeRecipients` must receive back), `getIndexDtfTradeAllowlist` (`{ enabled, tokens }`) and `getIndexDtfIsTokenAllowlisted` read the v6 contract from RPC at one pinned block; on a v5 proxy they throw (the immutable-table read probes `folioFeeForSelf` first instead of reporting an empty table). Exposed as `sdk.index.get*`, on the DTF ref, and as `useIndexDtf*` hooks.
- `getIndexDtfLatestVersion` and `getIndexDtfVersionDeployment` read `FolioVersionRegistry` (`INDEX_DTF_VERSION_REGISTRY_ADDRESS` per chain, overridable with `registry`); `getIndexDtfVersionHash` mirrors the registry's `keccak256(abi.encodePacked(version))`. Hooks sit at the static cache tier.
13 changes: 13 additions & 0 deletions .changeset/index-dtf-v6-subgraph-fields.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
"@reserve-protocol/sdk": minor
"@reserve-protocol/react-sdk": minor
---

Index DTF: Folio 6.0 fields from the subgraph.

- `IndexDtf` gains `version`, `rebalance.maxAuctionLength`, `rebalance.tradeAllowlist`, `fees.immutableRecipients`, `fees.selfFee` and `financials.selfRevenue` (absent, empty or zero before 6.0 and for grafted DTFs whose fields are null; `tradeAllowlist` is left out unless both the flag and the token list are indexed). `financials.totalRevenue` is protocol + governance + external + self; revenue fields are raw 18-decimal share amounts. The React SDK's flat `IndexDtfData` gains `selfRevenue`.
- `getIndexDtfRevenue` folds the immutable table and the holders' share into `effectiveDistribution` (`holders.percentage`) in the order Folio pays: the DAO fee first, the self fee keeps its share of the rest for holders, and the mutable and immutable tables split what is left (DAO 50%, self fee 25%, tables 60/40 → mutable 22.5%, immutable 15%, holders 12.5%). With both tables empty the DAO gets the recipients' pool, as `distributeFees` does.
- Breaking: `getIndexDtfEffectiveRevenueDistribution(fees, platformFee)` takes `{ recipients, immutableRecipients, selfFee }` instead of the recipients array.
- Breaking for code that builds these objects by hand: `Fees` requires `immutableRecipients` and `selfFee`, `Financials` requires `selfRevenue`, and `IndexDtfRevenueDistribution` requires `holders`.

Rollout blocker: `GetIndexDTF` now needs the index subgraph 1.11.1 schema. Against a 1.10.2 endpoint every Index DTF query fails, so this release must not be published (or Register pointed at it) before all three `prod` endpoints (mainnet, Base, BSC) serve 1.11.1. `release:ci` enforces it: `graphql:codegen:check` keeps checking Base `prod` by default (`INDEX_DTF_SUBGRAPH_SCHEMA=<.../dtf-index-base/1.11.1-test/gn>` checks the candidate), and the new `check:subgraph-endpoints` validates the shipped documents against every configured endpoint.
5 changes: 5 additions & 0 deletions .changeset/index-dtf-v6-upgrade.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@reserve-protocol/sdk": minor
---

Index DTF: 5.0.0 → 6.0.0 upgrade proposals. `buildIndexDtfUpgradeToV6Proposal` (`sdk.index.buildUpgradeToV6Proposal`, `ref.buildUpgradeToV6Proposal`) builds the spell migration against the DTF's admin governance: selector-registry swap of `startRebalance` for optimistic governors, `transferOwnership(spell)` on the proxy admin, then `cast`. `buildIndexDtfUpgradeToV6Calls` is the pure form (`selectorRegistry` present means optimistic); the description defaults to "Upgrade to Folio 6.0.0" and the DTF can be injected with `dtf`; `INDEX_DTF_START_REBALANCE_SELECTOR` and `upgradeSpell600Abi` are exported.
11 changes: 11 additions & 0 deletions .changeset/index-dtf-v6-write-contract.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@reserve-protocol/sdk": minor
"@reserve-protocol/react-sdk": minor
---

Index DTF: every Folio write builder takes `version`.

- `prepareIndexDtfBid`, `prepareIndexDtfCloseAuction`, `prepareIndexDtfEndRebalance`, `prepareIndexDtfOpenAuctionUnrestricted`, `prepareIndexDtfDistributeFees`, `prepareIndexDtfMint` (and its plan) and `prepareIndexDtfRedeem` now require `version` (`"5.0.0"` | `"6.0.0"`) and reject anything else with `SdkError(INVALID_INPUT)`. Their calldata is byte-identical across both versions; the ABI attached to the call follows the version.
- Breaking for ref callers: `dtf.prepareEndRebalance()` and `dtf.prepareDistributeFees()` now take `{ version }`. Read it with `sdk.index.getVersion` / `useIndexDtfVersion`.
- These five builders now return `IndexDtfCall` (`contract.abi` is `Abi`, `contract.functionName` is `string`, `contract.args` is `readonly unknown[]`); call sites that relied on the narrower inferred type must widen.
- New `getIndexDtfRebalanceNonce` (`sdk.index.getRebalanceNonce`, `ref.getRebalanceNonce`, `useIndexDtfRebalanceNonce`) reads Folio 6.0's `getRebalanceNonce()`.
11 changes: 11 additions & 0 deletions .changeset/index-dtf-version-contract.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@reserve-protocol/sdk": minor
"@reserve-protocol/react-sdk": minor
---

Index DTF rebalance: explicit version contract and protocol-accurate auction state.

- `prepareIndexDtfOpenAuctionArgs`, `prepareIndexDtfOpenAuction` and `buildIndexDtfStartRebalanceArgs` now require `version` (`"5.0.0"` | `"6.0.0"`) and reject anything else with `SdkError(INVALID_INPUT)`; there is no silent v5 default. `buildIndexDtfStartRebalance` reads the proxy version when none is passed and applies the same check.
- v6 open-auction math takes `auctionLength` and carries it into the args; `prepareIndexDtfOpenAuction` uses it when no explicit length is passed.
- `getLatestAuction` / `getActiveAuction` resolve one block first and pin every read to it, report `currentRebalanceNonce` and `blockNumber`, and treat an auction as active only while `startTime <= now <= endTime` (inclusive, as Folio checks) and its nonce matches the current rebalance.
- Open-auction inputs reject zero, negative or non-finite prices before the rebalance library runs.
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ jobs:
- name: Build
run: pnpm build

- name: Package Entry Points
run: pnpm --filter @reserve-protocol/sdk check:package

- name: Typecheck
run: pnpm typecheck

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ pnpm-debug.log*

.DS_Store
*.tsbuildinfo

.claude/
.scratch/
2 changes: 2 additions & 0 deletions .oxfmtrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
"**/coverage/**",
"**/.pnpm-store/**",
"**/.output/**",
"**/.claude/**",
"**/.scratch/**",
"**/*.generated.ts",
"**/CHANGELOG.md",
"scripts/llm-workflow/**",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pnpm docs:links
pnpm release:ci
```

`pnpm release:ci` runs typecheck, lint/format, live-schema GraphQL codegen freshness, tests, builds (including the docs site and SDK bundle budget), documentation/catalog checks, and package dry-runs for all publishable packages.
`pnpm release:ci` runs checked-in ABI freshness, typecheck, lint/format, live-schema GraphQL codegen freshness, tests, builds (including the docs site and SDK bundle budget), documentation/catalog checks, and package dry-runs for all publishable packages.

## Quick Example

Expand Down
2 changes: 1 addition & 1 deletion apps/docs/src/pages/gotchas.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The SDK handles protocol encoding.

Some Index DTF write builders need a contract version.

Current settings/proposal write builders support `5.0.0` and `6.0.0` targets where implemented. Some issuance, rebalance, and auction helpers are modern/v5-shaped; verify the specific builder before replacing legacy calldata.
Every settings, rebalance, auction and fee-distribution builder requires `version` (`5.0.0` or `6.0.0`) and rejects other releases. `prepareMint` and `prepareRedeem` take it too (their bytes are identical in v5 and v6, but v4 and unknown releases are rejected); verify before replacing legacy v4 calldata.

See [Contracts & Versions](/index-dtf/contracts-and-versions) before hand-encoding writes.

Expand Down
39 changes: 37 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,45 @@ 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. It also reads the trade allowlist: with enforcement on, every rebalance token (kept or new) must be allowlisted or the builder throws `INVALID_INPUT`, because `startRebalance` would revert `Folio__TokenNotAllowlisted`. The check runs at build time; governance can still change the allowlist before the proposal executes. The lower-level `buildIndexDtfStartRebalance` args builder does not read the allowlist.

Raw v6 fee-recipient calls require both the mutable and full immutable tables, sorted by address and totalling 100%
together; the SDK sorts and checks them before encoding. `buildSettingsProposal` reads the current immutable table with
`sdk.index.getImmutableFeeRecipients` and scales the mutable shares into the remainder.

## Upgrading A 5.0.0 DTF To 6.0.0

The migration is a governance proposal that hands the DTF's `FolioProxyAdmin` to the reviewed `UpgradeSpell_6_0_0`
and casts it. `sdk.index.buildUpgradeToV6Proposal({ address, chainId, spell })` reads the DTF's admin governance and
builds the exact sequence: an optimistic governor first registers the 6.0.0 `startRebalance` selector and unregisters
the 5.0.0 one (the signature changed), then `transferOwnership(spell)` on the proxy admin and `cast(folio, proxyAdmin,
selectorRegistry)`; standard governance gets the last two calls with a zero registry. `buildUpgradeToV6Calls` is the
pure form when the addresses are already known (`selectorRegistry` present means optimistic). The spell address is an
input: no spell is deployed on a public chain yet; the SDK tests reproduce the mainnet sandbox's executed proposals
byte for byte. The description defaults to "Upgrade to Folio 6.0.0".

Submit it as a standard proposal (`prepareSubmitProposal`) even on an optimistic governor: the registry calls are not
allowlisted selectors. The spell checks its preconditions only at execution, after the vote, so confirm them before
proposing: the executing timelock is the DTF's sole `DEFAULT_ADMIN_ROLE` member, the auction length is at least 120
seconds, no state change is active, the current rebalance's `availableUntil` has passed, and the last auction has
ended. `getVersionDeployment({ version: "6.0.0" })` tells you whether the chain's registry can serve the upgrade.

## Which Versions A Chain Can Run

`sdk.index.getLatestVersion({ chainId })` and `sdk.index.getVersionDeployment({ chainId, version })` read the
on-chain `FolioVersionRegistry` (deployer, Folio implementation, deprecation flag). Use them instead of assuming a
release is live on a chain; `getVersionDeployment` returns `null` for a version that was never registered there.
Deploys do not need registration (6.0.0 deploys go to `INDEX_DTF_V6_DEPLOYER_ADDRESS`); upgrading an existing DTF does,
because its proxy admin resolves the implementation through the registry.

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
14 changes: 10 additions & 4 deletions apps/docs/src/pages/index-dtf/deployment.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ The SDK prepares deployment calls and approval plans. Apps own wallet UX, transa
| Governed DTF | `prepareDeployGoverned` or `prepareDeployGovernedPlan` |
| Vote-lock staking token | `prepareDeployStakingToken` |

The DTF deploy builders take `version` (`"5.0.0"` | `"6.0.0"`) and deploy through that version's per-chain deployer;
Folio 6.0 deploys also take the v6 details. See the [SDK deployment page](/sdk/deployment#folio-60-deployment).

## Initial Basket

The deployment basket uses raw token amounts.
Expand Down Expand Up @@ -43,11 +46,14 @@ Defaults:

## Logs

After sending the deployment transaction, parse logs with:
After sending the deployment transaction, parse logs with the same target the deploy builder took:

```ts
const address = extractIndexDtfDeployedAddress(receipt.logs);
const stToken = extractIndexDtfDeployedStakingTokenAddress(receipt.logs);
const address = extractIndexDtfDeployedAddress(receipt.logs, { chainId, version, deployer });
const stToken = extractIndexDtfDeployedStakingTokenAddress(receipt.logs, { chainId });
```

Do this after confirmation, not before.
Only events emitted by the expected deployer count (`getIndexDtfDeployerAddress(target)`, or the chain's governance
deployer for staking tokens): a basket token can emit a lookalike `FolioDeployed` during `transferFrom`. A receipt
without the deployer's event throws `RECORD_NOT_FOUND`; one where the deployer names more than one address throws
`INVALID_RESPONSE`. Do this after confirmation, not before.
2 changes: 2 additions & 0 deletions apps/docs/src/pages/index-dtf/rebalance-auctions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,11 @@ const quote = await sdk.index.getBidQuote({
maxSellAmount,
});

const version = await sdk.index.getVersion({ address, chainId }); // "5.0.0" | "6.0.0"
const bid = sdk.index.prepareBid({
address,
chainId,
version,
auctionId,
sellToken,
buyToken,
Expand Down
Loading
Loading