@@ -56,6 +56,10 @@ const createTestExtensions = (t, common: CommonSetup) => {
56
56
} ) ;
57
57
58
58
const localTransferVK = vowTools . makeVowKit < void > ( ) ;
59
+ const resolveLocalTransferV = ( ) => {
60
+ // pretend funds move from tmpSeat to poolAccount
61
+ localTransferVK . resolver . resolve ( ) ;
62
+ } ;
59
63
const mockZoeTools = Far ( 'MockZoeTools' , {
60
64
localTransfer ( ...args : Parameters < ZoeTools [ 'localTransfer' ] > ) {
61
65
console . log ( 'ZoeTools.localTransfer called with' , args ) ;
@@ -91,7 +95,7 @@ const createTestExtensions = (t, common: CommonSetup) => {
91
95
} ;
92
96
93
97
const borrowUnderlyingPK = makePromiseKit < void > ( ) ;
94
- const resolveBorrowUnderlyingP = async ( ) => {
98
+ const resolveBorrowUnderlyingP = ( ) => {
95
99
// pretend funds are allocated to tmpSeat provided to borrow
96
100
return borrowUnderlyingPK . resolve ( ) ;
97
101
} ;
@@ -123,6 +127,7 @@ const createTestExtensions = (t, common: CommonSetup) => {
123
127
setMockPoolBalance,
124
128
resolveBorrowUnderlyingP,
125
129
rejectBorrowUnderlyingP,
130
+ resolveLocalTransferV,
126
131
} ,
127
132
services : {
128
133
advancer,
@@ -151,15 +156,20 @@ test('updates status to ADVANCED in happy path', async t => {
151
156
extensions : {
152
157
services : { advancer, statusManager } ,
153
158
helpers : { inspectLogs } ,
154
- mocks : { mockPoolAccount, resolveBorrowUnderlyingP } ,
159
+ mocks : {
160
+ mockPoolAccount,
161
+ resolveBorrowUnderlyingP,
162
+ resolveLocalTransferV,
163
+ } ,
155
164
} ,
156
165
brands : { usdc } ,
157
166
} = t . context ;
158
167
159
168
const mockEvidence = MockCctpTxEvidences . AGORIC_PLUS_OSMO ( ) ;
160
169
const handleTxP = advancer . handleTransactionEvent ( mockEvidence ) ;
161
170
162
- await resolveBorrowUnderlyingP ( usdc . make ( mockEvidence . tx . amount ) ) ;
171
+ resolveBorrowUnderlyingP ( ) ;
172
+ resolveLocalTransferV ( ) ;
163
173
await eventLoopIteration ( ) ;
164
174
mockPoolAccount . transferVResolver . resolve ( ) ;
165
175
@@ -179,7 +189,7 @@ test('updates status to ADVANCED in happy path', async t => {
179
189
180
190
t . deepEqual ( inspectLogs ( 0 ) , [
181
191
'Advance transfer fulfilled' ,
182
- '{"amount":{"brand":"[Alleged: USDC brand]","value":"[150000000n ]"},"destination":{"chainId":"osmosis-1","encoding":"bech32","value":"osmo183dejcnmkka5dzcu9xw6mywq0p2m5peks28men"},"result":"[undefined]"}' ,
192
+ '{"amount":{"brand":"[Alleged: USDC brand]","value":"[149999899n ]"},"destination":{"chainId":"osmosis-1","encoding":"bech32","value":"osmo183dejcnmkka5dzcu9xw6mywq0p2m5peks28men"},"result":"[undefined]"}' ,
183
193
] ) ;
184
194
} ) ;
185
195
@@ -211,7 +221,7 @@ test('updates status to OBSERVED on insufficient pool funds', async t => {
211
221
212
222
t . deepEqual ( inspectLogs ( 0 ) , [
213
223
'Insufficient pool funds' ,
214
- 'Requested {"brand":"[Alleged: USDC brand]","value":"[195000000n ]"} but only have {"brand":"[Alleged: USDC brand]","value":"[1n]"}' ,
224
+ 'Requested {"brand":"[Alleged: USDC brand]","value":"[199999899n ]"} but only have {"brand":"[Alleged: USDC brand]","value":"[1n]"}' ,
215
225
] ) ;
216
226
} ) ;
217
227
@@ -290,15 +300,20 @@ test('does not update status on failed transfer', async t => {
290
300
extensions : {
291
301
services : { advancer, statusManager } ,
292
302
helpers : { inspectLogs } ,
293
- mocks : { mockPoolAccount, resolveBorrowUnderlyingP } ,
303
+ mocks : {
304
+ mockPoolAccount,
305
+ resolveBorrowUnderlyingP,
306
+ resolveLocalTransferV,
307
+ } ,
294
308
} ,
295
309
brands : { usdc } ,
296
310
} = t . context ;
297
311
298
312
const mockEvidence = MockCctpTxEvidences . AGORIC_PLUS_DYDX ( ) ;
299
313
const handleTxP = advancer . handleTransactionEvent ( mockEvidence ) ;
300
314
301
- await resolveBorrowUnderlyingP ( usdc . make ( mockEvidence . tx . amount ) ) ;
315
+ resolveBorrowUnderlyingP ( ) ;
316
+ resolveLocalTransferV ( ) ;
302
317
mockPoolAccount . transferVResolver . reject ( new Error ( 'simulated error' ) ) ;
303
318
304
319
await handleTxP ;
@@ -357,23 +372,27 @@ test('will not advance same txHash:chainId evidence twice', async t => {
357
372
extensions : {
358
373
services : { advancer } ,
359
374
helpers : { inspectLogs } ,
360
- mocks : { mockPoolAccount, resolveBorrowUnderlyingP } ,
375
+ mocks : {
376
+ mockPoolAccount,
377
+ resolveBorrowUnderlyingP,
378
+ resolveLocalTransferV,
379
+ } ,
361
380
} ,
362
- brands : { usdc } ,
363
381
} = t . context ;
364
382
365
383
const mockEvidence = MockCctpTxEvidences . AGORIC_PLUS_OSMO ( ) ;
366
384
367
385
// First attempt
368
386
const handleTxP = advancer . handleTransactionEvent ( mockEvidence ) ;
369
- await resolveBorrowUnderlyingP ( usdc . make ( mockEvidence . tx . amount ) ) ;
387
+ resolveBorrowUnderlyingP ( ) ;
388
+ resolveLocalTransferV ( ) ;
370
389
mockPoolAccount . transferVResolver . resolve ( ) ;
371
390
await handleTxP ;
372
391
await eventLoopIteration ( ) ;
373
392
374
393
t . deepEqual ( inspectLogs ( 0 ) , [
375
394
'Advance transfer fulfilled' ,
376
- '{"amount":{"brand":"[Alleged: USDC brand]","value":"[150000000n ]"},"destination":{"chainId":"osmosis-1","encoding":"bech32","value":"osmo183dejcnmkka5dzcu9xw6mywq0p2m5peks28men"},"result":"[undefined]"}' ,
395
+ '{"amount":{"brand":"[Alleged: USDC brand]","value":"[149999899n ]"},"destination":{"chainId":"osmosis-1","encoding":"bech32","value":"osmo183dejcnmkka5dzcu9xw6mywq0p2m5peks28men"},"result":"[undefined]"}' ,
377
396
] ) ;
378
397
379
398
// Second attempt
@@ -384,3 +403,5 @@ test('will not advance same txHash:chainId evidence twice', async t => {
384
403
'"[Error: Transaction already seen: \\"seenTx:[\\\\\\"0xc81bc6105b60a234c7c50ac17816ebcd5561d366df8bf3be59ff387552761702\\\\\\",1]\\"]"' ,
385
404
] ) ;
386
405
} ) ;
406
+
407
+ test . todo ( 'zoeTools.localTransfer fails to deposit borrowed USDC to LOA' ) ;
0 commit comments