@@ -3881,35 +3881,20 @@ describe("Matching Engine", function () {
3881
3881
) ;
3882
3882
} ) ;
3883
3883
3884
- it ( "Cannot Add Entry from Settled Complete Auction with Beneficiary Token != Initial Offer Token " , async function ( ) {
3884
+ it ( "Cannot Add Entry from Settled Complete Auction with Beneficiary != Auction's Preparer " , async function ( ) {
3885
3885
await addAuctionHistoryEntryForTest (
3886
3886
{
3887
3887
payer : payer . publicKey ,
3888
3888
history : engine . auctionHistoryAddress ( 0 ) ,
3889
- beneficiary : payer . publicKey ,
3889
+ beneficiary : Keypair . generate ( ) . publicKey ,
3890
3890
} ,
3891
3891
{
3892
3892
settlementType : "complete" ,
3893
- errorMsg : "beneficiary_token . Error Code: ConstraintAddress" ,
3893
+ errorMsg : "beneficiary . Error Code: ConstraintAddress" ,
3894
3894
} ,
3895
3895
) ;
3896
3896
} ) ;
3897
3897
3898
- it ( "Cannot Add Entry from Settled Complete Auction with Beneficiary != Initial Offer Token Owner" , async function ( ) {
3899
- await addAuctionHistoryEntryForTest (
3900
- {
3901
- payer : payer . publicKey ,
3902
- history : engine . auctionHistoryAddress ( 0 ) ,
3903
- beneficiary : payer . publicKey ,
3904
- beneficiaryToken : splToken . getAssociatedTokenAddressSync (
3905
- USDC_MINT_ADDRESS ,
3906
- playerOne . publicKey ,
3907
- ) ,
3908
- } ,
3909
- { settlementType : "complete" , errorMsg : "Error Code: ConstraintTokenOwner" } ,
3910
- ) ;
3911
- } ) ;
3912
-
3913
3898
it ( "Add Entry from Settled Complete Auction After Expiration Time" , async function ( ) {
3914
3899
await addAuctionHistoryEntryForTest (
3915
3900
{
@@ -3936,30 +3921,17 @@ describe("Matching Engine", function () {
3936
3921
) ;
3937
3922
} ) ;
3938
3923
3939
- it ( "Cannot Close Auction Account from Settled Auction None with Beneficiary Token != Fee Recipient Token " , async function ( ) {
3924
+ it ( "Cannot Close Auction Account from Settled Auction None with Beneficiary != Auction's Preparer " , async function ( ) {
3940
3925
await addAuctionHistoryEntryForTest (
3941
3926
{
3942
3927
payer : payer . publicKey ,
3943
3928
history : engine . auctionHistoryAddress ( 0 ) ,
3944
- beneficiary : payer . publicKey ,
3929
+ beneficiary : Keypair . generate ( ) . publicKey ,
3945
3930
} ,
3946
3931
{
3947
3932
settlementType : "none" ,
3948
- errorMsg : "beneficiary_token. Error Code: ConstraintAddress" ,
3949
- } ,
3950
- ) ;
3951
- } ) ;
3952
-
3953
- it ( "Cannot Close Auction Account from Settled Auction None with Beneficiary != Fee Recipient" , async function ( ) {
3954
- const { feeRecipientToken } = await engine . fetchCustodian ( ) ;
3955
- await addAuctionHistoryEntryForTest (
3956
- {
3957
- payer : payer . publicKey ,
3958
- history : engine . auctionHistoryAddress ( 0 ) ,
3959
- beneficiary : payer . publicKey ,
3960
- beneficiaryToken : feeRecipientToken ,
3933
+ errorMsg : "beneficiary. Error Code: ConstraintAddress" ,
3961
3934
} ,
3962
- { settlementType : "none" , errorMsg : "Error Code: ConstraintTokenOwner" } ,
3963
3935
) ;
3964
3936
} ) ;
3965
3937
@@ -4161,7 +4133,6 @@ describe("Matching Engine", function () {
4161
4133
auction ?: PublicKey ;
4162
4134
history : PublicKey ;
4163
4135
beneficiary ?: PublicKey ;
4164
- beneficiaryToken ?: PublicKey ;
4165
4136
} ,
4166
4137
opts : ForTestOpts &
4167
4138
ObserveCctpOrderVaasOpts &
@@ -4194,8 +4165,8 @@ describe("Matching Engine", function () {
4194
4165
return result ! . auction ;
4195
4166
} else if ( settlementType == "none" ) {
4196
4167
const result = await settleAuctionNoneCctpForTest (
4197
- { payer : payer . publicKey } ,
4198
- { vaaTimestamp } ,
4168
+ { payer : playerOne . publicKey } ,
4169
+ { vaaTimestamp, signers : [ playerOne ] } ,
4199
4170
) ;
4200
4171
return result ! . auction ;
4201
4172
} else {
@@ -4209,47 +4180,19 @@ describe("Matching Engine", function () {
4209
4180
await waitUntilTimestamp ( connection , current + timeToWait ) ;
4210
4181
}
4211
4182
4212
- const { beneficiary, beneficiaryToken } = await ( async ( ) => {
4213
- if ( accounts . beneficiary !== undefined ) {
4214
- return {
4215
- beneficiary : accounts . beneficiary ,
4216
- beneficiaryToken :
4217
- accounts . beneficiaryToken ??
4218
- splToken . getAssociatedTokenAddressSync (
4219
- USDC_MINT_ADDRESS ,
4220
- accounts . beneficiary ,
4221
- ) ,
4222
- } ;
4223
- } else {
4224
- const { info } = await engine . fetchAuction ( { address : auction } ) ;
4225
- const beneficiaryToken = await ( async ( ) => {
4226
- if ( info === null ) {
4227
- const custodian = await engine . fetchCustodian ( ) ;
4228
- return custodian . feeRecipientToken ;
4229
- } else {
4230
- return info ! . initialOfferToken ;
4231
- }
4232
- } ) ( ) ;
4233
- const { owner } = await splToken . getAccount ( connection , beneficiaryToken ) ;
4234
- return {
4235
- beneficiary : owner ,
4236
- beneficiaryToken : accounts . beneficiaryToken ?? beneficiaryToken ,
4237
- } ;
4238
- }
4239
- } ) ( ) ;
4240
-
4241
- const { vaaHash, vaaTimestamp, info } = await engine . fetchAuction ( {
4183
+ const { vaaHash, vaaTimestamp, info, preparedBy } = await engine . fetchAuction ( {
4242
4184
address : auction ,
4243
4185
} ) ;
4244
4186
expect ( info === null ) . equals ( settlementType === "none" ) ;
4245
4187
4188
+ const beneficiary = accounts . beneficiary ?? preparedBy ;
4189
+
4246
4190
const ix = await engine . program . methods
4247
4191
. addAuctionHistoryEntry ( )
4248
4192
. accounts ( {
4249
4193
...accounts ,
4250
4194
auction,
4251
4195
beneficiary,
4252
- beneficiaryToken,
4253
4196
custodian : engine . checkedCustodianComposite ( ) ,
4254
4197
systemProgram : SystemProgram . programId ,
4255
4198
} )
@@ -4964,11 +4907,12 @@ describe("Matching Engine", function () {
4964
4907
} else {
4965
4908
const result = await prepareOrderResponseCctpForTest (
4966
4909
{
4967
- payer : payer . publicKey ,
4910
+ payer : accounts . payer ,
4968
4911
} ,
4969
4912
{
4970
4913
...excludedForTestOpts ,
4971
4914
placeInitialOffer : false ,
4915
+ signers,
4972
4916
} ,
4973
4917
) ;
4974
4918
expect ( typeof result == "object" && "preparedOrderResponse" in result ) . is . true ;
0 commit comments