otto-intel-mcp 0.1.2 → 0.1.4

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.
Files changed (239) hide show
  1. package/README.md +76 -18
  2. package/dist/account-userop-policy-definition.d.ts +14 -0
  3. package/dist/account-userop-policy-definition.js +12 -0
  4. package/dist/account-userop-policy-relation.d.ts +371 -0
  5. package/dist/account-userop-policy-relation.js +87 -0
  6. package/dist/adapter/cdp-signer.d.ts +76 -9
  7. package/dist/adapter/cdp-signer.js +274 -33
  8. package/dist/adapter/evm-call-failure.d.ts +29 -0
  9. package/dist/adapter/evm-call-failure.js +109 -0
  10. package/dist/adapter/refusal.d.ts +1 -1
  11. package/dist/adapter/refusal.js +13 -0
  12. package/dist/adapter/route-simulator.d.ts +91 -0
  13. package/dist/adapter/route-simulator.js +143 -0
  14. package/dist/adapter-cdp-index.d.ts +1 -1
  15. package/dist/executable-equities.d.ts +55 -0
  16. package/dist/executable-equities.js +116 -0
  17. package/dist/executable-yield-markets.d.ts +261 -0
  18. package/dist/executable-yield-markets.js +154 -0
  19. package/dist/execution-account-gas-quote.d.ts +141 -0
  20. package/dist/execution-account-gas-quote.js +443 -0
  21. package/dist/execution-account-gas-review.d.ts +123 -0
  22. package/dist/execution-account-gas-review.js +104 -0
  23. package/dist/execution-account-gas-runtime.d.ts +33 -0
  24. package/dist/execution-account-gas-runtime.js +131 -0
  25. package/dist/execution-account-gas-view.d.ts +936 -0
  26. package/dist/execution-account-gas-view.js +56 -0
  27. package/dist/execution-config.d.ts +3 -0
  28. package/dist/execution-config.js +4 -0
  29. package/dist/execution-delegated-definition.d.ts +7 -6
  30. package/dist/execution-delegated-definition.js +13 -2
  31. package/dist/execution-delegation-admin-definition.d.ts +127 -5
  32. package/dist/execution-delegation-admin-definition.js +155 -5
  33. package/dist/execution-delegation-admin.d.ts +48 -2
  34. package/dist/execution-delegation-admin.js +422 -12
  35. package/dist/execution-delegation-cap-store.d.ts +386 -0
  36. package/dist/execution-delegation-cap-store.js +1150 -0
  37. package/dist/execution-delegation-exit-definition.d.ts +309 -0
  38. package/dist/execution-delegation-exit-definition.js +204 -0
  39. package/dist/execution-delegation-exit-store.d.ts +114 -0
  40. package/dist/execution-delegation-exit-store.js +671 -0
  41. package/dist/execution-delegation-exit.d.ts +4 -0
  42. package/dist/execution-delegation-exit.js +614 -0
  43. package/dist/execution-delegation-finality.d.ts +22 -0
  44. package/dist/execution-delegation-finality.js +90 -0
  45. package/dist/execution-delegation-operation-store.d.ts +129 -0
  46. package/dist/execution-delegation-operation-store.js +1107 -0
  47. package/dist/execution-delegation-operations-definition.d.ts +282 -0
  48. package/dist/execution-delegation-operations-definition.js +117 -0
  49. package/dist/execution-delegation-operations.d.ts +6 -0
  50. package/dist/execution-delegation-operations.js +282 -0
  51. package/dist/execution-delegation-policy.d.ts +154 -8
  52. package/dist/execution-delegation-policy.js +273 -40
  53. package/dist/execution-delegation.d.ts +51 -0
  54. package/dist/execution-delegation.js +441 -31
  55. package/dist/execution-errors.d.ts +1 -1
  56. package/dist/execution-errors.js +122 -0
  57. package/dist/execution-index.d.ts +7 -2
  58. package/dist/execution-index.js +7 -2
  59. package/dist/execution-journal-schema.d.ts +96 -0
  60. package/dist/execution-journal-schema.js +368 -0
  61. package/dist/execution-journal-tables.d.ts +14 -0
  62. package/dist/execution-journal-tables.js +227 -0
  63. package/dist/execution-policy-compatibility.d.ts +34 -0
  64. package/dist/execution-policy-compatibility.js +76 -0
  65. package/dist/execution-registration.d.ts +54 -2
  66. package/dist/execution-registration.js +151 -5
  67. package/dist/execution-sponsored-account-profile.d.ts +32 -0
  68. package/dist/execution-sponsored-account-profile.js +59 -0
  69. package/dist/execution-sponsored-account.d.ts +1519 -0
  70. package/dist/execution-sponsored-account.js +222 -0
  71. package/dist/execution-sponsored-definition.d.ts +1713 -0
  72. package/dist/execution-sponsored-definition.js +185 -0
  73. package/dist/execution-sponsored-gas-policy.d.ts +27 -0
  74. package/dist/execution-sponsored-gas-policy.js +110 -0
  75. package/dist/execution-sponsored-hosted.d.ts +3 -0
  76. package/dist/execution-sponsored-hosted.js +71 -0
  77. package/dist/execution-sponsored-index.d.ts +1322 -0
  78. package/dist/execution-sponsored-index.js +102 -0
  79. package/dist/execution-sponsored-mcp-definition.d.ts +1662 -0
  80. package/dist/execution-sponsored-mcp-definition.js +94 -0
  81. package/dist/execution-sponsored-receipt.d.ts +47 -0
  82. package/dist/execution-sponsored-receipt.js +74 -0
  83. package/dist/execution-sponsored-registration.d.ts +14 -0
  84. package/dist/execution-sponsored-registration.js +77 -0
  85. package/dist/execution-sponsored-runtime.d.ts +84 -0
  86. package/dist/execution-sponsored-runtime.js +149 -0
  87. package/dist/execution-sponsored-settlement.d.ts +15 -0
  88. package/dist/execution-sponsored-settlement.js +88 -0
  89. package/dist/execution-sponsored-store.d.ts +67 -0
  90. package/dist/execution-sponsored-store.js +517 -0
  91. package/dist/execution-sponsored-transport.d.ts +90 -0
  92. package/dist/execution-sponsored-transport.js +180 -0
  93. package/dist/execution-tool-definitions.d.ts +21 -21
  94. package/dist/execution-tool-definitions.js +0 -7
  95. package/dist/execution-tools.d.ts +53 -1
  96. package/dist/execution-tools.js +171 -13
  97. package/dist/execution-worker-guard.d.ts +28 -0
  98. package/dist/execution-worker-guard.js +124 -0
  99. package/dist/hybrid-yield-index.d.ts +10 -0
  100. package/dist/hybrid-yield-index.js +11 -0
  101. package/dist/hybrid-yield-markets.d.ts +96 -0
  102. package/dist/hybrid-yield-markets.js +124 -0
  103. package/dist/hybrid-yield.d.ts +411 -0
  104. package/dist/hybrid-yield.js +155 -0
  105. package/dist/hyperliquid-order-builder.js +4 -0
  106. package/dist/lifi-execution-client.d.ts +6 -0
  107. package/dist/lifi-execution-client.js +3 -0
  108. package/dist/lp-userop-account.d.ts +461 -0
  109. package/dist/lp-userop-account.js +417 -0
  110. package/dist/lp-userop-authority.d.ts +49 -0
  111. package/dist/lp-userop-authority.js +211 -0
  112. package/dist/lp-userop-definition.d.ts +233 -0
  113. package/dist/lp-userop-definition.js +85 -0
  114. package/dist/lp-userop-hosted.d.ts +3 -0
  115. package/dist/lp-userop-hosted.js +73 -0
  116. package/dist/lp-userop-index.d.ts +1569 -0
  117. package/dist/lp-userop-index.js +112 -0
  118. package/dist/lp-userop-mcp-definition.d.ts +1220 -0
  119. package/dist/lp-userop-mcp-definition.js +46 -0
  120. package/dist/lp-userop-operation.d.ts +1230 -0
  121. package/dist/lp-userop-operation.js +140 -0
  122. package/dist/lp-userop-registration.d.ts +14 -0
  123. package/dist/lp-userop-registration.js +70 -0
  124. package/dist/lp-userop-settlement.d.ts +89 -0
  125. package/dist/lp-userop-settlement.js +184 -0
  126. package/dist/lp-userop.d.ts +643 -0
  127. package/dist/lp-userop.js +343 -0
  128. package/dist/native-yield-account-definition.d.ts +1192 -0
  129. package/dist/native-yield-account-definition.js +232 -0
  130. package/dist/native-yield-account-gas.d.ts +58 -0
  131. package/dist/native-yield-account-gas.js +228 -0
  132. package/dist/native-yield-account-index.d.ts +23 -0
  133. package/dist/native-yield-account-index.js +28 -0
  134. package/dist/native-yield-account-policy.d.ts +168 -0
  135. package/dist/native-yield-account-policy.js +525 -0
  136. package/dist/native-yield-account-rpc.d.ts +8 -0
  137. package/dist/native-yield-account-rpc.js +128 -0
  138. package/dist/native-yield-account-runtime.d.ts +71 -0
  139. package/dist/native-yield-account-runtime.js +125 -0
  140. package/dist/native-yield-account-store.d.ts +40 -0
  141. package/dist/native-yield-account-store.js +307 -0
  142. package/dist/native-yield-account.d.ts +662 -0
  143. package/dist/native-yield-account.js +371 -0
  144. package/dist/native-yield-consent-store.d.ts +20 -0
  145. package/dist/native-yield-consent-store.js +317 -0
  146. package/dist/native-yield-definition.d.ts +288 -0
  147. package/dist/native-yield-definition.js +105 -0
  148. package/dist/native-yield-reader.d.ts +4 -0
  149. package/dist/native-yield-reader.js +137 -0
  150. package/dist/native-yield-settlement.d.ts +48 -0
  151. package/dist/native-yield-settlement.js +167 -0
  152. package/dist/native-yield-simulation.d.ts +18 -0
  153. package/dist/native-yield-simulation.js +45 -0
  154. package/dist/native-yield-userop-account.d.ts +675 -0
  155. package/dist/native-yield-userop-account.js +357 -0
  156. package/dist/native-yield-userop-authority.d.ts +214 -0
  157. package/dist/native-yield-userop-authority.js +296 -0
  158. package/dist/native-yield-userop-definition.d.ts +331 -0
  159. package/dist/native-yield-userop-definition.js +105 -0
  160. package/dist/native-yield-userop-hosted.d.ts +3 -0
  161. package/dist/native-yield-userop-hosted.js +71 -0
  162. package/dist/native-yield-userop-index.d.ts +1522 -0
  163. package/dist/native-yield-userop-index.js +142 -0
  164. package/dist/native-yield-userop-mcp-definition.d.ts +1356 -0
  165. package/dist/native-yield-userop-mcp-definition.js +50 -0
  166. package/dist/native-yield-userop-operation.d.ts +845 -0
  167. package/dist/native-yield-userop-operation.js +127 -0
  168. package/dist/native-yield-userop-policy.d.ts +23 -0
  169. package/dist/native-yield-userop-policy.js +25 -0
  170. package/dist/native-yield-userop-registration.d.ts +17 -0
  171. package/dist/native-yield-userop-registration.js +76 -0
  172. package/dist/native-yield-userop-settlement.d.ts +8 -0
  173. package/dist/native-yield-userop-settlement.js +79 -0
  174. package/dist/native-yield-userop-simulation.d.ts +18 -0
  175. package/dist/native-yield-userop-simulation.js +34 -0
  176. package/dist/native-yield-userop.d.ts +35 -0
  177. package/dist/native-yield-userop.js +156 -0
  178. package/dist/native-yield-verify.d.ts +30 -0
  179. package/dist/native-yield-verify.js +141 -0
  180. package/dist/native-yield.d.ts +17 -0
  181. package/dist/native-yield.js +119 -0
  182. package/dist/stdio-main.js +0 -0
  183. package/dist/stock-buy-definition.d.ts +338 -0
  184. package/dist/stock-buy-definition.js +127 -0
  185. package/dist/stock-buy-oracle.d.ts +8 -0
  186. package/dist/stock-buy-oracle.js +22 -0
  187. package/dist/stock-buy.d.ts +17 -0
  188. package/dist/stock-buy.js +164 -0
  189. package/dist/tool-definitions.d.ts +3 -1
  190. package/dist/tool-definitions.js +55 -2
  191. package/dist/vendor/lp-v3/lp-v3-atomic-contract.d.ts +445 -0
  192. package/dist/vendor/lp-v3/lp-v3-atomic-contract.js +90 -0
  193. package/dist/vendor/lp-v3/lp-v3-atomic-evidence.d.ts +14 -0
  194. package/dist/vendor/lp-v3/lp-v3-atomic-evidence.js +82 -0
  195. package/dist/vendor/lp-v3/lp-v3-atomic-index.d.ts +80 -0
  196. package/dist/vendor/lp-v3/lp-v3-atomic-index.js +19 -0
  197. package/dist/vendor/lp-v3/lp-v3-atomic-plan.d.ts +43 -0
  198. package/dist/vendor/lp-v3/lp-v3-atomic-plan.js +112 -0
  199. package/dist/vendor/lp-v3/lp-v3-atomic-read-contract.d.ts +312 -0
  200. package/dist/vendor/lp-v3/lp-v3-atomic-read-contract.js +41 -0
  201. package/dist/vendor/lp-v3/lp-v3-atomic-read-index.d.ts +3 -0
  202. package/dist/vendor/lp-v3/lp-v3-atomic-read-index.js +3 -0
  203. package/dist/vendor/lp-v3/lp-v3-atomic-read-rpc.d.ts +49 -0
  204. package/dist/vendor/lp-v3/lp-v3-atomic-read-rpc.js +88 -0
  205. package/dist/vendor/lp-v3/lp-v3-atomic-read.d.ts +17 -0
  206. package/dist/vendor/lp-v3/lp-v3-atomic-read.js +232 -0
  207. package/dist/vendor/lp-v3/lp-v3-atomic-settlement.d.ts +105 -0
  208. package/dist/vendor/lp-v3/lp-v3-atomic-settlement.js +162 -0
  209. package/dist/vendor/lp-v3/lp-v3-collect-protocol-contract.d.ts +606 -0
  210. package/dist/vendor/lp-v3/lp-v3-collect-protocol-contract.js +59 -0
  211. package/dist/vendor/lp-v3/lp-v3-collect-protocol-index.d.ts +168 -0
  212. package/dist/vendor/lp-v3/lp-v3-collect-protocol-index.js +23 -0
  213. package/dist/vendor/lp-v3/lp-v3-collect-protocol-observation.d.ts +32 -0
  214. package/dist/vendor/lp-v3/lp-v3-collect-protocol-observation.js +228 -0
  215. package/dist/vendor/lp-v3/lp-v3-collect-protocol-plan.d.ts +11 -0
  216. package/dist/vendor/lp-v3/lp-v3-collect-protocol-plan.js +91 -0
  217. package/dist/vendor/lp-v3/lp-v3-collect-protocol-reconcile.d.ts +9 -0
  218. package/dist/vendor/lp-v3/lp-v3-collect-protocol-reconcile.js +124 -0
  219. package/dist/vendor/lp-v3/lp-v3-contract.d.ts +538 -0
  220. package/dist/vendor/lp-v3/lp-v3-contract.js +137 -0
  221. package/dist/vendor/lp-v3/lp-v3-evidence.d.ts +25 -0
  222. package/dist/vendor/lp-v3/lp-v3-evidence.js +168 -0
  223. package/dist/vendor/lp-v3/lp-v3-plan.d.ts +22 -0
  224. package/dist/vendor/lp-v3/lp-v3-plan.js +135 -0
  225. package/dist/vendor/lp-v3/types.d.ts +131 -0
  226. package/dist/vendor/lp-v3/types.js +6 -0
  227. package/dist/vendor/lp-v3/v4-math.d.ts +18 -0
  228. package/dist/vendor/lp-v3/v4-math.js +90 -0
  229. package/dist/yield-deposit-definition.d.ts +374 -0
  230. package/dist/yield-deposit-definition.js +123 -0
  231. package/dist/yield-deposit.d.ts +16 -0
  232. package/dist/yield-deposit.js +149 -0
  233. package/dist/yield-route-semantics.d.ts +27 -0
  234. package/dist/yield-route-semantics.js +71 -0
  235. package/dist/yield-withdraw-definition.d.ts +357 -0
  236. package/dist/yield-withdraw-definition.js +90 -0
  237. package/dist/yield-withdraw.d.ts +11 -0
  238. package/dist/yield-withdraw.js +122 -0
  239. package/package.json +239 -7
