@@ -19,7 +19,6 @@ import {
19
19
CircleBridge ,
20
20
Contracts ,
21
21
VAA ,
22
- keccak256 ,
23
22
} from "@wormhole-foundation/sdk-definitions" ;
24
23
import {
25
24
AnySolanaAddress ,
@@ -177,8 +176,10 @@ export class SolanaMatchingEngine<N extends Network, C extends SolanaChains>
177
176
offerPrice : bigint ,
178
177
totalDeposit ?: bigint ,
179
178
) {
180
- const payer = new SolanaAddress ( sender ) . unwrap ( ) ;
179
+ // If the VAA has not yet been posted, do so now
180
+ yield * this . postVaa ( sender , vaa ) ;
181
181
182
+ const payer = new SolanaAddress ( sender ) . unwrap ( ) ;
182
183
const vaaAddress = this . pdas . postedVaa ( vaa ) ;
183
184
184
185
const ixs = await this . placeInitialOfferCctpIx (
@@ -196,7 +197,9 @@ export class SolanaMatchingEngine<N extends Network, C extends SolanaChains>
196
197
offer : bigint ,
197
198
) {
198
199
const participant = new SolanaAddress ( sender ) . unwrap ( ) ;
199
- const auction = this . auctionAddress ( keccak256 ( vaa . hash ) ) ;
200
+
201
+ const digest = vaaHash ( vaa ) ;
202
+ const auction = this . pdas . auction ( digest ) ;
200
203
201
204
const ixs = await this . improveOfferIx ( { participant, auction } , { offerPrice : offer } ) ;
202
205
@@ -223,7 +226,6 @@ export class SolanaMatchingEngine<N extends Network, C extends SolanaChains>
223
226
224
227
const digest = vaaHash ( vaa ) ;
225
228
const auction = this . pdas . auction ( digest ) ;
226
-
227
229
const reservedSequence = this . pdas . reservedFastFillSequence ( digest ) ;
228
230
229
231
// TODO: make sure this has already been done, or do it here
@@ -272,7 +274,8 @@ export class SolanaMatchingEngine<N extends Network, C extends SolanaChains>
272
274
const fastVaa = this . pdas . postedVaa ( fast ) ;
273
275
const finalizedVaa = this . pdas . postedVaa ( finalized ) ;
274
276
275
- const preparedAddress = this . preparedOrderResponseAddress ( keccak256 ( fast . hash ) ) ;
277
+ const digest = vaaHash ( fast ) ;
278
+ const preparedAddress = this . pdas . preparedOrderResponse ( digest ) ;
276
279
277
280
try {
278
281
// Check if its already been prepared
@@ -341,15 +344,16 @@ export class SolanaMatchingEngine<N extends Network, C extends SolanaChains>
341
344
}
342
345
}
343
346
344
- const digest = keccak256 ( fast . hash ) ;
345
- const preparedOrderResponse = this . preparedOrderResponseAddress ( digest ) ;
346
- const auction = this . auctionAddress ( digest ) ;
347
347
const fastVaa = this . pdas . postedVaa ( fast ) ;
348
348
349
+ const digest = vaaHash ( fast ) ;
350
+ const preparedOrderResponse = this . pdas . preparedOrderResponse ( digest ) ;
351
+ const auction = this . pdas . auction ( digest ) ;
352
+
349
353
const settleIx = await ( async ( ) => {
350
354
if ( finalized && ! cctp ) {
351
355
if ( fast . payload . targetChain === "Solana" ) {
352
- const reservedSequence = this . reservedFastFillSequenceAddress ( digest ) ;
356
+ const reservedSequence = this . pdas . reservedFastFillSequence ( digest ) ;
353
357
return await this . settleAuctionNoneLocalIx ( {
354
358
payer,
355
359
reservedSequence,
0 commit comments