@lifi/composer-sdk 0.0.1-alpha → 0.2.0-staging.3
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/README.md +37 -1
- package/dist/authoring/signatureArgs.cjs +2 -2
- package/dist/authoring/signatureArgs.cjs.map +1 -1
- package/dist/authoring/signatureArgs.js +2 -2
- package/dist/authoring/signatureArgs.js.map +1 -1
- package/dist/client.cjs +2 -2
- package/dist/client.cjs.map +1 -1
- package/dist/client.js +2 -2
- package/dist/client.js.map +1 -1
- package/dist/generated/config.generated.cjs.map +1 -1
- package/dist/generated/config.generated.d.cts +307 -16
- package/dist/generated/config.generated.d.ts +307 -16
- package/dist/generated/guards.generated.cjs +6 -0
- package/dist/generated/guards.generated.cjs.map +1 -1
- package/dist/generated/guards.generated.d.cts +1 -1
- package/dist/generated/guards.generated.d.ts +1 -1
- package/dist/generated/guards.generated.js +5 -0
- package/dist/generated/guards.generated.js.map +1 -1
- package/dist/generated/materialisers.generated.cjs +8 -2
- package/dist/generated/materialisers.generated.cjs.map +1 -1
- package/dist/generated/materialisers.generated.d.cts +1 -1
- package/dist/generated/materialisers.generated.d.ts +1 -1
- package/dist/generated/materialisers.generated.js +6 -1
- package/dist/generated/materialisers.generated.js.map +1 -1
- package/dist/generated/operations.generated.cjs +84 -14
- package/dist/generated/operations.generated.cjs.map +1 -1
- package/dist/generated/operations.generated.d.cts +208 -13
- package/dist/generated/operations.generated.d.ts +208 -13
- package/dist/generated/operations.generated.js +84 -14
- package/dist/generated/operations.generated.js.map +1 -1
- package/dist/guards.generated-BPLFwe7y.d.ts +19 -0
- package/dist/guards.generated-M3VAIevI.d.cts +19 -0
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/materialisers.generated-BfWJ-g7t.d.ts +29 -0
- package/dist/materialisers.generated-DaJRwiRe.d.cts +29 -0
- package/dist/run/inputs.cjs +8 -5
- package/dist/run/inputs.cjs.map +1 -1
- package/dist/run/inputs.d.cts +8 -0
- package/dist/run/inputs.d.ts +8 -0
- package/dist/run/inputs.js +8 -5
- package/dist/run/inputs.js.map +1 -1
- package/dist/sdk.cjs +1 -0
- package/dist/sdk.cjs.map +1 -1
- package/dist/sdk.js +1 -0
- package/dist/sdk.js.map +1 -1
- package/package.json +16 -7
- package/src/authoring/signatureArgs.ts +2 -2
- package/src/client.ts +1 -1
- package/src/examples/aaveClaimRewards.ts +80 -0
- package/src/examples/aaveRepay.ts +69 -0
- package/src/examples/aaveRepayWithATokens.ts +81 -0
- package/src/examples/aaveSetEMode.ts +68 -0
- package/src/examples/run.ts +41 -4
- package/src/examples/swapToRecipient.ts +0 -19
- package/src/examples/swapWithFee.ts +59 -0
- package/src/generated/config.generated.ts +364 -18
- package/src/generated/guards.generated.ts +12 -1
- package/src/generated/materialisers.generated.ts +24 -12
- package/src/generated/operations.generated.ts +373 -13
- package/src/run/inputs.ts +16 -5
- package/src/sdk.ts +1 -0
- package/dist/guards.generated-DKKDKREA.d.ts +0 -14
- package/dist/guards.generated-hrQ1KPNv.d.cts +0 -14
- package/dist/materialisers.generated-BsA1uDW8.d.ts +0 -24
- package/dist/materialisers.generated-nMxTAaVi.d.cts +0 -24
|
@@ -11,6 +11,16 @@ export interface CoreSplitConfig {
|
|
|
11
11
|
* a positive number
|
|
12
12
|
*/
|
|
13
13
|
export type Positive = number;
|
|
14
|
+
/**
|
|
15
|
+
* a string at most 64 character(s) long
|
|
16
|
+
*/
|
|
17
|
+
export type MaxLength64 = string;
|
|
18
|
+
/**
|
|
19
|
+
* an array of at most 50 item(s)
|
|
20
|
+
*
|
|
21
|
+
* @maxItems 50
|
|
22
|
+
*/
|
|
23
|
+
export type MaxItems50 = MaxLength64[];
|
|
14
24
|
|
|
15
25
|
export interface LifiSwapConfig {
|
|
16
26
|
resourceOut:
|
|
@@ -38,19 +48,11 @@ export interface LifiSwapConfig {
|
|
|
38
48
|
reduceEveryMs: number;
|
|
39
49
|
}[];
|
|
40
50
|
};
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
kind: 'native';
|
|
47
|
-
chainId: Positive;
|
|
48
|
-
}
|
|
49
|
-
| {
|
|
50
|
-
kind: 'erc20';
|
|
51
|
-
token: Address;
|
|
52
|
-
chainId: Positive;
|
|
53
|
-
};
|
|
51
|
+
exchanges?: {
|
|
52
|
+
allow?: MaxItems50;
|
|
53
|
+
deny?: MaxItems50;
|
|
54
|
+
prefer?: MaxItems50;
|
|
55
|
+
};
|
|
54
56
|
}
|
|
55
57
|
|
|
56
58
|
export interface CoreBpsDownConfig {
|
|
@@ -120,22 +122,357 @@ export interface CoreAsResourceConfig {
|
|
|
120
122
|
};
|
|
121
123
|
}
|
|
122
124
|
|
|
123
|
-
export interface
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
125
|
+
export interface AaveBorrowConfig {
|
|
126
|
+
pool: string;
|
|
127
|
+
asset: string;
|
|
128
|
+
variableDebtToken: string;
|
|
129
|
+
amount: IntegerStringInput;
|
|
130
|
+
referralId?: number;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export type AaveRepayConfig =
|
|
134
|
+
| {
|
|
135
|
+
pool: string;
|
|
136
|
+
mode: 'exact';
|
|
137
|
+
}
|
|
138
|
+
| {
|
|
139
|
+
pool: string;
|
|
140
|
+
mode: 'max';
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
export interface AaveRepayWithATokensConfig {
|
|
144
|
+
pool: string;
|
|
145
|
+
asset: string;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface AaveClaimRewardsConfig {
|
|
149
|
+
rewardsController: string;
|
|
150
|
+
assets: string[];
|
|
151
|
+
reward: string;
|
|
152
|
+
amount?: IntegerStringInput;
|
|
153
|
+
to?: string;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* a number between 0 and 255
|
|
158
|
+
*/
|
|
159
|
+
export type Between0255 = number;
|
|
160
|
+
|
|
161
|
+
export interface AaveSetEModeConfig {
|
|
162
|
+
pool: string;
|
|
163
|
+
category: Between0255;
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export interface AaveGetHealthFactorConfig {
|
|
167
|
+
pool: string;
|
|
168
|
+
user?: string;
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export type MorphoBlueSupplyCollateralConfig =
|
|
172
|
+
| (
|
|
173
|
+
| {
|
|
174
|
+
morpho?: string;
|
|
175
|
+
onBehalfOf?: string;
|
|
176
|
+
mode: 'exact';
|
|
177
|
+
/**
|
|
178
|
+
* a string matching the pattern ^0x[0-9a-fA-F]{64}$
|
|
179
|
+
*/
|
|
180
|
+
marketId: string;
|
|
181
|
+
}
|
|
182
|
+
| {
|
|
183
|
+
morpho?: string;
|
|
184
|
+
onBehalfOf?: string;
|
|
185
|
+
mode: 'exact';
|
|
186
|
+
marketParams: {
|
|
187
|
+
loanToken: string;
|
|
188
|
+
collateralToken: string;
|
|
189
|
+
oracle: string;
|
|
190
|
+
irm: string;
|
|
191
|
+
lltv: string;
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
| (
|
|
196
|
+
| {
|
|
197
|
+
morpho?: string;
|
|
198
|
+
onBehalfOf?: string;
|
|
199
|
+
mode: 'all';
|
|
200
|
+
/**
|
|
201
|
+
* a string matching the pattern ^0x[0-9a-fA-F]{64}$
|
|
202
|
+
*/
|
|
203
|
+
marketId: string;
|
|
204
|
+
}
|
|
205
|
+
| {
|
|
206
|
+
morpho?: string;
|
|
207
|
+
onBehalfOf?: string;
|
|
208
|
+
mode: 'all';
|
|
209
|
+
marketParams: {
|
|
210
|
+
loanToken: string;
|
|
211
|
+
collateralToken: string;
|
|
212
|
+
oracle: string;
|
|
213
|
+
irm: string;
|
|
214
|
+
lltv: string;
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
);
|
|
218
|
+
|
|
219
|
+
export type MorphoBlueWithdrawCollateralConfig =
|
|
220
|
+
| {
|
|
221
|
+
morpho?: string;
|
|
222
|
+
amount: IntegerStringInput;
|
|
223
|
+
onBehalfOf?: string;
|
|
224
|
+
receiver?: string;
|
|
225
|
+
/**
|
|
226
|
+
* a string matching the pattern ^0x[0-9a-fA-F]{64}$
|
|
227
|
+
*/
|
|
228
|
+
marketId: string;
|
|
229
|
+
}
|
|
230
|
+
| {
|
|
231
|
+
morpho?: string;
|
|
232
|
+
amount: IntegerStringInput;
|
|
233
|
+
onBehalfOf?: string;
|
|
234
|
+
receiver?: string;
|
|
235
|
+
marketParams: {
|
|
236
|
+
loanToken: string;
|
|
237
|
+
collateralToken: string;
|
|
238
|
+
oracle: string;
|
|
239
|
+
irm: string;
|
|
240
|
+
lltv: string;
|
|
241
|
+
};
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
export type MorphoBlueBorrowConfig =
|
|
245
|
+
| {
|
|
246
|
+
morpho?: string;
|
|
247
|
+
amount: IntegerStringInput;
|
|
248
|
+
onBehalfOf?: string;
|
|
249
|
+
receiver?: string;
|
|
250
|
+
/**
|
|
251
|
+
* a string matching the pattern ^0x[0-9a-fA-F]{64}$
|
|
252
|
+
*/
|
|
253
|
+
marketId: string;
|
|
254
|
+
}
|
|
255
|
+
| {
|
|
256
|
+
morpho?: string;
|
|
257
|
+
amount: IntegerStringInput;
|
|
258
|
+
onBehalfOf?: string;
|
|
259
|
+
receiver?: string;
|
|
260
|
+
marketParams: {
|
|
261
|
+
loanToken: string;
|
|
262
|
+
collateralToken: string;
|
|
263
|
+
oracle: string;
|
|
264
|
+
irm: string;
|
|
265
|
+
lltv: string;
|
|
266
|
+
};
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
export type MorphoBlueRepayConfig =
|
|
270
|
+
| (
|
|
271
|
+
| {
|
|
272
|
+
morpho?: string;
|
|
273
|
+
mode: 'exact';
|
|
274
|
+
/**
|
|
275
|
+
* a string matching the pattern ^0x[0-9a-fA-F]{64}$
|
|
276
|
+
*/
|
|
277
|
+
marketId: string;
|
|
278
|
+
}
|
|
279
|
+
| {
|
|
280
|
+
morpho?: string;
|
|
281
|
+
mode: 'exact';
|
|
282
|
+
marketParams: {
|
|
283
|
+
loanToken: string;
|
|
284
|
+
collateralToken: string;
|
|
285
|
+
oracle: string;
|
|
286
|
+
irm: string;
|
|
287
|
+
lltv: string;
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
)
|
|
291
|
+
| (
|
|
292
|
+
| {
|
|
293
|
+
morpho?: string;
|
|
294
|
+
mode: 'max';
|
|
295
|
+
/**
|
|
296
|
+
* a string matching the pattern ^0x[0-9a-fA-F]{64}$
|
|
297
|
+
*/
|
|
298
|
+
marketId: string;
|
|
299
|
+
}
|
|
300
|
+
| {
|
|
301
|
+
morpho?: string;
|
|
302
|
+
mode: 'max';
|
|
303
|
+
marketParams: {
|
|
304
|
+
loanToken: string;
|
|
305
|
+
collateralToken: string;
|
|
306
|
+
oracle: string;
|
|
307
|
+
irm: string;
|
|
308
|
+
lltv: string;
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
export type MorphoBlueSupplyConfig =
|
|
314
|
+
| {
|
|
315
|
+
morpho?: string;
|
|
316
|
+
onBehalfOf?: string;
|
|
317
|
+
/**
|
|
318
|
+
* a string matching the pattern ^0x[0-9a-fA-F]{64}$
|
|
319
|
+
*/
|
|
320
|
+
marketId: string;
|
|
321
|
+
}
|
|
322
|
+
| {
|
|
323
|
+
morpho?: string;
|
|
324
|
+
onBehalfOf?: string;
|
|
325
|
+
marketParams: {
|
|
326
|
+
loanToken: string;
|
|
327
|
+
collateralToken: string;
|
|
328
|
+
oracle: string;
|
|
329
|
+
irm: string;
|
|
330
|
+
lltv: string;
|
|
331
|
+
};
|
|
332
|
+
};
|
|
333
|
+
|
|
334
|
+
export type MorphoBlueWithdrawConfig =
|
|
335
|
+
| (
|
|
336
|
+
| {
|
|
337
|
+
morpho?: string;
|
|
338
|
+
mode: 'exact';
|
|
339
|
+
amount: IntegerStringInput;
|
|
340
|
+
onBehalfOf?: string;
|
|
341
|
+
receiver?: string;
|
|
342
|
+
/**
|
|
343
|
+
* a string matching the pattern ^0x[0-9a-fA-F]{64}$
|
|
344
|
+
*/
|
|
345
|
+
marketId: string;
|
|
346
|
+
}
|
|
347
|
+
| {
|
|
348
|
+
morpho?: string;
|
|
349
|
+
mode: 'exact';
|
|
350
|
+
amount: IntegerStringInput;
|
|
351
|
+
onBehalfOf?: string;
|
|
352
|
+
receiver?: string;
|
|
353
|
+
marketParams: {
|
|
354
|
+
loanToken: string;
|
|
355
|
+
collateralToken: string;
|
|
356
|
+
oracle: string;
|
|
357
|
+
irm: string;
|
|
358
|
+
lltv: string;
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
)
|
|
362
|
+
| (
|
|
363
|
+
| {
|
|
364
|
+
morpho?: string;
|
|
365
|
+
mode: 'max';
|
|
366
|
+
onBehalfOf?: string;
|
|
367
|
+
receiver?: string;
|
|
368
|
+
/**
|
|
369
|
+
* a string matching the pattern ^0x[0-9a-fA-F]{64}$
|
|
370
|
+
*/
|
|
371
|
+
marketId: string;
|
|
372
|
+
}
|
|
373
|
+
| {
|
|
374
|
+
morpho?: string;
|
|
375
|
+
mode: 'max';
|
|
376
|
+
onBehalfOf?: string;
|
|
377
|
+
receiver?: string;
|
|
378
|
+
marketParams: {
|
|
379
|
+
loanToken: string;
|
|
380
|
+
collateralToken: string;
|
|
381
|
+
oracle: string;
|
|
382
|
+
irm: string;
|
|
383
|
+
lltv: string;
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
);
|
|
387
|
+
|
|
388
|
+
export type MorphoBlueGetPositionConfig =
|
|
389
|
+
| {
|
|
390
|
+
morpho?: string;
|
|
391
|
+
user?: string;
|
|
392
|
+
/**
|
|
393
|
+
* a string matching the pattern ^0x[0-9a-fA-F]{64}$
|
|
394
|
+
*/
|
|
395
|
+
marketId: string;
|
|
396
|
+
}
|
|
397
|
+
| {
|
|
398
|
+
morpho?: string;
|
|
399
|
+
user?: string;
|
|
400
|
+
marketParams: {
|
|
401
|
+
loanToken: string;
|
|
402
|
+
collateralToken: string;
|
|
403
|
+
oracle: string;
|
|
404
|
+
irm: string;
|
|
405
|
+
lltv: string;
|
|
406
|
+
};
|
|
407
|
+
};
|
|
408
|
+
|
|
409
|
+
export interface LifiFlashloanRepayConfig {
|
|
410
|
+
leg: string;
|
|
411
|
+
fee?: string;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export interface LifiZapConfig {
|
|
415
|
+
resourceOut:
|
|
416
|
+
| {
|
|
417
|
+
kind: 'native';
|
|
418
|
+
chainId: Positive;
|
|
419
|
+
}
|
|
420
|
+
| {
|
|
421
|
+
kind: 'erc20';
|
|
422
|
+
token: Address;
|
|
423
|
+
chainId: Positive;
|
|
424
|
+
};
|
|
127
425
|
}
|
|
128
426
|
|
|
427
|
+
/**
|
|
428
|
+
* a non-negative number
|
|
429
|
+
*/
|
|
430
|
+
export type GreaterThanOrEqualTo0 = number;
|
|
129
431
|
/**
|
|
130
432
|
* a number between 0 and 10000
|
|
131
433
|
*/
|
|
132
434
|
export type Between010000 = number;
|
|
133
435
|
|
|
436
|
+
export interface ParaswapBuyConfig {
|
|
437
|
+
resourceOut:
|
|
438
|
+
| {
|
|
439
|
+
kind: 'native';
|
|
440
|
+
chainId: Positive;
|
|
441
|
+
}
|
|
442
|
+
| {
|
|
443
|
+
kind: 'erc20';
|
|
444
|
+
token: Address;
|
|
445
|
+
chainId: Positive;
|
|
446
|
+
};
|
|
447
|
+
exactAmountOut: string;
|
|
448
|
+
srcDecimals: GreaterThanOrEqualTo0;
|
|
449
|
+
destDecimals: GreaterThanOrEqualTo0;
|
|
450
|
+
maxSlippageBps?: Between010000;
|
|
451
|
+
partner?: string;
|
|
452
|
+
partnerAddress?: string;
|
|
453
|
+
/**
|
|
454
|
+
* Integrator fee in basis points; non-negative integer string capped at 9000.
|
|
455
|
+
*/
|
|
456
|
+
partnerFeeBps?: string;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
export interface CorePeekConfig {
|
|
460
|
+
target: Address;
|
|
461
|
+
functionSignature: string;
|
|
462
|
+
args?: string[];
|
|
463
|
+
}
|
|
464
|
+
|
|
134
465
|
export interface SlippageGuardConfig {
|
|
135
466
|
port: string;
|
|
136
467
|
bps: Between010000;
|
|
137
468
|
}
|
|
138
469
|
|
|
470
|
+
export interface CoreNumericInvariantGuardConfig {
|
|
471
|
+
port: string;
|
|
472
|
+
op: 'gte' | 'gt' | 'lte' | 'lt' | 'eq' | 'neq';
|
|
473
|
+
threshold: IntegerStringInput;
|
|
474
|
+
}
|
|
475
|
+
|
|
139
476
|
export interface BalanceOfMaterialiserConfig {
|
|
140
477
|
owner: Address;
|
|
141
478
|
}
|
|
@@ -146,8 +483,12 @@ export type DirectDepositMaterialiserConfig =
|
|
|
146
483
|
allowNonExact?: false;
|
|
147
484
|
}
|
|
148
485
|
| {
|
|
149
|
-
amount
|
|
486
|
+
amount: IntegerStringInput;
|
|
150
487
|
allowNonExact: true;
|
|
488
|
+
}
|
|
489
|
+
| {
|
|
490
|
+
allowNonExact: true;
|
|
491
|
+
simAmount?: string;
|
|
151
492
|
};
|
|
152
493
|
|
|
153
494
|
export interface CallMaterialiserConfig {
|
|
@@ -155,6 +496,11 @@ export interface CallMaterialiserConfig {
|
|
|
155
496
|
calldata: string;
|
|
156
497
|
}
|
|
157
498
|
|
|
499
|
+
export interface FlashloanMaterialiserConfig {
|
|
500
|
+
providerKind: 'aave-v3' | 'erc3156' | 'balancer-v2' | 'morpho-blue';
|
|
501
|
+
amount: IntegerStringInput;
|
|
502
|
+
}
|
|
503
|
+
|
|
158
504
|
export interface Erc20BalancePreconditionConfig {
|
|
159
505
|
wallet: Address;
|
|
160
506
|
token: Address;
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
import type { TypedGuard } from '../types.js';
|
|
5
5
|
|
|
6
|
-
import type {
|
|
6
|
+
import type {
|
|
7
|
+
CoreNumericInvariantGuardConfig,
|
|
8
|
+
SlippageGuardConfig,
|
|
9
|
+
} from './config.generated.js';
|
|
7
10
|
|
|
8
11
|
/** Assert that output amounts are within a slippage tolerance in basis points */
|
|
9
12
|
export const slippage = <P extends string>(
|
|
@@ -12,3 +15,11 @@ export const slippage = <P extends string>(
|
|
|
12
15
|
kind: 'slippage',
|
|
13
16
|
...config,
|
|
14
17
|
});
|
|
18
|
+
|
|
19
|
+
/** Assert a numeric (uint256) handle output of the target op satisfies a comparison against a constant threshold. Emits one IR1 binary invariant; reverts the run on violation. */
|
|
20
|
+
export const coreNumericInvariant = <P extends string>(
|
|
21
|
+
config: Omit<CoreNumericInvariantGuardConfig, 'port'> & { port: P },
|
|
22
|
+
): TypedGuard<P> => ({
|
|
23
|
+
kind: 'core.numericInvariant',
|
|
24
|
+
...config,
|
|
25
|
+
});
|
|
@@ -7,38 +7,50 @@ import type {
|
|
|
7
7
|
} from '@lifi/compose-spec';
|
|
8
8
|
|
|
9
9
|
import type {
|
|
10
|
-
BalanceOfMaterialiserConfig,
|
|
11
|
-
CallMaterialiserConfig,
|
|
12
|
-
DirectDepositMaterialiserConfig,
|
|
10
|
+
BalanceOfMaterialiserConfig as BalanceOfMaterialiserConfigSchema,
|
|
11
|
+
CallMaterialiserConfig as CallMaterialiserConfigSchema,
|
|
12
|
+
DirectDepositMaterialiserConfig as DirectDepositMaterialiserConfigSchema,
|
|
13
|
+
FlashloanMaterialiserConfig as FlashloanMaterialiserConfigSchema,
|
|
13
14
|
} from './config.generated.js';
|
|
14
15
|
|
|
15
|
-
export type
|
|
16
|
-
MaterialiserConfigOf<
|
|
16
|
+
export type BalanceOfMaterialiserConfig =
|
|
17
|
+
MaterialiserConfigOf<BalanceOfMaterialiserConfigSchema>;
|
|
17
18
|
|
|
18
19
|
/** Read the on-chain token balance of an address as the input amount — accepts: resource */
|
|
19
20
|
export const balanceOf = (
|
|
20
|
-
config:
|
|
21
|
+
config: BalanceOfMaterialiserConfig,
|
|
21
22
|
): MaterialiserInput => ({
|
|
22
23
|
kind: 'balanceOf',
|
|
23
24
|
...config,
|
|
24
25
|
});
|
|
25
26
|
|
|
26
|
-
export type
|
|
27
|
-
MaterialiserConfigOf<
|
|
27
|
+
export type DirectDepositMaterialiserConfig =
|
|
28
|
+
MaterialiserConfigOf<DirectDepositMaterialiserConfigSchema>;
|
|
28
29
|
|
|
29
30
|
/** Deposit tokens into the VM — native via msg.value, ERC-20 via transferFrom — accepts: resource */
|
|
30
31
|
export const directDeposit = (
|
|
31
|
-
config:
|
|
32
|
+
config: DirectDepositMaterialiserConfig,
|
|
32
33
|
): MaterialiserInput => ({
|
|
33
34
|
kind: 'directDeposit',
|
|
34
35
|
...config,
|
|
35
36
|
});
|
|
36
37
|
|
|
37
|
-
export type
|
|
38
|
-
MaterialiserConfigOf<
|
|
38
|
+
export type CallMaterialiserConfig =
|
|
39
|
+
MaterialiserConfigOf<CallMaterialiserConfigSchema>;
|
|
39
40
|
|
|
40
41
|
/** Execute an arbitrary contract call and measure the resulting token balance diff — accepts: resource */
|
|
41
|
-
export const call = (config:
|
|
42
|
+
export const call = (config: CallMaterialiserConfig): MaterialiserInput => ({
|
|
42
43
|
kind: 'call',
|
|
43
44
|
...config,
|
|
44
45
|
});
|
|
46
|
+
|
|
47
|
+
export type FlashloanMaterialiserConfig =
|
|
48
|
+
MaterialiserConfigOf<FlashloanMaterialiserConfigSchema>;
|
|
49
|
+
|
|
50
|
+
/** Borrow tokens from a flashloan provider; amount becomes a register populated by the proxy at callback time — accepts: resource */
|
|
51
|
+
export const flashloan = (
|
|
52
|
+
config: FlashloanMaterialiserConfig,
|
|
53
|
+
): MaterialiserInput => ({
|
|
54
|
+
kind: 'flashloan',
|
|
55
|
+
...config,
|
|
56
|
+
});
|