@@ -17,7 +17,7 @@ import {
17
17
SlowOrderResponse ,
18
18
} from "@wormhole-foundation/example-liquidity-layer-definitions" ;
19
19
import { Chain , ChainId , encoding , toChain , toChainId } from "@wormhole-foundation/sdk-base" ;
20
- import { CircleBridge , toUniversal } from "@wormhole-foundation/sdk-definitions" ;
20
+ import { CircleBridge , VAA , toUniversal } from "@wormhole-foundation/sdk-definitions" ;
21
21
import { SolanaAddress } from "@wormhole-foundation/sdk-solana" ;
22
22
import { deserializePostMessage } from "@wormhole-foundation/sdk-solana-core" ;
23
23
import { expect } from "chai" ;
@@ -290,7 +290,6 @@ describe("Matching Engine", function () {
290
290
ownerAssistant . publicKey ,
291
291
feeRecipient ,
292
292
{ ...auctionParams , duration : 0 } ,
293
- USDC_MINT_ADDRESS ,
294
293
) ;
295
294
await expectTxsErr ( payerSigner , txs , "Error Code: ZeroDuration" ) ;
296
295
} ) ;
@@ -301,7 +300,6 @@ describe("Matching Engine", function () {
301
300
ownerAssistant . publicKey ,
302
301
feeRecipient ,
303
302
{ ...auctionParams , gracePeriod : 0 } ,
304
- USDC_MINT_ADDRESS ,
305
303
) ;
306
304
await expectTxsErr ( payerSigner , txs , "Error Code: ZeroGracePeriod" ) ;
307
305
} ) ;
@@ -312,7 +310,6 @@ describe("Matching Engine", function () {
312
310
ownerAssistant . publicKey ,
313
311
feeRecipient ,
314
312
{ ...auctionParams , penaltyPeriod : 0 } ,
315
- USDC_MINT_ADDRESS ,
316
313
) ;
317
314
await expectTxsErr ( payerSigner , txs , "Error Code: ZeroPenaltyPeriod" ) ;
318
315
} ) ;
@@ -323,7 +320,6 @@ describe("Matching Engine", function () {
323
320
ownerAssistant . publicKey ,
324
321
feeRecipient ,
325
322
{ ...auctionParams , userPenaltyRewardBps : 1_000_001 } ,
326
- USDC_MINT_ADDRESS ,
327
323
) ;
328
324
await expectTxsErr ( payerSigner , txs , "Error Code: UserPenaltyRewardBpsTooLarge" ) ;
329
325
} ) ;
@@ -334,7 +330,6 @@ describe("Matching Engine", function () {
334
330
ownerAssistant . publicKey ,
335
331
feeRecipient ,
336
332
{ ...auctionParams , initialPenaltyBps : 1_000_001 } ,
337
- USDC_MINT_ADDRESS ,
338
333
) ;
339
334
await expectTxsErr ( payerSigner , txs , "Error Code: InitialPenaltyBpsTooLarge" ) ;
340
335
} ) ;
@@ -345,7 +340,6 @@ describe("Matching Engine", function () {
345
340
ownerAssistant . publicKey ,
346
341
feeRecipient ,
347
342
{ ...auctionParams , minOfferDeltaBps : 1_000_001 } ,
348
- USDC_MINT_ADDRESS ,
349
343
) ;
350
344
await expectTxsErr ( payerSigner , txs , "Error Code: MinOfferDeltaBpsTooLarge" ) ;
351
345
} ) ;
@@ -356,7 +350,6 @@ describe("Matching Engine", function () {
356
350
ownerAssistant . publicKey ,
357
351
feeRecipient ,
358
352
{ ...auctionParams , securityDepositBase : uint64ToBN ( 0 ) } ,
359
- USDC_MINT_ADDRESS ,
360
353
) ;
361
354
await expectTxsErr ( payerSigner , txs , "Error Code: ZeroSecurityDepositBase" ) ;
362
355
} ) ;
@@ -367,7 +360,6 @@ describe("Matching Engine", function () {
367
360
ownerAssistant . publicKey ,
368
361
feeRecipient ,
369
362
{ ...auctionParams , securityDepositBps : 1_000_001 } ,
370
- USDC_MINT_ADDRESS ,
371
363
) ;
372
364
await expectTxsErr ( payerSigner , txs , "Error Code: SecurityDepositBpsTooLarge" ) ;
373
365
} ) ;
@@ -378,7 +370,6 @@ describe("Matching Engine", function () {
378
370
ownerAssistant . publicKey ,
379
371
feeRecipient ,
380
372
auctionParams ,
381
- USDC_MINT_ADDRESS ,
382
373
) ;
383
374
await expectTxsOk ( payerSigner , txs ) ;
384
375
@@ -409,7 +400,6 @@ describe("Matching Engine", function () {
409
400
ownerAssistant . publicKey ,
410
401
feeRecipient ,
411
402
auctionParams ,
412
- USDC_MINT_ADDRESS ,
413
403
) ;
414
404
await expectTxsErr (
415
405
payerSigner ,
@@ -3543,67 +3533,46 @@ describe("Matching Engine", function () {
3543
3533
} ) ;
3544
3534
3545
3535
const result = await placeInitialOfferCctpForTest (
3546
- {
3547
- payer : playerTwo . publicKey ,
3548
- fastVaa : fast . vaa ,
3549
- } ,
3536
+ { payer : playerTwo . publicKey , fastVaa : fast . vaa } ,
3550
3537
{
3551
3538
signers : [ playerTwoSigner ] ,
3552
3539
finalized : false ,
3553
3540
fastMarketOrder : baseFastOrder ,
3554
3541
} ,
3555
3542
) ;
3556
- const { fastVaa , auction , auctionDataBefore : initialData } = result ! ;
3543
+ const { auctionDataBefore : initialData } = result ! ;
3557
3544
3558
3545
const { duration, gracePeriod } = await engine . fetchAuctionParameters ( ) ;
3559
3546
await waitUntilSlot (
3560
3547
connection ,
3561
3548
initialData . info ! . startSlot . addn ( duration + gracePeriod - 1 ) . toNumber ( ) ,
3562
3549
) ;
3563
3550
3564
- const { value : lookupTableAccount } = await connection . getAddressLookupTable (
3565
- lookupTableAddress ,
3566
- ) ;
3567
-
3568
- const tx = await engine . executeFastOrderTx (
3569
- { payer : playerTwo . publicKey , fastVaa, auction } ,
3570
- [ playerTwo ] ,
3571
- {
3572
- feeMicroLamports : 10 ,
3573
- computeUnits : 300_000 ,
3574
- addressLookupTableAccounts : [ lookupTableAccount ! ] ,
3575
- } ,
3576
- { commitment : "confirmed" } ,
3551
+ const txs = engine . executeFastOrder (
3552
+ playerTwo . publicKey ,
3553
+ fast . vaaAccount . vaa ( "FastTransfer:FastMarketOrder" ) ,
3577
3554
) ;
3578
3555
3579
- const computeIx = ComputeBudgetProgram . setComputeUnitLimit ( {
3580
- units : 300_000 ,
3581
- } ) ;
3556
+ await expectTxsOkDetails ( playerTwoSigner , txs , connection ) ;
3582
3557
3583
- await expectIxOkDetails ( connection , [ computeIx , ...tx . ixs ] , [ playerTwo ] , {
3584
- addressLookupTableAccounts : [ lookupTableAccount ! ] ,
3585
- } ) ;
3558
+ const { encodedCctpMessage, cctpAttestation } = finalized ! . cctp ;
3559
+ const [ cctpMessage ] = CircleBridge . deserialize ( encodedCctpMessage ) ;
3586
3560
3587
- const tx2 = await engine . settleAuctionCompleteTx (
3588
- {
3589
- executor : playerTwo . publicKey ,
3590
- auction,
3591
- fastVaa,
3592
- finalizedVaa : finalized ! . vaa ,
3593
- bestOfferToken : initialData . info ! . bestOfferToken ,
3594
- } ,
3595
- finalized ! . cctp ,
3596
- [ playerTwo ] ,
3561
+ const { value : lookupTableAccount } = await connection . getAddressLookupTable (
3562
+ lookupTableAddress ,
3563
+ ) ;
3564
+ const tx2 = engine . settleOrder (
3565
+ playerTwo . publicKey ,
3566
+ fast . vaaAccount . vaa ( "FastTransfer:FastMarketOrder" ) ,
3567
+ finalized ! . vaaAccount . vaa ( "FastTransfer:CctpDeposit" ) ,
3597
3568
{
3598
- feeMicroLamports : 10 ,
3599
- computeUnits : 300_000 ,
3600
- addressLookupTableAccounts : [ lookupTableAccount ! ] ,
3569
+ message : cctpMessage ,
3570
+ attestation : cctpAttestation . toString ( "hex" ) ,
3601
3571
} ,
3602
- { commitment : "confirmed" } ,
3572
+ [ lookupTableAccount ! ] ,
3603
3573
) ;
3604
- await expectIxOkDetails ( connection , [ computeIx , ...tx2 . ixs ] , [ playerTwo ] , {
3605
- addressLookupTableAccounts : [ lookupTableAccount ! ] ,
3606
- } ) ;
3574
+
3575
+ await expectTxsOkDetails ( playerTwoSigner , tx2 , connection ) ;
3607
3576
} ) ;
3608
3577
} ) ;
3609
3578
@@ -4172,13 +4141,13 @@ describe("Matching Engine", function () {
4172
4141
}
4173
4142
: await observeCctpOrderVaas ( excludedForTestOpts ) ;
4174
4143
4175
- let fastMarketOrderVAA ;
4144
+ let fastMarketOrderVAA : VAA < "Uint8Array" > | VAA < "FastTransfer:FastMarketOrder" > ;
4176
4145
try {
4177
4146
fastMarketOrderVAA = fast . vaaAccount . vaa ( "FastTransfer:FastMarketOrder" ) ;
4178
4147
args . offerPrice ??= fastMarketOrderVAA . payload . maxFee ;
4179
4148
} catch ( e ) {
4180
4149
// Ignore if parsing failed, this will be a VAA<"Uint8Array">
4181
- fastMarketOrderVAA = fast . vaaAccount . vaa ( ) ;
4150
+ fastMarketOrderVAA = fast . vaaAccount . vaa ( "Uint8Array" ) ;
4182
4151
}
4183
4152
4184
4153
if ( args . offerPrice === undefined ) {
@@ -4188,7 +4157,7 @@ describe("Matching Engine", function () {
4188
4157
// Place the initial offer.
4189
4158
const txs = engine . placeInitialOffer (
4190
4159
accounts . payer ,
4191
- // @ts -ignore -- may still be a Uint8array payload for testing invalid VAA
4160
+ // @ts -expect-error -- may still be a Uint8array payload for testing invalid VAA
4192
4161
fastMarketOrderVAA ,
4193
4162
args . offerPrice ,
4194
4163
args . totalDeposit ,
0 commit comments