@crediolabs/policy-synth 0.1.7 → 0.1.8

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.
@@ -250,6 +250,32 @@ function appendProtocolSpecificConstraints(ozConstraints, interpreterConstraints
250
250
  }
251
251
  }
252
252
  }
253
+ // Blend submit / claim: the `to` arg is the beneficiary - it receives the
254
+ // resulting position shares on `submit` and the claimed tokens on `claim`.
255
+ // That is the same role as the SEP-41 recipient above and the SoroSwap swap
256
+ // recipient below, so it is pinned to the recorded address the same way:
257
+ // without it a policy scoped to a pool and method still lets an agent send
258
+ // the proceeds anywhere. `from` and `spender` are deliberately NOT pinned -
259
+ // the call already requires their authorisation, so binding them adds no
260
+ // restriction the chain is not already enforcing.
261
+ if (protocol.protocol === 'blend' && (protocol.fn === 'submit' || protocol.fn === 'claim')) {
262
+ // Index 2 in both signatures: submit(from, spender, to, requests) and
263
+ // claim(from, reserve_token_ids, to).
264
+ const toArg = topLevel.args[2];
265
+ if (toArg && toArg.type === 'address') {
266
+ const cond = {
267
+ op: 'in',
268
+ selector: { kind: 'arg', argIndex: 2, scalarType: 'address' },
269
+ values: [toArg.value],
270
+ };
271
+ if (interpreterEnabled) {
272
+ interpreterConstraints.push(cond);
273
+ }
274
+ else {
275
+ ozConstraints.push(cond);
276
+ }
277
+ }
278
+ }
253
279
  // SoroSwap: the recorded hop path -> eq_seq on the path arg (call_arg[2]).
254
280
  // The interpreter adapter is the ONLY way to express an exact ordered
255
281
  // sequence (OZ built-ins cannot). Element order is preserved verbatim.
@@ -253,6 +253,32 @@ function appendProtocolSpecificConstraints(ozConstraints, interpreterConstraints
253
253
  }
254
254
  }
255
255
  }
256
+ // Blend submit / claim: the `to` arg is the beneficiary - it receives the
257
+ // resulting position shares on `submit` and the claimed tokens on `claim`.
258
+ // That is the same role as the SEP-41 recipient above and the SoroSwap swap
259
+ // recipient below, so it is pinned to the recorded address the same way:
260
+ // without it a policy scoped to a pool and method still lets an agent send
261
+ // the proceeds anywhere. `from` and `spender` are deliberately NOT pinned -
262
+ // the call already requires their authorisation, so binding them adds no
263
+ // restriction the chain is not already enforcing.
264
+ if (protocol.protocol === 'blend' && (protocol.fn === 'submit' || protocol.fn === 'claim')) {
265
+ // Index 2 in both signatures: submit(from, spender, to, requests) and
266
+ // claim(from, reserve_token_ids, to).
267
+ const toArg = topLevel.args[2];
268
+ if (toArg && toArg.type === 'address') {
269
+ const cond = {
270
+ op: 'in',
271
+ selector: { kind: 'arg', argIndex: 2, scalarType: 'address' },
272
+ values: [toArg.value],
273
+ };
274
+ if (interpreterEnabled) {
275
+ interpreterConstraints.push(cond);
276
+ }
277
+ else {
278
+ ozConstraints.push(cond);
279
+ }
280
+ }
281
+ }
256
282
  // SoroSwap: the recorded hop path -> eq_seq on the path arg (call_arg[2]).
257
283
  // The interpreter adapter is the ONLY way to express an exact ordered
258
284
  // sequence (OZ built-ins cannot). Element order is preserved verbatim.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crediolabs/policy-synth",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "license": "MIT",
5
5
  "description": "Off-chain TypeScript synthesis core for the OZ Accounts Policy Builder. Records Soroban transactions, synthesises the minimal policy that permits exactly that flow, verifies it, and returns an unsigned install transaction.",
6
6
  "type": "module",
@@ -355,6 +355,32 @@ function appendProtocolSpecificConstraints(
355
355
  }
356
356
  }
357
357
 
358
+ // Blend submit / claim: the `to` arg is the beneficiary - it receives the
359
+ // resulting position shares on `submit` and the claimed tokens on `claim`.
360
+ // That is the same role as the SEP-41 recipient above and the SoroSwap swap
361
+ // recipient below, so it is pinned to the recorded address the same way:
362
+ // without it a policy scoped to a pool and method still lets an agent send
363
+ // the proceeds anywhere. `from` and `spender` are deliberately NOT pinned -
364
+ // the call already requires their authorisation, so binding them adds no
365
+ // restriction the chain is not already enforcing.
366
+ if (protocol.protocol === 'blend' && (protocol.fn === 'submit' || protocol.fn === 'claim')) {
367
+ // Index 2 in both signatures: submit(from, spender, to, requests) and
368
+ // claim(from, reserve_token_ids, to).
369
+ const toArg = topLevel.args[2]
370
+ if (toArg && toArg.type === 'address') {
371
+ const cond: IRCondition = {
372
+ op: 'in',
373
+ selector: { kind: 'arg', argIndex: 2, scalarType: 'address' },
374
+ values: [toArg.value],
375
+ }
376
+ if (interpreterEnabled) {
377
+ interpreterConstraints.push(cond)
378
+ } else {
379
+ ozConstraints.push(cond)
380
+ }
381
+ }
382
+ }
383
+
358
384
  // SoroSwap: the recorded hop path -> eq_seq on the path arg (call_arg[2]).
359
385
  // The interpreter adapter is the ONLY way to express an exact ordered
360
386
  // sequence (OZ built-ins cannot). Element order is preserved verbatim.