|
2 | 2 | * V1 vault state query + Withdraw-Zero TX builder + CommunitySunset |
3 | 3 | * (Layer 3 90-day dead-man-switch) TX builder. |
4 | 4 | * |
5 | | - * V1 differs from V9.x / V10: |
6 | | - * - 29-field VaultDatum (added: liqwid_positions, non_deposit_value, |
| 5 | + * V1 contract surface: |
| 6 | + * - 29-field VaultDatum (liqwid_positions, non_deposit_value, |
7 | 7 | * last_realloc_time, last_fee_update_time, last_ada_swap_time, |
8 | 8 | * keeper_fee_bps, gov_fee_bps, max_slippage_bps, min_swap_peg_bps, |
9 | 9 | * community_sunset_triggered) |
10 | | - * - Withdraw redeemer: Constr(1, [shares, receiver, receiver_output_idx]) |
11 | | - * (V9 was Constr(1, [shares, receiver]) — 2 fields; V1 added |
12 | | - * receiver_output_idx to defend against R48 M-1 anti-double-satisfaction) |
13 | | - * - Withdraw routes through `vault_user` staking validator (V9 used |
14 | | - * `vault_core`; V1 split user-flow into `vault_user` + `vault_keeper_hot`) |
15 | | - * - vault_proxy.UseUser = Constr(0, []) (was UseCore) |
16 | | - * - vault_nft_policy is a compile-time anchor (R55), not a datum field; |
| 10 | + * - Withdraw redeemer: Constr(1, [shares, receiver, receiver_output_idx]) — |
| 11 | + * receiver_output_idx pins the payout output index, defending against |
| 12 | + * output double-satisfaction |
| 13 | + * - Withdraw routes through the `vault_user` staking validator (the |
| 14 | + * user-flow validators are split into `vault_user` + `vault_keeper_hot`) |
| 15 | + * - vault_proxy.UseUser = Constr(0, []) |
| 16 | + * - vault_nft_policy is a compile-time anchor, not a datum field; |
17 | 17 | * vault is identified via NFT scan at proxy address |
18 | 18 | * - CommunitySunset = Constr(3, []) — permissionless redeemer; sets |
19 | 19 | * frozen=1 + community_sunset_triggered=1 after ≥90d operational inactivity |
20 | 20 | * |
21 | | - * V1 Withdraw TX structure (Withdraw-Zero pattern, identical 3 ref scripts |
22 | | - * to V9): |
| 21 | + * V1 Withdraw TX structure (Withdraw-Zero pattern, 3 ref scripts): |
23 | 22 | * - Spend vault UTXO at proxy address with ProxyRedeemer::UseUser |
24 | 23 | * - Withdraw 0 lovelace from `vault_user` reward address with |
25 | 24 | * VaultRedeemer::Withdraw(shares, receiver, receiver_output_idx) |
@@ -200,9 +199,6 @@ function hexToUint8Array(hex: string): Uint8Array { |
200 | 199 | * letting Lucid send hex text. |
201 | 200 | * 3. Return `{redeemer_tag, redeemer_index, ex_units}` shape that |
202 | 201 | * Lucid's downstream effect-ts switch expects. |
203 | | - * |
204 | | - * Mirrors `v1/reference/frontend/src/lib/lucidClient.ts::patchBlockfrostEvaluate` |
205 | | - * + `deploy/lib/blockfrostProvider.ts::patchEval`. |
206 | 202 | */ |
207 | 203 | function patchBlockfrostEvaluate(bf: any, baseUrl: string, key: string): void { |
208 | 204 | bf.evaluateTx = async (tx: string, _additionalUTxOs?: unknown) => { |
@@ -264,7 +260,7 @@ function patchBlockfrostEvaluate(bf: any, baseUrl: string, key: string): void { |
264 | 260 | * missing `drep_deposit` / `gov_action_deposit` fields). Replace its |
265 | 261 | * `getProtocolParameters` with a Conway-safe implementation that reads |
266 | 262 | * Blockfrost REST directly + applies fallbacks. Cached per provider |
267 | | - * instance. Mirrors `v1/keeper/src/agent/utils/blockfrostProtocolParamsPatch.ts`. |
| 263 | + * instance. |
268 | 264 | */ |
269 | 265 | function patchProtocolParamsConwaySafe(bf: any, url: string, key: string): void { |
270 | 266 | let cached: any = null |
@@ -353,7 +349,7 @@ export function hydrateRewardAddrs(cfg: V1Config): void { |
353 | 349 |
|
354 | 350 | /** |
355 | 351 | * Locate the unique vault UTXO at proxy.address by scanning for the |
356 | | - * one-shot vault NFT (R55 compile-time anchor). The deploy ceremony |
| 352 | + * one-shot vault NFT (compile-time anchor). The deploy ceremony |
357 | 353 | * mints exactly one such NFT and burns the mint window deadline, so |
358 | 354 | * there is provably one vault UTxO per proxy address. |
359 | 355 | */ |
@@ -589,7 +585,7 @@ export async function buildWithdrawTx( |
589 | 585 | // Build new datum — copy all 29 fields, mutate only accounting deltas. |
590 | 586 | const oldDatum = Data.from(state.rawDatum) as any |
591 | 587 | const newFields = [...(oldDatum.fields as unknown[])] |
592 | | - newFields[VF.total_deposited] = state.totalDeposited - quote.netWithdraw // R49 M-4 deferred-yield: subtract NET, not BASE |
| 588 | + newFields[VF.total_deposited] = state.totalDeposited - quote.netWithdraw // deferred-yield: subtract NET, not BASE |
593 | 589 | newFields[VF.total_shares] = state.totalShares - shares |
594 | 590 | newFields[VF.idle_buffer] = state.idleBuffer - quote.netWithdraw |
595 | 591 | const newDatumCbor = Data.to(new Constr(0, newFields as any) as any) |
|
0 commit comments