diff --git a/.changeset/fix-folio-v6-rebalances.md b/.changeset/fix-folio-v6-rebalances.md new file mode 100644 index 0000000..4f50f0c --- /dev/null +++ b/.changeset/fix-folio-v6-rebalances.md @@ -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. diff --git a/apps/docs/src/pages/index-dtf/contracts-and-versions.mdx b/apps/docs/src/pages/index-dtf/contracts-and-versions.mdx index a3ee4a2..af6845a 100644 --- a/apps/docs/src/pages/index-dtf/contracts-and-versions.mdx +++ b/apps/docs/src/pages/index-dtf/contracts-and-versions.mdx @@ -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 @@ -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 diff --git a/apps/docs/src/pages/llm-guide.mdx b/apps/docs/src/pages/llm-guide.mdx index d58e2f2..997cd27 100644 --- a/apps/docs/src/pages/llm-guide.mdx +++ b/apps/docs/src/pages/llm-guide.mdx @@ -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. diff --git a/docs/index-dtf/contracts-and-versions.md b/docs/index-dtf/contracts-and-versions.md index 303df92..53aa77b 100644 --- a/docs/index-dtf/contracts-and-versions.md +++ b/docs/index-dtf/contracts-and-versions.md @@ -45,14 +45,14 @@ 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 @@ -60,10 +60,11 @@ The SDK handles version-specific write calls where the affected builder encodes - 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. diff --git a/docs/known-gotchas.md b/docs/known-gotchas.md index 820e113..70c2081 100644 --- a/docs/known-gotchas.md +++ b/docs/known-gotchas.md @@ -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 diff --git a/docs/wiki/domains/sdk.md b/docs/wiki/domains/sdk.md index 44cf86f..d6cce7b 100644 --- a/docs/wiki/domains/sdk.md +++ b/docs/wiki/domains/sdk.md @@ -1,6 +1,6 @@ --- title: Core SDK Domain -updated: 2026-07-22 +updated: 2026-08-25 type: domain sources: - packages/sdk/src/** @@ -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. @@ -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. diff --git a/docs/wiki/log.md b/docs/wiki/log.md index 910b67b..b7f4648 100644 --- a/docs/wiki/log.md +++ b/docs/wiki/log.md @@ -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. diff --git a/docs/wiki/progress.md b/docs/wiki/progress.md index c23232a..ccddb94 100644 --- a/docs/wiki/progress.md +++ b/docs/wiki/progress.md @@ -8,15 +8,16 @@ type: ledger Stage ledger. One row per stage; keep entries short. Verifier = exact fresh commands that ran green. Lenses = one line each in the Review column. -| Stage | Status | Verifier | Review | Next | -| ----------------------------------------------------------------------- | ------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------- | -| Harden package publishing trigger | human-review-required (base 466324e) | full gate: forced build + bundle + types + lint/format + 397 tests (17 skipped) + 93 links + catalog; actionlint 1.7.12 green | correctness+security+complexity: independent review; fixed manual-dispatch ref guard; Changesets v1 release-PR/OIDC flow preserved | engineer review; merge to main | -| vote-lock self-appreciating vault support (0.5.1) | human-review-required (base 9231139) | scoped verify green: format/lint/typecheck/test both packages (vote-lock.test 2, query-keys 12) + bundle + docs:links + wiki-lint | Dark + Light; blocker fixed (redeem builder missing from index-dtf/index.ts + index.ts barrels); multicall-order assertion added; patch changeset per Luis (0.5.1, though API additions are minor-shaped) | engineer review; release 0.5.1; Register uses local link until published | -| 0.5.0 hardening release closeout | done (base f1ee8f5) | Node 24 `release:ci`: types + lint/format + live codegen + 394 tests (+17 live skipped) + build/bundle + 93 docs + catalog + 3 LICENSE-bearing tarballs; forced closeout gate + wiki-lint green | correctness+security+product+complexity: PR #27 reconciled; zero values, status validation, timestamp selection, namespace/ref/hook coverage, schema drift, publish gate, docs, and linked Register RED→GREEN verified | engineer review; commit/push; Changesets release to 0.5.0 | -| governance tie semantics + yield list state + rebalance hardening tests | done (base 588954e) | full gate on Node 24: forced builds + sdk-bundle + typecheck + lint + format + forced tests (sdk 287 passed/17 live skipped, react-sdk 72) + docs links + catalog checks; wiki-lint green | correctness+security+product+complexity: Dark+Light subagent pair; adopted boundary/mixed-flavor vectors and pinned zero-supply message; PENDING-expired labeling and detail QUORUM_NOT_REACHED split verified against Register reference, sent to backlog | Luis review (user-visible governance badge change); release patch | -| Current DTF aggregate, rebalance health, and bundle packaging | done (base 4bcda6a) | `turbo build --force` + SDK bundle gate + typecheck + lint + format + forced tests (340 passed, 17 live skipped) + 93-doc links + catalog checks | correctness+security+product+complexity: self-review, no blockers; external reviewer skipped because delegation was not authorized for closeout | release SDK/React SDK; replace Register local links with released versions | -| SDK audit and Register gap closure | done (base 4bcda6a) | forced builds + types + lint/format + 331 tests (+17 live skipped) + 93-doc links/routes + catalog; release:ci pack dry-runs; workflow 24 tests | correctness+security+product+complexity: independent review; fixed dirty-tree codegen, public-route coverage, docs routing, fresh-build gate | release SDK/React SDK and bump Register | -| workflow adoption | done (base 4bcda6a) | build + typecheck + lint (2 baseline warnings) + format + 321 tests + docs + catalog checks; workflow 24 tests | correctness+complexity: independent review; fixed build/codegen/risk routing, rule preservation, formatter ownership, attribute precedence | audit SDK/React SDK and Register gaps | +| Stage | Status | Verifier | Review | Next | +| -------------------------------------------------------------------------- | ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------- | +| Sync Folio v6 ABI and basket proposal encoding with reserve-index-dtf main | human-review-required (base 3dbb611) | `turbo build --force` + SDK bundle + typecheck + lint/format + forced tests (SDK 321 passed/17 skipped; React 82) + live GraphQL codegen + 93 docs links + catalog checks; ABI exact-match 166 items; wiki-lint green | correctness+security+product: Codex Sol medium; fixed v6 immutable-recipient omission and protocol two-token minimum; nonce/deadline/version calldata verified | engineer review; merge PR; high-level v6 revenue remains explicitly unsupported | +| Harden package publishing trigger | human-review-required (base 466324e) | full gate: forced build + bundle + types + lint/format + 397 tests (17 skipped) + 93 links + catalog; actionlint 1.7.12 green | correctness+security+complexity: independent review; fixed manual-dispatch ref guard; Changesets v1 release-PR/OIDC flow preserved | engineer review; merge to main | +| vote-lock self-appreciating vault support (0.5.1) | human-review-required (base 9231139) | scoped verify green: format/lint/typecheck/test both packages (vote-lock.test 2, query-keys 12) + bundle + docs:links + wiki-lint | Dark + Light; blocker fixed (redeem builder missing from index-dtf/index.ts + index.ts barrels); multicall-order assertion added; patch changeset per Luis (0.5.1, though API additions are minor-shaped) | engineer review; release 0.5.1; Register uses local link until published | +| 0.5.0 hardening release closeout | done (base f1ee8f5) | Node 24 `release:ci`: types + lint/format + live codegen + 394 tests (+17 live skipped) + build/bundle + 93 docs + catalog + 3 LICENSE-bearing tarballs; forced closeout gate + wiki-lint green | correctness+security+product+complexity: PR #27 reconciled; zero values, status validation, timestamp selection, namespace/ref/hook coverage, schema drift, publish gate, docs, and linked Register RED→GREEN verified | engineer review; commit/push; Changesets release to 0.5.0 | +| governance tie semantics + yield list state + rebalance hardening tests | done (base 588954e) | full gate on Node 24: forced builds + sdk-bundle + typecheck + lint + format + forced tests (sdk 287 passed/17 live skipped, react-sdk 72) + docs links + catalog checks; wiki-lint green | correctness+security+product+complexity: Dark+Light subagent pair; adopted boundary/mixed-flavor vectors and pinned zero-supply message; PENDING-expired labeling and detail QUORUM_NOT_REACHED split verified against Register reference, sent to backlog | Luis review (user-visible governance badge change); release patch | +| Current DTF aggregate, rebalance health, and bundle packaging | done (base 4bcda6a) | `turbo build --force` + SDK bundle gate + typecheck + lint + format + forced tests (340 passed, 17 live skipped) + 93-doc links + catalog checks | correctness+security+product+complexity: self-review, no blockers; external reviewer skipped because delegation was not authorized for closeout | release SDK/React SDK; replace Register local links with released versions | +| SDK audit and Register gap closure | done (base 4bcda6a) | forced builds + types + lint/format + 331 tests (+17 live skipped) + 93-doc links/routes + catalog; release:ci pack dry-runs; workflow 24 tests | correctness+security+product+complexity: independent review; fixed dirty-tree codegen, public-route coverage, docs routing, fresh-build gate | release SDK/React SDK and bump Register | +| workflow adoption | done (base 4bcda6a) | build + typecheck + lint (2 baseline warnings) + format + 321 tests + docs + catalog checks; workflow 24 tests | correctness+complexity: independent review; fixed build/codegen/risk routing, rule preservation, formatter ownership, attribute precedence | audit SDK/React SDK and Register gaps | ## Backlog diff --git a/packages/sdk/package.json b/packages/sdk/package.json index c34ee6c..a2bf550 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -52,7 +52,7 @@ "dependencies": { "@graphql-typed-document-node/core": "^3.2.0", "@reserve-protocol/dtf-catalog": "workspace:*", - "@reserve-protocol/dtf-rebalance-lib": "^3.2.1", + "@reserve-protocol/dtf-rebalance-lib": "^3.3.1", "decimal.js-light": "^2.5.1", "graphql": "^16.13.2", "graphql-request": "^7.4.0", diff --git a/packages/sdk/src/index-dtf/abis/dtf-index-abi-v6.ts b/packages/sdk/src/index-dtf/abis/dtf-index-abi-v6.ts index 8f2a2ee..6cd7968 100644 --- a/packages/sdk/src/index-dtf/abis/dtf-index-abi-v6.ts +++ b/packages/sdk/src/index-dtf/abis/dtf-index-abi-v6.ts @@ -1,2813 +1 @@ -export default [ - { - type: "constructor", - inputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "DEFAULT_ADMIN_ROLE", - inputs: [], - outputs: [ - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "addToAllowlist", - inputs: [ - { - name: "tokens", - type: "address[]", - internalType: "address[]", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "addToBasket", - inputs: [ - { - name: "token", - type: "address", - internalType: "contract IERC20", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "allowance", - inputs: [ - { - name: "owner", - type: "address", - internalType: "address", - }, - { - name: "spender", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "approve", - inputs: [ - { - name: "spender", - type: "address", - internalType: "address", - }, - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "auctions", - inputs: [ - { - name: "id", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "rebalanceNonce", - type: "uint256", - internalType: "uint256", - }, - { - name: "startTime", - type: "uint256", - internalType: "uint256", - }, - { - name: "endTime", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "balanceOf", - inputs: [ - { - name: "account", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "bid", - inputs: [ - { - name: "auctionId", - type: "uint256", - internalType: "uint256", - }, - { - name: "sellToken", - type: "address", - internalType: "contract IERC20", - }, - { - name: "buyToken", - type: "address", - internalType: "contract IERC20", - }, - { - name: "sellAmount", - type: "uint256", - internalType: "uint256", - }, - { - name: "maxBuyAmount", - type: "uint256", - internalType: "uint256", - }, - { - name: "withCallback", - type: "bool", - internalType: "bool", - }, - { - name: "data", - type: "bytes", - internalType: "bytes", - }, - ], - outputs: [ - { - name: "boughtAmt", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "bidsEnabled", - inputs: [], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "closeAuction", - inputs: [ - { - name: "auctionId", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "createTrustedFill", - inputs: [ - { - name: "auctionId", - type: "uint256", - internalType: "uint256", - }, - { - name: "sellToken", - type: "address", - internalType: "contract IERC20", - }, - { - name: "buyToken", - type: "address", - internalType: "contract IERC20", - }, - { - name: "targetFiller", - type: "address", - internalType: "address", - }, - { - name: "deploymentSalt", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [ - { - name: "filler", - type: "address", - internalType: "contract IBaseTrustedFiller", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "daoFeeRegistry", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "contract IFolioDAOFeeRegistry", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "daoPendingFeeShares", - inputs: [], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "decimals", - inputs: [], - outputs: [ - { - name: "", - type: "uint8", - internalType: "uint8", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "deprecateFolio", - inputs: [], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "distributeFees", - inputs: [], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "emergencyCloseTrustedFill", - inputs: [], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "endRebalance", - inputs: [], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "feeRecipients", - inputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "recipient", - type: "address", - internalType: "address", - }, - { - name: "portion", - type: "uint96", - internalType: "uint96", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "feeRecipientsPendingFeeShares", - inputs: [], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "folioFeeForSelf", - inputs: [], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getAuctionPrice", - inputs: [ - { - name: "auctionId", - type: "uint256", - internalType: "uint256", - }, - { - name: "token", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "range", - type: "tuple", - internalType: "struct IFolio.PriceRange", - components: [ - { - name: "low", - type: "uint256", - internalType: "uint256", - }, - { - name: "high", - type: "uint256", - internalType: "uint256", - }, - ], - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getBid", - inputs: [ - { - name: "auctionId", - type: "uint256", - internalType: "uint256", - }, - { - name: "sellToken", - type: "address", - internalType: "contract IERC20", - }, - { - name: "buyToken", - type: "address", - internalType: "contract IERC20", - }, - { - name: "maxSellAmount", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "sellAmount", - type: "uint256", - internalType: "uint256", - }, - { - name: "bidAmount", - type: "uint256", - internalType: "uint256", - }, - { - name: "price", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getPendingFeeShares", - inputs: [], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getRebalance", - inputs: [], - outputs: [ - { - name: "nonce", - type: "uint256", - internalType: "uint256", - }, - { - name: "priceControl", - type: "uint8", - internalType: "enum IFolio.PriceControl", - }, - { - name: "tokens", - type: "tuple[]", - internalType: "struct IFolio.TokenRebalanceParams[]", - components: [ - { - name: "token", - type: "address", - internalType: "address", - }, - { - name: "weight", - type: "tuple", - internalType: "struct IFolio.WeightRange", - components: [ - { - name: "low", - type: "uint256", - internalType: "uint256", - }, - { - name: "spot", - type: "uint256", - internalType: "uint256", - }, - { - name: "high", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - name: "price", - type: "tuple", - internalType: "struct IFolio.PriceRange", - components: [ - { - name: "low", - type: "uint256", - internalType: "uint256", - }, - { - name: "high", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - name: "maxAuctionSize", - type: "uint256", - internalType: "uint256", - }, - { - name: "inRebalance", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "limits", - type: "tuple", - internalType: "struct IFolio.RebalanceLimits", - components: [ - { - name: "low", - type: "uint256", - internalType: "uint256", - }, - { - name: "spot", - type: "uint256", - internalType: "uint256", - }, - { - name: "high", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - name: "timestamps", - type: "tuple", - internalType: "struct Folio.RebalanceTimestamps", - components: [ - { - name: "startedAt", - type: "uint256", - internalType: "uint256", - }, - { - name: "restrictedUntil", - type: "uint256", - internalType: "uint256", - }, - { - name: "availableUntil", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - name: "bidsEnabled_", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getRoleAdmin", - inputs: [ - { - name: "role", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [ - { - name: "", - type: "bytes32", - internalType: "bytes32", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getRoleMember", - inputs: [ - { - name: "role", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "index", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "", - type: "address", - internalType: "address", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getRoleMemberCount", - inputs: [ - { - name: "role", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getRoleMembers", - inputs: [ - { - name: "role", - type: "bytes32", - internalType: "bytes32", - }, - ], - outputs: [ - { - name: "", - type: "address[]", - internalType: "address[]", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "getTokenAllowlist", - inputs: [], - outputs: [ - { - name: "", - type: "address[]", - internalType: "address[]", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "grantRole", - inputs: [ - { - name: "role", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "account", - type: "address", - internalType: "address", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "hasRole", - inputs: [ - { - name: "role", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "account", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "initialize", - inputs: [ - { - name: "_basicDetails", - type: "tuple", - internalType: "struct IFolio.FolioBasicDetails", - components: [ - { - name: "name", - type: "string", - internalType: "string", - }, - { - name: "symbol", - type: "string", - internalType: "string", - }, - { - name: "assets", - type: "address[]", - internalType: "address[]", - }, - { - name: "amounts", - type: "uint256[]", - internalType: "uint256[]", - }, - { - name: "initialShares", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - name: "_additionalDetails", - type: "tuple", - internalType: "struct IFolio.FolioAdditionalDetails", - components: [ - { - name: "maxAuctionLength", - type: "uint256", - internalType: "uint256", - }, - { - name: "feeRecipients", - type: "tuple[]", - internalType: "struct IFolio.FeeRecipient[]", - components: [ - { - name: "recipient", - type: "address", - internalType: "address", - }, - { - name: "portion", - type: "uint96", - internalType: "uint96", - }, - ], - }, - { - name: "tvlFee", - type: "uint256", - internalType: "uint256", - }, - { - name: "mintFee", - type: "uint256", - internalType: "uint256", - }, - { - name: "folioFeeForSelf", - type: "uint256", - internalType: "uint256", - }, - { - name: "mandate", - type: "string", - internalType: "string", - }, - ], - }, - { - name: "_folioRegistries", - type: "tuple", - internalType: "struct IFolio.FolioRegistryIndex", - components: [ - { - name: "daoFeeRegistry", - type: "address", - internalType: "address", - }, - { - name: "trustedFillerRegistry", - type: "address", - internalType: "address", - }, - ], - }, - { - name: "_folioFlags", - type: "tuple", - internalType: "struct IFolio.FolioFlags", - components: [ - { - name: "trustedFillerEnabled", - type: "bool", - internalType: "bool", - }, - { - name: "rebalanceControl", - type: "tuple", - internalType: "struct IFolio.RebalanceControl", - components: [ - { - name: "weightControl", - type: "bool", - internalType: "bool", - }, - { - name: "priceControl", - type: "uint8", - internalType: "enum IFolio.PriceControl", - }, - ], - }, - { - name: "bidsEnabled", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "_creator", - type: "address", - internalType: "address", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "isDeprecated", - inputs: [], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "isTokenAllowlisted", - inputs: [ - { - name: "token", - type: "address", - internalType: "address", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "lastPoke", - inputs: [], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "mandate", - inputs: [], - outputs: [ - { - name: "", - type: "string", - internalType: "string", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "maxAuctionLength", - inputs: [], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "mint", - inputs: [ - { - name: "shares", - type: "uint256", - internalType: "uint256", - }, - { - name: "receiver", - type: "address", - internalType: "address", - }, - { - name: "minSharesOut", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "_assets", - type: "address[]", - internalType: "address[]", - }, - { - name: "_amounts", - type: "uint256[]", - internalType: "uint256[]", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "mintFee", - inputs: [], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "name", - inputs: [], - outputs: [ - { - name: "", - type: "string", - internalType: "string", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "nextAuctionId", - inputs: [], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "openAuction", - inputs: [ - { - name: "rebalanceNonce", - type: "uint256", - internalType: "uint256", - }, - { - name: "tokens", - type: "address[]", - internalType: "address[]", - }, - { - name: "newWeights", - type: "tuple[]", - internalType: "struct IFolio.WeightRange[]", - components: [ - { - name: "low", - type: "uint256", - internalType: "uint256", - }, - { - name: "spot", - type: "uint256", - internalType: "uint256", - }, - { - name: "high", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - name: "newPrices", - type: "tuple[]", - internalType: "struct IFolio.PriceRange[]", - components: [ - { - name: "low", - type: "uint256", - internalType: "uint256", - }, - { - name: "high", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - name: "newLimits", - type: "tuple", - internalType: "struct IFolio.RebalanceLimits", - components: [ - { - name: "low", - type: "uint256", - internalType: "uint256", - }, - { - name: "spot", - type: "uint256", - internalType: "uint256", - }, - { - name: "high", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - name: "auctionLength", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "auctionId", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "openAuctionUnrestricted", - inputs: [ - { - name: "rebalanceNonce", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "auctionId", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "poke", - inputs: [], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "rebalanceControl", - inputs: [], - outputs: [ - { - name: "weightControl", - type: "bool", - internalType: "bool", - }, - { - name: "priceControl", - type: "uint8", - internalType: "enum IFolio.PriceControl", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "redeem", - inputs: [ - { - name: "shares", - type: "uint256", - internalType: "uint256", - }, - { - name: "receiver", - type: "address", - internalType: "address", - }, - { - name: "assets", - type: "address[]", - internalType: "address[]", - }, - { - name: "minAmountsOut", - type: "uint256[]", - internalType: "uint256[]", - }, - ], - outputs: [ - { - name: "_amounts", - type: "uint256[]", - internalType: "uint256[]", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "removeFromAllowlist", - inputs: [ - { - name: "tokens", - type: "address[]", - internalType: "address[]", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "removeFromBasket", - inputs: [ - { - name: "token", - type: "address", - internalType: "contract IERC20", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "renounceRole", - inputs: [ - { - name: "role", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "callerConfirmation", - type: "address", - internalType: "address", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "revokeRole", - inputs: [ - { - name: "role", - type: "bytes32", - internalType: "bytes32", - }, - { - name: "account", - type: "address", - internalType: "address", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "setBidsEnabled", - inputs: [ - { - name: "_bidsEnabled", - type: "bool", - internalType: "bool", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "setFeeRecipients", - inputs: [ - { - name: "_newRecipients", - type: "tuple[]", - internalType: "struct IFolio.FeeRecipient[]", - components: [ - { - name: "recipient", - type: "address", - internalType: "address", - }, - { - name: "portion", - type: "uint96", - internalType: "uint96", - }, - ], - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "setFolioSelfFee", - inputs: [ - { - name: "_newFee", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "setMandate", - inputs: [ - { - name: "_newMandate", - type: "string", - internalType: "string", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "setMaxAuctionLength", - inputs: [ - { - name: "_newLength", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "setMintFee", - inputs: [ - { - name: "_newFee", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "setName", - inputs: [ - { - name: "_newName", - type: "string", - internalType: "string", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "setRebalanceControl", - inputs: [ - { - name: "_rebalanceControl", - type: "tuple", - internalType: "struct IFolio.RebalanceControl", - components: [ - { - name: "weightControl", - type: "bool", - internalType: "bool", - }, - { - name: "priceControl", - type: "uint8", - internalType: "enum IFolio.PriceControl", - }, - ], - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "setTVLFee", - inputs: [ - { - name: "_newFee", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "setTradeAllowlistEnabled", - inputs: [ - { - name: "_enabled", - type: "bool", - internalType: "bool", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "setTrustedFillerRegistry", - inputs: [ - { - name: "_newFillerRegistry", - type: "address", - internalType: "address", - }, - { - name: "_enabled", - type: "bool", - internalType: "bool", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "startRebalance", - inputs: [ - { - name: "tokens", - type: "tuple[]", - internalType: "struct IFolio.TokenRebalanceParams[]", - components: [ - { - name: "token", - type: "address", - internalType: "address", - }, - { - name: "weight", - type: "tuple", - internalType: "struct IFolio.WeightRange", - components: [ - { - name: "low", - type: "uint256", - internalType: "uint256", - }, - { - name: "spot", - type: "uint256", - internalType: "uint256", - }, - { - name: "high", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - name: "price", - type: "tuple", - internalType: "struct IFolio.PriceRange", - components: [ - { - name: "low", - type: "uint256", - internalType: "uint256", - }, - { - name: "high", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - name: "maxAuctionSize", - type: "uint256", - internalType: "uint256", - }, - { - name: "inRebalance", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "limits", - type: "tuple", - internalType: "struct IFolio.RebalanceLimits", - components: [ - { - name: "low", - type: "uint256", - internalType: "uint256", - }, - { - name: "spot", - type: "uint256", - internalType: "uint256", - }, - { - name: "high", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - name: "auctionLauncherWindow", - type: "uint256", - internalType: "uint256", - }, - { - name: "ttl", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "stateChangeActive", - inputs: [], - outputs: [ - { - name: "syncStateChangeActive", - type: "bool", - internalType: "bool", - }, - { - name: "asyncStateChangeActive", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "supportsInterface", - inputs: [ - { - name: "interfaceId", - type: "bytes4", - internalType: "bytes4", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "symbol", - inputs: [], - outputs: [ - { - name: "", - type: "string", - internalType: "string", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "toAssets", - inputs: [ - { - name: "shares", - type: "uint256", - internalType: "uint256", - }, - { - name: "rounding", - type: "uint8", - internalType: "enum Math.Rounding", - }, - ], - outputs: [ - { - name: "_assets", - type: "address[]", - internalType: "address[]", - }, - { - name: "_amounts", - type: "uint256[]", - internalType: "uint256[]", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "totalAssets", - inputs: [], - outputs: [ - { - name: "_assets", - type: "address[]", - internalType: "address[]", - }, - { - name: "_amounts", - type: "uint256[]", - internalType: "uint256[]", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "totalSupply", - inputs: [], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "tradeAllowlistEnabled", - inputs: [], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "transfer", - inputs: [ - { - name: "to", - type: "address", - internalType: "address", - }, - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "transferFrom", - inputs: [ - { - name: "from", - type: "address", - internalType: "address", - }, - { - name: "to", - type: "address", - internalType: "address", - }, - { - name: "value", - type: "uint256", - internalType: "uint256", - }, - ], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "nonpayable", - }, - { - type: "function", - name: "trustedFillerEnabled", - inputs: [], - outputs: [ - { - name: "", - type: "bool", - internalType: "bool", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "trustedFillerRegistry", - inputs: [], - outputs: [ - { - name: "", - type: "address", - internalType: "contract ITrustedFillerRegistry", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "tvlFee", - inputs: [], - outputs: [ - { - name: "", - type: "uint256", - internalType: "uint256", - }, - ], - stateMutability: "view", - }, - { - type: "function", - name: "version", - inputs: [], - outputs: [ - { - name: "", - type: "string", - internalType: "string", - }, - ], - stateMutability: "pure", - }, - { - type: "event", - name: "Approval", - inputs: [ - { - name: "owner", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "spender", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "value", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "AuctionBid", - inputs: [ - { - name: "auctionId", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "sellToken", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "buyToken", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "sellAmount", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - { - name: "buyAmount", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "AuctionClosed", - inputs: [ - { - name: "auctionId", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "AuctionOpened", - inputs: [ - { - name: "rebalanceNonce", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "auctionId", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "tokens", - type: "address[]", - indexed: false, - internalType: "address[]", - }, - { - name: "weights", - type: "tuple[]", - indexed: false, - internalType: "struct IFolio.WeightRange[]", - components: [ - { - name: "low", - type: "uint256", - internalType: "uint256", - }, - { - name: "spot", - type: "uint256", - internalType: "uint256", - }, - { - name: "high", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - name: "prices", - type: "tuple[]", - indexed: false, - internalType: "struct IFolio.PriceRange[]", - components: [ - { - name: "low", - type: "uint256", - internalType: "uint256", - }, - { - name: "high", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - name: "limits", - type: "tuple", - indexed: false, - internalType: "struct IFolio.RebalanceLimits", - components: [ - { - name: "low", - type: "uint256", - internalType: "uint256", - }, - { - name: "spot", - type: "uint256", - internalType: "uint256", - }, - { - name: "high", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - name: "startTime", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - { - name: "endTime", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "AuctionTrustedFillCreated", - inputs: [ - { - name: "auctionId", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "filler", - type: "address", - indexed: false, - internalType: "address", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "BasketTokenAdded", - inputs: [ - { - name: "token", - type: "address", - indexed: true, - internalType: "address", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "BasketTokenRemoved", - inputs: [ - { - name: "token", - type: "address", - indexed: true, - internalType: "address", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "BidsEnabledSet", - inputs: [ - { - name: "bidsEnabled", - type: "bool", - indexed: false, - internalType: "bool", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "FeeRecipientsSet", - inputs: [ - { - name: "recipients", - type: "tuple[]", - indexed: false, - internalType: "struct IFolio.FeeRecipient[]", - components: [ - { - name: "recipient", - type: "address", - internalType: "address", - }, - { - name: "portion", - type: "uint96", - internalType: "uint96", - }, - ], - }, - ], - anonymous: false, - }, - { - type: "event", - name: "FolioDeprecated", - inputs: [], - anonymous: false, - }, - { - type: "event", - name: "FolioFeePaid", - inputs: [ - { - name: "recipient", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "amount", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "FolioFeeSet", - inputs: [ - { - name: "newFolioFee", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "Initialized", - inputs: [ - { - name: "version", - type: "uint64", - indexed: false, - internalType: "uint64", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "MandateSet", - inputs: [ - { - name: "newMandate", - type: "string", - indexed: false, - internalType: "string", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "MaxAuctionLengthSet", - inputs: [ - { - name: "newMaxAuctionLength", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "MintFeeSet", - inputs: [ - { - name: "newFee", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "NameSet", - inputs: [ - { - name: "newName", - type: "string", - indexed: false, - internalType: "string", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "ProtocolFeePaid", - inputs: [ - { - name: "recipient", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "amount", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "RebalanceControlSet", - inputs: [ - { - name: "newControl", - type: "tuple", - indexed: false, - internalType: "struct IFolio.RebalanceControl", - components: [ - { - name: "weightControl", - type: "bool", - internalType: "bool", - }, - { - name: "priceControl", - type: "uint8", - internalType: "enum IFolio.PriceControl", - }, - ], - }, - ], - anonymous: false, - }, - { - type: "event", - name: "RebalanceEnded", - inputs: [ - { - name: "nonce", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "RebalanceStarted", - inputs: [ - { - name: "nonce", - type: "uint256", - indexed: true, - internalType: "uint256", - }, - { - name: "priceControl", - type: "uint8", - indexed: false, - internalType: "enum IFolio.PriceControl", - }, - { - name: "tokens", - type: "tuple[]", - indexed: false, - internalType: "struct IFolio.TokenRebalanceParams[]", - components: [ - { - name: "token", - type: "address", - internalType: "address", - }, - { - name: "weight", - type: "tuple", - internalType: "struct IFolio.WeightRange", - components: [ - { - name: "low", - type: "uint256", - internalType: "uint256", - }, - { - name: "spot", - type: "uint256", - internalType: "uint256", - }, - { - name: "high", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - name: "price", - type: "tuple", - internalType: "struct IFolio.PriceRange", - components: [ - { - name: "low", - type: "uint256", - internalType: "uint256", - }, - { - name: "high", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - name: "maxAuctionSize", - type: "uint256", - internalType: "uint256", - }, - { - name: "inRebalance", - type: "bool", - internalType: "bool", - }, - ], - }, - { - name: "limits", - type: "tuple", - indexed: false, - internalType: "struct IFolio.RebalanceLimits", - components: [ - { - name: "low", - type: "uint256", - internalType: "uint256", - }, - { - name: "spot", - type: "uint256", - internalType: "uint256", - }, - { - name: "high", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - name: "startedAt", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - { - name: "restrictedUntil", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - { - name: "availableUntil", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - { - name: "bidsEnabled", - type: "bool", - indexed: false, - internalType: "bool", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "RoleAdminChanged", - inputs: [ - { - name: "role", - type: "bytes32", - indexed: true, - internalType: "bytes32", - }, - { - name: "previousAdminRole", - type: "bytes32", - indexed: true, - internalType: "bytes32", - }, - { - name: "newAdminRole", - type: "bytes32", - indexed: true, - internalType: "bytes32", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "RoleGranted", - inputs: [ - { - name: "role", - type: "bytes32", - indexed: true, - internalType: "bytes32", - }, - { - name: "account", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "sender", - type: "address", - indexed: true, - internalType: "address", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "RoleRevoked", - inputs: [ - { - name: "role", - type: "bytes32", - indexed: true, - internalType: "bytes32", - }, - { - name: "account", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "sender", - type: "address", - indexed: true, - internalType: "address", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "TVLFeeSet", - inputs: [ - { - name: "newFee", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - { - name: "feeAnnually", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "TradeAllowlistEnabled", - inputs: [ - { - name: "enabled", - type: "bool", - indexed: false, - internalType: "bool", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "TradeAllowlistTokenAdded", - inputs: [ - { - name: "token", - type: "address", - indexed: true, - internalType: "address", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "TradeAllowlistTokenRemoved", - inputs: [ - { - name: "token", - type: "address", - indexed: true, - internalType: "address", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "Transfer", - inputs: [ - { - name: "from", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "to", - type: "address", - indexed: true, - internalType: "address", - }, - { - name: "value", - type: "uint256", - indexed: false, - internalType: "uint256", - }, - ], - anonymous: false, - }, - { - type: "event", - name: "TrustedFillerRegistrySet", - inputs: [ - { - name: "trustedFillerRegistry", - type: "address", - indexed: false, - internalType: "address", - }, - { - name: "isEnabled", - type: "bool", - indexed: false, - internalType: "bool", - }, - ], - anonymous: false, - }, - { - type: "error", - name: "AccessControlBadConfirmation", - inputs: [], - }, - { - type: "error", - name: "AccessControlUnauthorizedAccount", - inputs: [ - { - name: "account", - type: "address", - internalType: "address", - }, - { - name: "neededRole", - type: "bytes32", - internalType: "bytes32", - }, - ], - }, - { - type: "error", - name: "ERC20InsufficientAllowance", - inputs: [ - { - name: "spender", - type: "address", - internalType: "address", - }, - { - name: "allowance", - type: "uint256", - internalType: "uint256", - }, - { - name: "needed", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - type: "error", - name: "ERC20InsufficientBalance", - inputs: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - { - name: "balance", - type: "uint256", - internalType: "uint256", - }, - { - name: "needed", - type: "uint256", - internalType: "uint256", - }, - ], - }, - { - type: "error", - name: "ERC20InvalidApprover", - inputs: [ - { - name: "approver", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "ERC20InvalidReceiver", - inputs: [ - { - name: "receiver", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "ERC20InvalidSender", - inputs: [ - { - name: "sender", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "ERC20InvalidSpender", - inputs: [ - { - name: "spender", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "Folio__AuctionCannotBeOpenedWithoutRestriction", - inputs: [], - }, - { - type: "error", - name: "Folio__AuctionNotOngoing", - inputs: [], - }, - { - type: "error", - name: "Folio__BadFeeTotal", - inputs: [], - }, - { - type: "error", - name: "Folio__BalanceNotRemovable", - inputs: [], - }, - { - type: "error", - name: "Folio__BasketModificationFailed", - inputs: [], - }, - { - type: "error", - name: "Folio__DuplicateAsset", - inputs: [], - }, - { - type: "error", - name: "Folio__EmptyAssets", - inputs: [], - }, - { - type: "error", - name: "Folio__EmptyRebalance", - inputs: [], - }, - { - type: "error", - name: "Folio__FeeRecipientInvalidAddress", - inputs: [], - }, - { - type: "error", - name: "Folio__FeeRecipientInvalidFeeShare", - inputs: [], - }, - { - type: "error", - name: "Folio__FolioDeprecated", - inputs: [], - }, - { - type: "error", - name: "Folio__FolioFeeTooHigh", - inputs: [], - }, - { - type: "error", - name: "Folio__InsufficientBid", - inputs: [], - }, - { - type: "error", - name: "Folio__InsufficientBuyAvailable", - inputs: [], - }, - { - type: "error", - name: "Folio__InsufficientSellAvailable", - inputs: [], - }, - { - type: "error", - name: "Folio__InsufficientSharesOut", - inputs: [], - }, - { - type: "error", - name: "Folio__InvalidArrayLengths", - inputs: [], - }, - { - type: "error", - name: "Folio__InvalidAsset", - inputs: [], - }, - { - type: "error", - name: "Folio__InvalidAssetAmount", - inputs: [ - { - name: "asset", - type: "address", - internalType: "address", - }, - ], - }, - { - type: "error", - name: "Folio__InvalidAuctionLength", - inputs: [], - }, - { - type: "error", - name: "Folio__InvalidLimits", - inputs: [], - }, - { - type: "error", - name: "Folio__InvalidPrices", - inputs: [], - }, - { - type: "error", - name: "Folio__InvalidRegistry", - inputs: [], - }, - { - type: "error", - name: "Folio__InvalidTTL", - inputs: [], - }, - { - type: "error", - name: "Folio__InvalidTransferToSelf", - inputs: [], - }, - { - type: "error", - name: "Folio__InvalidWeights", - inputs: [], - }, - { - type: "error", - name: "Folio__MintFeeTooHigh", - inputs: [], - }, - { - type: "error", - name: "Folio__MixedAtomicSwaps", - inputs: [], - }, - { - type: "error", - name: "Folio__NotRebalancing", - inputs: [], - }, - { - type: "error", - name: "Folio__PermissionlessBidsDisabled", - inputs: [], - }, - { - type: "error", - name: "Folio__SlippageExceeded", - inputs: [], - }, - { - type: "error", - name: "Folio__TVLFeeTooHigh", - inputs: [], - }, - { - type: "error", - name: "Folio__TVLFeeTooLow", - inputs: [], - }, - { - type: "error", - name: "Folio__TokenNotAllowlisted", - inputs: [], - }, - { - type: "error", - name: "Folio__TooManyFeeRecipients", - inputs: [], - }, - { - type: "error", - name: "Folio__TrustedFillerRegistryAlreadySet", - inputs: [], - }, - { - type: "error", - name: "Folio__TrustedFillerRegistryNotEnabled", - inputs: [], - }, - { - type: "error", - name: "Folio__Unauthorized", - inputs: [], - }, - { - type: "error", - name: "Folio__ZeroInitialShares", - inputs: [], - }, - { - type: "error", - name: "Folo__NotInRebalance", - inputs: [], - }, - { - type: "error", - name: "InvalidInitialization", - inputs: [], - }, - { - type: "error", - name: "NotInitializing", - inputs: [], - }, - { - type: "error", - name: "ReentrancyGuardReentrantCall", - inputs: [], - }, - { - type: "error", - name: "SafeERC20FailedOperation", - inputs: [ - { - name: "token", - type: "address", - internalType: "address", - }, - ], - }, -] as const; +export { folioArtifactAbi as default } from "@/index-dtf/abis/folio-artifact"; diff --git a/packages/sdk/src/index-dtf/abis/folio-artifact.ts b/packages/sdk/src/index-dtf/abis/folio-artifact.ts index 667f94c..8b9b106 100644 --- a/packages/sdk/src/index-dtf/abis/folio-artifact.ts +++ b/packages/sdk/src/index-dtf/abis/folio-artifact.ts @@ -311,7 +311,13 @@ export const folioArtifact = { { type: "function", name: "emergencyCloseTrustedFill", - inputs: [], + inputs: [ + { + name: "trustedFill", + type: "address", + internalType: "address", + }, + ], outputs: [], stateMutability: "nonpayable", }, @@ -372,6 +378,19 @@ export const folioArtifact = { ], stateMutability: "view", }, + { + type: "function", + name: "folioPendingMintFeeShares", + inputs: [], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, { type: "function", name: "getAuctionPrice", @@ -593,6 +612,19 @@ export const folioArtifact = { ], stateMutability: "view", }, + { + type: "function", + name: "getRebalanceNonce", + inputs: [], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, { type: "function", name: "getRoleAdmin", @@ -729,6 +761,30 @@ export const folioArtifact = { ], stateMutability: "view", }, + { + type: "function", + name: "immutableFeeRecipients", + inputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + outputs: [ + { + name: "recipient", + type: "address", + internalType: "address", + }, + { + name: "portion", + type: "uint96", + internalType: "uint96", + }, + ], + stateMutability: "view", + }, { type: "function", name: "initialize", @@ -792,6 +848,23 @@ export const folioArtifact = { }, ], }, + { + name: "immutableFeeRecipients", + type: "tuple[]", + internalType: "struct IFolio.FeeRecipient[]", + components: [ + { + name: "recipient", + type: "address", + internalType: "address", + }, + { + name: "portion", + type: "uint96", + internalType: "uint96", + }, + ], + }, { name: "tvlFee", type: "uint256", @@ -906,6 +979,19 @@ export const folioArtifact = { ], stateMutability: "view", }, + { + type: "function", + name: "lastFolioFeePoke", + inputs: [], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, { type: "function", name: "lastPoke", @@ -1282,6 +1368,23 @@ export const folioArtifact = { }, ], }, + { + name: "_immutableRecipients", + type: "tuple[]", + internalType: "struct IFolio.FeeRecipient[]", + components: [ + { + name: "recipient", + type: "address", + internalType: "address", + }, + { + name: "portion", + type: "uint96", + internalType: "uint96", + }, + ], + }, ], outputs: [], stateMutability: "nonpayable", @@ -1424,6 +1527,11 @@ export const folioArtifact = { type: "function", name: "startRebalance", inputs: [ + { + name: "rebalanceNonce", + type: "uint256", + internalType: "uint256", + }, { name: "tokens", type: "tuple[]", @@ -1517,6 +1625,11 @@ export const folioArtifact = { type: "uint256", internalType: "uint256", }, + { + name: "deadline", + type: "uint256", + internalType: "uint256", + }, ], outputs: [], stateMutability: "nonpayable", @@ -2046,6 +2159,31 @@ export const folioArtifact = { ], anonymous: false, }, + { + type: "event", + name: "ImmutableFeeRecipientsSet", + inputs: [ + { + name: "recipients", + type: "tuple[]", + indexed: false, + internalType: "struct IFolio.FeeRecipient[]", + components: [ + { + name: "recipient", + type: "address", + internalType: "address", + }, + { + name: "portion", + type: "uint96", + internalType: "uint96", + }, + ], + }, + ], + anonymous: false, + }, { type: "event", name: "Initialized", @@ -2597,12 +2735,7 @@ export const folioArtifact = { }, { type: "error", - name: "Folio__BalanceNotRemovable", - inputs: [], - }, - { - type: "error", - name: "Folio__BasketModificationFailed", + name: "Folio__DeadlineExpired", inputs: [], }, { @@ -2640,6 +2773,11 @@ export const folioArtifact = { name: "Folio__FolioFeeTooHigh", inputs: [], }, + { + type: "error", + name: "Folio__ImmutableFeeRecipientRemoved", + inputs: [], + }, { type: "error", name: "Folio__InsufficientBid", @@ -2696,6 +2834,11 @@ export const folioArtifact = { name: "Folio__InvalidPrices", inputs: [], }, + { + type: "error", + name: "Folio__InvalidRebalanceNonce", + inputs: [], + }, { type: "error", name: "Folio__InvalidRegistry", @@ -2711,6 +2854,11 @@ export const folioArtifact = { name: "Folio__InvalidTransferToSelf", inputs: [], }, + { + type: "error", + name: "Folio__InvalidTrustedFill", + inputs: [], + }, { type: "error", name: "Folio__InvalidWeights", @@ -2726,6 +2874,11 @@ export const folioArtifact = { name: "Folio__MixedAtomicSwaps", inputs: [], }, + { + type: "error", + name: "Folio__NotInRebalance", + inputs: [], + }, { type: "error", name: "Folio__NotRebalancing", @@ -2781,11 +2934,6 @@ export const folioArtifact = { name: "Folio__ZeroInitialShares", inputs: [], }, - { - type: "error", - name: "Folo__NotInRebalance", - inputs: [], - }, { type: "error", name: "InvalidInitialization", diff --git a/packages/sdk/src/index-dtf/dtf/basket/index.ts b/packages/sdk/src/index-dtf/dtf/basket/index.ts index 300cd4d..8543bfd 100644 --- a/packages/sdk/src/index-dtf/dtf/basket/index.ts +++ b/packages/sdk/src/index-dtf/dtf/basket/index.ts @@ -20,7 +20,9 @@ export type { IndexDtfBasketTokenInput, IndexDtfBasketUnitsInput, IndexDtfInitialBasket, + IndexDtfStartRebalanceVersion, StartRebalanceArgsV5, + StartRebalanceArgsV6, } from "@/index-dtf/dtf/basket/types"; export { buildInitialBasket, diff --git a/packages/sdk/src/index-dtf/dtf/basket/rebalance-args.ts b/packages/sdk/src/index-dtf/dtf/basket/rebalance-args.ts index cfdd065..49027d1 100644 --- a/packages/sdk/src/index-dtf/dtf/basket/rebalance-args.ts +++ b/packages/sdk/src/index-dtf/dtf/basket/rebalance-args.ts @@ -1,12 +1,18 @@ import { FolioVersion, getStartRebalance } from "@reserve-protocol/dtf-rebalance-lib"; -import type { BuildIndexDtfStartRebalanceArgsParams, StartRebalanceArgsV5 } from "@/index-dtf/dtf/basket/types"; +import type { + BuildIndexDtfStartRebalanceArgsParams, + StartRebalanceArgsV5, + StartRebalanceArgsV6, +} from "@/index-dtf/dtf/basket/types"; import { getBasketShares } from "@/index-dtf/dtf/basket/math"; import { assertPositiveNumber, validateBasketTokens } from "@/index-dtf/dtf/basket/validation"; import { SdkError } from "@/lib/errors"; -export function buildStartRebalanceArgs(params: BuildIndexDtfStartRebalanceArgsParams): StartRebalanceArgsV5 { +export function buildStartRebalanceArgs( + params: BuildIndexDtfStartRebalanceArgsParams, +): StartRebalanceArgsV5 | StartRebalanceArgsV6 { if (params.supply <= 0n) { throw new SdkError({ code: "INVALID_INPUT", @@ -22,6 +28,12 @@ export function buildStartRebalanceArgs(params: BuildIndexDtfStartRebalanceArgsP } validateBasketTokens(params.tokens); + if (params.tokens.length < 2) { + throw new SdkError({ + code: "INVALID_INPUT", + message: "Rebalance must include at least two tokens", + }); + } const targetShares = getBasketShares(params.tokens, params.basket); for (const priceError of params.priceErrors) { @@ -38,7 +50,7 @@ export function buildStartRebalanceArgs(params: BuildIndexDtfStartRebalanceArgsP } return getStartRebalance( - FolioVersion.V5, + params.version === "6.0.0" ? FolioVersion.V6 : FolioVersion.V5, params.supply, params.tokens.map((token) => token.address), [...params.balances], @@ -49,5 +61,5 @@ export function buildStartRebalanceArgs(params: BuildIndexDtfStartRebalanceArgsP [...params.maxAuctionSizesUsd], params.weightControl, params.deferWeights ?? false, - ) as StartRebalanceArgsV5; + ) as StartRebalanceArgsV5 | StartRebalanceArgsV6; } diff --git a/packages/sdk/src/index-dtf/dtf/basket/start-rebalance.ts b/packages/sdk/src/index-dtf/dtf/basket/start-rebalance.ts index b3edc6f..b1539df 100644 --- a/packages/sdk/src/index-dtf/dtf/basket/start-rebalance.ts +++ b/packages/sdk/src/index-dtf/dtf/basket/start-rebalance.ts @@ -26,6 +26,7 @@ export async function buildIndexDtfStartRebalance( params: BuildIndexDtfStartRebalanceParams, ): Promise { const address = getAddress(params.address); + const version = params.version ?? "5.0.0"; const inputTokens = params.basket.tokens.map((token) => ({ ...token, address: getAddress(token.address) })); assertUniqueAddresses(inputTokens.map((token) => token.address)); assertValidBasketAddresses(inputTokens.map((token) => token.address)); @@ -69,6 +70,7 @@ export async function buildIndexDtfStartRebalance( return { address, chainId: params.chainId, + version, tokens: pricedTokens, assets: pricedTokens.map((token, index) => ({ token, @@ -81,6 +83,7 @@ export async function buildIndexDtfStartRebalance( weightControl, deferWeights: params.deferWeights ?? false, startRebalanceArgs: buildStartRebalanceArgs({ + version, tokens: pricedTokens, supply, balances, diff --git a/packages/sdk/src/index-dtf/dtf/basket/types.ts b/packages/sdk/src/index-dtf/dtf/basket/types.ts index f6f9cff..4e4c70d 100644 --- a/packages/sdk/src/index-dtf/dtf/basket/types.ts +++ b/packages/sdk/src/index-dtf/dtf/basket/types.ts @@ -114,12 +114,17 @@ export type BuildIndexDtfInitialBasketParams = { readonly initialShares: bigint; }; +export type IndexDtfStartRebalanceVersion = "5.0.0" | "6.0.0"; + export type StartRebalanceArgsV5 = { readonly tokens: readonly TokenRebalanceParams[]; readonly limits: RebalanceLimits; }; +export type StartRebalanceArgsV6 = StartRebalanceArgsV5; + export type BuildIndexDtfStartRebalanceArgsParams = { + readonly version?: IndexDtfStartRebalanceVersion; readonly tokens: readonly IndexDtfBasketToken[]; readonly supply: bigint; readonly balances: readonly bigint[]; @@ -131,6 +136,7 @@ export type BuildIndexDtfStartRebalanceArgsParams = { }; export type BuildIndexDtfStartRebalanceParams = DtfParams & { + readonly version?: IndexDtfStartRebalanceVersion; readonly basket: IndexDtfBasketInput; readonly dtf?: IndexDtf; readonly supply?: bigint; @@ -156,10 +162,11 @@ export type BuiltIndexDtfStartRebalanceAsset = { export type BuiltIndexDtfStartRebalance = { readonly address: Address; readonly chainId: DtfParams["chainId"]; + readonly version: IndexDtfStartRebalanceVersion; readonly tokens: readonly IndexDtfBasketToken[]; readonly assets: readonly BuiltIndexDtfStartRebalanceAsset[]; readonly supply: bigint; readonly weightControl: boolean; readonly deferWeights: boolean; - readonly startRebalanceArgs: StartRebalanceArgsV5; + readonly startRebalanceArgs: StartRebalanceArgsV5 | StartRebalanceArgsV6; }; diff --git a/packages/sdk/src/index-dtf/governance/propose/basket.test.ts b/packages/sdk/src/index-dtf/governance/propose/basket.test.ts index 919435e..3ae64e5 100644 --- a/packages/sdk/src/index-dtf/governance/propose/basket.test.ts +++ b/packages/sdk/src/index-dtf/governance/propose/basket.test.ts @@ -3,6 +3,7 @@ import { describe, expect, it, vi } from "vitest"; import { createDtfClient } from "@/client"; import { dtfIndexAbi } from "@/index-dtf/abis/dtf-index-abi"; +import { folioArtifactAbi } from "@/index-dtf/abis/folio-artifact"; import { buildInitialBasket, getBasketSharesFromUnits, @@ -204,6 +205,87 @@ describe("buildIndexDtfBasketProposal", () => { ).toBe(true); }); + it("builds a v6 startRebalance proposal with the next nonce and deadline", async () => { + const proposal = await buildIndexDtfBasketProposal(testClient({ version: "6.0.0", rebalanceNonce: 7n }), { + address: DTF, + chainId: 1, + governance: GOVERNANCE, + supply: parseEther("1"), + currentBalances: { + [USDC]: parseUnits("1", 6), + [DAI]: 0n, + }, + prices: { + [USDC]: 1, + [DAI]: 1, + }, + priceErrors: { + [USDC]: 0.5, + [DAI]: 0.5, + }, + weightControl: true, + basket: { + type: "shares", + tokens: [ + { address: USDC, share: "50" }, + { address: DAI, share: "50" }, + ], + }, + auctionLauncherWindow: 3600, + ttl: 10_800, + deadline: 2_000_000_000, + }); + + const decoded = decodeFunctionData({ + abi: folioArtifactAbi, + data: proposal.calldatas[0]!, + }); + + expect(proposal.context).toMatchObject({ + version: "6.0.0", + rebalanceNonce: 8n, + deadline: 2_000_000_000n, + }); + expect(decoded.functionName).toBe("startRebalance"); + expect(decoded.args[0]).toBe(8n); + expect(decoded.args[3]).toBe(3600n); + expect(decoded.args[4]).toBe(10_800n); + expect(decoded.args[5]).toBe(2_000_000_000n); + }); + + it("requires a deadline for v6 basket proposals", async () => { + await expect( + buildIndexDtfBasketProposal(testClient({ version: "6.0.0" }), { + address: DTF, + chainId: 1, + governance: GOVERNANCE, + supply: parseEther("1"), + currentBalances: { [USDC]: parseUnits("1", 6) }, + prices: { [USDC]: 1 }, + priceErrors: { [USDC]: 0.5 }, + weightControl: true, + basket: { type: "shares", tokens: [{ address: USDC, share: "100" }] }, + }), + ).rejects.toThrow("deadline is required"); + }); + + it("rejects one-token v6 rebalances", async () => { + await expect( + buildIndexDtfBasketProposal(testClient({ version: "6.0.0" }), { + address: DTF, + chainId: 1, + governance: GOVERNANCE, + supply: parseEther("1"), + currentBalances: { [USDC]: parseUnits("1", 6) }, + prices: { [USDC]: 1 }, + priceErrors: { [USDC]: 0.5 }, + weightControl: true, + deadline: 2_000_000_000, + basket: { type: "shares", tokens: [{ address: USDC, share: "100" }] }, + }), + ).rejects.toThrow("Rebalance must include at least two tokens"); + }); + it("builds tracking rebalance args from unit input", async () => { const proposal = await buildIndexDtfBasketProposal(testClient(), { address: DTF, @@ -433,11 +515,16 @@ describe("buildIndexDtfBasketProposal", () => { }); }); -function testClient() { +function testClient(options: { readonly version?: "5.0.0" | "6.0.0"; readonly rebalanceNonce?: bigint } = {}) { return createDtfClient({ chains: { 1: { publicClient: { + readContract: vi.fn(async ({ functionName }: { functionName: string }) => { + if (functionName === "version") return options.version ?? "5.0.0"; + if (functionName === "getRebalanceNonce") return options.rebalanceNonce ?? 0n; + throw new Error(`Unexpected read: ${functionName}`); + }), multicall: vi.fn(async ({ contracts }: { contracts: unknown[] }) => { const tokens = [USDC, DAI, WBTC]; const metadata: Record = { diff --git a/packages/sdk/src/index-dtf/governance/propose/basket.ts b/packages/sdk/src/index-dtf/governance/propose/basket.ts index 3e1d082..b1e91bc 100644 --- a/packages/sdk/src/index-dtf/governance/propose/basket.ts +++ b/packages/sdk/src/index-dtf/governance/propose/basket.ts @@ -6,6 +6,7 @@ import type { IndexDtfCall } from "@/types/governance"; import type { IndexDtf } from "@/types/index-dtf"; import { dtfIndexAbi } from "@/index-dtf/abis/dtf-index-abi"; +import { folioArtifactAbi } from "@/index-dtf/abis/folio-artifact"; import { DEFAULT_AUCTION_LAUNCHER_WINDOW, buildIndexDtfStartRebalance, @@ -19,9 +20,9 @@ import { type IndexDtfBasketSharesInput, type IndexDtfBasketTokenInput, type IndexDtfBasketUnitsInput, - type StartRebalanceArgsV5, + type IndexDtfStartRebalanceVersion, } from "@/index-dtf/dtf/basket/index"; -import { getDtf } from "@/index-dtf/dtf/index"; +import { getDtf, getVersion } from "@/index-dtf/dtf/index"; import { prepareContractCall } from "@/lib/contract-call"; import { SdkError } from "@/lib/errors"; @@ -45,12 +46,15 @@ export type BuildIndexDtfBasketProposalParams = BuildIndexDtfStartRebalanceParam readonly auctionLauncherWindow?: number | bigint; readonly permissionlessWindow?: number | bigint; readonly ttl?: number | bigint; + readonly deadline?: number | bigint; }; export type BuiltIndexDtfBasketProposalContext = BuiltIndexDtfStartRebalance & { readonly chainId: DtfParams["chainId"]; readonly auctionLauncherWindow: bigint; readonly ttl: bigint; + readonly rebalanceNonce?: bigint; + readonly deadline?: bigint; }; export type BuiltIndexDtfBasketProposal = { @@ -67,15 +71,27 @@ export async function buildIndexDtfBasketProposal( ): Promise { const windows = getRebalanceWindows(params); validateBasketTokenAddresses(params); - const dtf = await getDtfForProposal(client, params); + const [dtf, version] = await Promise.all([ + getDtfForProposal(client, params), + getBasketProposalVersion(client, params), + ]); + const v6Context = + version === "6.0.0" + ? { + deadline: getRequiredDeadline(params.deadline), + rebalanceNonce: await getNextRebalanceNonce(client, params), + } + : {}; const rebalance = await buildIndexDtfStartRebalance(client, { ...params, + version, ...(dtf ? { dtf } : {}), }); const context: BuiltIndexDtfBasketProposalContext = { ...rebalance, chainId: params.chainId, ...windows, + ...v6Context, }; const authority = getProposalAuthority(params, dtf); const call = prepareIndexDtfBasketRebalance(context); @@ -90,14 +106,41 @@ export async function buildIndexDtfBasketProposal( } function prepareIndexDtfBasketRebalance(context: BuiltIndexDtfBasketProposalContext): IndexDtfCall { - const args = getStartRebalanceArgs(context); + const tokens = context.startRebalanceArgs.tokens.map((token) => ({ + ...token, + token: getAddress(token.token as Address), + })); + + if (context.version === "6.0.0") { + if (context.rebalanceNonce === undefined || context.deadline === undefined) { + throw new SdkError({ + code: "INVALID_INPUT", + message: "rebalanceNonce and deadline are required for Index DTF 6.0.0", + }); + } + + return prepareContractCall({ + chainId: context.chainId, + address: context.address, + abi: folioArtifactAbi, + functionName: "startRebalance", + args: [ + context.rebalanceNonce, + tokens, + context.startRebalanceArgs.limits, + context.auctionLauncherWindow, + context.ttl, + context.deadline, + ] as const, + }); + } return prepareContractCall({ chainId: context.chainId, address: context.address, abi: dtfIndexAbi, functionName: "startRebalance", - args, + args: [tokens, context.startRebalanceArgs.limits, context.auctionLauncherWindow, context.ttl] as const, }); } @@ -116,18 +159,44 @@ async function getDtfForProposal( return getDtf(client, params); } -function getStartRebalanceArgs(context: BuiltIndexDtfBasketProposalContext) { - const startRebalanceArgs = context.startRebalanceArgs as StartRebalanceArgsV5; - - return [ - startRebalanceArgs.tokens.map((token) => ({ - ...token, - token: getAddress(token.token as Address), - })), - startRebalanceArgs.limits, - context.auctionLauncherWindow, - context.ttl, - ] as const; +async function getBasketProposalVersion( + client: DtfClient, + params: BuildIndexDtfBasketProposalParams, +): Promise { + const version = params.version ?? (await getVersion(client, params)); + + if (version !== "5.0.0" && version !== "6.0.0") { + throw new SdkError({ + code: "INVALID_INPUT", + message: `Unsupported Index DTF basket proposal version: ${version}`, + meta: { version }, + }); + } + + return version; +} + +async function getNextRebalanceNonce(client: DtfClient, params: DtfParams): Promise { + const nonce = await client.viem.readContract({ + chainId: params.chainId, + address: getAddress(params.address), + abi: folioArtifactAbi, + functionName: "getRebalanceNonce", + blockNumber: params.blockNumber, + }); + + return nonce + 1n; +} + +function getRequiredDeadline(deadline: number | bigint | undefined): bigint { + if (deadline === undefined) { + throw new SdkError({ + code: "INVALID_INPUT", + message: "deadline is required to build an Index DTF 6.0.0 basket proposal", + }); + } + + return toSeconds(deadline, "deadline", { allowZero: false }); } function getProposalAuthority( diff --git a/packages/sdk/src/index-dtf/governance/propose/calls.test.ts b/packages/sdk/src/index-dtf/governance/propose/calls.test.ts index a50689c..927f28c 100644 --- a/packages/sdk/src/index-dtf/governance/propose/calls.test.ts +++ b/packages/sdk/src/index-dtf/governance/propose/calls.test.ts @@ -24,6 +24,7 @@ import { const DTF = "0x0000000000000000000000000000000000000001"; const ACCOUNT = "0x0000000000000000000000000000000000000002"; +const IMMUTABLE_ACCOUNT = "0x0000000000000000000000000000000000000003"; describe("Index DTF call builders", () => { it("encodes simple setter calls", () => { @@ -76,6 +77,34 @@ describe("Index DTF call builders", () => { ); }); + it("encodes v6 mutable and immutable fee recipient tables", () => { + const call = prepareIndexDtfSetFeeRecipients({ + address: DTF, + chainId: 1, + version: "6.0.0", + recipients: [{ recipient: ACCOUNT, portion: 600000000000000000n }], + immutableRecipients: [{ recipient: IMMUTABLE_ACCOUNT, portion: 400000000000000000n }], + }); + const decoded = decodeFunctionData({ abi: indexDtfV6WriteAbi, data: call.data }); + + expect(decoded.functionName).toBe("setFeeRecipients"); + expect(decoded.args).toEqual([ + [{ recipient: ACCOUNT, portion: 600000000000000000n }], + [{ recipient: IMMUTABLE_ACCOUNT, portion: 400000000000000000n }], + ]); + }); + + it("requires the immutable fee recipient table for v6", () => { + expect(() => + prepareIndexDtfSetFeeRecipients({ + address: DTF, + chainId: 1, + version: "6.0.0", + recipients: [{ recipient: ACCOUNT, portion: 1n }], + }), + ).toThrow("immutableRecipients is required"); + }); + it("keeps unchanged no-arg calls available on older versions", () => { const call = prepareIndexDtfDeprecate({ address: DTF, diff --git a/packages/sdk/src/index-dtf/governance/propose/calls.ts b/packages/sdk/src/index-dtf/governance/propose/calls.ts index 9d72545..f0ee5e1 100644 --- a/packages/sdk/src/index-dtf/governance/propose/calls.ts +++ b/packages/sdk/src/index-dtf/governance/propose/calls.ts @@ -130,19 +130,41 @@ export function prepareIndexDtfSetSelfFee(params: PrepareIndexDtfPercentageCallP export function prepareIndexDtfSetFeeRecipients( params: PrepareIndexDtfCallParams & { readonly recipients: readonly IndexDtfFeeRecipient[]; + readonly immutableRecipients?: readonly IndexDtfFeeRecipient[]; }, ): IndexDtfCall { + const recipients = params.recipients.map(normalizeFeeRecipient); + + if (params.version === "6.0.0") { + if (params.immutableRecipients === undefined) { + throw new SdkError({ + code: "INVALID_INPUT", + message: "immutableRecipients is required for Index DTF 6.0.0 fee recipient calls", + }); + } + + return prepareContractCall({ + chainId: params.chainId, + address: params.address, + abi: indexDtfV6WriteAbi, + functionName: "setFeeRecipients", + args: [recipients, params.immutableRecipients.map(normalizeFeeRecipient)] as const, + }); + } + + if (params.immutableRecipients?.length) { + throw new SdkError({ + code: "INVALID_INPUT", + message: "immutable fee recipients are only supported by Index DTF 6.0.0", + }); + } + return prepareContractCall({ chainId: params.chainId, address: params.address, - abi: getIndexDtfWriteAbi(params.version), + abi: indexDtfV5WriteAbi, functionName: "setFeeRecipients", - args: [ - params.recipients.map((recipient) => ({ - recipient: recipient.recipient, - portion: recipient.portion, - })), - ] as never, + args: [recipients] as const, }); } @@ -458,6 +480,13 @@ export function prepareIndexDtfTimelockExecuteBatch( }); } +function normalizeFeeRecipient(recipient: IndexDtfFeeRecipient) { + return { + recipient: recipient.recipient, + portion: recipient.portion, + }; +} + function encodePercent(percentage: number): bigint { if (!Number.isFinite(percentage) || percentage < 0) { throw new SdkError({ diff --git a/packages/sdk/src/index-dtf/governance/propose/revenue.ts b/packages/sdk/src/index-dtf/governance/propose/revenue.ts index c849c05..0b63f45 100644 --- a/packages/sdk/src/index-dtf/governance/propose/revenue.ts +++ b/packages/sdk/src/index-dtf/governance/propose/revenue.ts @@ -47,6 +47,12 @@ export function prepareRevenueDistribution( if (!distribution) { return undefined; } + if (version === "6.0.0") { + throw new SdkError({ + code: "INVALID_INPUT", + message: "Index DTF 6.0.0 revenue proposals require the full immutable fee recipient table", + }); + } validateRevenueDistributionInput(dtf, distribution); diff --git a/packages/sdk/src/index-dtf/governance/propose/settings.test.ts b/packages/sdk/src/index-dtf/governance/propose/settings.test.ts index 73e5fe5..77a60ba 100644 --- a/packages/sdk/src/index-dtf/governance/propose/settings.test.ts +++ b/packages/sdk/src/index-dtf/governance/propose/settings.test.ts @@ -595,6 +595,24 @@ describe("settings proposal builders", () => { expect(total).toBe(parseEther("1")); }); + it("rejects v6 revenue proposals without the immutable recipient table", async () => { + await expect( + buildIndexDtfSettingsProposal({} as never, { + address: DTF, + chainId: 1, + governance: GOVERNANCE, + dtf: createDtfContext(), + version: "6.0.0", + revenueDistribution: { + platformFee: 20, + governanceShare: 0, + deployerShare: 80, + additionalRecipients: [], + }, + }), + ).rejects.toThrow("full immutable fee recipient table"); + }); + it("encodes repeating revenue recipient portions", async () => { const proposal = await buildIndexDtfSettingsProposal({} as never, { address: DTF, diff --git a/packages/sdk/src/index-dtf/subgraph/dtf.generated.ts b/packages/sdk/src/index-dtf/subgraph/dtf.generated.ts index ced0db2..534c4d2 100644 --- a/packages/sdk/src/index-dtf/subgraph/dtf.generated.ts +++ b/packages/sdk/src/index-dtf/subgraph/dtf.generated.ts @@ -332,6 +332,7 @@ export type Account_Filter = { mintings_?: InputMaybe; or?: InputMaybe>>; rewardClaims_?: InputMaybe; + stakingPositions_?: InputMaybe; transferFrom_?: InputMaybe; transferTo_?: InputMaybe; }; @@ -343,6 +344,7 @@ export type Account_OrderBy = | 'locks' | 'mintings' | 'rewardClaims' + | 'stakingPositions' | 'transferFrom' | 'transferTo'; @@ -1152,12 +1154,19 @@ export type Dtf_OrderBy = | 'stToken__currentOptimisticDelegates' | 'stToken__delegatedVotes' | 'stToken__delegatedVotesRaw' + | 'stToken__exchangeRate' + | 'stToken__exchangeRateBlock' + | 'stToken__exchangeRateTimestamp' | 'stToken__id' | 'stToken__optimisticDelegatedVotes' | 'stToken__optimisticDelegatedVotesRaw' + | 'stToken__rewardHalfLife' + | 'stToken__rewardRatio' | 'stToken__tokenJar' + | 'stToken__totalAssets' | 'stToken__totalDelegates' | 'stToken__totalOptimisticDelegates' + | 'stToken__unstakingDelay' | 'timestamp' | 'token' | 'token__address' @@ -1639,12 +1648,19 @@ export type Delegate_OrderBy = | 'token__currentOptimisticDelegates' | 'token__delegatedVotes' | 'token__delegatedVotesRaw' + | 'token__exchangeRate' + | 'token__exchangeRateBlock' + | 'token__exchangeRateTimestamp' | 'token__id' | 'token__optimisticDelegatedVotes' | 'token__optimisticDelegatedVotesRaw' + | 'token__rewardHalfLife' + | 'token__rewardRatio' | 'token__tokenJar' + | 'token__totalAssets' | 'token__totalDelegates' | 'token__totalOptimisticDelegates' + | 'token__unstakingDelay' | 'votes'; export type Event_Filter = { @@ -2187,12 +2203,19 @@ export type Governance_OrderBy = | 'token__currentOptimisticDelegates' | 'token__delegatedVotes' | 'token__delegatedVotesRaw' + | 'token__exchangeRate' + | 'token__exchangeRateBlock' + | 'token__exchangeRateTimestamp' | 'token__id' | 'token__optimisticDelegatedVotes' | 'token__optimisticDelegatedVotesRaw' + | 'token__rewardHalfLife' + | 'token__rewardRatio' | 'token__tokenJar' + | 'token__totalAssets' | 'token__totalDelegates' | 'token__totalOptimisticDelegates' + | 'token__unstakingDelay' | 'version' | 'votingDelay' | 'votingPeriod'; @@ -2406,12 +2429,19 @@ export type Lock_OrderBy = | 'token__currentOptimisticDelegates' | 'token__delegatedVotes' | 'token__delegatedVotesRaw' + | 'token__exchangeRate' + | 'token__exchangeRateBlock' + | 'token__exchangeRateTimestamp' | 'token__id' | 'token__optimisticDelegatedVotes' | 'token__optimisticDelegatedVotesRaw' + | 'token__rewardHalfLife' + | 'token__rewardRatio' | 'token__tokenJar' + | 'token__totalAssets' | 'token__totalDelegates' | 'token__totalOptimisticDelegates' + | 'token__unstakingDelay' | 'unlockTime'; export type Minting_Filter = { @@ -4095,14 +4125,806 @@ export type RewardClaim_OrderBy = | 'token__currentOptimisticDelegates' | 'token__delegatedVotes' | 'token__delegatedVotesRaw' + | 'token__exchangeRate' + | 'token__exchangeRateBlock' + | 'token__exchangeRateTimestamp' | 'token__id' | 'token__optimisticDelegatedVotes' | 'token__optimisticDelegatedVotesRaw' + | 'token__rewardHalfLife' + | 'token__rewardRatio' | 'token__tokenJar' + | 'token__totalAssets' | 'token__totalDelegates' | 'token__totalOptimisticDelegates' + | 'token__unstakingDelay' | 'txnHash'; +export type StakingPositionDailySnapshot_Filter = { + /** Filter for the block changed event. */ + _change_block?: InputMaybe; + account?: InputMaybe; + account_?: InputMaybe; + account_contains?: InputMaybe; + account_contains_nocase?: InputMaybe; + account_ends_with?: InputMaybe; + account_ends_with_nocase?: InputMaybe; + account_gt?: InputMaybe; + account_gte?: InputMaybe; + account_in?: InputMaybe>; + account_lt?: InputMaybe; + account_lte?: InputMaybe; + account_not?: InputMaybe; + account_not_contains?: InputMaybe; + account_not_contains_nocase?: InputMaybe; + account_not_ends_with?: InputMaybe; + account_not_ends_with_nocase?: InputMaybe; + account_not_in?: InputMaybe>; + account_not_starts_with?: InputMaybe; + account_not_starts_with_nocase?: InputMaybe; + account_starts_with?: InputMaybe; + account_starts_with_nocase?: InputMaybe; + and?: InputMaybe>>; + blockNumber?: InputMaybe; + blockNumber_gt?: InputMaybe; + blockNumber_gte?: InputMaybe; + blockNumber_in?: InputMaybe>; + blockNumber_lt?: InputMaybe; + blockNumber_lte?: InputMaybe; + blockNumber_not?: InputMaybe; + blockNumber_not_in?: InputMaybe>; + id?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not?: InputMaybe; + id_not_in?: InputMaybe>; + or?: InputMaybe>>; + position?: InputMaybe; + position_?: InputMaybe; + position_contains?: InputMaybe; + position_contains_nocase?: InputMaybe; + position_ends_with?: InputMaybe; + position_ends_with_nocase?: InputMaybe; + position_gt?: InputMaybe; + position_gte?: InputMaybe; + position_in?: InputMaybe>; + position_lt?: InputMaybe; + position_lte?: InputMaybe; + position_not?: InputMaybe; + position_not_contains?: InputMaybe; + position_not_contains_nocase?: InputMaybe; + position_not_ends_with?: InputMaybe; + position_not_ends_with_nocase?: InputMaybe; + position_not_in?: InputMaybe>; + position_not_starts_with?: InputMaybe; + position_not_starts_with_nocase?: InputMaybe; + position_starts_with?: InputMaybe; + position_starts_with_nocase?: InputMaybe; + principal?: InputMaybe; + principal_gt?: InputMaybe; + principal_gte?: InputMaybe; + principal_in?: InputMaybe>; + principal_lt?: InputMaybe; + principal_lte?: InputMaybe; + principal_not?: InputMaybe; + principal_not_in?: InputMaybe>; + realizedRewards?: InputMaybe; + realizedRewards_gt?: InputMaybe; + realizedRewards_gte?: InputMaybe; + realizedRewards_in?: InputMaybe>; + realizedRewards_lt?: InputMaybe; + realizedRewards_lte?: InputMaybe; + realizedRewards_not?: InputMaybe; + realizedRewards_not_in?: InputMaybe>; + shares?: InputMaybe; + shares_gt?: InputMaybe; + shares_gte?: InputMaybe; + shares_in?: InputMaybe>; + shares_lt?: InputMaybe; + shares_lte?: InputMaybe; + shares_not?: InputMaybe; + shares_not_in?: InputMaybe>; + timestamp?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not?: InputMaybe; + timestamp_not_in?: InputMaybe>; + token?: InputMaybe; + token_?: InputMaybe; + token_contains?: InputMaybe; + token_contains_nocase?: InputMaybe; + token_ends_with?: InputMaybe; + token_ends_with_nocase?: InputMaybe; + token_gt?: InputMaybe; + token_gte?: InputMaybe; + token_in?: InputMaybe>; + token_lt?: InputMaybe; + token_lte?: InputMaybe; + token_not?: InputMaybe; + token_not_contains?: InputMaybe; + token_not_contains_nocase?: InputMaybe; + token_not_ends_with?: InputMaybe; + token_not_ends_with_nocase?: InputMaybe; + token_not_in?: InputMaybe>; + token_not_starts_with?: InputMaybe; + token_not_starts_with_nocase?: InputMaybe; + token_starts_with?: InputMaybe; + token_starts_with_nocase?: InputMaybe; + totalDeposited?: InputMaybe; + totalDeposited_gt?: InputMaybe; + totalDeposited_gte?: InputMaybe; + totalDeposited_in?: InputMaybe>; + totalDeposited_lt?: InputMaybe; + totalDeposited_lte?: InputMaybe; + totalDeposited_not?: InputMaybe; + totalDeposited_not_in?: InputMaybe>; + totalWithdrawn?: InputMaybe; + totalWithdrawn_gt?: InputMaybe; + totalWithdrawn_gte?: InputMaybe; + totalWithdrawn_in?: InputMaybe>; + totalWithdrawn_lt?: InputMaybe; + totalWithdrawn_lte?: InputMaybe; + totalWithdrawn_not?: InputMaybe; + totalWithdrawn_not_in?: InputMaybe>; +}; + +export type StakingPositionDailySnapshot_OrderBy = + | 'account' + | 'account__id' + | 'blockNumber' + | 'id' + | 'position' + | 'position__blockNumber' + | 'position__depositCount' + | 'position__id' + | 'position__principal' + | 'position__realizedRewards' + | 'position__shares' + | 'position__timestamp' + | 'position__totalDeposited' + | 'position__totalWithdrawn' + | 'position__withdrawCount' + | 'principal' + | 'realizedRewards' + | 'shares' + | 'timestamp' + | 'token' + | 'token__currentDelegates' + | 'token__currentOptimisticDelegates' + | 'token__delegatedVotes' + | 'token__delegatedVotesRaw' + | 'token__exchangeRate' + | 'token__exchangeRateBlock' + | 'token__exchangeRateTimestamp' + | 'token__id' + | 'token__optimisticDelegatedVotes' + | 'token__optimisticDelegatedVotesRaw' + | 'token__rewardHalfLife' + | 'token__rewardRatio' + | 'token__tokenJar' + | 'token__totalAssets' + | 'token__totalDelegates' + | 'token__totalOptimisticDelegates' + | 'token__unstakingDelay' + | 'totalDeposited' + | 'totalWithdrawn'; + +export type StakingPositionRecordType = + | 'DEPOSIT' + /** UnstakingManager.cancelLock re-depositing a pending unlock (Deposit.sender == unstakingManager); not new capital */ + | 'LOCK_CANCEL' + | 'TRANSFER_IN' + | 'TRANSFER_OUT' + | 'WITHDRAW'; + +export type StakingPositionRecord_Filter = { + /** Filter for the block changed event. */ + _change_block?: InputMaybe; + account?: InputMaybe; + account_?: InputMaybe; + account_contains?: InputMaybe; + account_contains_nocase?: InputMaybe; + account_ends_with?: InputMaybe; + account_ends_with_nocase?: InputMaybe; + account_gt?: InputMaybe; + account_gte?: InputMaybe; + account_in?: InputMaybe>; + account_lt?: InputMaybe; + account_lte?: InputMaybe; + account_not?: InputMaybe; + account_not_contains?: InputMaybe; + account_not_contains_nocase?: InputMaybe; + account_not_ends_with?: InputMaybe; + account_not_ends_with_nocase?: InputMaybe; + account_not_in?: InputMaybe>; + account_not_starts_with?: InputMaybe; + account_not_starts_with_nocase?: InputMaybe; + account_starts_with?: InputMaybe; + account_starts_with_nocase?: InputMaybe; + and?: InputMaybe>>; + assets?: InputMaybe; + assets_gt?: InputMaybe; + assets_gte?: InputMaybe; + assets_in?: InputMaybe>; + assets_lt?: InputMaybe; + assets_lte?: InputMaybe; + assets_not?: InputMaybe; + assets_not_in?: InputMaybe>; + blockNumber?: InputMaybe; + blockNumber_gt?: InputMaybe; + blockNumber_gte?: InputMaybe; + blockNumber_in?: InputMaybe>; + blockNumber_lt?: InputMaybe; + blockNumber_lte?: InputMaybe; + blockNumber_not?: InputMaybe; + blockNumber_not_in?: InputMaybe>; + counterparty?: InputMaybe; + counterparty_?: InputMaybe; + counterparty_contains?: InputMaybe; + counterparty_contains_nocase?: InputMaybe; + counterparty_ends_with?: InputMaybe; + counterparty_ends_with_nocase?: InputMaybe; + counterparty_gt?: InputMaybe; + counterparty_gte?: InputMaybe; + counterparty_in?: InputMaybe>; + counterparty_lt?: InputMaybe; + counterparty_lte?: InputMaybe; + counterparty_not?: InputMaybe; + counterparty_not_contains?: InputMaybe; + counterparty_not_contains_nocase?: InputMaybe; + counterparty_not_ends_with?: InputMaybe; + counterparty_not_ends_with_nocase?: InputMaybe; + counterparty_not_in?: InputMaybe>; + counterparty_not_starts_with?: InputMaybe; + counterparty_not_starts_with_nocase?: InputMaybe; + counterparty_starts_with?: InputMaybe; + counterparty_starts_with_nocase?: InputMaybe; + exchangeRate?: InputMaybe; + exchangeRate_gt?: InputMaybe; + exchangeRate_gte?: InputMaybe; + exchangeRate_in?: InputMaybe>; + exchangeRate_lt?: InputMaybe; + exchangeRate_lte?: InputMaybe; + exchangeRate_not?: InputMaybe; + exchangeRate_not_in?: InputMaybe>; + hash?: InputMaybe; + hash_contains?: InputMaybe; + hash_contains_nocase?: InputMaybe; + hash_ends_with?: InputMaybe; + hash_ends_with_nocase?: InputMaybe; + hash_gt?: InputMaybe; + hash_gte?: InputMaybe; + hash_in?: InputMaybe>; + hash_lt?: InputMaybe; + hash_lte?: InputMaybe; + hash_not?: InputMaybe; + hash_not_contains?: InputMaybe; + hash_not_contains_nocase?: InputMaybe; + hash_not_ends_with?: InputMaybe; + hash_not_ends_with_nocase?: InputMaybe; + hash_not_in?: InputMaybe>; + hash_not_starts_with?: InputMaybe; + hash_not_starts_with_nocase?: InputMaybe; + hash_starts_with?: InputMaybe; + hash_starts_with_nocase?: InputMaybe; + id?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not?: InputMaybe; + id_not_in?: InputMaybe>; + logIndex?: InputMaybe; + logIndex_gt?: InputMaybe; + logIndex_gte?: InputMaybe; + logIndex_in?: InputMaybe>; + logIndex_lt?: InputMaybe; + logIndex_lte?: InputMaybe; + logIndex_not?: InputMaybe; + logIndex_not_in?: InputMaybe>; + or?: InputMaybe>>; + position?: InputMaybe; + position_?: InputMaybe; + position_contains?: InputMaybe; + position_contains_nocase?: InputMaybe; + position_ends_with?: InputMaybe; + position_ends_with_nocase?: InputMaybe; + position_gt?: InputMaybe; + position_gte?: InputMaybe; + position_in?: InputMaybe>; + position_lt?: InputMaybe; + position_lte?: InputMaybe; + position_not?: InputMaybe; + position_not_contains?: InputMaybe; + position_not_contains_nocase?: InputMaybe; + position_not_ends_with?: InputMaybe; + position_not_ends_with_nocase?: InputMaybe; + position_not_in?: InputMaybe>; + position_not_starts_with?: InputMaybe; + position_not_starts_with_nocase?: InputMaybe; + position_starts_with?: InputMaybe; + position_starts_with_nocase?: InputMaybe; + principalDelta?: InputMaybe; + principalDelta_gt?: InputMaybe; + principalDelta_gte?: InputMaybe; + principalDelta_in?: InputMaybe>; + principalDelta_lt?: InputMaybe; + principalDelta_lte?: InputMaybe; + principalDelta_not?: InputMaybe; + principalDelta_not_in?: InputMaybe>; + realizedRewards?: InputMaybe; + realizedRewards_gt?: InputMaybe; + realizedRewards_gte?: InputMaybe; + realizedRewards_in?: InputMaybe>; + realizedRewards_lt?: InputMaybe; + realizedRewards_lte?: InputMaybe; + realizedRewards_not?: InputMaybe; + realizedRewards_not_in?: InputMaybe>; + shares?: InputMaybe; + shares_gt?: InputMaybe; + shares_gte?: InputMaybe; + shares_in?: InputMaybe>; + shares_lt?: InputMaybe; + shares_lte?: InputMaybe; + shares_not?: InputMaybe; + shares_not_in?: InputMaybe>; + timestamp?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not?: InputMaybe; + timestamp_not_in?: InputMaybe>; + token?: InputMaybe; + token_?: InputMaybe; + token_contains?: InputMaybe; + token_contains_nocase?: InputMaybe; + token_ends_with?: InputMaybe; + token_ends_with_nocase?: InputMaybe; + token_gt?: InputMaybe; + token_gte?: InputMaybe; + token_in?: InputMaybe>; + token_lt?: InputMaybe; + token_lte?: InputMaybe; + token_not?: InputMaybe; + token_not_contains?: InputMaybe; + token_not_contains_nocase?: InputMaybe; + token_not_ends_with?: InputMaybe; + token_not_ends_with_nocase?: InputMaybe; + token_not_in?: InputMaybe>; + token_not_starts_with?: InputMaybe; + token_not_starts_with_nocase?: InputMaybe; + token_starts_with?: InputMaybe; + token_starts_with_nocase?: InputMaybe; + type?: InputMaybe; + type_in?: InputMaybe>; + type_not?: InputMaybe; + type_not_in?: InputMaybe>; +}; + +export type StakingPositionRecord_OrderBy = + | 'account' + | 'account__id' + | 'assets' + | 'blockNumber' + | 'counterparty' + | 'counterparty__id' + | 'exchangeRate' + | 'hash' + | 'id' + | 'logIndex' + | 'position' + | 'position__blockNumber' + | 'position__depositCount' + | 'position__id' + | 'position__principal' + | 'position__realizedRewards' + | 'position__shares' + | 'position__timestamp' + | 'position__totalDeposited' + | 'position__totalWithdrawn' + | 'position__withdrawCount' + | 'principalDelta' + | 'realizedRewards' + | 'shares' + | 'timestamp' + | 'token' + | 'token__currentDelegates' + | 'token__currentOptimisticDelegates' + | 'token__delegatedVotes' + | 'token__delegatedVotesRaw' + | 'token__exchangeRate' + | 'token__exchangeRateBlock' + | 'token__exchangeRateTimestamp' + | 'token__id' + | 'token__optimisticDelegatedVotes' + | 'token__optimisticDelegatedVotesRaw' + | 'token__rewardHalfLife' + | 'token__rewardRatio' + | 'token__tokenJar' + | 'token__totalAssets' + | 'token__totalDelegates' + | 'token__totalOptimisticDelegates' + | 'token__unstakingDelay' + | 'type'; + +export type StakingPosition_Filter = { + /** Filter for the block changed event. */ + _change_block?: InputMaybe; + account?: InputMaybe; + account_?: InputMaybe; + account_contains?: InputMaybe; + account_contains_nocase?: InputMaybe; + account_ends_with?: InputMaybe; + account_ends_with_nocase?: InputMaybe; + account_gt?: InputMaybe; + account_gte?: InputMaybe; + account_in?: InputMaybe>; + account_lt?: InputMaybe; + account_lte?: InputMaybe; + account_not?: InputMaybe; + account_not_contains?: InputMaybe; + account_not_contains_nocase?: InputMaybe; + account_not_ends_with?: InputMaybe; + account_not_ends_with_nocase?: InputMaybe; + account_not_in?: InputMaybe>; + account_not_starts_with?: InputMaybe; + account_not_starts_with_nocase?: InputMaybe; + account_starts_with?: InputMaybe; + account_starts_with_nocase?: InputMaybe; + and?: InputMaybe>>; + blockNumber?: InputMaybe; + blockNumber_gt?: InputMaybe; + blockNumber_gte?: InputMaybe; + blockNumber_in?: InputMaybe>; + blockNumber_lt?: InputMaybe; + blockNumber_lte?: InputMaybe; + blockNumber_not?: InputMaybe; + blockNumber_not_in?: InputMaybe>; + dailySnapshots_?: InputMaybe; + depositCount?: InputMaybe; + depositCount_gt?: InputMaybe; + depositCount_gte?: InputMaybe; + depositCount_in?: InputMaybe>; + depositCount_lt?: InputMaybe; + depositCount_lte?: InputMaybe; + depositCount_not?: InputMaybe; + depositCount_not_in?: InputMaybe>; + id?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not?: InputMaybe; + id_not_in?: InputMaybe>; + or?: InputMaybe>>; + principal?: InputMaybe; + principal_gt?: InputMaybe; + principal_gte?: InputMaybe; + principal_in?: InputMaybe>; + principal_lt?: InputMaybe; + principal_lte?: InputMaybe; + principal_not?: InputMaybe; + principal_not_in?: InputMaybe>; + realizedRewards?: InputMaybe; + realizedRewards_gt?: InputMaybe; + realizedRewards_gte?: InputMaybe; + realizedRewards_in?: InputMaybe>; + realizedRewards_lt?: InputMaybe; + realizedRewards_lte?: InputMaybe; + realizedRewards_not?: InputMaybe; + realizedRewards_not_in?: InputMaybe>; + records_?: InputMaybe; + shares?: InputMaybe; + shares_gt?: InputMaybe; + shares_gte?: InputMaybe; + shares_in?: InputMaybe>; + shares_lt?: InputMaybe; + shares_lte?: InputMaybe; + shares_not?: InputMaybe; + shares_not_in?: InputMaybe>; + timestamp?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not?: InputMaybe; + timestamp_not_in?: InputMaybe>; + token?: InputMaybe; + token_?: InputMaybe; + token_contains?: InputMaybe; + token_contains_nocase?: InputMaybe; + token_ends_with?: InputMaybe; + token_ends_with_nocase?: InputMaybe; + token_gt?: InputMaybe; + token_gte?: InputMaybe; + token_in?: InputMaybe>; + token_lt?: InputMaybe; + token_lte?: InputMaybe; + token_not?: InputMaybe; + token_not_contains?: InputMaybe; + token_not_contains_nocase?: InputMaybe; + token_not_ends_with?: InputMaybe; + token_not_ends_with_nocase?: InputMaybe; + token_not_in?: InputMaybe>; + token_not_starts_with?: InputMaybe; + token_not_starts_with_nocase?: InputMaybe; + token_starts_with?: InputMaybe; + token_starts_with_nocase?: InputMaybe; + totalDeposited?: InputMaybe; + totalDeposited_gt?: InputMaybe; + totalDeposited_gte?: InputMaybe; + totalDeposited_in?: InputMaybe>; + totalDeposited_lt?: InputMaybe; + totalDeposited_lte?: InputMaybe; + totalDeposited_not?: InputMaybe; + totalDeposited_not_in?: InputMaybe>; + totalWithdrawn?: InputMaybe; + totalWithdrawn_gt?: InputMaybe; + totalWithdrawn_gte?: InputMaybe; + totalWithdrawn_in?: InputMaybe>; + totalWithdrawn_lt?: InputMaybe; + totalWithdrawn_lte?: InputMaybe; + totalWithdrawn_not?: InputMaybe; + totalWithdrawn_not_in?: InputMaybe>; + withdrawCount?: InputMaybe; + withdrawCount_gt?: InputMaybe; + withdrawCount_gte?: InputMaybe; + withdrawCount_in?: InputMaybe>; + withdrawCount_lt?: InputMaybe; + withdrawCount_lte?: InputMaybe; + withdrawCount_not?: InputMaybe; + withdrawCount_not_in?: InputMaybe>; +}; + +export type StakingPosition_OrderBy = + | 'account' + | 'account__id' + | 'blockNumber' + | 'dailySnapshots' + | 'depositCount' + | 'id' + | 'principal' + | 'realizedRewards' + | 'records' + | 'shares' + | 'timestamp' + | 'token' + | 'token__currentDelegates' + | 'token__currentOptimisticDelegates' + | 'token__delegatedVotes' + | 'token__delegatedVotesRaw' + | 'token__exchangeRate' + | 'token__exchangeRateBlock' + | 'token__exchangeRateTimestamp' + | 'token__id' + | 'token__optimisticDelegatedVotes' + | 'token__optimisticDelegatedVotesRaw' + | 'token__rewardHalfLife' + | 'token__rewardRatio' + | 'token__tokenJar' + | 'token__totalAssets' + | 'token__totalDelegates' + | 'token__totalOptimisticDelegates' + | 'token__unstakingDelay' + | 'totalDeposited' + | 'totalWithdrawn' + | 'withdrawCount'; + +export type StakingTokenExchangeRateDailySnapshot_Filter = { + /** Filter for the block changed event. */ + _change_block?: InputMaybe; + and?: InputMaybe>>; + blockNumber?: InputMaybe; + blockNumber_gt?: InputMaybe; + blockNumber_gte?: InputMaybe; + blockNumber_in?: InputMaybe>; + blockNumber_lt?: InputMaybe; + blockNumber_lte?: InputMaybe; + blockNumber_not?: InputMaybe; + blockNumber_not_in?: InputMaybe>; + exchangeRate?: InputMaybe; + exchangeRate_gt?: InputMaybe; + exchangeRate_gte?: InputMaybe; + exchangeRate_in?: InputMaybe>; + exchangeRate_lt?: InputMaybe; + exchangeRate_lte?: InputMaybe; + exchangeRate_not?: InputMaybe; + exchangeRate_not_in?: InputMaybe>; + id?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not?: InputMaybe; + id_not_in?: InputMaybe>; + or?: InputMaybe>>; + timestamp?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not?: InputMaybe; + timestamp_not_in?: InputMaybe>; + token?: InputMaybe; + token_?: InputMaybe; + token_contains?: InputMaybe; + token_contains_nocase?: InputMaybe; + token_ends_with?: InputMaybe; + token_ends_with_nocase?: InputMaybe; + token_gt?: InputMaybe; + token_gte?: InputMaybe; + token_in?: InputMaybe>; + token_lt?: InputMaybe; + token_lte?: InputMaybe; + token_not?: InputMaybe; + token_not_contains?: InputMaybe; + token_not_contains_nocase?: InputMaybe; + token_not_ends_with?: InputMaybe; + token_not_ends_with_nocase?: InputMaybe; + token_not_in?: InputMaybe>; + token_not_starts_with?: InputMaybe; + token_not_starts_with_nocase?: InputMaybe; + token_starts_with?: InputMaybe; + token_starts_with_nocase?: InputMaybe; + totalAssets?: InputMaybe; + totalAssets_gt?: InputMaybe; + totalAssets_gte?: InputMaybe; + totalAssets_in?: InputMaybe>; + totalAssets_lt?: InputMaybe; + totalAssets_lte?: InputMaybe; + totalAssets_not?: InputMaybe; + totalAssets_not_in?: InputMaybe>; + totalSupply?: InputMaybe; + totalSupply_gt?: InputMaybe; + totalSupply_gte?: InputMaybe; + totalSupply_in?: InputMaybe>; + totalSupply_lt?: InputMaybe; + totalSupply_lte?: InputMaybe; + totalSupply_not?: InputMaybe; + totalSupply_not_in?: InputMaybe>; +}; + +export type StakingTokenExchangeRateDailySnapshot_OrderBy = + | 'blockNumber' + | 'exchangeRate' + | 'id' + | 'timestamp' + | 'token' + | 'token__currentDelegates' + | 'token__currentOptimisticDelegates' + | 'token__delegatedVotes' + | 'token__delegatedVotesRaw' + | 'token__exchangeRate' + | 'token__exchangeRateBlock' + | 'token__exchangeRateTimestamp' + | 'token__id' + | 'token__optimisticDelegatedVotes' + | 'token__optimisticDelegatedVotesRaw' + | 'token__rewardHalfLife' + | 'token__rewardRatio' + | 'token__tokenJar' + | 'token__totalAssets' + | 'token__totalDelegates' + | 'token__totalOptimisticDelegates' + | 'token__unstakingDelay' + | 'totalAssets' + | 'totalSupply'; + +export type StakingTokenExchangeRateSnapshot_Filter = { + /** Filter for the block changed event. */ + _change_block?: InputMaybe; + and?: InputMaybe>>; + blockNumber?: InputMaybe; + blockNumber_gt?: InputMaybe; + blockNumber_gte?: InputMaybe; + blockNumber_in?: InputMaybe>; + blockNumber_lt?: InputMaybe; + blockNumber_lte?: InputMaybe; + blockNumber_not?: InputMaybe; + blockNumber_not_in?: InputMaybe>; + exchangeRate?: InputMaybe; + exchangeRate_gt?: InputMaybe; + exchangeRate_gte?: InputMaybe; + exchangeRate_in?: InputMaybe>; + exchangeRate_lt?: InputMaybe; + exchangeRate_lte?: InputMaybe; + exchangeRate_not?: InputMaybe; + exchangeRate_not_in?: InputMaybe>; + id?: InputMaybe; + id_gt?: InputMaybe; + id_gte?: InputMaybe; + id_in?: InputMaybe>; + id_lt?: InputMaybe; + id_lte?: InputMaybe; + id_not?: InputMaybe; + id_not_in?: InputMaybe>; + or?: InputMaybe>>; + timestamp?: InputMaybe; + timestamp_gt?: InputMaybe; + timestamp_gte?: InputMaybe; + timestamp_in?: InputMaybe>; + timestamp_lt?: InputMaybe; + timestamp_lte?: InputMaybe; + timestamp_not?: InputMaybe; + timestamp_not_in?: InputMaybe>; + token?: InputMaybe; + token_?: InputMaybe; + token_contains?: InputMaybe; + token_contains_nocase?: InputMaybe; + token_ends_with?: InputMaybe; + token_ends_with_nocase?: InputMaybe; + token_gt?: InputMaybe; + token_gte?: InputMaybe; + token_in?: InputMaybe>; + token_lt?: InputMaybe; + token_lte?: InputMaybe; + token_not?: InputMaybe; + token_not_contains?: InputMaybe; + token_not_contains_nocase?: InputMaybe; + token_not_ends_with?: InputMaybe; + token_not_ends_with_nocase?: InputMaybe; + token_not_in?: InputMaybe>; + token_not_starts_with?: InputMaybe; + token_not_starts_with_nocase?: InputMaybe; + token_starts_with?: InputMaybe; + token_starts_with_nocase?: InputMaybe; + totalAssets?: InputMaybe; + totalAssets_gt?: InputMaybe; + totalAssets_gte?: InputMaybe; + totalAssets_in?: InputMaybe>; + totalAssets_lt?: InputMaybe; + totalAssets_lte?: InputMaybe; + totalAssets_not?: InputMaybe; + totalAssets_not_in?: InputMaybe>; + totalSupply?: InputMaybe; + totalSupply_gt?: InputMaybe; + totalSupply_gte?: InputMaybe; + totalSupply_in?: InputMaybe>; + totalSupply_lt?: InputMaybe; + totalSupply_lte?: InputMaybe; + totalSupply_not?: InputMaybe; + totalSupply_not_in?: InputMaybe>; +}; + +export type StakingTokenExchangeRateSnapshot_OrderBy = + | 'blockNumber' + | 'exchangeRate' + | 'id' + | 'timestamp' + | 'token' + | 'token__currentDelegates' + | 'token__currentOptimisticDelegates' + | 'token__delegatedVotes' + | 'token__delegatedVotesRaw' + | 'token__exchangeRate' + | 'token__exchangeRateBlock' + | 'token__exchangeRateTimestamp' + | 'token__id' + | 'token__optimisticDelegatedVotes' + | 'token__optimisticDelegatedVotesRaw' + | 'token__rewardHalfLife' + | 'token__rewardRatio' + | 'token__tokenJar' + | 'token__totalAssets' + | 'token__totalDelegates' + | 'token__totalOptimisticDelegates' + | 'token__unstakingDelay' + | 'totalAssets' + | 'totalSupply'; + export type StakingTokenRewards_Filter = { /** Filter for the block changed event. */ _change_block?: InputMaybe; @@ -4187,12 +5009,19 @@ export type StakingTokenRewards_OrderBy = | 'stToken__currentOptimisticDelegates' | 'stToken__delegatedVotes' | 'stToken__delegatedVotesRaw' + | 'stToken__exchangeRate' + | 'stToken__exchangeRateBlock' + | 'stToken__exchangeRateTimestamp' | 'stToken__id' | 'stToken__optimisticDelegatedVotes' | 'stToken__optimisticDelegatedVotesRaw' + | 'stToken__rewardHalfLife' + | 'stToken__rewardRatio' | 'stToken__tokenJar' + | 'stToken__totalAssets' | 'stToken__totalDelegates' - | 'stToken__totalOptimisticDelegates'; + | 'stToken__totalOptimisticDelegates' + | 'stToken__unstakingDelay'; export type StakingToken_Filter = { /** Filter for the block changed event. */ @@ -4233,6 +5062,32 @@ export type StakingToken_Filter = { delegatedVotes_not_in?: InputMaybe>; delegates_?: InputMaybe; dtfs_?: InputMaybe; + exchangeRate?: InputMaybe; + exchangeRateBlock?: InputMaybe; + exchangeRateBlock_gt?: InputMaybe; + exchangeRateBlock_gte?: InputMaybe; + exchangeRateBlock_in?: InputMaybe>; + exchangeRateBlock_lt?: InputMaybe; + exchangeRateBlock_lte?: InputMaybe; + exchangeRateBlock_not?: InputMaybe; + exchangeRateBlock_not_in?: InputMaybe>; + exchangeRateDailySnapshots_?: InputMaybe; + exchangeRateSnapshots_?: InputMaybe; + exchangeRateTimestamp?: InputMaybe; + exchangeRateTimestamp_gt?: InputMaybe; + exchangeRateTimestamp_gte?: InputMaybe; + exchangeRateTimestamp_in?: InputMaybe>; + exchangeRateTimestamp_lt?: InputMaybe; + exchangeRateTimestamp_lte?: InputMaybe; + exchangeRateTimestamp_not?: InputMaybe; + exchangeRateTimestamp_not_in?: InputMaybe>; + exchangeRate_gt?: InputMaybe; + exchangeRate_gte?: InputMaybe; + exchangeRate_in?: InputMaybe>; + exchangeRate_lt?: InputMaybe; + exchangeRate_lte?: InputMaybe; + exchangeRate_not?: InputMaybe; + exchangeRate_not_in?: InputMaybe>; governance?: InputMaybe; governance_?: InputMaybe; governance_contains?: InputMaybe; @@ -4285,6 +5140,23 @@ export type StakingToken_Filter = { optimisticDelegatedVotes_not?: InputMaybe; optimisticDelegatedVotes_not_in?: InputMaybe>; or?: InputMaybe>>; + positions_?: InputMaybe; + rewardHalfLife?: InputMaybe; + rewardHalfLife_gt?: InputMaybe; + rewardHalfLife_gte?: InputMaybe; + rewardHalfLife_in?: InputMaybe>; + rewardHalfLife_lt?: InputMaybe; + rewardHalfLife_lte?: InputMaybe; + rewardHalfLife_not?: InputMaybe; + rewardHalfLife_not_in?: InputMaybe>; + rewardRatio?: InputMaybe; + rewardRatio_gt?: InputMaybe; + rewardRatio_gte?: InputMaybe; + rewardRatio_in?: InputMaybe>; + rewardRatio_lt?: InputMaybe; + rewardRatio_lte?: InputMaybe; + rewardRatio_not?: InputMaybe; + rewardRatio_not_in?: InputMaybe>; rewards_?: InputMaybe; token?: InputMaybe; tokenJar?: InputMaybe; @@ -4327,6 +5199,14 @@ export type StakingToken_Filter = { token_not_starts_with_nocase?: InputMaybe; token_starts_with?: InputMaybe; token_starts_with_nocase?: InputMaybe; + totalAssets?: InputMaybe; + totalAssets_gt?: InputMaybe; + totalAssets_gte?: InputMaybe; + totalAssets_in?: InputMaybe>; + totalAssets_lt?: InputMaybe; + totalAssets_lte?: InputMaybe; + totalAssets_not?: InputMaybe; + totalAssets_not_in?: InputMaybe>; totalDelegates?: InputMaybe; totalDelegates_gt?: InputMaybe; totalDelegates_gte?: InputMaybe; @@ -4364,6 +5244,35 @@ export type StakingToken_Filter = { underlying_not_starts_with_nocase?: InputMaybe; underlying_starts_with?: InputMaybe; underlying_starts_with_nocase?: InputMaybe; + unstakingDelay?: InputMaybe; + unstakingDelay_gt?: InputMaybe; + unstakingDelay_gte?: InputMaybe; + unstakingDelay_in?: InputMaybe>; + unstakingDelay_lt?: InputMaybe; + unstakingDelay_lte?: InputMaybe; + unstakingDelay_not?: InputMaybe; + unstakingDelay_not_in?: InputMaybe>; + unstakingManager?: InputMaybe; + unstakingManager_?: InputMaybe; + unstakingManager_contains?: InputMaybe; + unstakingManager_contains_nocase?: InputMaybe; + unstakingManager_ends_with?: InputMaybe; + unstakingManager_ends_with_nocase?: InputMaybe; + unstakingManager_gt?: InputMaybe; + unstakingManager_gte?: InputMaybe; + unstakingManager_in?: InputMaybe>; + unstakingManager_lt?: InputMaybe; + unstakingManager_lte?: InputMaybe; + unstakingManager_not?: InputMaybe; + unstakingManager_not_contains?: InputMaybe; + unstakingManager_not_contains_nocase?: InputMaybe; + unstakingManager_not_ends_with?: InputMaybe; + unstakingManager_not_ends_with_nocase?: InputMaybe; + unstakingManager_not_in?: InputMaybe>; + unstakingManager_not_starts_with?: InputMaybe; + unstakingManager_not_starts_with_nocase?: InputMaybe; + unstakingManager_starts_with?: InputMaybe; + unstakingManager_starts_with_nocase?: InputMaybe; }; export type StakingToken_OrderBy = @@ -4374,6 +5283,11 @@ export type StakingToken_OrderBy = | 'delegatedVotesRaw' | 'delegates' | 'dtfs' + | 'exchangeRate' + | 'exchangeRateBlock' + | 'exchangeRateDailySnapshots' + | 'exchangeRateSnapshots' + | 'exchangeRateTimestamp' | 'governance' | 'governance__id' | 'governance__isOptimistic' @@ -4398,6 +5312,9 @@ export type StakingToken_OrderBy = | 'legacyGovernance' | 'optimisticDelegatedVotes' | 'optimisticDelegatedVotesRaw' + | 'positions' + | 'rewardHalfLife' + | 'rewardRatio' | 'rewards' | 'token' | 'tokenJar' @@ -4415,6 +5332,7 @@ export type StakingToken_OrderBy = | 'token__totalSupply' | 'token__transferCount' | 'token__type' + | 'totalAssets' | 'totalDelegates' | 'totalOptimisticDelegates' | 'underlying' @@ -4431,7 +5349,10 @@ export type StakingToken_OrderBy = | 'underlying__totalMinted' | 'underlying__totalSupply' | 'underlying__transferCount' - | 'underlying__type'; + | 'underlying__type' + | 'unstakingDelay' + | 'unstakingManager' + | 'unstakingManager__id'; export type TimelockOperationByTx_Filter = { /** Filter for the block changed event. */ @@ -6073,12 +6994,19 @@ export type UnstakingManager_OrderBy = | 'token__currentOptimisticDelegates' | 'token__delegatedVotes' | 'token__delegatedVotesRaw' + | 'token__exchangeRate' + | 'token__exchangeRateBlock' + | 'token__exchangeRateTimestamp' | 'token__id' | 'token__optimisticDelegatedVotes' | 'token__optimisticDelegatedVotesRaw' + | 'token__rewardHalfLife' + | 'token__rewardRatio' | 'token__tokenJar' + | 'token__totalAssets' | 'token__totalDelegates' - | 'token__totalOptimisticDelegates'; + | 'token__totalOptimisticDelegates' + | 'token__unstakingDelay'; export type Version_Filter = { /** Filter for the block changed event. */ diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 576442b..4d4868b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -150,8 +150,8 @@ importers: specifier: workspace:* version: link:../dtf-catalog '@reserve-protocol/dtf-rebalance-lib': - specifier: ^3.2.1 - version: 3.2.1(decimal.js-light@2.5.1) + specifier: ^3.3.1 + version: 3.3.1(decimal.js-light@2.5.1) decimal.js-light: specifier: ^2.5.1 version: 2.5.1 @@ -1464,8 +1464,9 @@ packages: '@repeaterjs/repeater@3.0.6': resolution: {integrity: sha512-Javneu5lsuhwNCryN+pXH93VPQ8g0dBX7wItHFgYiwQmzE1sVdg5tWHiOgHywzL2W21XQopa7IwIEnNbmeUJYA==} - '@reserve-protocol/dtf-rebalance-lib@3.2.1': - resolution: {integrity: sha512-QfxMA/rLRYlgQHJCULzNHAHxXSPGER4TcN/4r6o5qjJklC4fcSHuxaE1DUJW5eR+8zTXwuZil5JJNHTEBPco8Q==} + '@reserve-protocol/dtf-rebalance-lib@3.3.1': + resolution: {integrity: sha512-Bftvz3OV7oD1bMTJ2gguq1XMh2qUgOzUWPo7VDY6KbT4kAVdBdCBbmN1D7zMSeMSAFrQV+/jWuuntRjTlmGkqA==} + engines: {node: '>=20'} peerDependencies: decimal.js-light: ^2.5.1 @@ -6652,7 +6653,7 @@ snapshots: '@repeaterjs/repeater@3.0.6': {} - '@reserve-protocol/dtf-rebalance-lib@3.2.1(decimal.js-light@2.5.1)': + '@reserve-protocol/dtf-rebalance-lib@3.3.1(decimal.js-light@2.5.1)': dependencies: decimal.js-light: 2.5.1