-
Notifications
You must be signed in to change notification settings - Fork 8
/
market_auction_soft_test.go
740 lines (571 loc) · 19.7 KB
/
market_auction_soft_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
package test_main
import (
"testing"
. "github.com/bjartek/overflow"
)
func TestMarketAuctionSoft(t *testing.T) {
otu := NewOverflowTest(t)
price := 10.0
preIncrement := 5.0
id := otu.setupMarketAndDandyDapper()
otu.registerDandyInNFTRegistry().
registerDUCInRegistry().
setFlowDandyMarketOption("dapper").
setProfile("user1").
setProfile("user2").
createDapperUser("find").
createDapperUser("find-admin")
otu.setUUID(600)
eventIdentifier := otu.identifier("FindMarketAuctionSoft", "EnglishAuction")
royaltyIdentifier := otu.identifier("FindMarket", "RoyaltyPaid")
listingTx := otu.O.TxFileNameFN(
"listNFTForAuctionSoftDapper",
WithSigner("user1"),
WithArg("nftAliasOrIdentifier", dandyNFTType(otu)),
WithArg("id", id),
WithArg("ftAliasOrIdentifier", "FUT"),
WithArg("price", price),
WithArg("auctionReservePrice", price),
WithArg("auctionDuration", 300.0),
WithArg("auctionExtensionOnLateBid", 60.0),
WithArg("minimumBidIncrement", 1.0),
)
t.Run("Should not be able to list an item for auction twice, and will give error message.", func(t *testing.T) {
otu.listNFTForSoftAuction("user1", id, price).
saleItemListed("user1", "active_listed", price)
listingTx(
WithArg("auctionValidUntil", otu.currentTime()+10.0),
).
AssertFailure(t, "Auction listing for this item is already created.")
otu.delistAllNFTForSoftAuction("user1")
})
t.Run("Should be able to sell at auction", func(t *testing.T) {
otu.listNFTForSoftAuction("user1", id, price).
saleItemListed("user1", "active_listed", price).
auctionBidMarketSoft("user2", "user1", id, price+5.0).
tickClock(400.0).
saleItemListed("user1", "finished_completed", price+5.0).
fulfillMarketAuctionSoft("user2", id, 15.0)
otu.sendDandy("user1", "user2", id)
})
t.Run("Should be able to sell and buy at auction even buyer is without the collection.", func(t *testing.T) {
otu.listNFTForSoftAuction("user1", id, price).
saleItemListed("user1", "active_listed", price).
destroyDandyCollection("user2").
auctionBidMarketSoft("user2", "user1", id, price+5.0).
tickClock(400.0).
saleItemListed("user1", "finished_completed", price+5.0).
fulfillMarketAuctionSoft("user2", id, 15.0)
otu.sendDandy("user1", "user2", id)
})
t.Run("Should be able to cancel listing if the pointer is no longer valid", func(t *testing.T) {
otu.listNFTForSoftAuction("user1", id, price).
saleItemListed("user1", "active_listed", price).
destroyDandyCollection("user2").
auctionBidMarketSoft("user2", "user1", id, price+5.0).
tickClock(400.0).
saleItemListed("user1", "finished_completed", price+5.0).
sendDandy("user2", "user1", id)
otu.setUUID(800)
otu.O.Tx("cancelMarketAuctionSoft",
WithSigner("user1"),
WithArg("ids", []uint64{id}),
).
AssertSuccess(t).
AssertEvent(t, eventIdentifier, map[string]interface{}{
"id": id,
"seller": otu.O.Address("user1"),
"buyer": otu.O.Address("user2"),
"amount": 15.0,
"status": "cancel_ghostlisting",
})
otu.sendDandy("user1", "user2", id)
})
t.Run("Should not be able to list with price 0", func(t *testing.T) {
listingTx(
WithArg("price", 0.0),
WithArg("auctionValidUntil", otu.currentTime()+10.0),
).
AssertFailure(t, "Auction start price should be greater than 0")
})
t.Run("Should not be able to list with invalid reserve price", func(t *testing.T) {
listingTx(
WithArg("price", price),
WithArg("auctionReservePrice", price-5.0),
WithArg("auctionValidUntil", otu.currentTime()+10.0),
).
AssertFailure(t, "Auction reserve price should be greater than Auction start price")
})
t.Run("Should not be able to list with invalid time", func(t *testing.T) {
listingTx(
WithArg("auctionReservePrice", price),
WithArg("auctionValidUntil", 10.0),
).
AssertFailure(t, "Valid until is before current time")
})
t.Run("Should be able to add bid at auction", func(t *testing.T) {
otu.listNFTForSoftAuction("user1", id, price).
saleItemListed("user1", "active_listed", price).
auctionBidMarketSoft("user2", "user1", id, price+5.0).
increaseAuctionBidMarketSoft("user2", id, 5.0, price+10.0).
tickClock(400.0).
saleItemListed("user1", "finished_completed", price+10.0).
fulfillMarketAuctionSoft("user2", id, price+10.0)
otu.sendDandy("user1", "user2", id)
otu.delistAllNFTForSoftAuction("user1")
})
t.Run("Should not be able to bid expired auction listing", func(t *testing.T) {
otu.listNFTForSoftAuction("user1", id, price).
saleItemListed("user1", "active_listed", price).
tickClock(200.0)
otu.O.Tx("bidMarketAuctionSoftDapper",
WithSigner("user2"),
WithArg("user", "user1"),
WithArg("id", id),
WithArg("amount", price),
).
AssertFailure(t, "This auction listing is already expired")
otu.delistAllNFTForSoftAuction("user1")
})
t.Run("Should not be able to bid your own listing", func(t *testing.T) {
otu.listNFTForSoftAuction("user1", id, price).
saleItemListed("user1", "active_listed", price)
otu.O.Tx("bidMarketAuctionSoftDapper",
WithSigner("user1"),
WithArg("user", "user1"),
WithArg("id", id),
WithArg("amount", price),
).
AssertFailure(t, "You cannot bid on your own resource")
otu.delistAllNFTForSoftAuction("user1")
})
t.Run("Should be able to cancel an auction", func(t *testing.T) {
otu.listNFTForSoftAuction("user1", id, price).
saleItemListed("user1", "active_listed", price)
name := "user1"
otu.O.Tx("cancelMarketAuctionSoft",
WithSigner(name),
WithArg("ids", []uint64{id}),
).
AssertSuccess(t).
AssertEvent(t, eventIdentifier, map[string]interface{}{
"id": id,
"seller": otu.O.Address(name),
"amount": 10.0,
"status": "cancel",
})
})
t.Run("Should not be able to cancel an ended auction", func(t *testing.T) {
otu.listNFTForSoftAuction("user1", id, price).
saleItemListed("user1", "active_listed", price).
auctionBidMarketSoft("user2", "user1", id, price+5.0).
tickClock(4000.0).
saleItemListed("user1", "finished_completed", price+5.0)
name := "user1"
otu.O.Tx("cancelMarketAuctionSoft",
WithSigner(name),
WithArg("ids", []uint64{id}),
).
AssertFailure(t, "Cannot cancel finished auction, fulfill it instead")
otu.fulfillMarketAuctionSoft("user2", id, price+5.0).
sendDandy("user1", "user2", id)
})
t.Run("Cannot fulfill a not yet ended auction", func(t *testing.T) {
otu.listNFTForSoftAuction("user1", id, price).
saleItemListed("user1", "active_listed", price)
otu.setUUID(1000)
otu.auctionBidMarketSoft("user2", "user1", id, price+5.0)
otu.tickClock(100.0)
otu.O.Tx("fulfillMarketAuctionSoftDapper",
WithSigner("user2"),
WithPayloadSigner("dapper"),
WithArg("id", id),
WithArg("amount", price+5.0),
).
AssertFailure(t, "Auction has not ended yet")
otu.delistAllNFTForSoftAuction("user1")
})
t.Run("Should allow seller to cancel auction if it failed to meet reserve price", func(t *testing.T) {
otu.listNFTForSoftAuction("user1", id, price).
saleItemListed("user1", "active_listed", price).
auctionBidMarketSoft("user2", "user1", id, price+1.0).
tickClock(400.0).
saleItemListed("user1", "finished_failed", 11.0)
buyer := "user2"
name := "user1"
otu.O.Tx("cancelMarketAuctionSoft",
WithSigner(name),
WithArg("ids", []uint64{id}),
).
AssertSuccess(t).
AssertEvent(t, eventIdentifier, map[string]interface{}{
"id": id,
"seller": otu.O.Address(name),
"buyer": otu.O.Address(buyer),
"amount": 11.0,
"status": "cancel_reserved_not_met",
})
})
t.Run("Should be able to bid and increase bid by same user", func(t *testing.T) {
otu.listNFTForSoftAuction("user1", id, price).
saleItemListed("user1", "active_listed", price).
auctionBidMarketSoft("user2", "user1", id, price+preIncrement).
saleItemListed("user1", "active_ongoing", price+preIncrement)
otu.O.Tx("increaseBidMarketAuctionSoft",
WithSigner("user2"),
WithArg("id", id),
WithArg("amount", 0.1),
).
AssertFailure(t, "must be larger then previous bid+bidIncrement")
otu.delistAllNFTForSoftAuction("user1")
})
/* Tests on Rules */
t.Run("Should not be able to list after deprecated", func(t *testing.T) {
otu.alterMarketOptionDapper("deprecate")
listingTx(
WithArg("auctionValidUntil", otu.currentTime()+10.0),
).
AssertFailure(t, "Tenant has deprected mutation options on this item")
otu.alterMarketOptionDapper("enable")
})
t.Run("Should be able to bid, add bid , fulfill auction and delist after deprecated", func(t *testing.T) {
otu.listNFTForSoftAuction("user1", id, price)
otu.alterMarketOptionDapper("deprecate")
otu.O.Tx("bidMarketAuctionSoftDapper",
WithSigner("user2"),
WithArg("user", "user1"),
WithArg("id", id),
WithArg("amount", price),
).
AssertSuccess(t)
otu.O.Tx("increaseBidMarketAuctionSoft",
WithSigner("user2"),
WithArg("id", id),
WithArg("amount", price+10.0),
).
AssertSuccess(t)
otu.tickClock(500.0)
otu.O.Tx("fulfillMarketAuctionSoftDapper",
WithSigner("user2"),
WithPayloadSigner("dapper"),
WithArg("id", id),
WithArg("amount", 30.0),
).
AssertSuccess(t)
otu.alterMarketOptionDapper("enable")
listingTx(
WithSigner("user2"),
WithArg("auctionValidUntil", otu.currentTime()+10.0),
).
AssertSuccess(t)
otu.auctionBidMarketSoft("user1", "user2", id, price+5.0)
otu.alterMarketOptionDapper("deprecate")
otu.O.Tx("cancelMarketAuctionSoft",
WithSigner("user2"),
WithArg("ids", []uint64{id}),
).
AssertSuccess(t)
otu.alterMarketOptionDapper("enable").
sendDandy("user1", "user2", id)
})
t.Run("Should no be able to list, bid, add bid , fulfill auction after stopped", func(t *testing.T) {
otu.alterMarketOptionDapper("stop")
listingTx(
WithSigner("user1"),
WithArg("auctionValidUntil", otu.currentTime()+10.0),
).
AssertFailure(t, "Tenant has stopped this item")
otu.alterMarketOptionDapper("enable").
listNFTForSoftAuction("user1", id, price).
alterMarketOptionDapper("stop")
otu.O.Tx("bidMarketAuctionSoftDapper",
WithSigner("user2"),
WithArg("user", "user1"),
WithArg("id", id),
WithArg("amount", price),
).
AssertFailure(t, "Tenant has stopped this item")
otu.alterMarketOptionDapper("enable").
auctionBidMarketSoft("user2", "user1", id, price+5.0).
alterMarketOptionDapper("stop")
otu.O.Tx("increaseBidMarketAuctionSoft",
WithSigner("user2"),
WithArg("id", id),
WithArg("amount", price+10.0),
).
AssertFailure(t, "Tenant has stopped this item")
otu.alterMarketOptionDapper("stop")
otu.tickClock(500.0)
otu.O.Tx("fulfillMarketAuctionSoftDapper",
WithSigner("user2"),
WithPayloadSigner("dapper"),
WithArg("id", id),
WithArg("amount", price+5.0),
).
AssertFailure(t, "Tenant has stopped this item")
/* Reset */
otu.alterMarketOptionDapper("enable")
otu.O.Tx("fulfillMarketAuctionSoftDapper",
WithSigner("user2"),
WithPayloadSigner("dapper"),
WithArg("id", id),
WithArg("amount", price+5.0),
).
AssertSuccess(t)
otu.sendDandy("user1", "user2", id)
})
t.Run("Should not be able to bid below listing price", func(t *testing.T) {
otu.listNFTForSoftAuction("user1", id, price).
saleItemListed("user1", "active_listed", price)
otu.O.Tx("bidMarketAuctionSoftDapper",
WithSigner("user2"),
WithArg("user", "user1"),
WithArg("id", id),
WithArg("amount", 1.0),
).
AssertFailure(t, "You need to bid more then the starting price of 10.00000000")
otu.delistAllNFTForSoftAuction("user1")
})
t.Run("Should not be able to bid less the previous bidder", func(t *testing.T) {
otu.listNFTForSoftAuction("user1", id, price).
saleItemListed("user1", "active_listed", price).
auctionBidMarketSoft("user2", "user1", id, price+5.0)
otu.O.Tx("bidMarketAuctionSoftDapper",
WithSigner("user3"),
WithArg("user", "user1"),
WithArg("id", id),
WithArg("amount", 5.0),
).
AssertFailure(t, "bid 5.00000000 must be larger then previous bid+bidIncrement 16.00000000")
otu.delistAllNFTForSoftAuction("user1")
})
/* Testing on Royalties */
// platform 0.15
// artist 0.05
// find 0.025
// tenant nil
t.Run("Royalties should be sent to correspondence upon fulfill action", func(t *testing.T) {
price = 5.0
otu.listNFTForSoftAuction("user1", id, price).
saleItemListed("user1", "active_listed", price).
auctionBidMarketSoft("user2", "user1", id, price+5.0)
otu.tickClock(500.0)
otu.O.Tx("fulfillMarketAuctionSoftDapper",
WithSigner("user2"),
WithPayloadSigner("dapper"),
WithArg("id", id),
WithArg("amount", 10.0),
).
AssertSuccess(t).
AssertEvent(t, royaltyIdentifier, map[string]interface{}{
"address": otu.O.Address("find"),
"amount": 0.25,
"royaltyName": "find",
}).
AssertEvent(t, royaltyIdentifier, map[string]interface{}{
"address": otu.O.Address("user1"),
"amount": 0.5,
"royaltyName": "creator",
}).
AssertEvent(t, royaltyIdentifier, map[string]interface{}{
"address": otu.O.Address("find"),
"amount": 0.25,
"royaltyName": "find forge",
})
otu.sendDandy("user1", "user2", id)
})
t.Run("Should be able to ban user, user is only allowed to cancel listing.", func(t *testing.T) {
price = 10.0
ids := otu.mintThreeExampleDandies()
otu.listNFTForSoftAuction("user1", ids[0], price).
listNFTForSoftAuction("user1", ids[1], price).
auctionBidMarketSoft("user2", "user1", ids[0], price+5.0).
tickClock(400.0).
profileBan("user1")
// Should not be able to list
listingTx(
WithArg("auctionValidUntil", otu.currentTime()+10.0),
).
AssertFailure(t, "Seller banned by Tenant")
otu.O.Tx("bidMarketAuctionSoftDapper",
WithSigner("user2"),
WithArg("user", "user1"),
WithArg("id", ids[1]),
WithArg("amount", price),
).
AssertFailure(t, "Seller banned by Tenant")
otu.O.Tx("fulfillMarketAuctionSoftDapper",
WithSigner("user2"),
WithPayloadSigner("dapper"),
WithArg("id", ids[0]),
WithArg("amount", price+5.0),
).
AssertFailure(t, "Seller banned by Tenant")
otu.O.Tx("cancelMarketAuctionSoft",
WithSigner("user1"),
WithArg("ids", ids[1:1]),
).
AssertSuccess(t)
otu.removeProfileBan("user1")
otu.O.Tx("fulfillMarketAuctionSoftDapper",
WithSigner("user2"),
WithPayloadSigner("dapper"),
WithArg("id", ids[0]),
WithArg("amount", price+5.0),
).
AssertSuccess(t)
otu.delistAllNFTForSoftAuction("user1")
})
t.Run("Should be able to ban user, user cannot bid NFT.", func(t *testing.T) {
price = 10.0
ids := otu.mintThreeExampleDandies()
otu.listNFTForSoftAuction("user1", ids[0], price).
listNFTForSoftAuction("user1", ids[1], price).
auctionBidMarketSoft("user2", "user1", ids[0], price+5.0).
tickClock(400.0).
profileBan("user2")
otu.O.Tx("bidMarketAuctionSoftDapper",
WithSigner("user2"),
WithArg("user", "user1"),
WithArg("id", ids[1]),
WithArg("amount", price),
).
AssertFailure(t, "Buyer banned by Tenant")
otu.O.Tx("fulfillMarketAuctionSoftDapper",
WithSigner("user2"),
WithPayloadSigner("dapper"),
WithArg("id", ids[0]),
WithArg("amount", price+5.0),
).
AssertFailure(t, "Buyer banned by Tenant")
/* Reset */
otu.removeProfileBan("user2")
otu.O.Tx("fulfillMarketAuctionSoftDapper",
WithSigner("user2"),
WithPayloadSigner("dapper"),
WithArg("id", ids[0]),
WithArg("amount", price+5.0),
).
AssertSuccess(t)
otu.delistAllNFTForSoftAuction("user1")
})
t.Run("Should emit previous bidder if outbid", func(t *testing.T) {
otu.listNFTForSoftAuction("user1", id, price).
saleItemListed("user1", "active_listed", price).
auctionBidMarketSoft("user2", "user1", id, price+5.0).
saleItemListed("user1", "active_ongoing", 15.0)
otu.O.Tx("bidMarketAuctionSoftDapper",
WithSigner("user3"),
WithArg("user", "user1"),
WithArg("id", id),
WithArg("amount", 20.0),
).
AssertSuccess(t).
AssertEvent(t, eventIdentifier, map[string]interface{}{
"amount": 20.0,
"id": id,
"buyer": otu.O.Address("user3"),
"previousBuyer": otu.O.Address("user2"),
"status": "active_ongoing",
})
otu.delistAllNFTForSoftAuction("user1")
})
t.Run("Should be able to list an NFT for auction and bid it with DUC", func(t *testing.T) {
otu.setDUCExampleNFT().
sendExampleNFT("user1", "find",0)
saleItemID := otu.listNFTForSoftAuctionDUC("user1", 0, price)
otu.saleItemListed("user1", "active_listed", price).
auctionBidMarketSoftDUC("user2", "user1", saleItemID[0], price+5.0).
tickClock(400.0).
saleItemListed("user1", "finished_completed", price+5.0).
fulfillMarketAuctionSoftDUC("user2", saleItemID[0], 15.0)
otu.sendExampleNFT("user1", "user2",0)
})
t.Run("Should be able to list an NFT for auction and bid it with id != uuid", func(t *testing.T) {
saleItemID := otu.listExampleNFTForSoftAuction("user1", 0, price)
otu.saleItemListed("user1", "active_listed", price).
auctionBidMarketSoft("user2", "user1", saleItemID[0], price+5.0).
tickClock(400.0).
saleItemListed("user1", "finished_completed", price+5.0).
fulfillMarketAuctionSoft("user2", saleItemID[0], 15.0)
otu.sendExampleNFT("user1", "user2",0)
})
t.Run("Should not be able to list soul bound items", func(t *testing.T) {
otu.sendSoulBoundNFT("user1", "find")
// set market rules
otu.O.Tx("adminSetSellExampleNFTForFUT",
WithSigner("find"),
WithArg("tenant", "find"),
)
otu.O.Tx("listNFTForAuctionSoftDapper",
WithSigner("user1"),
WithArg("nftAliasOrIdentifier", exampleNFTType(otu)),
WithArg("id", 1),
WithArg("ftAliasOrIdentifier", "FUT"),
WithArg("price", price),
WithArg("auctionReservePrice", price+5.0),
WithArg("auctionDuration", 300.0),
WithArg("auctionExtensionOnLateBid", 60.0),
WithArg("minimumBidIncrement", 1.0),
WithArg("auctionValidUntil", otu.currentTime()+100.0),
).AssertFailure(t, "This item is soul bounded and cannot be traded")
})
t.Run("not be able to buy an NFT with changed royalties, but should be able to cancel listing", func(t *testing.T) {
saleItemID := otu.listExampleNFTForSoftAuction("user1", 0, price)
otu.saleItemListed("user1", "active_listed", price).
auctionBidMarketSoft("user2", "user1", saleItemID[0], price+5.0).
tickClock(400.0).
saleItemListed("user1", "finished_completed", price+5.0)
otu.changeRoyaltyExampleNFT("user1", 0, true)
otu.O.Tx("fulfillMarketAuctionSoftDapper",
WithSigner("user2"),
WithPayloadSigner("dapper"),
WithArg("id", saleItemID[0]),
WithArg("amount", 15.0),
).
AssertFailure(t, "The total Royalties to be paid is changed after listing.")
otu.O.Tx("cancelMarketAuctionSoft",
WithSigner("user1"),
WithArg("ids", saleItemID[0:1]),
).
AssertSuccess(t).
AssertEvent(t, eventIdentifier, map[string]interface{}{
"status": "cancel_royalties_changed",
})
})
t.Run("should be able to get listings with royalty problems and relist", func(t *testing.T) {
saleItemID := otu.listExampleNFTForSoftAuction("user1", 0, price)
otu.saleItemListed("user1", "active_listed", price).
auctionBidMarketSoft("user2", "user1", saleItemID[0], price+5.0).
tickClock(400.0).
saleItemListed("user1", "finished_completed", price+5.0)
otu.changeRoyaltyExampleNFT("user1", 0, false)
ids, err := otu.O.Script("getRoyaltyChangedIds",
WithArg("user", "user1"),
).
GetAsJson()
if err != nil {
panic(err)
}
otu.O.Tx("relistMarketListings",
WithSigner("user1"),
WithArg("ids", ids),
).
AssertSuccess(t)
})
t.Run("should be able to get listings with royalty problems and cancel", func(t *testing.T) {
otu.changeRoyaltyExampleNFT("user1", 0, true)
ids, err := otu.O.Script("getRoyaltyChangedIds",
WithArg("user", "user1"),
).
GetAsJson()
if err != nil {
panic(err)
}
otu.O.Tx("cancelMarketListings",
WithSigner("user1"),
WithArg("ids", ids),
).
AssertSuccess(t)
})
}