@newton-xyz/policy-pack-vaultsfyi 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,27 @@
1
+ # `@newton-xyz/policy-pack-vaultsfyi`
2
+
3
+ Gates vault deposits based on real-time risk signals: APY anomalies, TVL drawdowns, risk score floors, and allocation changes
4
+
5
+ Typed TypeScript bindings for the Newton **vaultsfyi** policy pack. Generated from the AVS-side artifacts at [`/vaultsfyi/`](../../vaultsfyi/) in this repo.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pnpm add @newton-xyz/policy-pack-vaultsfyi
11
+ ```
12
+
13
+ ## What's exported
14
+
15
+ | Export | Source | Purpose |
16
+ |---|---|---|
17
+ | `WasmArgsSchema` (zod) + `WasmArgs` (type) | `wasm_args_schema.json` | Inputs the pack's WASM receives at evaluation time. |
18
+ | `SecretsSchema` (zod) + `Secrets` (type) | `secrets_schema.json` | API credentials uploaded before run/sim. |
19
+ | `ParamsSchema` (zod) + `Params` (type) | `params_schema.json` | Configuration thresholds, set at policy upload time. |
20
+ | `deployments` | top-level `deployments.json` | `chainId → { policy, policyData, wasmCid, ... }` |
21
+ | `PACK_NAME`, `PACK_VERSION`, `PACK_DESCRIPTION`, `PACK_LINK`, `PACK_AUTHOR` | `policy_metadata.json` | Static pack identity. |
22
+
23
+ ## Regeneration
24
+
25
+ The `src/*` files are generated. Edit the upstream JSON schemas under [`/vaultsfyi/`](../../vaultsfyi/) and run `pnpm gen:bindings` from the repo root to regenerate.
26
+
27
+ The `package.json`, `tsconfig.json`, `tsup.config.ts`, and this README are scaffolded once and not overwritten on regen — you can hand-tune them.
package/dist/index.cjs ADDED
@@ -0,0 +1,227 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ PACK_AUTHOR: () => PACK_AUTHOR,
24
+ PACK_DESCRIPTION: () => PACK_DESCRIPTION,
25
+ PACK_LINK: () => PACK_LINK,
26
+ PACK_NAME: () => PACK_NAME,
27
+ PACK_VERSION: () => PACK_VERSION,
28
+ ParamsSchema: () => ParamsSchema,
29
+ RefinedParamsSchema: () => RefinedParamsSchema,
30
+ SecretsSchema: () => SecretsSchema,
31
+ WasmArgsSchema: () => WasmArgsSchema,
32
+ deployments: () => deployments,
33
+ vaultsfyi: () => vaultsfyi
34
+ });
35
+ module.exports = __toCommonJS(index_exports);
36
+
37
+ // src/deployments.ts
38
+ var deployments = {
39
+ "11155111": {
40
+ policy: "0x14685C1769Eb6f449FeC42A48d086746F470CE4a",
41
+ policyData: "0x5F8B0FC2c22c039f97D2c806B48307B9A9C288C8",
42
+ wasmCid: "bafybeig6oielnnf4zorcmqkets6v26ov7t2o6ikipx6vupuzsjrxvbpkpe",
43
+ policyCodeHash: "0x09be97b5636da7b6e231914f47e2bfbc32fddfd3647e771d7624cea8fa2bdc54",
44
+ deployedAt: "2026-06-09",
45
+ notes: "host-secrets fix; current"
46
+ }
47
+ };
48
+
49
+ // src/metadata.ts
50
+ var PACK_NAME = "vaultsfyi";
51
+ var PACK_VERSION = "0.0.1";
52
+ var PACK_DESCRIPTION = "Gates vault deposits based on real-time risk signals: APY anomalies, TVL drawdowns, risk score floors, and allocation changes";
53
+ var PACK_LINK = "https://vaults.fyi";
54
+ var PACK_AUTHOR = "";
55
+
56
+ // src/pack.ts
57
+ var import_viem = require("viem");
58
+ var import_zod4 = require("zod");
59
+
60
+ // src/params.ts
61
+ var import_zod = require("zod");
62
+ var ParamsSchema = import_zod.z.object({
63
+ apy_z_max: import_zod.z.number().describe(
64
+ "Max APY z-score (current vs 30d median). Exceeding this indicates an APY anomaly."
65
+ ),
66
+ tvl_drawdown_24h_max_pct: import_zod.z.number().describe("Max allowed 24h TVL drawdown percentage"),
67
+ tvl_drawdown_7d_max_pct: import_zod.z.number().describe("Max allowed 7d TVL drawdown percentage"),
68
+ risk_score_floor: import_zod.z.number().int().gte(0).lte(100).describe(
69
+ "Minimum acceptable risk score (0-100 integer scale; matches the AVS-side `vault.scores.netScore`). Set to 0 to effectively disable the floor."
70
+ ),
71
+ deny_on_allocation_change: import_zod.z.boolean().describe(
72
+ "Whether to deny if vault allocation/strategy metadata has changed since last evaluation"
73
+ ),
74
+ deny_on_critical_flag: import_zod.z.boolean().describe("Whether to deny if the vault has a flag with severity 'critical' or 'high'"),
75
+ deny_on_corrupted: import_zod.z.boolean().describe("Whether to deny if the vault is reported as corrupted by the data source")
76
+ }).describe("Risk envelope thresholds for vault deposit gating");
77
+
78
+ // src/prepare-query.ts
79
+ var NETWORK_BY_CHAIN_ID = {
80
+ 1: "mainnet",
81
+ 8453: "base",
82
+ 42161: "arbitrum",
83
+ 10: "optimism",
84
+ 11155111: "sepolia",
85
+ 84532: "base-sepolia"
86
+ };
87
+ function networkForChain(chainId) {
88
+ const name = NETWORK_BY_CHAIN_ID[chainId];
89
+ if (!name) {
90
+ throw new Error(
91
+ `policy-pack-vaultsfyi: chain id ${chainId} is not in the vaults.fyi network map. Add it to NETWORK_BY_CHAIN_ID before using this pack on this chain.`
92
+ );
93
+ }
94
+ return name;
95
+ }
96
+ async function prepareQuery({ publicClient, vault }, options = {}) {
97
+ const chainId = publicClient.chain?.id;
98
+ if (chainId === void 0) {
99
+ throw new Error(
100
+ "policy-pack-vaultsfyi: publicClient.chain is undefined. Pass a chain to viem's createPublicClient."
101
+ );
102
+ }
103
+ return {
104
+ wasmArgs: {
105
+ network: networkForChain(chainId),
106
+ vaultAddress: vault,
107
+ lastKnownAllocationHash: options.previousAllocationHash ?? null
108
+ }
109
+ };
110
+ }
111
+
112
+ // src/secrets.ts
113
+ var import_zod2 = require("zod");
114
+ var SecretsSchema = import_zod2.z.object({ VAULTS_FYI_API_KEY: import_zod2.z.string().min(1) }).strict();
115
+
116
+ // src/wasm-args.ts
117
+ var import_zod3 = require("zod");
118
+ var WasmArgsSchema = import_zod3.z.object({
119
+ network: import_zod3.z.string().describe(
120
+ "Blockchain network name as accepted by the vaults.fyi API (e.g. 'mainnet', 'base', 'arbitrum')."
121
+ ),
122
+ vaultAddress: import_zod3.z.string().describe("Vault contract address (0x-prefixed) to inspect."),
123
+ lastKnownAllocationHash: import_zod3.z.union([
124
+ import_zod3.z.string().describe(
125
+ "Hash of the previously observed allocation. Used to detect changes between evaluations. Null on the first evaluation."
126
+ ),
127
+ import_zod3.z.null().describe(
128
+ "Hash of the previously observed allocation. Used to detect changes between evaluations. Null on the first evaluation."
129
+ )
130
+ ]).describe(
131
+ "Hash of the previously observed allocation. Used to detect changes between evaluations. Null on the first evaluation."
132
+ ).optional()
133
+ }).describe("Inputs passed to the vaults.fyi allocation-change policy WASM at evaluation time");
134
+
135
+ // src/pack.ts
136
+ var BASIS_POINTS = 1e4;
137
+ function toBp(n) {
138
+ return BigInt(Math.round(n * BASIS_POINTS));
139
+ }
140
+ function fromBp(n) {
141
+ return Number(n) / BASIS_POINTS;
142
+ }
143
+ var isAtBasisPointPrecision = (n) => Math.abs(n * BASIS_POINTS - Math.round(n * BASIS_POINTS)) < Number.EPSILON;
144
+ var RefinedParamsSchema = ParamsSchema.superRefine(
145
+ (params, ctx) => {
146
+ const numericFields = [
147
+ "apy_z_max",
148
+ "tvl_drawdown_24h_max_pct",
149
+ "tvl_drawdown_7d_max_pct"
150
+ ];
151
+ for (const field of numericFields) {
152
+ const value = params[field];
153
+ if (!isAtBasisPointPrecision(value)) {
154
+ ctx.addIssue({
155
+ code: import_zod4.z.ZodIssueCode.custom,
156
+ path: [field],
157
+ message: `Sub-basis-point precision is not supported. \`${field}: ${value}\` would silently encode as ${Math.round(value * BASIS_POINTS) / BASIS_POINTS}. Round to 4 decimal places (1bp) before passing.`
158
+ });
159
+ }
160
+ }
161
+ }
162
+ );
163
+ var POLICY_PARAMS_ABI = [
164
+ {
165
+ type: "tuple",
166
+ components: [
167
+ { name: "apyZMax", type: "uint256" },
168
+ { name: "tvlDrawdown24hMaxPct", type: "uint256" },
169
+ { name: "tvlDrawdown7dMaxPct", type: "uint256" },
170
+ { name: "riskScoreFloor", type: "uint16" },
171
+ { name: "denyOnAllocationChange", type: "bool" },
172
+ { name: "denyOnCriticalFlag", type: "bool" },
173
+ { name: "denyOnCorrupted", type: "bool" }
174
+ ]
175
+ }
176
+ ];
177
+ function encodeRiskScore(n) {
178
+ if (!Number.isInteger(n) || n < 0 || n > 100) {
179
+ throw new RangeError(
180
+ `risk_score_floor must be an integer in [0, 100]; received ${n}. The AVS-side floor compares against \`vault.scores.netScore\` which is an integer 0-100.`
181
+ );
182
+ }
183
+ return n;
184
+ }
185
+ function encodeParams(params) {
186
+ return (0, import_viem.encodeAbiParameters)(POLICY_PARAMS_ABI, [
187
+ {
188
+ apyZMax: toBp(params.apy_z_max),
189
+ tvlDrawdown24hMaxPct: toBp(params.tvl_drawdown_24h_max_pct),
190
+ tvlDrawdown7dMaxPct: toBp(params.tvl_drawdown_7d_max_pct),
191
+ riskScoreFloor: encodeRiskScore(params.risk_score_floor),
192
+ denyOnAllocationChange: params.deny_on_allocation_change,
193
+ denyOnCriticalFlag: params.deny_on_critical_flag,
194
+ denyOnCorrupted: params.deny_on_corrupted
195
+ }
196
+ ]);
197
+ }
198
+ function decodeParams(encoded) {
199
+ const [decoded] = (0, import_viem.decodeAbiParameters)(POLICY_PARAMS_ABI, encoded);
200
+ return ParamsSchema.parse({
201
+ apy_z_max: fromBp(decoded.apyZMax),
202
+ tvl_drawdown_24h_max_pct: fromBp(decoded.tvlDrawdown24hMaxPct),
203
+ tvl_drawdown_7d_max_pct: fromBp(decoded.tvlDrawdown7dMaxPct),
204
+ risk_score_floor: decoded.riskScoreFloor,
205
+ deny_on_allocation_change: decoded.denyOnAllocationChange,
206
+ deny_on_critical_flag: decoded.denyOnCriticalFlag,
207
+ deny_on_corrupted: decoded.denyOnCorrupted
208
+ });
209
+ }
210
+ var vaultsfyi = {
211
+ id: `${PACK_NAME}/risk-envelope/v1`,
212
+ paramsSchema: RefinedParamsSchema,
213
+ wasmArgsSchema: WasmArgsSchema,
214
+ secretsSchema: SecretsSchema,
215
+ encodeParams,
216
+ decodeParams,
217
+ prepareQuery,
218
+ deployments,
219
+ metadata: {
220
+ name: PACK_NAME,
221
+ version: PACK_VERSION,
222
+ description: PACK_DESCRIPTION,
223
+ author: PACK_AUTHOR || void 0,
224
+ link: PACK_LINK || void 0
225
+ }
226
+ };
227
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/deployments.ts","../src/metadata.ts","../src/pack.ts","../src/params.ts","../src/prepare-query.ts","../src/secrets.ts","../src/wasm-args.ts"],"sourcesContent":["// AUTO-GENERATED by scripts/generate-bindings.ts — DO NOT EDIT.\n// Source: AVS-side artifacts in this repo (run `pnpm gen:bindings` to regenerate).\n\nexport * from \"./deployments\";\nexport * from \"./metadata\";\nexport * from \"./pack\";\nexport * from \"./params\";\nexport * from \"./secrets\";\nexport * from \"./wasm-args\";\n","// AUTO-GENERATED by scripts/generate-bindings.ts — DO NOT EDIT.\n// Source: AVS-side artifacts in this repo (run `pnpm gen:bindings` to regenerate).\nimport type { ChainId, Deployment } from \"@newton-xyz/policy-pack-shared\";\n\nexport const deployments = {\n\t\"11155111\": {\n\t\tpolicy: \"0x14685C1769Eb6f449FeC42A48d086746F470CE4a\",\n\t\tpolicyData: \"0x5F8B0FC2c22c039f97D2c806B48307B9A9C288C8\",\n\t\twasmCid: \"bafybeig6oielnnf4zorcmqkets6v26ov7t2o6ikipx6vupuzsjrxvbpkpe\",\n\t\tpolicyCodeHash: \"0x09be97b5636da7b6e231914f47e2bfbc32fddfd3647e771d7624cea8fa2bdc54\",\n\t\tdeployedAt: \"2026-06-09\",\n\t\tnotes: \"host-secrets fix; current\",\n\t},\n} as const satisfies Readonly<Partial<Record<ChainId, Deployment>>>;\n","// AUTO-GENERATED by scripts/generate-bindings.ts — DO NOT EDIT.\n// Source: AVS-side artifacts in this repo (run `pnpm gen:bindings` to regenerate).\nexport const PACK_NAME = \"vaultsfyi\" as const;\nexport const PACK_VERSION = \"0.0.1\" as const;\nexport const PACK_DESCRIPTION =\n\t\"Gates vault deposits based on real-time risk signals: APY anomalies, TVL drawdowns, risk score floors, and allocation changes\" as const;\nexport const PACK_LINK = \"https://vaults.fyi\" as const;\nexport const PACK_AUTHOR = \"\" as const;\n","// Hand-written canonical export — survives `pnpm gen:bindings` regen.\n// The generated `index.ts` re-exports `pack.ts` when present.\nimport type { PolicyPack } from \"@newton-xyz/policy-pack-shared\";\nimport { decodeAbiParameters, encodeAbiParameters, type Hex } from \"viem\";\nimport { z } from \"zod\";\nimport { deployments } from \"./deployments\";\nimport { PACK_AUTHOR, PACK_DESCRIPTION, PACK_LINK, PACK_NAME, PACK_VERSION } from \"./metadata\";\nimport { type Params, ParamsSchema } from \"./params\";\nimport { prepareQuery } from \"./prepare-query\";\nimport { type Secrets, SecretsSchema } from \"./secrets\";\nimport { type WasmArgs, WasmArgsSchema } from \"./wasm-args\";\n\n/**\n * The fractional thresholds (`apy_z_max`, `tvl_drawdown_*_max_pct`) are stored\n * in basis points so the on-chain bytes carry only `uint256`. `apy_z_max: 1.5`\n * becomes `15000` (1.5e4 bp); `tvl_drawdown_24h_max_pct: 0.05` becomes `500`.\n * `risk_score_floor` is *not* basis-point-encoded — it's a 0-100 integer scale\n * that matches the AVS-side `vault.scores.netScore` field directly, so it\n * round-trips through `uint16` as-is.\n */\nconst BASIS_POINTS = 10_000;\n\nfunction toBp(n: number): bigint {\n\treturn BigInt(Math.round(n * BASIS_POINTS));\n}\n\nfunction fromBp(n: bigint): number {\n\treturn Number(n) / BASIS_POINTS;\n}\n\n/**\n * Refined params schema with sub-basis-point precision rejection on every\n * fractional threshold so a curator typing `tvl_drawdown_24h_max_pct: 0.00005`\n * can't silently encode as `0n` and disable the cap. The generated\n * `ParamsSchema` from `./params` is the canonical zod derived from\n * `params_schema.json`; this version sits on top of it for stricter SDK-side\n * input validation. `risk_score_floor` is excluded — it's an integer 0-100\n * scale, not a basis-point fraction. Exported with a distinct name to avoid\n * clashing with the generated star re-export in `index.ts`.\n */\nconst isAtBasisPointPrecision = (n: number) =>\n\tMath.abs(n * BASIS_POINTS - Math.round(n * BASIS_POINTS)) < Number.EPSILON;\n\nexport const RefinedParamsSchema = (ParamsSchema as unknown as z.ZodType<Params>).superRefine(\n\t(params, ctx) => {\n\t\tconst numericFields: ReadonlyArray<keyof Params> = [\n\t\t\t\"apy_z_max\",\n\t\t\t\"tvl_drawdown_24h_max_pct\",\n\t\t\t\"tvl_drawdown_7d_max_pct\",\n\t\t];\n\t\tfor (const field of numericFields) {\n\t\t\tconst value = params[field] as number;\n\t\t\tif (!isAtBasisPointPrecision(value)) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: z.ZodIssueCode.custom,\n\t\t\t\t\tpath: [field],\n\t\t\t\t\tmessage: `Sub-basis-point precision is not supported. \\`${field}: ${value}\\` would silently encode as ${\n\t\t\t\t\t\tMath.round(value * BASIS_POINTS) / BASIS_POINTS\n\t\t\t\t\t}. Round to 4 decimal places (1bp) before passing.`,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t},\n);\n\n/**\n * On-chain layout of `policyParams` for the vaults.fyi risk-envelope policy.\n *\n * This is the ABI tuple that round-trips through `NewtonPolicyData.policyParams`.\n * Keys are sorted to match `ParamsSchema`'s key order so generated zod and\n * encoded bytes stay in sync. If the schema adds a field, add it here in the\n * same position and bump the policy contract.\n */\nconst POLICY_PARAMS_ABI = [\n\t{\n\t\ttype: \"tuple\",\n\t\tcomponents: [\n\t\t\t{ name: \"apyZMax\", type: \"uint256\" },\n\t\t\t{ name: \"tvlDrawdown24hMaxPct\", type: \"uint256\" },\n\t\t\t{ name: \"tvlDrawdown7dMaxPct\", type: \"uint256\" },\n\t\t\t{ name: \"riskScoreFloor\", type: \"uint16\" },\n\t\t\t{ name: \"denyOnAllocationChange\", type: \"bool\" },\n\t\t\t{ name: \"denyOnCriticalFlag\", type: \"bool\" },\n\t\t\t{ name: \"denyOnCorrupted\", type: \"bool\" },\n\t\t],\n\t},\n] as const;\n\nfunction encodeRiskScore(n: number): number {\n\tif (!Number.isInteger(n) || n < 0 || n > 100) {\n\t\tthrow new RangeError(\n\t\t\t`risk_score_floor must be an integer in [0, 100]; received ${n}. The AVS-side floor compares against \\`vault.scores.netScore\\` which is an integer 0-100.`,\n\t\t);\n\t}\n\treturn n;\n}\n\nfunction encodeParams(params: Params): Hex {\n\treturn encodeAbiParameters(POLICY_PARAMS_ABI, [\n\t\t{\n\t\t\tapyZMax: toBp(params.apy_z_max),\n\t\t\ttvlDrawdown24hMaxPct: toBp(params.tvl_drawdown_24h_max_pct),\n\t\t\ttvlDrawdown7dMaxPct: toBp(params.tvl_drawdown_7d_max_pct),\n\t\t\triskScoreFloor: encodeRiskScore(params.risk_score_floor),\n\t\t\tdenyOnAllocationChange: params.deny_on_allocation_change,\n\t\t\tdenyOnCriticalFlag: params.deny_on_critical_flag,\n\t\t\tdenyOnCorrupted: params.deny_on_corrupted,\n\t\t},\n\t]);\n}\n\nfunction decodeParams(encoded: Hex): Params {\n\tconst [decoded] = decodeAbiParameters(POLICY_PARAMS_ABI, encoded);\n\treturn ParamsSchema.parse({\n\t\tapy_z_max: fromBp(decoded.apyZMax),\n\t\ttvl_drawdown_24h_max_pct: fromBp(decoded.tvlDrawdown24hMaxPct),\n\t\ttvl_drawdown_7d_max_pct: fromBp(decoded.tvlDrawdown7dMaxPct),\n\t\trisk_score_floor: decoded.riskScoreFloor,\n\t\tdeny_on_allocation_change: decoded.denyOnAllocationChange,\n\t\tdeny_on_critical_flag: decoded.denyOnCriticalFlag,\n\t\tdeny_on_corrupted: decoded.denyOnCorrupted,\n\t});\n}\n\n/**\n * The vaults.fyi risk-envelope `PolicyPack`.\n *\n * Pass to `createShield(...)` from `@newton-xyz/newton-shield-sdk`:\n *\n * ```ts\n * import { vaultsfyi } from \"@newton-xyz/policy-pack-vaultsfyi\";\n *\n * const shield = await createShield({\n * walletClient,\n * vault,\n * pack: vaultsfyi,\n * params: {\n * apy_z_max: 3,\n * tvl_drawdown_24h_max_pct: 0.05,\n * tvl_drawdown_7d_max_pct: 0.20,\n * risk_score_floor: 85, // 0-100 integer; matches AVS `vault.scores.netScore`\n * deny_on_allocation_change: true,\n * deny_on_critical_flag: true,\n * deny_on_corrupted: true,\n * },\n * });\n * ```\n */\nexport const vaultsfyi: PolicyPack<Params, WasmArgs, Secrets> = {\n\tid: `${PACK_NAME}/risk-envelope/v1`,\n\tparamsSchema: RefinedParamsSchema,\n\twasmArgsSchema: WasmArgsSchema,\n\tsecretsSchema: SecretsSchema,\n\tencodeParams,\n\tdecodeParams,\n\tprepareQuery,\n\tdeployments,\n\tmetadata: {\n\t\tname: PACK_NAME,\n\t\tversion: PACK_VERSION,\n\t\tdescription: PACK_DESCRIPTION,\n\t\tauthor: PACK_AUTHOR || undefined,\n\t\tlink: PACK_LINK || undefined,\n\t},\n};\n","// AUTO-GENERATED by scripts/generate-bindings.ts — DO NOT EDIT.\n// Source: AVS-side artifacts in this repo (run `pnpm gen:bindings` to regenerate).\n// Source schema: vaultsfyi/params_schema.json\nimport { z } from \"zod\";\n\nexport const ParamsSchema = z\n\t.object({\n\t\tapy_z_max: z\n\t\t\t.number()\n\t\t\t.describe(\n\t\t\t\t\"Max APY z-score (current vs 30d median). Exceeding this indicates an APY anomaly.\",\n\t\t\t),\n\t\ttvl_drawdown_24h_max_pct: z.number().describe(\"Max allowed 24h TVL drawdown percentage\"),\n\t\ttvl_drawdown_7d_max_pct: z.number().describe(\"Max allowed 7d TVL drawdown percentage\"),\n\t\trisk_score_floor: z\n\t\t\t.number()\n\t\t\t.int()\n\t\t\t.gte(0)\n\t\t\t.lte(100)\n\t\t\t.describe(\n\t\t\t\t\"Minimum acceptable risk score (0-100 integer scale; matches the AVS-side `vault.scores.netScore`). Set to 0 to effectively disable the floor.\",\n\t\t\t),\n\t\tdeny_on_allocation_change: z\n\t\t\t.boolean()\n\t\t\t.describe(\n\t\t\t\t\"Whether to deny if vault allocation/strategy metadata has changed since last evaluation\",\n\t\t\t),\n\t\tdeny_on_critical_flag: z\n\t\t\t.boolean()\n\t\t\t.describe(\"Whether to deny if the vault has a flag with severity 'critical' or 'high'\"),\n\t\tdeny_on_corrupted: z\n\t\t\t.boolean()\n\t\t\t.describe(\"Whether to deny if the vault is reported as corrupted by the data source\"),\n\t})\n\t.describe(\"Risk envelope thresholds for vault deposit gating\");\n\nexport type Params = z.infer<typeof ParamsSchema>;\n","import type { PrepareQueryArgs, PrepareQueryResult } from \"@newton-xyz/policy-pack-shared\";\nimport type { WasmArgs } from \"./wasm-args\";\n\n/**\n * vaults.fyi network slugs. Keyed by viem chain id. The AVS-side `policy.js`\n * fetches `https://api.vaults.fyi/v2/historical/<network>/<vaultAddress>`\n * with this slug, so the SDK has to use the same map.\n */\nconst NETWORK_BY_CHAIN_ID: Readonly<Record<number, string>> = {\n\t1: \"mainnet\",\n\t8453: \"base\",\n\t42161: \"arbitrum\",\n\t10: \"optimism\",\n\t11155111: \"sepolia\",\n\t84532: \"base-sepolia\",\n};\n\nfunction networkForChain(chainId: number): string {\n\tconst name = NETWORK_BY_CHAIN_ID[chainId];\n\tif (!name) {\n\t\tthrow new Error(\n\t\t\t`policy-pack-vaultsfyi: chain id ${chainId} is not in the vaults.fyi network map. Add it to NETWORK_BY_CHAIN_ID before using this pack on this chain.`,\n\t\t);\n\t}\n\treturn name;\n}\n\n/**\n * Build the WASM args the vaults.fyi policy expects.\n *\n * The AVS-side `policy.js` computes the canonical allocation hash itself\n * (FNV-1a over `JSON.stringify({ protocol?.name, tags, fees, childrenVaults })`\n * fetched from the vaults.fyi API). The SDK has nothing to add — the AVS is\n * the source of truth for both the data and the hash. The SDK's only job is\n * to thread the *previous* hash through so the AVS can compare:\n *\n * - First call: pass `previousAllocationHash: undefined` (defaults to\n * `null` in wasmArgs). The AVS-side `allocation_changed_since_last`\n * branch returns `false`, so `deny_on_allocation_change` doesn't fire\n * on a clean first observation.\n * - Subsequent calls: pass the hash the AVS returned on the prior call\n * (typically read from `policyData` storage or a curator-side cache).\n * The AVS compares against its freshly-computed hash and flips\n * `allocation_changed_since_last` if they diverge.\n *\n * Earlier revisions of this function read MetaMorpho's `supplyQueue` and\n * computed `keccak256(abi.encode(bytes32[]))` — that hash never matched the\n * AVS's FNV-1a-over-API-metadata, so `deny_on_allocation_change: true` was\n * effectively a coin flip. Removed.\n */\nexport async function prepareQuery(\n\t{ publicClient, vault }: PrepareQueryArgs,\n\toptions: { previousAllocationHash?: string } = {},\n): Promise<PrepareQueryResult<WasmArgs>> {\n\tconst chainId = publicClient.chain?.id;\n\tif (chainId === undefined) {\n\t\tthrow new Error(\n\t\t\t\"policy-pack-vaultsfyi: publicClient.chain is undefined. Pass a chain to viem's createPublicClient.\",\n\t\t);\n\t}\n\n\treturn {\n\t\twasmArgs: {\n\t\t\tnetwork: networkForChain(chainId),\n\t\t\tvaultAddress: vault,\n\t\t\tlastKnownAllocationHash: options.previousAllocationHash ?? null,\n\t\t},\n\t};\n}\n","// AUTO-GENERATED by scripts/generate-bindings.ts — DO NOT EDIT.\n// Source: AVS-side artifacts in this repo (run `pnpm gen:bindings` to regenerate).\n// Source schema: vaultsfyi/secrets_schema.json\nimport { z } from \"zod\";\n\nexport const SecretsSchema = z.object({ VAULTS_FYI_API_KEY: z.string().min(1) }).strict();\n\nexport type Secrets = z.infer<typeof SecretsSchema>;\n","// AUTO-GENERATED by scripts/generate-bindings.ts — DO NOT EDIT.\n// Source: AVS-side artifacts in this repo (run `pnpm gen:bindings` to regenerate).\n// Source schema: vaultsfyi/wasm_args_schema.json\nimport { z } from \"zod\";\n\nexport const WasmArgsSchema = z\n\t.object({\n\t\tnetwork: z\n\t\t\t.string()\n\t\t\t.describe(\n\t\t\t\t\"Blockchain network name as accepted by the vaults.fyi API (e.g. 'mainnet', 'base', 'arbitrum').\",\n\t\t\t),\n\t\tvaultAddress: z.string().describe(\"Vault contract address (0x-prefixed) to inspect.\"),\n\t\tlastKnownAllocationHash: z\n\t\t\t.union([\n\t\t\t\tz\n\t\t\t\t\t.string()\n\t\t\t\t\t.describe(\n\t\t\t\t\t\t\"Hash of the previously observed allocation. Used to detect changes between evaluations. Null on the first evaluation.\",\n\t\t\t\t\t),\n\t\t\t\tz\n\t\t\t\t\t.null()\n\t\t\t\t\t.describe(\n\t\t\t\t\t\t\"Hash of the previously observed allocation. Used to detect changes between evaluations. Null on the first evaluation.\",\n\t\t\t\t\t),\n\t\t\t])\n\t\t\t.describe(\n\t\t\t\t\"Hash of the previously observed allocation. Used to detect changes between evaluations. Null on the first evaluation.\",\n\t\t\t)\n\t\t\t.optional(),\n\t})\n\t.describe(\"Inputs passed to the vaults.fyi allocation-change policy WASM at evaluation time\");\n\nexport type WasmArgs = z.infer<typeof WasmArgsSchema>;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACIO,IAAM,cAAc;AAAA,EAC1B,YAAY;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AA,IAC7D,yBAAyB,OAAO,QAAQ,mBAAmB;AAAA,IAC3D,kBAAkB,QAAQ;AAAA,IAC1B,2BAA2B,QAAQ;AAAA,IACnC,uBAAuB,QAAQ;AAAA,IAC/B,mBAAmB,QAAQ;AAAA,EAC5B,CAAC;AACF;AA0BO,IAAM,YAAmD;AAAA,EAC/D,IAAI,GAAG,SAAS;AAAA,EAChB,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,IACT,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,IACb,QAAQ,eAAe;AAAA,IACvB,MAAM,aAAa;AAAA,EACpB;AACD;","names":["import_zod","import_zod","import_zod"]}
@@ -0,0 +1,131 @@
1
+ import { PolicyPack } from '@newton-xyz/policy-pack-shared';
2
+ import { z } from 'zod';
3
+
4
+ declare const deployments: {
5
+ readonly "11155111": {
6
+ readonly policy: "0x14685C1769Eb6f449FeC42A48d086746F470CE4a";
7
+ readonly policyData: "0x5F8B0FC2c22c039f97D2c806B48307B9A9C288C8";
8
+ readonly wasmCid: "bafybeig6oielnnf4zorcmqkets6v26ov7t2o6ikipx6vupuzsjrxvbpkpe";
9
+ readonly policyCodeHash: "0x09be97b5636da7b6e231914f47e2bfbc32fddfd3647e771d7624cea8fa2bdc54";
10
+ readonly deployedAt: "2026-06-09";
11
+ readonly notes: "host-secrets fix; current";
12
+ };
13
+ };
14
+
15
+ declare const PACK_NAME: "vaultsfyi";
16
+ declare const PACK_VERSION: "0.0.1";
17
+ declare const PACK_DESCRIPTION: "Gates vault deposits based on real-time risk signals: APY anomalies, TVL drawdowns, risk score floors, and allocation changes";
18
+ declare const PACK_LINK: "https://vaults.fyi";
19
+ declare const PACK_AUTHOR: "";
20
+
21
+ declare const ParamsSchema: z.ZodObject<{
22
+ apy_z_max: z.ZodNumber;
23
+ tvl_drawdown_24h_max_pct: z.ZodNumber;
24
+ tvl_drawdown_7d_max_pct: z.ZodNumber;
25
+ risk_score_floor: z.ZodNumber;
26
+ deny_on_allocation_change: z.ZodBoolean;
27
+ deny_on_critical_flag: z.ZodBoolean;
28
+ deny_on_corrupted: z.ZodBoolean;
29
+ }, "strip", z.ZodTypeAny, {
30
+ apy_z_max: number;
31
+ tvl_drawdown_24h_max_pct: number;
32
+ tvl_drawdown_7d_max_pct: number;
33
+ risk_score_floor: number;
34
+ deny_on_allocation_change: boolean;
35
+ deny_on_critical_flag: boolean;
36
+ deny_on_corrupted: boolean;
37
+ }, {
38
+ apy_z_max: number;
39
+ tvl_drawdown_24h_max_pct: number;
40
+ tvl_drawdown_7d_max_pct: number;
41
+ risk_score_floor: number;
42
+ deny_on_allocation_change: boolean;
43
+ deny_on_critical_flag: boolean;
44
+ deny_on_corrupted: boolean;
45
+ }>;
46
+ type Params = z.infer<typeof ParamsSchema>;
47
+
48
+ declare const SecretsSchema: z.ZodObject<{
49
+ VAULTS_FYI_API_KEY: z.ZodString;
50
+ }, "strict", z.ZodTypeAny, {
51
+ VAULTS_FYI_API_KEY: string;
52
+ }, {
53
+ VAULTS_FYI_API_KEY: string;
54
+ }>;
55
+ type Secrets = z.infer<typeof SecretsSchema>;
56
+
57
+ declare const WasmArgsSchema: z.ZodObject<{
58
+ network: z.ZodString;
59
+ vaultAddress: z.ZodString;
60
+ lastKnownAllocationHash: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
61
+ }, "strip", z.ZodTypeAny, {
62
+ network: string;
63
+ vaultAddress: string;
64
+ lastKnownAllocationHash?: string | null | undefined;
65
+ }, {
66
+ network: string;
67
+ vaultAddress: string;
68
+ lastKnownAllocationHash?: string | null | undefined;
69
+ }>;
70
+ type WasmArgs = z.infer<typeof WasmArgsSchema>;
71
+
72
+ declare const RefinedParamsSchema: z.ZodEffects<z.ZodType<{
73
+ apy_z_max: number;
74
+ tvl_drawdown_24h_max_pct: number;
75
+ tvl_drawdown_7d_max_pct: number;
76
+ risk_score_floor: number;
77
+ deny_on_allocation_change: boolean;
78
+ deny_on_critical_flag: boolean;
79
+ deny_on_corrupted: boolean;
80
+ }, z.ZodTypeDef, {
81
+ apy_z_max: number;
82
+ tvl_drawdown_24h_max_pct: number;
83
+ tvl_drawdown_7d_max_pct: number;
84
+ risk_score_floor: number;
85
+ deny_on_allocation_change: boolean;
86
+ deny_on_critical_flag: boolean;
87
+ deny_on_corrupted: boolean;
88
+ }>, {
89
+ apy_z_max: number;
90
+ tvl_drawdown_24h_max_pct: number;
91
+ tvl_drawdown_7d_max_pct: number;
92
+ risk_score_floor: number;
93
+ deny_on_allocation_change: boolean;
94
+ deny_on_critical_flag: boolean;
95
+ deny_on_corrupted: boolean;
96
+ }, {
97
+ apy_z_max: number;
98
+ tvl_drawdown_24h_max_pct: number;
99
+ tvl_drawdown_7d_max_pct: number;
100
+ risk_score_floor: number;
101
+ deny_on_allocation_change: boolean;
102
+ deny_on_critical_flag: boolean;
103
+ deny_on_corrupted: boolean;
104
+ }>;
105
+ /**
106
+ * The vaults.fyi risk-envelope `PolicyPack`.
107
+ *
108
+ * Pass to `createShield(...)` from `@newton-xyz/newton-shield-sdk`:
109
+ *
110
+ * ```ts
111
+ * import { vaultsfyi } from "@newton-xyz/policy-pack-vaultsfyi";
112
+ *
113
+ * const shield = await createShield({
114
+ * walletClient,
115
+ * vault,
116
+ * pack: vaultsfyi,
117
+ * params: {
118
+ * apy_z_max: 3,
119
+ * tvl_drawdown_24h_max_pct: 0.05,
120
+ * tvl_drawdown_7d_max_pct: 0.20,
121
+ * risk_score_floor: 85, // 0-100 integer; matches AVS `vault.scores.netScore`
122
+ * deny_on_allocation_change: true,
123
+ * deny_on_critical_flag: true,
124
+ * deny_on_corrupted: true,
125
+ * },
126
+ * });
127
+ * ```
128
+ */
129
+ declare const vaultsfyi: PolicyPack<Params, WasmArgs, Secrets>;
130
+
131
+ export { PACK_AUTHOR, PACK_DESCRIPTION, PACK_LINK, PACK_NAME, PACK_VERSION, type Params, ParamsSchema, RefinedParamsSchema, type Secrets, SecretsSchema, type WasmArgs, WasmArgsSchema, deployments, vaultsfyi };
@@ -0,0 +1,131 @@
1
+ import { PolicyPack } from '@newton-xyz/policy-pack-shared';
2
+ import { z } from 'zod';
3
+
4
+ declare const deployments: {
5
+ readonly "11155111": {
6
+ readonly policy: "0x14685C1769Eb6f449FeC42A48d086746F470CE4a";
7
+ readonly policyData: "0x5F8B0FC2c22c039f97D2c806B48307B9A9C288C8";
8
+ readonly wasmCid: "bafybeig6oielnnf4zorcmqkets6v26ov7t2o6ikipx6vupuzsjrxvbpkpe";
9
+ readonly policyCodeHash: "0x09be97b5636da7b6e231914f47e2bfbc32fddfd3647e771d7624cea8fa2bdc54";
10
+ readonly deployedAt: "2026-06-09";
11
+ readonly notes: "host-secrets fix; current";
12
+ };
13
+ };
14
+
15
+ declare const PACK_NAME: "vaultsfyi";
16
+ declare const PACK_VERSION: "0.0.1";
17
+ declare const PACK_DESCRIPTION: "Gates vault deposits based on real-time risk signals: APY anomalies, TVL drawdowns, risk score floors, and allocation changes";
18
+ declare const PACK_LINK: "https://vaults.fyi";
19
+ declare const PACK_AUTHOR: "";
20
+
21
+ declare const ParamsSchema: z.ZodObject<{
22
+ apy_z_max: z.ZodNumber;
23
+ tvl_drawdown_24h_max_pct: z.ZodNumber;
24
+ tvl_drawdown_7d_max_pct: z.ZodNumber;
25
+ risk_score_floor: z.ZodNumber;
26
+ deny_on_allocation_change: z.ZodBoolean;
27
+ deny_on_critical_flag: z.ZodBoolean;
28
+ deny_on_corrupted: z.ZodBoolean;
29
+ }, "strip", z.ZodTypeAny, {
30
+ apy_z_max: number;
31
+ tvl_drawdown_24h_max_pct: number;
32
+ tvl_drawdown_7d_max_pct: number;
33
+ risk_score_floor: number;
34
+ deny_on_allocation_change: boolean;
35
+ deny_on_critical_flag: boolean;
36
+ deny_on_corrupted: boolean;
37
+ }, {
38
+ apy_z_max: number;
39
+ tvl_drawdown_24h_max_pct: number;
40
+ tvl_drawdown_7d_max_pct: number;
41
+ risk_score_floor: number;
42
+ deny_on_allocation_change: boolean;
43
+ deny_on_critical_flag: boolean;
44
+ deny_on_corrupted: boolean;
45
+ }>;
46
+ type Params = z.infer<typeof ParamsSchema>;
47
+
48
+ declare const SecretsSchema: z.ZodObject<{
49
+ VAULTS_FYI_API_KEY: z.ZodString;
50
+ }, "strict", z.ZodTypeAny, {
51
+ VAULTS_FYI_API_KEY: string;
52
+ }, {
53
+ VAULTS_FYI_API_KEY: string;
54
+ }>;
55
+ type Secrets = z.infer<typeof SecretsSchema>;
56
+
57
+ declare const WasmArgsSchema: z.ZodObject<{
58
+ network: z.ZodString;
59
+ vaultAddress: z.ZodString;
60
+ lastKnownAllocationHash: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNull]>>;
61
+ }, "strip", z.ZodTypeAny, {
62
+ network: string;
63
+ vaultAddress: string;
64
+ lastKnownAllocationHash?: string | null | undefined;
65
+ }, {
66
+ network: string;
67
+ vaultAddress: string;
68
+ lastKnownAllocationHash?: string | null | undefined;
69
+ }>;
70
+ type WasmArgs = z.infer<typeof WasmArgsSchema>;
71
+
72
+ declare const RefinedParamsSchema: z.ZodEffects<z.ZodType<{
73
+ apy_z_max: number;
74
+ tvl_drawdown_24h_max_pct: number;
75
+ tvl_drawdown_7d_max_pct: number;
76
+ risk_score_floor: number;
77
+ deny_on_allocation_change: boolean;
78
+ deny_on_critical_flag: boolean;
79
+ deny_on_corrupted: boolean;
80
+ }, z.ZodTypeDef, {
81
+ apy_z_max: number;
82
+ tvl_drawdown_24h_max_pct: number;
83
+ tvl_drawdown_7d_max_pct: number;
84
+ risk_score_floor: number;
85
+ deny_on_allocation_change: boolean;
86
+ deny_on_critical_flag: boolean;
87
+ deny_on_corrupted: boolean;
88
+ }>, {
89
+ apy_z_max: number;
90
+ tvl_drawdown_24h_max_pct: number;
91
+ tvl_drawdown_7d_max_pct: number;
92
+ risk_score_floor: number;
93
+ deny_on_allocation_change: boolean;
94
+ deny_on_critical_flag: boolean;
95
+ deny_on_corrupted: boolean;
96
+ }, {
97
+ apy_z_max: number;
98
+ tvl_drawdown_24h_max_pct: number;
99
+ tvl_drawdown_7d_max_pct: number;
100
+ risk_score_floor: number;
101
+ deny_on_allocation_change: boolean;
102
+ deny_on_critical_flag: boolean;
103
+ deny_on_corrupted: boolean;
104
+ }>;
105
+ /**
106
+ * The vaults.fyi risk-envelope `PolicyPack`.
107
+ *
108
+ * Pass to `createShield(...)` from `@newton-xyz/newton-shield-sdk`:
109
+ *
110
+ * ```ts
111
+ * import { vaultsfyi } from "@newton-xyz/policy-pack-vaultsfyi";
112
+ *
113
+ * const shield = await createShield({
114
+ * walletClient,
115
+ * vault,
116
+ * pack: vaultsfyi,
117
+ * params: {
118
+ * apy_z_max: 3,
119
+ * tvl_drawdown_24h_max_pct: 0.05,
120
+ * tvl_drawdown_7d_max_pct: 0.20,
121
+ * risk_score_floor: 85, // 0-100 integer; matches AVS `vault.scores.netScore`
122
+ * deny_on_allocation_change: true,
123
+ * deny_on_critical_flag: true,
124
+ * deny_on_corrupted: true,
125
+ * },
126
+ * });
127
+ * ```
128
+ */
129
+ declare const vaultsfyi: PolicyPack<Params, WasmArgs, Secrets>;
130
+
131
+ export { PACK_AUTHOR, PACK_DESCRIPTION, PACK_LINK, PACK_NAME, PACK_VERSION, type Params, ParamsSchema, RefinedParamsSchema, type Secrets, SecretsSchema, type WasmArgs, WasmArgsSchema, deployments, vaultsfyi };
package/dist/index.js ADDED
@@ -0,0 +1,204 @@
1
+ // src/deployments.ts
2
+ var deployments = {
3
+ "11155111": {
4
+ policy: "0x14685C1769Eb6f449FeC42A48d086746F470CE4a",
5
+ policyData: "0x5F8B0FC2c22c039f97D2c806B48307B9A9C288C8",
6
+ wasmCid: "bafybeig6oielnnf4zorcmqkets6v26ov7t2o6ikipx6vupuzsjrxvbpkpe",
7
+ policyCodeHash: "0x09be97b5636da7b6e231914f47e2bfbc32fddfd3647e771d7624cea8fa2bdc54",
8
+ deployedAt: "2026-06-09",
9
+ notes: "host-secrets fix; current"
10
+ }
11
+ };
12
+
13
+ // src/metadata.ts
14
+ var PACK_NAME = "vaultsfyi";
15
+ var PACK_VERSION = "0.0.1";
16
+ var PACK_DESCRIPTION = "Gates vault deposits based on real-time risk signals: APY anomalies, TVL drawdowns, risk score floors, and allocation changes";
17
+ var PACK_LINK = "https://vaults.fyi";
18
+ var PACK_AUTHOR = "";
19
+
20
+ // src/pack.ts
21
+ import { decodeAbiParameters, encodeAbiParameters } from "viem";
22
+ import { z as z4 } from "zod";
23
+
24
+ // src/params.ts
25
+ import { z } from "zod";
26
+ var ParamsSchema = z.object({
27
+ apy_z_max: z.number().describe(
28
+ "Max APY z-score (current vs 30d median). Exceeding this indicates an APY anomaly."
29
+ ),
30
+ tvl_drawdown_24h_max_pct: z.number().describe("Max allowed 24h TVL drawdown percentage"),
31
+ tvl_drawdown_7d_max_pct: z.number().describe("Max allowed 7d TVL drawdown percentage"),
32
+ risk_score_floor: z.number().int().gte(0).lte(100).describe(
33
+ "Minimum acceptable risk score (0-100 integer scale; matches the AVS-side `vault.scores.netScore`). Set to 0 to effectively disable the floor."
34
+ ),
35
+ deny_on_allocation_change: z.boolean().describe(
36
+ "Whether to deny if vault allocation/strategy metadata has changed since last evaluation"
37
+ ),
38
+ deny_on_critical_flag: z.boolean().describe("Whether to deny if the vault has a flag with severity 'critical' or 'high'"),
39
+ deny_on_corrupted: z.boolean().describe("Whether to deny if the vault is reported as corrupted by the data source")
40
+ }).describe("Risk envelope thresholds for vault deposit gating");
41
+
42
+ // src/prepare-query.ts
43
+ var NETWORK_BY_CHAIN_ID = {
44
+ 1: "mainnet",
45
+ 8453: "base",
46
+ 42161: "arbitrum",
47
+ 10: "optimism",
48
+ 11155111: "sepolia",
49
+ 84532: "base-sepolia"
50
+ };
51
+ function networkForChain(chainId) {
52
+ const name = NETWORK_BY_CHAIN_ID[chainId];
53
+ if (!name) {
54
+ throw new Error(
55
+ `policy-pack-vaultsfyi: chain id ${chainId} is not in the vaults.fyi network map. Add it to NETWORK_BY_CHAIN_ID before using this pack on this chain.`
56
+ );
57
+ }
58
+ return name;
59
+ }
60
+ async function prepareQuery({ publicClient, vault }, options = {}) {
61
+ const chainId = publicClient.chain?.id;
62
+ if (chainId === void 0) {
63
+ throw new Error(
64
+ "policy-pack-vaultsfyi: publicClient.chain is undefined. Pass a chain to viem's createPublicClient."
65
+ );
66
+ }
67
+ return {
68
+ wasmArgs: {
69
+ network: networkForChain(chainId),
70
+ vaultAddress: vault,
71
+ lastKnownAllocationHash: options.previousAllocationHash ?? null
72
+ }
73
+ };
74
+ }
75
+
76
+ // src/secrets.ts
77
+ import { z as z2 } from "zod";
78
+ var SecretsSchema = z2.object({ VAULTS_FYI_API_KEY: z2.string().min(1) }).strict();
79
+
80
+ // src/wasm-args.ts
81
+ import { z as z3 } from "zod";
82
+ var WasmArgsSchema = z3.object({
83
+ network: z3.string().describe(
84
+ "Blockchain network name as accepted by the vaults.fyi API (e.g. 'mainnet', 'base', 'arbitrum')."
85
+ ),
86
+ vaultAddress: z3.string().describe("Vault contract address (0x-prefixed) to inspect."),
87
+ lastKnownAllocationHash: z3.union([
88
+ z3.string().describe(
89
+ "Hash of the previously observed allocation. Used to detect changes between evaluations. Null on the first evaluation."
90
+ ),
91
+ z3.null().describe(
92
+ "Hash of the previously observed allocation. Used to detect changes between evaluations. Null on the first evaluation."
93
+ )
94
+ ]).describe(
95
+ "Hash of the previously observed allocation. Used to detect changes between evaluations. Null on the first evaluation."
96
+ ).optional()
97
+ }).describe("Inputs passed to the vaults.fyi allocation-change policy WASM at evaluation time");
98
+
99
+ // src/pack.ts
100
+ var BASIS_POINTS = 1e4;
101
+ function toBp(n) {
102
+ return BigInt(Math.round(n * BASIS_POINTS));
103
+ }
104
+ function fromBp(n) {
105
+ return Number(n) / BASIS_POINTS;
106
+ }
107
+ var isAtBasisPointPrecision = (n) => Math.abs(n * BASIS_POINTS - Math.round(n * BASIS_POINTS)) < Number.EPSILON;
108
+ var RefinedParamsSchema = ParamsSchema.superRefine(
109
+ (params, ctx) => {
110
+ const numericFields = [
111
+ "apy_z_max",
112
+ "tvl_drawdown_24h_max_pct",
113
+ "tvl_drawdown_7d_max_pct"
114
+ ];
115
+ for (const field of numericFields) {
116
+ const value = params[field];
117
+ if (!isAtBasisPointPrecision(value)) {
118
+ ctx.addIssue({
119
+ code: z4.ZodIssueCode.custom,
120
+ path: [field],
121
+ message: `Sub-basis-point precision is not supported. \`${field}: ${value}\` would silently encode as ${Math.round(value * BASIS_POINTS) / BASIS_POINTS}. Round to 4 decimal places (1bp) before passing.`
122
+ });
123
+ }
124
+ }
125
+ }
126
+ );
127
+ var POLICY_PARAMS_ABI = [
128
+ {
129
+ type: "tuple",
130
+ components: [
131
+ { name: "apyZMax", type: "uint256" },
132
+ { name: "tvlDrawdown24hMaxPct", type: "uint256" },
133
+ { name: "tvlDrawdown7dMaxPct", type: "uint256" },
134
+ { name: "riskScoreFloor", type: "uint16" },
135
+ { name: "denyOnAllocationChange", type: "bool" },
136
+ { name: "denyOnCriticalFlag", type: "bool" },
137
+ { name: "denyOnCorrupted", type: "bool" }
138
+ ]
139
+ }
140
+ ];
141
+ function encodeRiskScore(n) {
142
+ if (!Number.isInteger(n) || n < 0 || n > 100) {
143
+ throw new RangeError(
144
+ `risk_score_floor must be an integer in [0, 100]; received ${n}. The AVS-side floor compares against \`vault.scores.netScore\` which is an integer 0-100.`
145
+ );
146
+ }
147
+ return n;
148
+ }
149
+ function encodeParams(params) {
150
+ return encodeAbiParameters(POLICY_PARAMS_ABI, [
151
+ {
152
+ apyZMax: toBp(params.apy_z_max),
153
+ tvlDrawdown24hMaxPct: toBp(params.tvl_drawdown_24h_max_pct),
154
+ tvlDrawdown7dMaxPct: toBp(params.tvl_drawdown_7d_max_pct),
155
+ riskScoreFloor: encodeRiskScore(params.risk_score_floor),
156
+ denyOnAllocationChange: params.deny_on_allocation_change,
157
+ denyOnCriticalFlag: params.deny_on_critical_flag,
158
+ denyOnCorrupted: params.deny_on_corrupted
159
+ }
160
+ ]);
161
+ }
162
+ function decodeParams(encoded) {
163
+ const [decoded] = decodeAbiParameters(POLICY_PARAMS_ABI, encoded);
164
+ return ParamsSchema.parse({
165
+ apy_z_max: fromBp(decoded.apyZMax),
166
+ tvl_drawdown_24h_max_pct: fromBp(decoded.tvlDrawdown24hMaxPct),
167
+ tvl_drawdown_7d_max_pct: fromBp(decoded.tvlDrawdown7dMaxPct),
168
+ risk_score_floor: decoded.riskScoreFloor,
169
+ deny_on_allocation_change: decoded.denyOnAllocationChange,
170
+ deny_on_critical_flag: decoded.denyOnCriticalFlag,
171
+ deny_on_corrupted: decoded.denyOnCorrupted
172
+ });
173
+ }
174
+ var vaultsfyi = {
175
+ id: `${PACK_NAME}/risk-envelope/v1`,
176
+ paramsSchema: RefinedParamsSchema,
177
+ wasmArgsSchema: WasmArgsSchema,
178
+ secretsSchema: SecretsSchema,
179
+ encodeParams,
180
+ decodeParams,
181
+ prepareQuery,
182
+ deployments,
183
+ metadata: {
184
+ name: PACK_NAME,
185
+ version: PACK_VERSION,
186
+ description: PACK_DESCRIPTION,
187
+ author: PACK_AUTHOR || void 0,
188
+ link: PACK_LINK || void 0
189
+ }
190
+ };
191
+ export {
192
+ PACK_AUTHOR,
193
+ PACK_DESCRIPTION,
194
+ PACK_LINK,
195
+ PACK_NAME,
196
+ PACK_VERSION,
197
+ ParamsSchema,
198
+ RefinedParamsSchema,
199
+ SecretsSchema,
200
+ WasmArgsSchema,
201
+ deployments,
202
+ vaultsfyi
203
+ };
204
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/deployments.ts","../src/metadata.ts","../src/pack.ts","../src/params.ts","../src/prepare-query.ts","../src/secrets.ts","../src/wasm-args.ts"],"sourcesContent":["// AUTO-GENERATED by scripts/generate-bindings.ts — DO NOT EDIT.\n// Source: AVS-side artifacts in this repo (run `pnpm gen:bindings` to regenerate).\nimport type { ChainId, Deployment } from \"@newton-xyz/policy-pack-shared\";\n\nexport const deployments = {\n\t\"11155111\": {\n\t\tpolicy: \"0x14685C1769Eb6f449FeC42A48d086746F470CE4a\",\n\t\tpolicyData: \"0x5F8B0FC2c22c039f97D2c806B48307B9A9C288C8\",\n\t\twasmCid: \"bafybeig6oielnnf4zorcmqkets6v26ov7t2o6ikipx6vupuzsjrxvbpkpe\",\n\t\tpolicyCodeHash: \"0x09be97b5636da7b6e231914f47e2bfbc32fddfd3647e771d7624cea8fa2bdc54\",\n\t\tdeployedAt: \"2026-06-09\",\n\t\tnotes: \"host-secrets fix; current\",\n\t},\n} as const satisfies Readonly<Partial<Record<ChainId, Deployment>>>;\n","// AUTO-GENERATED by scripts/generate-bindings.ts — DO NOT EDIT.\n// Source: AVS-side artifacts in this repo (run `pnpm gen:bindings` to regenerate).\nexport const PACK_NAME = \"vaultsfyi\" as const;\nexport const PACK_VERSION = \"0.0.1\" as const;\nexport const PACK_DESCRIPTION =\n\t\"Gates vault deposits based on real-time risk signals: APY anomalies, TVL drawdowns, risk score floors, and allocation changes\" as const;\nexport const PACK_LINK = \"https://vaults.fyi\" as const;\nexport const PACK_AUTHOR = \"\" as const;\n","// Hand-written canonical export — survives `pnpm gen:bindings` regen.\n// The generated `index.ts` re-exports `pack.ts` when present.\nimport type { PolicyPack } from \"@newton-xyz/policy-pack-shared\";\nimport { decodeAbiParameters, encodeAbiParameters, type Hex } from \"viem\";\nimport { z } from \"zod\";\nimport { deployments } from \"./deployments\";\nimport { PACK_AUTHOR, PACK_DESCRIPTION, PACK_LINK, PACK_NAME, PACK_VERSION } from \"./metadata\";\nimport { type Params, ParamsSchema } from \"./params\";\nimport { prepareQuery } from \"./prepare-query\";\nimport { type Secrets, SecretsSchema } from \"./secrets\";\nimport { type WasmArgs, WasmArgsSchema } from \"./wasm-args\";\n\n/**\n * The fractional thresholds (`apy_z_max`, `tvl_drawdown_*_max_pct`) are stored\n * in basis points so the on-chain bytes carry only `uint256`. `apy_z_max: 1.5`\n * becomes `15000` (1.5e4 bp); `tvl_drawdown_24h_max_pct: 0.05` becomes `500`.\n * `risk_score_floor` is *not* basis-point-encoded — it's a 0-100 integer scale\n * that matches the AVS-side `vault.scores.netScore` field directly, so it\n * round-trips through `uint16` as-is.\n */\nconst BASIS_POINTS = 10_000;\n\nfunction toBp(n: number): bigint {\n\treturn BigInt(Math.round(n * BASIS_POINTS));\n}\n\nfunction fromBp(n: bigint): number {\n\treturn Number(n) / BASIS_POINTS;\n}\n\n/**\n * Refined params schema with sub-basis-point precision rejection on every\n * fractional threshold so a curator typing `tvl_drawdown_24h_max_pct: 0.00005`\n * can't silently encode as `0n` and disable the cap. The generated\n * `ParamsSchema` from `./params` is the canonical zod derived from\n * `params_schema.json`; this version sits on top of it for stricter SDK-side\n * input validation. `risk_score_floor` is excluded — it's an integer 0-100\n * scale, not a basis-point fraction. Exported with a distinct name to avoid\n * clashing with the generated star re-export in `index.ts`.\n */\nconst isAtBasisPointPrecision = (n: number) =>\n\tMath.abs(n * BASIS_POINTS - Math.round(n * BASIS_POINTS)) < Number.EPSILON;\n\nexport const RefinedParamsSchema = (ParamsSchema as unknown as z.ZodType<Params>).superRefine(\n\t(params, ctx) => {\n\t\tconst numericFields: ReadonlyArray<keyof Params> = [\n\t\t\t\"apy_z_max\",\n\t\t\t\"tvl_drawdown_24h_max_pct\",\n\t\t\t\"tvl_drawdown_7d_max_pct\",\n\t\t];\n\t\tfor (const field of numericFields) {\n\t\t\tconst value = params[field] as number;\n\t\t\tif (!isAtBasisPointPrecision(value)) {\n\t\t\t\tctx.addIssue({\n\t\t\t\t\tcode: z.ZodIssueCode.custom,\n\t\t\t\t\tpath: [field],\n\t\t\t\t\tmessage: `Sub-basis-point precision is not supported. \\`${field}: ${value}\\` would silently encode as ${\n\t\t\t\t\t\tMath.round(value * BASIS_POINTS) / BASIS_POINTS\n\t\t\t\t\t}. Round to 4 decimal places (1bp) before passing.`,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t},\n);\n\n/**\n * On-chain layout of `policyParams` for the vaults.fyi risk-envelope policy.\n *\n * This is the ABI tuple that round-trips through `NewtonPolicyData.policyParams`.\n * Keys are sorted to match `ParamsSchema`'s key order so generated zod and\n * encoded bytes stay in sync. If the schema adds a field, add it here in the\n * same position and bump the policy contract.\n */\nconst POLICY_PARAMS_ABI = [\n\t{\n\t\ttype: \"tuple\",\n\t\tcomponents: [\n\t\t\t{ name: \"apyZMax\", type: \"uint256\" },\n\t\t\t{ name: \"tvlDrawdown24hMaxPct\", type: \"uint256\" },\n\t\t\t{ name: \"tvlDrawdown7dMaxPct\", type: \"uint256\" },\n\t\t\t{ name: \"riskScoreFloor\", type: \"uint16\" },\n\t\t\t{ name: \"denyOnAllocationChange\", type: \"bool\" },\n\t\t\t{ name: \"denyOnCriticalFlag\", type: \"bool\" },\n\t\t\t{ name: \"denyOnCorrupted\", type: \"bool\" },\n\t\t],\n\t},\n] as const;\n\nfunction encodeRiskScore(n: number): number {\n\tif (!Number.isInteger(n) || n < 0 || n > 100) {\n\t\tthrow new RangeError(\n\t\t\t`risk_score_floor must be an integer in [0, 100]; received ${n}. The AVS-side floor compares against \\`vault.scores.netScore\\` which is an integer 0-100.`,\n\t\t);\n\t}\n\treturn n;\n}\n\nfunction encodeParams(params: Params): Hex {\n\treturn encodeAbiParameters(POLICY_PARAMS_ABI, [\n\t\t{\n\t\t\tapyZMax: toBp(params.apy_z_max),\n\t\t\ttvlDrawdown24hMaxPct: toBp(params.tvl_drawdown_24h_max_pct),\n\t\t\ttvlDrawdown7dMaxPct: toBp(params.tvl_drawdown_7d_max_pct),\n\t\t\triskScoreFloor: encodeRiskScore(params.risk_score_floor),\n\t\t\tdenyOnAllocationChange: params.deny_on_allocation_change,\n\t\t\tdenyOnCriticalFlag: params.deny_on_critical_flag,\n\t\t\tdenyOnCorrupted: params.deny_on_corrupted,\n\t\t},\n\t]);\n}\n\nfunction decodeParams(encoded: Hex): Params {\n\tconst [decoded] = decodeAbiParameters(POLICY_PARAMS_ABI, encoded);\n\treturn ParamsSchema.parse({\n\t\tapy_z_max: fromBp(decoded.apyZMax),\n\t\ttvl_drawdown_24h_max_pct: fromBp(decoded.tvlDrawdown24hMaxPct),\n\t\ttvl_drawdown_7d_max_pct: fromBp(decoded.tvlDrawdown7dMaxPct),\n\t\trisk_score_floor: decoded.riskScoreFloor,\n\t\tdeny_on_allocation_change: decoded.denyOnAllocationChange,\n\t\tdeny_on_critical_flag: decoded.denyOnCriticalFlag,\n\t\tdeny_on_corrupted: decoded.denyOnCorrupted,\n\t});\n}\n\n/**\n * The vaults.fyi risk-envelope `PolicyPack`.\n *\n * Pass to `createShield(...)` from `@newton-xyz/newton-shield-sdk`:\n *\n * ```ts\n * import { vaultsfyi } from \"@newton-xyz/policy-pack-vaultsfyi\";\n *\n * const shield = await createShield({\n * walletClient,\n * vault,\n * pack: vaultsfyi,\n * params: {\n * apy_z_max: 3,\n * tvl_drawdown_24h_max_pct: 0.05,\n * tvl_drawdown_7d_max_pct: 0.20,\n * risk_score_floor: 85, // 0-100 integer; matches AVS `vault.scores.netScore`\n * deny_on_allocation_change: true,\n * deny_on_critical_flag: true,\n * deny_on_corrupted: true,\n * },\n * });\n * ```\n */\nexport const vaultsfyi: PolicyPack<Params, WasmArgs, Secrets> = {\n\tid: `${PACK_NAME}/risk-envelope/v1`,\n\tparamsSchema: RefinedParamsSchema,\n\twasmArgsSchema: WasmArgsSchema,\n\tsecretsSchema: SecretsSchema,\n\tencodeParams,\n\tdecodeParams,\n\tprepareQuery,\n\tdeployments,\n\tmetadata: {\n\t\tname: PACK_NAME,\n\t\tversion: PACK_VERSION,\n\t\tdescription: PACK_DESCRIPTION,\n\t\tauthor: PACK_AUTHOR || undefined,\n\t\tlink: PACK_LINK || undefined,\n\t},\n};\n","// AUTO-GENERATED by scripts/generate-bindings.ts — DO NOT EDIT.\n// Source: AVS-side artifacts in this repo (run `pnpm gen:bindings` to regenerate).\n// Source schema: vaultsfyi/params_schema.json\nimport { z } from \"zod\";\n\nexport const ParamsSchema = z\n\t.object({\n\t\tapy_z_max: z\n\t\t\t.number()\n\t\t\t.describe(\n\t\t\t\t\"Max APY z-score (current vs 30d median). Exceeding this indicates an APY anomaly.\",\n\t\t\t),\n\t\ttvl_drawdown_24h_max_pct: z.number().describe(\"Max allowed 24h TVL drawdown percentage\"),\n\t\ttvl_drawdown_7d_max_pct: z.number().describe(\"Max allowed 7d TVL drawdown percentage\"),\n\t\trisk_score_floor: z\n\t\t\t.number()\n\t\t\t.int()\n\t\t\t.gte(0)\n\t\t\t.lte(100)\n\t\t\t.describe(\n\t\t\t\t\"Minimum acceptable risk score (0-100 integer scale; matches the AVS-side `vault.scores.netScore`). Set to 0 to effectively disable the floor.\",\n\t\t\t),\n\t\tdeny_on_allocation_change: z\n\t\t\t.boolean()\n\t\t\t.describe(\n\t\t\t\t\"Whether to deny if vault allocation/strategy metadata has changed since last evaluation\",\n\t\t\t),\n\t\tdeny_on_critical_flag: z\n\t\t\t.boolean()\n\t\t\t.describe(\"Whether to deny if the vault has a flag with severity 'critical' or 'high'\"),\n\t\tdeny_on_corrupted: z\n\t\t\t.boolean()\n\t\t\t.describe(\"Whether to deny if the vault is reported as corrupted by the data source\"),\n\t})\n\t.describe(\"Risk envelope thresholds for vault deposit gating\");\n\nexport type Params = z.infer<typeof ParamsSchema>;\n","import type { PrepareQueryArgs, PrepareQueryResult } from \"@newton-xyz/policy-pack-shared\";\nimport type { WasmArgs } from \"./wasm-args\";\n\n/**\n * vaults.fyi network slugs. Keyed by viem chain id. The AVS-side `policy.js`\n * fetches `https://api.vaults.fyi/v2/historical/<network>/<vaultAddress>`\n * with this slug, so the SDK has to use the same map.\n */\nconst NETWORK_BY_CHAIN_ID: Readonly<Record<number, string>> = {\n\t1: \"mainnet\",\n\t8453: \"base\",\n\t42161: \"arbitrum\",\n\t10: \"optimism\",\n\t11155111: \"sepolia\",\n\t84532: \"base-sepolia\",\n};\n\nfunction networkForChain(chainId: number): string {\n\tconst name = NETWORK_BY_CHAIN_ID[chainId];\n\tif (!name) {\n\t\tthrow new Error(\n\t\t\t`policy-pack-vaultsfyi: chain id ${chainId} is not in the vaults.fyi network map. Add it to NETWORK_BY_CHAIN_ID before using this pack on this chain.`,\n\t\t);\n\t}\n\treturn name;\n}\n\n/**\n * Build the WASM args the vaults.fyi policy expects.\n *\n * The AVS-side `policy.js` computes the canonical allocation hash itself\n * (FNV-1a over `JSON.stringify({ protocol?.name, tags, fees, childrenVaults })`\n * fetched from the vaults.fyi API). The SDK has nothing to add — the AVS is\n * the source of truth for both the data and the hash. The SDK's only job is\n * to thread the *previous* hash through so the AVS can compare:\n *\n * - First call: pass `previousAllocationHash: undefined` (defaults to\n * `null` in wasmArgs). The AVS-side `allocation_changed_since_last`\n * branch returns `false`, so `deny_on_allocation_change` doesn't fire\n * on a clean first observation.\n * - Subsequent calls: pass the hash the AVS returned on the prior call\n * (typically read from `policyData` storage or a curator-side cache).\n * The AVS compares against its freshly-computed hash and flips\n * `allocation_changed_since_last` if they diverge.\n *\n * Earlier revisions of this function read MetaMorpho's `supplyQueue` and\n * computed `keccak256(abi.encode(bytes32[]))` — that hash never matched the\n * AVS's FNV-1a-over-API-metadata, so `deny_on_allocation_change: true` was\n * effectively a coin flip. Removed.\n */\nexport async function prepareQuery(\n\t{ publicClient, vault }: PrepareQueryArgs,\n\toptions: { previousAllocationHash?: string } = {},\n): Promise<PrepareQueryResult<WasmArgs>> {\n\tconst chainId = publicClient.chain?.id;\n\tif (chainId === undefined) {\n\t\tthrow new Error(\n\t\t\t\"policy-pack-vaultsfyi: publicClient.chain is undefined. Pass a chain to viem's createPublicClient.\",\n\t\t);\n\t}\n\n\treturn {\n\t\twasmArgs: {\n\t\t\tnetwork: networkForChain(chainId),\n\t\t\tvaultAddress: vault,\n\t\t\tlastKnownAllocationHash: options.previousAllocationHash ?? null,\n\t\t},\n\t};\n}\n","// AUTO-GENERATED by scripts/generate-bindings.ts — DO NOT EDIT.\n// Source: AVS-side artifacts in this repo (run `pnpm gen:bindings` to regenerate).\n// Source schema: vaultsfyi/secrets_schema.json\nimport { z } from \"zod\";\n\nexport const SecretsSchema = z.object({ VAULTS_FYI_API_KEY: z.string().min(1) }).strict();\n\nexport type Secrets = z.infer<typeof SecretsSchema>;\n","// AUTO-GENERATED by scripts/generate-bindings.ts — DO NOT EDIT.\n// Source: AVS-side artifacts in this repo (run `pnpm gen:bindings` to regenerate).\n// Source schema: vaultsfyi/wasm_args_schema.json\nimport { z } from \"zod\";\n\nexport const WasmArgsSchema = z\n\t.object({\n\t\tnetwork: z\n\t\t\t.string()\n\t\t\t.describe(\n\t\t\t\t\"Blockchain network name as accepted by the vaults.fyi API (e.g. 'mainnet', 'base', 'arbitrum').\",\n\t\t\t),\n\t\tvaultAddress: z.string().describe(\"Vault contract address (0x-prefixed) to inspect.\"),\n\t\tlastKnownAllocationHash: z\n\t\t\t.union([\n\t\t\t\tz\n\t\t\t\t\t.string()\n\t\t\t\t\t.describe(\n\t\t\t\t\t\t\"Hash of the previously observed allocation. Used to detect changes between evaluations. Null on the first evaluation.\",\n\t\t\t\t\t),\n\t\t\t\tz\n\t\t\t\t\t.null()\n\t\t\t\t\t.describe(\n\t\t\t\t\t\t\"Hash of the previously observed allocation. Used to detect changes between evaluations. Null on the first evaluation.\",\n\t\t\t\t\t),\n\t\t\t])\n\t\t\t.describe(\n\t\t\t\t\"Hash of the previously observed allocation. Used to detect changes between evaluations. Null on the first evaluation.\",\n\t\t\t)\n\t\t\t.optional(),\n\t})\n\t.describe(\"Inputs passed to the vaults.fyi allocation-change policy WASM at evaluation time\");\n\nexport type WasmArgs = z.infer<typeof WasmArgsSchema>;\n"],"mappings":";AAIO,IAAM,cAAc;AAAA,EAC1B,YAAY;AAAA,IACX,QAAQ;AAAA,IACR,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,gBAAgB;AAAA,IAChB,YAAY;AAAA,IACZ,OAAO;AAAA,EACR;AACD;;;ACXO,IAAM,YAAY;AAClB,IAAM,eAA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,QAAQ;AAAA,IAC/B,mBAAmB,QAAQ;AAAA,EAC5B,CAAC;AACF;AA0BO,IAAM,YAAmD;AAAA,EAC/D,IAAI,GAAG,SAAS;AAAA,EAChB,cAAc;AAAA,EACd,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,UAAU;AAAA,IACT,MAAM;AAAA,IACN,SAAS;AAAA,IACT,aAAa;AAAA,IACb,QAAQ,eAAe;AAAA,IACvB,MAAM,aAAa;AAAA,EACpB;AACD;","names":["z","z","z","z"]}
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@newton-xyz/policy-pack-vaultsfyi",
3
+ "version": "0.2.0",
4
+ "description": "Typed TypeScript bindings for the Newton vaultsfyi policy pack.",
5
+ "license": "Apache-2.0",
6
+ "author": "Newton Protocol <https://x.com/newton_xyz> (https://newton.xyz)",
7
+ "homepage": "https://github.com/newt-foundation/newton-policy-packs/tree/main/packages/policy-pack-vaultsfyi",
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/newt-foundation/newton-policy-packs.git",
11
+ "directory": "packages/policy-pack-vaultsfyi"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/newt-foundation/newton-policy-packs/issues"
15
+ },
16
+ "keywords": [
17
+ "newton",
18
+ "newton-protocol",
19
+ "policy-pack",
20
+ "shield",
21
+ "vaultsfyi"
22
+ ],
23
+ "publishConfig": {
24
+ "access": "public"
25
+ },
26
+ "sideEffects": false,
27
+ "type": "module",
28
+ "main": "./dist/index.cjs",
29
+ "module": "./dist/index.js",
30
+ "types": "./dist/index.d.ts",
31
+ "exports": {
32
+ ".": {
33
+ "types": "./dist/index.d.ts",
34
+ "import": "./dist/index.js",
35
+ "require": "./dist/index.cjs"
36
+ }
37
+ },
38
+ "files": [
39
+ "dist",
40
+ "README.md",
41
+ "LICENSE"
42
+ ],
43
+ "peerDependencies": {
44
+ "@newton-xyz/policy-pack-shared": "^0.1.0",
45
+ "viem": "^2.0.0",
46
+ "zod": "^3.0.0"
47
+ },
48
+ "devDependencies": {
49
+ "tsup": "^8.5.1",
50
+ "typescript": "^5.5.0",
51
+ "viem": "^2.0.0",
52
+ "zod": "^3.23.0",
53
+ "@newton-xyz/policy-pack-shared": "0.1.0"
54
+ },
55
+ "scripts": {
56
+ "build": "tsup",
57
+ "dev": "tsup --watch",
58
+ "typecheck": "tsc --noEmit",
59
+ "test": "echo 'no tests yet'"
60
+ }
61
+ }