@@ -0,0 +1,90 @@
1
+ import { encodeAbiParameters, keccak256 } from 'viem';
2
+ export const Q96 = 1n << 96n;
3
+ export const Q128 = 1n << 128n;
4
+ export const UINT256_MOD = 1n << 256n;
5
+ export const MIN_TICK = -887272;
6
+ export const MAX_TICK = 887272;
7
+ function uint(value, bits) {
8
+ if (value < 0n || value >= (1n << BigInt(bits)))
9
+ throw new Error(`Invalid uint${bits}`);
10
+ }
11
+ // The mathematical constants and rounding follow Uniswap's MIT-licensed TickMath:
12
+ // https://github.com/Uniswap/v4-core/blob/main/src/libraries/TickMath.sol
13
+ const TICK_FACTORS = [
14
+ 0xfffcb933bd6fad37aa2d162d1a594001n, 0xfff97272373d413259a46990580e213an,
15
+ 0xfff2e50f5f656932ef12357cf3c7fdccn, 0xffe5caca7e10e4e61c3624eaa0941cd0n,
16
+ 0xffcb9843d60f6159c9db58835c926644n, 0xff973b41fa98c081472e6896dfb254c0n,
17
+ 0xff2ea16466c96a3843ec78b326b52861n, 0xfe5dee046a99a2a811c461f1969c3053n,
18
+ 0xfcbe86c7900a88aedcffc83b479aa3a4n, 0xf987a7253ac413176f2b074cf7815e54n,
19
+ 0xf3392b0822b70005940c7a398e4b70f3n, 0xe7159475a2c29b7443b29c7fa6e889d9n,
20
+ 0xd097f3bdfd2022b8845ad8f792aa5825n, 0xa9f746462d870fdf8a65dc1f90e061e5n,
21
+ 0x70d869a156d2a1b890bb3df62baf32f7n, 0x31be135f97d08fd981231505542fcfa6n,
22
+ 0x9aa508b5b7a84e1c677de54f3e99bc9n, 0x5d6af8dedb81196699c329225ee604n,
23
+ 0x2216e584f5fa1ea926041bedfe98n, 0x48a170391f7dc42444e8fa2n,
24
+ ];
25
+ export function sqrtPriceAtTick(tick) {
26
+ if (!Number.isInteger(tick) || tick < MIN_TICK || tick > MAX_TICK)
27
+ throw new Error('Invalid tick');
28
+ const magnitude = Math.abs(tick);
29
+ let ratio = Q128;
30
+ for (let bit = 0; bit < TICK_FACTORS.length; bit++) {
31
+ if ((magnitude & (1 << bit)) !== 0)
32
+ ratio = (ratio * TICK_FACTORS[bit]) >> 128n;
33
+ }
34
+ if (tick > 0)
35
+ ratio = (UINT256_MOD - 1n) / ratio;
36
+ return (ratio + (1n << 32n) - 1n) >> 32n;
37
+ }
38
+ // PositionInfo has lower tick at bit 8, upper tick at bit 32, and the
39
+ // most-significant 200 bits of the pool hash at bit 56 (not the low 200 bits).
40
+ // https://github.com/Uniswap/v4-periphery/blob/main/src/libraries/PositionInfoLibrary.sol
41
+ export function unpackPositionInfo(info) {
42
+ uint(info, 256);
43
+ const signed24 = (n) => Number(BigInt.asIntN(24, n));
44
+ return {
45
+ lowerTick: signed24(info >> 8n), upperTick: signed24(info >> 32n),
46
+ poolIdPrefix: `0x${(info >> 56n).toString(16).padStart(50, '0')}`,
47
+ hasSubscriber: (info & 255n) !== 0n,
48
+ };
49
+ }
50
+ export function poolId(key) {
51
+ return keccak256(encodeAbiParameters([
52
+ { type: 'address' }, { type: 'address' }, { type: 'uint24' },
53
+ { type: 'int24' }, { type: 'address' },
54
+ ], [key.currency0, key.currency1, key.fee, key.tickSpacing, key.hooks]));
55
+ }
56
+ export function feesOwed(liquidity, current, checkpoint) {
57
+ uint(liquidity, 128);
58
+ return current.map((growth, i) => {
59
+ uint(growth, 256);
60
+ uint(checkpoint[i], 256);
61
+ // Core intentionally permits uint256 fee-growth subtraction to wrap.
62
+ const delta = (growth - checkpoint[i] + UINT256_MOD) % UINT256_MOD;
63
+ const owed = delta * liquidity / Q128;
64
+ uint(owed, 256);
65
+ return owed;
66
+ });
67
+ }
68
+ export function principalAmounts(liquidity, sqrtPriceX96, lowerTick, upperTick) {
69
+ uint(liquidity, 128);
70
+ uint(sqrtPriceX96, 160);
71
+ if (sqrtPriceX96 === 0n || lowerTick >= upperTick)
72
+ throw new Error('Invalid position range or price');
73
+ const lower = sqrtPriceAtTick(lowerTick), upper = sqrtPriceAtTick(upperTick);
74
+ const clamped = sqrtPriceX96 < lower ? lower : sqrtPriceX96 > upper ? upper : sqrtPriceX96;
75
+ // Rounded down, matching principal returned by removing this liquidity.
76
+ return [liquidity * Q96 * (upper - clamped) / upper / clamped,
77
+ liquidity * (clamped - lower) / Q96];
78
+ }
79
+ /** Human units of currency1 per one currency0. Display marks only, never raw accounting. */
80
+ export function humanPriceRatio(sqrtPriceX96, decimals0, decimals1) {
81
+ uint(sqrtPriceX96, 160);
82
+ for (const d of [decimals0, decimals1])
83
+ if (!Number.isInteger(d) || d < 0 || d > 36)
84
+ throw new Error('Unsupported decimals');
85
+ const result = (Number(sqrtPriceX96) / Number(Q96)) ** 2 * 10 ** (decimals0 - decimals1);
86
+ if (!Number.isFinite(result) || result <= 0)
87
+ throw new Error('Invalid mark ratio');
88
+ return result;
89
+ }
90
+ //# sourceMappingURL=v4-math.js.map
@@ -0,0 +1,374 @@
1
+ /**
2
+ * `otto_prepare_yield_deposit` — the Yield Copilot EXECUTION half at BARE (Founder word `yield deploy`,
3
+ * 2026-09-03), as a thin constructor over `otto_prepare_swap`.
4
+ *
5
+ * WHY A SWAP. The Morpho MetaMorpho vaults in the executable-yield registry are ERC-4626, and LI.FI quotes
6
+ * USDC → the vault's SHARE token as a same-chain route through the LI.FI diamond whose calldata is one of
7
+ * the two fenced GenericSwapV3 entry points, with the shares delivered to the payer's own address. The
8
+ * share-token output does not establish a protocol mint: LI.FI may instead buy shares on a
9
+ * secondary market. Parity bounds quoted economics; it cannot prove the protocol action.
10
+ * So the deposit IS a `otto_prepare_swap` pair with `toToken` pinned to the registry vault — inside the
11
+ * v1 delegation fence (approve to the diamond on an allow-listed input token; call = the fenced selector;
12
+ * receiver == the signing account), submittable through the unchanged `otto_submit_under_delegation` path
13
+ * under the per-swap cap (the cap's gross is the approve amount, i.e. the USDC deposited). Nothing about
14
+ * the fence, the cap store or the send gate changes.
15
+ *
16
+ * WHAT THIS TOOL PINS THAT A RAW SWAP DOES NOT:
17
+ * - the OUTPUT token is the registry row's `vaultAddress`, never a caller input;
18
+ * - the row is the CURRENT registry record: the caller's `registryCommitment` (what the READ half served)
19
+ * must equal the commitment recomputed here over the complete record, else refused by name;
20
+ * - chain 8453 / asset USDC / protocol MORPHO, from the row, refused otherwise;
21
+ * - DEPOSIT PARITY: the quoted shares may not fall below the vault's own `previewDeposit(amount)` by
22
+ * more than `YIELD_DEPOSIT_PARITY_TOLERANCE_BPS` — so a thin secondary pool can never silently
23
+ * produce a materially worse acquisition quote. This does not prove a mint.
24
+ * The receiver is the signing account by construction (the swap verifier binds `_receiver` to it and the
25
+ * delegated send binds the account to the end user's CDP accounts), so it is not an input anywhere.
26
+ *
27
+ * The WITHDRAW is the twin constructor `otto_prepare_yield_withdraw` (shares → USDC through the same fenced
28
+ * entry), admitted by the send gate only under fence v2 (Founder word `fence v2`, 2026-09-03): the Model-B
29
+ * fence is default-deny for every end-user-signed send in the project, so a user-signed `vault.redeem` is
30
+ * not a path out (ws-7 probe, 2026-09-03), and a deposit-only surface would trap the person's USDC.
31
+ */
32
+ import { z } from 'zod';
33
+ export declare const YIELD_DEPOSIT_TOOL_NAME: "otto_prepare_yield_deposit";
34
+ /**
35
+ * 🔴 PINNED DEPOSIT-PARITY TOLERANCE, in basis points of the vault's own `previewDeposit(amount)`.
36
+ *
37
+ * Derivation (live li.quest quotes, 2026-09-03, production params `integrator=ottowallet&fee=0.001`):
38
+ * - LI.FI's fee-collection leg takes a FIXED 0.25% of the input before the vault leg
39
+ * (`feeCosts: LIFI Fixed Fee 0.0025`; `fromAmount` 1,000,000 → swap leg 997,500) → 25 bps
40
+ * - the aggregator's mint of the post-fee amount matched `previewDeposit` to 6 s.f.; one share-unit
41
+ * of ERC-4626 rounding on an 18-decimal share is far below 1 bps → 5 bps headroom
42
+ * = 30 bps. `slippage.maxBps` is NOT part of this number: it bounds the on-chain floor
43
+ * (`minAmountOut`, enforced by the router), while this tolerance bounds the QUOTE itself — a route that
44
+ * quotes worse than the vault's own rate is refused before anything is prepared, whatever the floor.
45
+ * A test pins this value; widening it must redden that test.
46
+ */
47
+ export declare const YIELD_DEPOSIT_PARITY_TOLERANCE_BPS: 30;
48
+ export declare const PREPARE_YIELD_DEPOSIT_INPUT_SCHEMA: z.ZodObject<{
49
+ accountProfile: z.ZodObject<{
50
+ kind: z.ZodEnum<{
51
+ eoa: "eoa";
52
+ safe: "safe";
53
+ }>;
54
+ address: z.ZodString;
55
+ chainId: z.ZodNumber;
56
+ }, z.core.$strict>;
57
+ executableMarketId: z.ZodString;
58
+ registryCommitment: z.ZodString;
59
+ amount: z.ZodString;
60
+ slippage: z.ZodObject<{
61
+ maxBps: z.ZodNumber;
62
+ }, z.core.$strict>;
63
+ client_ref: z.ZodOptional<z.ZodString>;
64
+ }, z.core.$strict>;
65
+ export type PrepareYieldDepositInput = z.infer<typeof PREPARE_YIELD_DEPOSIT_INPUT_SCHEMA>;
66
+ export declare const YIELD_DEPOSIT_PREVIEW_SCHEMA: z.ZodObject<{
67
+ market_id: z.ZodString;
68
+ venue: z.ZodString;
69
+ protocol: z.ZodLiteral<"MORPHO">;
70
+ chain_id: z.ZodLiteral<8453>;
71
+ vault: z.ZodString;
72
+ asset: z.ZodString;
73
+ amount: z.ZodString;
74
+ expected_shares: z.ZodString;
75
+ min_shares: z.ZodString;
76
+ preview_deposit_shares: z.ZodString;
77
+ parity_shortfall_bps: z.ZodNumber;
78
+ parity_tolerance_bps: z.ZodLiteral<30>;
79
+ quoted_fees: z.ZodArray<z.ZodObject<{
80
+ name: z.ZodString;
81
+ amount_usd: z.ZodString;
82
+ }, z.core.$strict>>;
83
+ quoted_gas_usd: z.ZodOptional<z.ZodString>;
84
+ route_semantics: z.ZodObject<{
85
+ transport: z.ZodLiteral<"lifi">;
86
+ action: z.ZodEnum<{
87
+ deposit: "deposit";
88
+ withdraw: "withdraw";
89
+ }>;
90
+ classification: z.ZodEnum<{
91
+ "share-purchase": "share-purchase";
92
+ "share-sale": "share-sale";
93
+ "protocol-composition": "protocol-composition";
94
+ mixed: "mixed";
95
+ unclassified: "unclassified";
96
+ }>;
97
+ evidence: z.ZodLiteral<"provider-quote-steps">;
98
+ protocol_action_verified: z.ZodLiteral<false>;
99
+ tools: z.ZodArray<z.ZodString>;
100
+ }, z.core.$strict>;
101
+ }, z.core.$strict>;
102
+ export declare const PREPARE_YIELD_DEPOSIT_OUTPUT_SCHEMA: z.ZodObject<{
103
+ envelope: z.ZodObject<{
104
+ schema_version: z.ZodLiteral<"1">;
105
+ artifact_id: z.ZodString;
106
+ rail: z.ZodLiteral<"lifi">;
107
+ operation: z.ZodLiteral<"swap">;
108
+ intent_digest: z.ZodString;
109
+ account_binding: z.ZodObject<{
110
+ kind: z.ZodEnum<{
111
+ eoa: "eoa";
112
+ safe: "safe";
113
+ }>;
114
+ address: z.ZodString;
115
+ chainId: z.ZodNumber;
116
+ protocol_roles: z.ZodObject<{
117
+ lifi: z.ZodObject<{
118
+ sender: z.ZodString;
119
+ receiver: z.ZodString;
120
+ }, z.core.$strict>;
121
+ }, z.core.$strict>;
122
+ }, z.core.$strict>;
123
+ required_capabilities: z.ZodArray<z.ZodEnum<{
124
+ send_evm_transaction: "send_evm_transaction";
125
+ submit_evm_batch: "submit_evm_batch";
126
+ }>>;
127
+ payload: z.ZodDiscriminatedUnion<[z.ZodObject<{
128
+ kind: z.ZodLiteral<"evm_execution_plan">;
129
+ chain_id: z.ZodNumber;
130
+ steps: z.ZodArray<z.ZodObject<{
131
+ to: z.ZodString;
132
+ value: z.ZodString;
133
+ data: z.ZodString;
134
+ kind: z.ZodEnum<{
135
+ approve: "approve";
136
+ approve_reset: "approve_reset";
137
+ call: "call";
138
+ }>;
139
+ }, z.core.$strict>>;
140
+ }, z.core.$strict>], "kind">;
141
+ fee_attribution: z.ZodObject<{
142
+ mechanism: z.ZodLiteral<"lifi_integrator_fee">;
143
+ config_version: z.ZodString;
144
+ }, z.core.$strict>;
145
+ replay_disclosure: z.ZodObject<{
146
+ artifact_role: z.ZodLiteral<"construction_aid">;
147
+ freshness_boundary: z.ZodLiteral<"valid_until">;
148
+ onchain_replay_boundary: z.ZodLiteral<"signer_account_nonce">;
149
+ tool_guarantees_single_execution: z.ZodLiteral<false>;
150
+ }, z.core.$strict>;
151
+ assertions: z.ZodArray<z.ZodObject<{
152
+ id: z.ZodString;
153
+ result: z.ZodLiteral<"passed">;
154
+ }, z.core.$strict>>;
155
+ valid_until: z.ZodString;
156
+ submission: z.ZodObject<{
157
+ method: z.ZodEnum<{
158
+ send_evm_transaction: "send_evm_transaction";
159
+ submit_evm_batch: "submit_evm_batch";
160
+ }>;
161
+ chain_id: z.ZodNumber;
162
+ artifact_id: z.ZodString;
163
+ payload_digest: z.ZodString;
164
+ artifact_digest: z.ZodString;
165
+ adapter_owned_fields: z.ZodTuple<[z.ZodLiteral<"nonce">, z.ZodLiteral<"gas">, z.ZodLiteral<"serialization">], null>;
166
+ client_ref: z.ZodOptional<z.ZodString>;
167
+ }, z.core.$strict>;
168
+ }, z.core.$strict>;
169
+ prepareInput: z.ZodObject<{
170
+ accountProfile: z.ZodObject<{
171
+ kind: z.ZodEnum<{
172
+ eoa: "eoa";
173
+ safe: "safe";
174
+ }>;
175
+ address: z.ZodString;
176
+ chainId: z.ZodNumber;
177
+ }, z.core.$strict>;
178
+ chainId: z.ZodNumber;
179
+ fromToken: z.ZodString;
180
+ toToken: z.ZodString;
181
+ fromAmount: z.ZodString;
182
+ slippage: z.ZodObject<{
183
+ maxBps: z.ZodNumber;
184
+ minAmountOut: z.ZodOptional<z.ZodString>;
185
+ }, z.core.$strict>;
186
+ client_ref: z.ZodOptional<z.ZodString>;
187
+ }, z.core.$strict>;
188
+ preview: z.ZodObject<{
189
+ market_id: z.ZodString;
190
+ venue: z.ZodString;
191
+ protocol: z.ZodLiteral<"MORPHO">;
192
+ chain_id: z.ZodLiteral<8453>;
193
+ vault: z.ZodString;
194
+ asset: z.ZodString;
195
+ amount: z.ZodString;
196
+ expected_shares: z.ZodString;
197
+ min_shares: z.ZodString;
198
+ preview_deposit_shares: z.ZodString;
199
+ parity_shortfall_bps: z.ZodNumber;
200
+ parity_tolerance_bps: z.ZodLiteral<30>;
201
+ quoted_fees: z.ZodArray<z.ZodObject<{
202
+ name: z.ZodString;
203
+ amount_usd: z.ZodString;
204
+ }, z.core.$strict>>;
205
+ quoted_gas_usd: z.ZodOptional<z.ZodString>;
206
+ route_semantics: z.ZodObject<{
207
+ transport: z.ZodLiteral<"lifi">;
208
+ action: z.ZodEnum<{
209
+ deposit: "deposit";
210
+ withdraw: "withdraw";
211
+ }>;
212
+ classification: z.ZodEnum<{
213
+ "share-purchase": "share-purchase";
214
+ "share-sale": "share-sale";
215
+ "protocol-composition": "protocol-composition";
216
+ mixed: "mixed";
217
+ unclassified: "unclassified";
218
+ }>;
219
+ evidence: z.ZodLiteral<"provider-quote-steps">;
220
+ protocol_action_verified: z.ZodLiteral<false>;
221
+ tools: z.ZodArray<z.ZodString>;
222
+ }, z.core.$strict>;
223
+ }, z.core.$strict>;
224
+ registry_commitment: z.ZodString;
225
+ }, z.core.$strict>;
226
+ export type PrepareYieldDepositOutput = z.infer<typeof PREPARE_YIELD_DEPOSIT_OUTPUT_SCHEMA>;
227
+ /** The vault reads both yield constructors need — declared once, with the withdraw twin. */
228
+ export type { YieldVaultReader } from './yield-withdraw-definition.js';
229
+ export declare const YIELD_DEPOSIT_TOOL_DEFINITION: Readonly<{
230
+ name: "otto_prepare_yield_deposit";
231
+ title: "Prepare a Yield Copilot vault deposit (Morpho USDC on Base) as a delegable swap pair";
232
+ description: "Prepare the EXACT otto_prepare_swap pair (envelope + prepareInput) that deposits USDC into one of the executable Morpho vaults from the Yield Copilot registry, as a LI.FI position-acquisition route (which may buy shares or compose a protocol deposit) whose output token is the vault's ERC-4626 share token and whose receiver is the signing account. The vault comes from the registry row named by executableMarketId and is never an input; the caller's registryCommitment must equal the commitment recomputed over the current record. The quoted shares are checked against the vault's own previewDeposit and refused when they fall short by more than the pinned tolerance. Returns the pair unchanged plus a preview; never signs or submits — submit the pair through otto_submit_under_delegation under the end user's per-swap cap.";
233
+ inputSchema: z.ZodObject<{
234
+ accountProfile: z.ZodObject<{
235
+ kind: z.ZodEnum<{
236
+ eoa: "eoa";
237
+ safe: "safe";
238
+ }>;
239
+ address: z.ZodString;
240
+ chainId: z.ZodNumber;
241
+ }, z.core.$strict>;
242
+ executableMarketId: z.ZodString;
243
+ registryCommitment: z.ZodString;
244
+ amount: z.ZodString;
245
+ slippage: z.ZodObject<{
246
+ maxBps: z.ZodNumber;
247
+ }, z.core.$strict>;
248
+ client_ref: z.ZodOptional<z.ZodString>;
249
+ }, z.core.$strict>;
250
+ outputSchema: z.ZodObject<{
251
+ envelope: z.ZodObject<{
252
+ schema_version: z.ZodLiteral<"1">;
253
+ artifact_id: z.ZodString;
254
+ rail: z.ZodLiteral<"lifi">;
255
+ operation: z.ZodLiteral<"swap">;
256
+ intent_digest: z.ZodString;
257
+ account_binding: z.ZodObject<{
258
+ kind: z.ZodEnum<{
259
+ eoa: "eoa";
260
+ safe: "safe";
261
+ }>;
262
+ address: z.ZodString;
263
+ chainId: z.ZodNumber;
264
+ protocol_roles: z.ZodObject<{
265
+ lifi: z.ZodObject<{
266
+ sender: z.ZodString;
267
+ receiver: z.ZodString;
268
+ }, z.core.$strict>;
269
+ }, z.core.$strict>;
270
+ }, z.core.$strict>;
271
+ required_capabilities: z.ZodArray<z.ZodEnum<{
272
+ send_evm_transaction: "send_evm_transaction";
273
+ submit_evm_batch: "submit_evm_batch";
274
+ }>>;
275
+ payload: z.ZodDiscriminatedUnion<[z.ZodObject<{
276
+ kind: z.ZodLiteral<"evm_execution_plan">;
277
+ chain_id: z.ZodNumber;
278
+ steps: z.ZodArray<z.ZodObject<{
279
+ to: z.ZodString;
280
+ value: z.ZodString;
281
+ data: z.ZodString;
282
+ kind: z.ZodEnum<{
283
+ approve: "approve";
284
+ approve_reset: "approve_reset";
285
+ call: "call";
286
+ }>;
287
+ }, z.core.$strict>>;
288
+ }, z.core.$strict>], "kind">;
289
+ fee_attribution: z.ZodObject<{
290
+ mechanism: z.ZodLiteral<"lifi_integrator_fee">;
291
+ config_version: z.ZodString;
292
+ }, z.core.$strict>;
293
+ replay_disclosure: z.ZodObject<{
294
+ artifact_role: z.ZodLiteral<"construction_aid">;
295
+ freshness_boundary: z.ZodLiteral<"valid_until">;
296
+ onchain_replay_boundary: z.ZodLiteral<"signer_account_nonce">;
297
+ tool_guarantees_single_execution: z.ZodLiteral<false>;
298
+ }, z.core.$strict>;
299
+ assertions: z.ZodArray<z.ZodObject<{
300
+ id: z.ZodString;
301
+ result: z.ZodLiteral<"passed">;
302
+ }, z.core.$strict>>;
303
+ valid_until: z.ZodString;
304
+ submission: z.ZodObject<{
305
+ method: z.ZodEnum<{
306
+ send_evm_transaction: "send_evm_transaction";
307
+ submit_evm_batch: "submit_evm_batch";
308
+ }>;
309
+ chain_id: z.ZodNumber;
310
+ artifact_id: z.ZodString;
311
+ payload_digest: z.ZodString;
312
+ artifact_digest: z.ZodString;
313
+ adapter_owned_fields: z.ZodTuple<[z.ZodLiteral<"nonce">, z.ZodLiteral<"gas">, z.ZodLiteral<"serialization">], null>;
314
+ client_ref: z.ZodOptional<z.ZodString>;
315
+ }, z.core.$strict>;
316
+ }, z.core.$strict>;
317
+ prepareInput: z.ZodObject<{
318
+ accountProfile: z.ZodObject<{
319
+ kind: z.ZodEnum<{
320
+ eoa: "eoa";
321
+ safe: "safe";
322
+ }>;
323
+ address: z.ZodString;
324
+ chainId: z.ZodNumber;
325
+ }, z.core.$strict>;
326
+ chainId: z.ZodNumber;
327
+ fromToken: z.ZodString;
328
+ toToken: z.ZodString;
329
+ fromAmount: z.ZodString;
330
+ slippage: z.ZodObject<{
331
+ maxBps: z.ZodNumber;
332
+ minAmountOut: z.ZodOptional<z.ZodString>;
333
+ }, z.core.$strict>;
334
+ client_ref: z.ZodOptional<z.ZodString>;
335
+ }, z.core.$strict>;
336
+ preview: z.ZodObject<{
337
+ market_id: z.ZodString;
338
+ venue: z.ZodString;
339
+ protocol: z.ZodLiteral<"MORPHO">;
340
+ chain_id: z.ZodLiteral<8453>;
341
+ vault: z.ZodString;
342
+ asset: z.ZodString;
343
+ amount: z.ZodString;
344
+ expected_shares: z.ZodString;
345
+ min_shares: z.ZodString;
346
+ preview_deposit_shares: z.ZodString;
347
+ parity_shortfall_bps: z.ZodNumber;
348
+ parity_tolerance_bps: z.ZodLiteral<30>;
349
+ quoted_fees: z.ZodArray<z.ZodObject<{
350
+ name: z.ZodString;
351
+ amount_usd: z.ZodString;
352
+ }, z.core.$strict>>;
353
+ quoted_gas_usd: z.ZodOptional<z.ZodString>;
354
+ route_semantics: z.ZodObject<{
355
+ transport: z.ZodLiteral<"lifi">;
356
+ action: z.ZodEnum<{
357
+ deposit: "deposit";
358
+ withdraw: "withdraw";
359
+ }>;
360
+ classification: z.ZodEnum<{
361
+ "share-purchase": "share-purchase";
362
+ "share-sale": "share-sale";
363
+ "protocol-composition": "protocol-composition";
364
+ mixed: "mixed";
365
+ unclassified: "unclassified";
366
+ }>;
367
+ evidence: z.ZodLiteral<"provider-quote-steps">;
368
+ protocol_action_verified: z.ZodLiteral<false>;
369
+ tools: z.ZodArray<z.ZodString>;
370
+ }, z.core.$strict>;
371
+ }, z.core.$strict>;
372
+ registry_commitment: z.ZodString;
373
+ }, z.core.$strict>;
374
+ }>;
@@ -0,0 +1,123 @@
1
+ /**
2
+ * `otto_prepare_yield_deposit` — the Yield Copilot EXECUTION half at BARE (Founder word `yield deploy`,
3
+ * 2026-09-03), as a thin constructor over `otto_prepare_swap`.
4
+ *
5
+ * WHY A SWAP. The Morpho MetaMorpho vaults in the executable-yield registry are ERC-4626, and LI.FI quotes
6
+ * USDC → the vault's SHARE token as a same-chain route through the LI.FI diamond whose calldata is one of
7
+ * the two fenced GenericSwapV3 entry points, with the shares delivered to the payer's own address. The
8
+ * share-token output does not establish a protocol mint: LI.FI may instead buy shares on a
9
+ * secondary market. Parity bounds quoted economics; it cannot prove the protocol action.
10
+ * So the deposit IS a `otto_prepare_swap` pair with `toToken` pinned to the registry vault — inside the
11
+ * v1 delegation fence (approve to the diamond on an allow-listed input token; call = the fenced selector;
12
+ * receiver == the signing account), submittable through the unchanged `otto_submit_under_delegation` path
13
+ * under the per-swap cap (the cap's gross is the approve amount, i.e. the USDC deposited). Nothing about
14
+ * the fence, the cap store or the send gate changes.
15
+ *
16
+ * WHAT THIS TOOL PINS THAT A RAW SWAP DOES NOT:
17
+ * - the OUTPUT token is the registry row's `vaultAddress`, never a caller input;
18
+ * - the row is the CURRENT registry record: the caller's `registryCommitment` (what the READ half served)
19
+ * must equal the commitment recomputed here over the complete record, else refused by name;
20
+ * - chain 8453 / asset USDC / protocol MORPHO, from the row, refused otherwise;
21
+ * - DEPOSIT PARITY: the quoted shares may not fall below the vault's own `previewDeposit(amount)` by
22
+ * more than `YIELD_DEPOSIT_PARITY_TOLERANCE_BPS` — so a thin secondary pool can never silently
23
+ * produce a materially worse acquisition quote. This does not prove a mint.
24
+ * The receiver is the signing account by construction (the swap verifier binds `_receiver` to it and the
25
+ * delegated send binds the account to the end user's CDP accounts), so it is not an input anywhere.
26
+ *
27
+ * The WITHDRAW is the twin constructor `otto_prepare_yield_withdraw` (shares → USDC through the same fenced
28
+ * entry), admitted by the send gate only under fence v2 (Founder word `fence v2`, 2026-09-03): the Model-B
29
+ * fence is default-deny for every end-user-signed send in the project, so a user-signed `vault.redeem` is
30
+ * not a path out (ws-7 probe, 2026-09-03), and a deposit-only surface would trap the person's USDC.
31
+ */
32
+ import { z } from 'zod';
33
+ import { YIELD_ROUTE_SEMANTICS_SCHEMA } from './yield-route-semantics.js';
34
+ import { ACCOUNT_PROFILE_SCHEMA, EXECUTION_ENVELOPE_SCHEMA, PREPARE_SWAP_INPUT_SCHEMA, } from './execution-tool-definitions.js';
35
+ export const YIELD_DEPOSIT_TOOL_NAME = 'otto_prepare_yield_deposit';
36
+ /**
37
+ * 🔴 PINNED DEPOSIT-PARITY TOLERANCE, in basis points of the vault's own `previewDeposit(amount)`.
38
+ *
39
+ * Derivation (live li.quest quotes, 2026-09-03, production params `integrator=ottowallet&fee=0.001`):
40
+ * - LI.FI's fee-collection leg takes a FIXED 0.25% of the input before the vault leg
41
+ * (`feeCosts: LIFI Fixed Fee 0.0025`; `fromAmount` 1,000,000 → swap leg 997,500) → 25 bps
42
+ * - the aggregator's mint of the post-fee amount matched `previewDeposit` to 6 s.f.; one share-unit
43
+ * of ERC-4626 rounding on an 18-decimal share is far below 1 bps → 5 bps headroom
44
+ * = 30 bps. `slippage.maxBps` is NOT part of this number: it bounds the on-chain floor
45
+ * (`minAmountOut`, enforced by the router), while this tolerance bounds the QUOTE itself — a route that
46
+ * quotes worse than the vault's own rate is refused before anything is prepared, whatever the floor.
47
+ * A test pins this value; widening it must redden that test.
48
+ */
49
+ export const YIELD_DEPOSIT_PARITY_TOLERANCE_BPS = 30;
50
+ const uintString = z
51
+ .string()
52
+ .regex(/^[1-9]\d*$/, 'must be a positive decimal integer')
53
+ .refine((value) => BigInt(value) <= (1n << 256n) - 1n, 'must fit uint256');
54
+ export const PREPARE_YIELD_DEPOSIT_INPUT_SCHEMA = z
55
+ .object({
56
+ accountProfile: ACCOUNT_PROFILE_SCHEMA,
57
+ executableMarketId: z
58
+ .string()
59
+ .min(1)
60
+ .max(120)
61
+ .describe('The executable market id the READ half served (`GET /api/yield-copilot` rows with deployable:true), e.g. base-usdc-morpho-gauntlet-prime.'),
62
+ registryCommitment: z
63
+ .string()
64
+ .regex(/^sha256:[0-9a-f]{64}$/, 'must be the sha256:… registry commitment the READ half served')
65
+ .describe("The registry commitment served with that row. It must equal the commitment this server recomputes over the CURRENT record; a stale or foreign row is refused by name."),
66
+ amount: uintString.describe('Exact USDC amount to deposit, in atomic units (6 decimals).'),
67
+ slippage: z
68
+ .object({
69
+ maxBps: z.number().int().min(1).max(1_000),
70
+ })
71
+ .strict(),
72
+ client_ref: z.string().trim().min(1).max(128).optional(),
73
+ })
74
+ .strict();
75
+ const addressOut = z.string().regex(/^0x[0-9a-fA-F]{40}$/);
76
+ const uintOut = z.string().regex(/^\d+$/);
77
+ export const YIELD_DEPOSIT_PREVIEW_SCHEMA = z
78
+ .object({
79
+ market_id: z.string(),
80
+ venue: z.string(),
81
+ protocol: z.literal('MORPHO'),
82
+ chain_id: z.literal(8453),
83
+ vault: addressOut,
84
+ asset: addressOut,
85
+ /** The USDC deposited (atomic) — the cap's gross at submit is this same approve amount. */
86
+ amount: uintOut,
87
+ /** Shares the route quotes for `amount` (18-decimal vault shares). */
88
+ expected_shares: uintOut,
89
+ /** The on-chain floor the router enforces; what `prepareInput.slippage.minAmountOut` carries. */
90
+ min_shares: uintOut,
91
+ /** The vault's own `previewDeposit(amount)` at prepare time. */
92
+ preview_deposit_shares: uintOut,
93
+ /** `preview_deposit_shares − expected_shares`, in bps of the preview; ≤ the pinned tolerance. */
94
+ parity_shortfall_bps: z.number().int().min(0),
95
+ parity_tolerance_bps: z.literal(YIELD_DEPOSIT_PARITY_TOLERANCE_BPS),
96
+ /** The fee lines the router attached to the quote, as LI.FI names them (amount in USD). */
97
+ quoted_fees: z.array(z.object({ name: z.string(), amount_usd: z.string() }).strict()),
98
+ /** The route's own gas estimate for the call step, in USD, when LI.FI reported one. */
99
+ quoted_gas_usd: z.string().optional(),
100
+ route_semantics: YIELD_ROUTE_SEMANTICS_SCHEMA,
101
+ })
102
+ .strict();
103
+ export const PREPARE_YIELD_DEPOSIT_OUTPUT_SCHEMA = z
104
+ .object({
105
+ /** The EXACT `otto_prepare_swap` envelope — submit it unchanged. */
106
+ envelope: EXECUTION_ENVELOPE_SCHEMA,
107
+ /**
108
+ * The EXACT `otto_prepare_swap` request that produced the envelope, with `slippage.minAmountOut` FILLED
109
+ * from the quote's floor — the pair `otto_submit_under_delegation` takes, verbatim.
110
+ */
111
+ prepareInput: PREPARE_SWAP_INPUT_SCHEMA,
112
+ preview: YIELD_DEPOSIT_PREVIEW_SCHEMA,
113
+ registry_commitment: z.string().regex(/^sha256:[0-9a-f]{64}$/),
114
+ })
115
+ .strict();
116
+ export const YIELD_DEPOSIT_TOOL_DEFINITION = Object.freeze({
117
+ name: YIELD_DEPOSIT_TOOL_NAME,
118
+ title: 'Prepare a Yield Copilot vault deposit (Morpho USDC on Base) as a delegable swap pair',
119
+ description: "Prepare the EXACT otto_prepare_swap pair (envelope + prepareInput) that deposits USDC into one of the executable Morpho vaults from the Yield Copilot registry, as a LI.FI position-acquisition route (which may buy shares or compose a protocol deposit) whose output token is the vault's ERC-4626 share token and whose receiver is the signing account. The vault comes from the registry row named by executableMarketId and is never an input; the caller's registryCommitment must equal the commitment recomputed over the current record. The quoted shares are checked against the vault's own previewDeposit and refused when they fall short by more than the pinned tolerance. Returns the pair unchanged plus a preview; never signs or submits — submit the pair through otto_submit_under_delegation under the end user's per-swap cap.",
120
+ inputSchema: PREPARE_YIELD_DEPOSIT_INPUT_SCHEMA,
121
+ outputSchema: PREPARE_YIELD_DEPOSIT_OUTPUT_SCHEMA,
122
+ });
123
+ //# sourceMappingURL=yield-deposit-definition.js.map
@@ -0,0 +1,16 @@
1
+ import { type ExecutableYieldMarket } from './executable-yield-markets.js';
2
+ import { type ExecutionToolRuntime } from './execution-tools.js';
3
+ import { type PrepareYieldDepositInput, type PrepareYieldDepositOutput } from './yield-deposit-definition.js';
4
+ type MorphoMarket = Extract<ExecutableYieldMarket, {
5
+ readonly protocol: 'MORPHO';
6
+ }>;
7
+ /** Steps 2: the registry row, pinned to the caller's commitment and to Base / USDC / MORPHO. */
8
+ export declare function resolveYieldDepositMarket(input: Pick<PrepareYieldDepositInput, 'executableMarketId' | 'registryCommitment'>): MorphoMarket;
9
+ /**
10
+ * Step 4, as a pure function: the shortfall of the quoted shares against the vault's own preview, in
11
+ * basis points of the preview (0 when the route quotes at or above the preview). Refuses past the
12
+ * pinned tolerance.
13
+ */
14
+ export declare function assertDepositParity(previewShares: bigint, quotedShares: bigint): number;
15
+ export declare function prepareYieldDeposit(runtime: ExecutionToolRuntime, rawInput: unknown, signal?: AbortSignal): Promise<PrepareYieldDepositOutput>;
16
+ export {};