/
dragon-sats.clar
639 lines (511 loc) · 24 KB
/
dragon-sats.clar
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
;; dragon-sats
;; contractType: public
(impl-trait 'SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait.nft-trait)
(define-non-fungible-token dragon-sats uint)
;; Constants
(define-constant DEPLOYER tx-sender)
(define-constant COMM u1000)
(define-constant COMM-ADDR 'SPNWZ5V2TPWGQGVDR6T7B6RQ4XMGZ4PXTEE0VQ0S)
(define-constant ERR-NO-MORE-NFTS u100)
(define-constant ERR-NOT-ENOUGH-PASSES u101)
(define-constant ERR-PUBLIC-SALE-DISABLED u102)
(define-constant ERR-CONTRACT-INITIALIZED u103)
(define-constant ERR-NOT-AUTHORIZED u104)
(define-constant ERR-INVALID-USER u105)
(define-constant ERR-LISTING u106)
(define-constant ERR-WRONG-COMMISSION u107)
(define-constant ERR-NOT-FOUND u108)
(define-constant ERR-PAUSED u109)
(define-constant ERR-MINT-LIMIT u110)
(define-constant ERR-METADATA-FROZEN u111)
(define-constant ERR-AIRDROP-CALLED u112)
(define-constant ERR-NO-MORE-MINTS u113)
(define-constant ERR-INVALID-PERCENTAGE u114)
;; Internal variables
(define-data-var mint-limit uint u111)
(define-data-var last-id uint u1)
(define-data-var total-price uint u20000000)
(define-data-var artist-address principal 'SP1C1RWSW6ZB1STCJTHFRNYE1Y777JSJQFKM8T1ZS)
(define-data-var ipfs-root (string-ascii 80) "ipfs://ipfs/Qmaa39ATj19EXbq24p54WL7dVQQrJReUj8ArkEvyjZRmJi/json/")
(define-data-var mint-paused bool false)
(define-data-var premint-enabled bool false)
(define-data-var sale-enabled bool false)
(define-data-var metadata-frozen bool false)
(define-data-var airdrop-called bool false)
(define-data-var mint-cap uint u0)
(define-map mints-per-user principal uint)
(define-map mint-passes principal uint)
(define-public (claim)
(mint (list true)))
(define-public (claim-two) (mint (list true true)))
(define-public (claim-three) (mint (list true true true)))
(define-public (claim-four) (mint (list true true true true)))
(define-public (claim-five) (mint (list true true true true true)))
;; Default Minting
(define-private (mint (orders (list 25 bool)))
(mint-many orders))
(define-private (mint-many (orders (list 25 bool )))
(let
(
(last-nft-id (var-get last-id))
(enabled (asserts! (<= last-nft-id (var-get mint-limit)) (err ERR-NO-MORE-NFTS)))
(art-addr (var-get artist-address))
(id-reached (fold mint-many-iter orders last-nft-id))
(price (* (var-get total-price) (- id-reached last-nft-id)))
(total-commission (/ (* price COMM) u10000))
(current-balance (get-balance tx-sender))
(total-artist (- price total-commission))
(capped (> (var-get mint-cap) u0))
(user-mints (get-mints tx-sender))
)
(asserts! (or (is-eq false (var-get mint-paused)) (is-eq tx-sender DEPLOYER)) (err ERR-PAUSED))
(asserts! (or (not capped) (is-eq tx-sender DEPLOYER) (is-eq tx-sender art-addr) (>= (var-get mint-cap) (+ (len orders) user-mints))) (err ERR-NO-MORE-MINTS))
(map-set mints-per-user tx-sender (+ (len orders) user-mints))
(if (or (is-eq tx-sender art-addr) (is-eq tx-sender DEPLOYER) (is-eq (var-get total-price) u0000000))
(begin
(var-set last-id id-reached)
(map-set token-count tx-sender (+ current-balance (- id-reached last-nft-id)))
)
(begin
(var-set last-id id-reached)
(map-set token-count tx-sender (+ current-balance (- id-reached last-nft-id)))
(try! (stx-transfer? total-artist tx-sender (var-get artist-address)))
(try! (stx-transfer? total-commission tx-sender COMM-ADDR))
)
)
(ok id-reached)))
(define-private (mint-many-iter (ignore bool) (next-id uint))
(if (<= next-id (var-get mint-limit))
(begin
(unwrap! (nft-mint? dragon-sats next-id tx-sender) next-id)
(+ next-id u1)
)
next-id))
(define-public (set-artist-address (address principal))
(begin
(asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-INVALID-USER))
(ok (var-set artist-address address))))
(define-public (set-price (price uint))
(begin
(asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-INVALID-USER))
(ok (var-set total-price price))))
(define-public (toggle-pause)
(begin
(asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-INVALID-USER))
(ok (var-set mint-paused (not (var-get mint-paused))))))
(define-public (set-mint-limit (limit uint))
(begin
(asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-INVALID-USER))
(asserts! (< limit (var-get mint-limit)) (err ERR-MINT-LIMIT))
(ok (var-set mint-limit limit))))
(define-public (burn (token-id uint))
(begin
(asserts! (is-owner token-id tx-sender) (err ERR-NOT-AUTHORIZED))
(asserts! (is-none (map-get? market token-id)) (err ERR-LISTING))
(nft-burn? dragon-sats token-id tx-sender)))
(define-private (is-owner (token-id uint) (user principal))
(is-eq user (unwrap! (nft-get-owner? dragon-sats token-id) false)))
(define-public (set-base-uri (new-base-uri (string-ascii 80)))
(begin
(asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-NOT-AUTHORIZED))
(asserts! (not (var-get metadata-frozen)) (err ERR-METADATA-FROZEN))
(print { notification: "token-metadata-update", payload: { token-class: "nft", contract-id: (as-contract tx-sender) }})
(var-set ipfs-root new-base-uri)
(ok true)))
(define-public (freeze-metadata)
(begin
(asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-NOT-AUTHORIZED))
(var-set metadata-frozen true)
(ok true)))
;; Non-custodial SIP-009 transfer function
(define-public (transfer (id uint) (sender principal) (recipient principal))
(begin
(asserts! (is-eq tx-sender sender) (err ERR-NOT-AUTHORIZED))
(asserts! (is-none (map-get? market id)) (err ERR-LISTING))
(trnsfr id sender recipient)))
;; read-only functions
(define-read-only (get-owner (token-id uint))
(ok (nft-get-owner? dragon-sats token-id)))
(define-read-only (get-last-token-id)
(ok (- (var-get last-id) u1)))
(define-read-only (get-token-uri (token-id uint))
(ok (some (concat (concat (var-get ipfs-root) "{id}") ".json"))))
(define-read-only (get-paused)
(ok (var-get mint-paused)))
(define-read-only (get-price)
(ok (var-get total-price)))
(define-read-only (get-artist-address)
(ok (var-get artist-address)))
(define-read-only (get-mints (caller principal))
(default-to u0 (map-get? mints-per-user caller)))
(define-read-only (get-mint-limit)
(ok (var-get mint-limit)))
(define-data-var license-uri (string-ascii 80) "https://arweave.net/zmc1WTspIhFyVY82bwfAIcIExLFH5lUcHHUN0wXg4W8/0")
(define-data-var license-name (string-ascii 40) "PUBLIC")
(define-read-only (get-license-uri)
(ok (var-get license-uri)))
(define-read-only (get-license-name)
(ok (var-get license-name)))
(define-public (set-license-uri (uri (string-ascii 80)))
(begin
(asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-NOT-AUTHORIZED))
(ok (var-set license-uri uri))))
(define-public (set-license-name (name (string-ascii 40)))
(begin
(asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-NOT-AUTHORIZED))
(ok (var-set license-name name))))
;; Non-custodial marketplace extras
(use-trait commission-trait 'SP3D6PV2ACBPEKYJTCMH7HEN02KP87QSP8KTEH335.commission-trait.commission)
(define-map token-count principal uint)
(define-map market uint {price: uint, commission: principal, royalty: uint})
(define-read-only (get-balance (account principal))
(default-to u0
(map-get? token-count account)))
(define-private (trnsfr (id uint) (sender principal) (recipient principal))
(match (nft-transfer? dragon-sats id sender recipient)
success
(let
((sender-balance (get-balance sender))
(recipient-balance (get-balance recipient)))
(map-set token-count
sender
(- sender-balance u1))
(map-set token-count
recipient
(+ recipient-balance u1))
(ok success))
error (err error)))
(define-private (is-sender-owner (id uint))
(let ((owner (unwrap! (nft-get-owner? dragon-sats id) false)))
(or (is-eq tx-sender owner) (is-eq contract-caller owner))))
(define-read-only (get-listing-in-ustx (id uint))
(map-get? market id))
(define-public (list-in-ustx (id uint) (price uint) (comm-trait <commission-trait>))
(let ((listing {price: price, commission: (contract-of comm-trait), royalty: (var-get royalty-percent)}))
(asserts! (is-sender-owner id) (err ERR-NOT-AUTHORIZED))
(map-set market id listing)
(print (merge listing {a: "list-in-ustx", id: id}))
(ok true)))
(define-public (unlist-in-ustx (id uint))
(begin
(asserts! (is-sender-owner id) (err ERR-NOT-AUTHORIZED))
(map-delete market id)
(print {a: "unlist-in-ustx", id: id})
(ok true)))
(define-public (buy-in-ustx (id uint) (comm-trait <commission-trait>))
(let ((owner (unwrap! (nft-get-owner? dragon-sats id) (err ERR-NOT-FOUND)))
(listing (unwrap! (map-get? market id) (err ERR-LISTING)))
(price (get price listing))
(royalty (get royalty listing)))
(asserts! (is-eq (contract-of comm-trait) (get commission listing)) (err ERR-WRONG-COMMISSION))
(try! (stx-transfer? price tx-sender owner))
(try! (pay-royalty price royalty))
(try! (contract-call? comm-trait pay id price))
(try! (trnsfr id owner tx-sender))
(map-delete market id)
(print {a: "buy-in-ustx", id: id})
(ok true)))
(define-data-var royalty-percent uint u500)
(define-read-only (get-royalty-percent)
(ok (var-get royalty-percent)))
(define-public (set-royalty-percent (royalty uint))
(begin
(asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-INVALID-USER))
(asserts! (and (>= royalty u0) (<= royalty u1000)) (err ERR-INVALID-PERCENTAGE))
(ok (var-set royalty-percent royalty))))
(define-private (pay-royalty (price uint) (royalty uint))
(let (
(royalty-amount (/ (* price royalty) u10000))
)
(if (and (> royalty-amount u0) (not (is-eq tx-sender (var-get artist-address))))
(try! (stx-transfer? royalty-amount tx-sender (var-get artist-address)))
(print false)
)
(ok true)))
;; Alt Minting Default
(define-data-var total-price-xbtc uint u72295)
(define-read-only (get-price-xbtc)
(ok (var-get total-price-xbtc)))
(define-public (set-price-xbtc (price uint))
(begin
(asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-INVALID-USER))
(ok (var-set total-price-xbtc price))))
(define-public (claim-xbtc)
(mint-xbtc (list true)))
(define-public (claim-two-xbtc) (mint-xbtc (list true true)))
(define-public (claim-three-xbtc) (mint-xbtc (list true true true)))
(define-public (claim-four-xbtc) (mint-xbtc (list true true true true)))
(define-public (claim-five-xbtc) (mint-xbtc (list true true true true true)))
(define-private (mint-xbtc (orders (list 25 bool)))
(mint-many-xbtc orders))
(define-private (mint-many-xbtc (orders (list 25 bool )))
(let
(
(last-nft-id (var-get last-id))
(enabled (asserts! (<= last-nft-id (var-get mint-limit)) (err ERR-NO-MORE-NFTS)))
(art-addr (var-get artist-address))
(id-reached (fold mint-many-iter orders last-nft-id))
(price (* (var-get total-price-xbtc) (- id-reached last-nft-id)))
(total-commission (/ (* price COMM) u10000))
(current-balance (get-balance tx-sender))
(total-artist (- price total-commission))
)
(if (or (is-eq tx-sender art-addr) (is-eq tx-sender DEPLOYER))
(begin
(var-set last-id id-reached)
(map-set token-count tx-sender (+ current-balance (- id-reached last-nft-id)))
)
(begin
(var-set last-id id-reached)
(map-set token-count tx-sender (+ current-balance (- id-reached last-nft-id)))
(try! (contract-call? 'SP3DX3H4FEYZJZ586MFBS25ZW3HZDMEW92260R2PR.Wrapped-Bitcoin transfer total-artist tx-sender (var-get artist-address) (some 0x00)))
(try! (contract-call? 'SP3DX3H4FEYZJZ586MFBS25ZW3HZDMEW92260R2PR.Wrapped-Bitcoin transfer total-commission tx-sender COMM-ADDR (some 0x00)))
)
)
(ok id-reached)))
;; Alt Minting Default
(define-data-var total-price-usda uint u37000000)
(define-read-only (get-price-usda)
(ok (var-get total-price-usda)))
(define-public (set-price-usda (price uint))
(begin
(asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-INVALID-USER))
(ok (var-set total-price-usda price))))
(define-public (claim-usda)
(mint-usda (list true)))
(define-public (claim-two-usda) (mint-usda (list true true)))
(define-public (claim-three-usda) (mint-usda (list true true true)))
(define-public (claim-four-usda) (mint-usda (list true true true true)))
(define-public (claim-five-usda) (mint-usda (list true true true true true)))
(define-private (mint-usda (orders (list 25 bool)))
(mint-many-usda orders))
(define-private (mint-many-usda (orders (list 25 bool )))
(let
(
(last-nft-id (var-get last-id))
(enabled (asserts! (<= last-nft-id (var-get mint-limit)) (err ERR-NO-MORE-NFTS)))
(art-addr (var-get artist-address))
(id-reached (fold mint-many-iter orders last-nft-id))
(price (* (var-get total-price-usda) (- id-reached last-nft-id)))
(total-commission (/ (* price COMM) u10000))
(current-balance (get-balance tx-sender))
(total-artist (- price total-commission))
)
(if (or (is-eq tx-sender art-addr) (is-eq tx-sender DEPLOYER))
(begin
(var-set last-id id-reached)
(map-set token-count tx-sender (+ current-balance (- id-reached last-nft-id)))
)
(begin
(var-set last-id id-reached)
(map-set token-count tx-sender (+ current-balance (- id-reached last-nft-id)))
(try! (contract-call? 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.usda-token transfer total-artist tx-sender (var-get artist-address) (some 0x00)))
(try! (contract-call? 'SP2C2YFP12AJZB4MABJBAJ55XECVS7E4PMMZ89YZR.usda-token transfer total-commission tx-sender COMM-ADDR (some 0x00)))
)
)
(ok id-reached)))
;; Alt Minting Default
(define-data-var total-price-mia2 uint u67014000000)
(define-read-only (get-price-mia2)
(ok (var-get total-price-mia2)))
(define-public (set-price-mia2 (price uint))
(begin
(asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-INVALID-USER))
(ok (var-set total-price-mia2 price))))
(define-public (claim-mia2)
(mint-mia2 (list true)))
(define-public (claim-two-mia2) (mint-mia2 (list true true)))
(define-public (claim-three-mia2) (mint-mia2 (list true true true)))
(define-public (claim-four-mia2) (mint-mia2 (list true true true true)))
(define-public (claim-five-mia2) (mint-mia2 (list true true true true true)))
(define-private (mint-mia2 (orders (list 25 bool)))
(mint-many-mia2 orders))
(define-private (mint-many-mia2 (orders (list 25 bool )))
(let
(
(last-nft-id (var-get last-id))
(enabled (asserts! (<= last-nft-id (var-get mint-limit)) (err ERR-NO-MORE-NFTS)))
(art-addr (var-get artist-address))
(id-reached (fold mint-many-iter orders last-nft-id))
(price (* (var-get total-price-mia2) (- id-reached last-nft-id)))
(total-commission (/ (* price COMM) u10000))
(current-balance (get-balance tx-sender))
(total-artist (- price total-commission))
)
(if (or (is-eq tx-sender art-addr) (is-eq tx-sender DEPLOYER))
(begin
(var-set last-id id-reached)
(map-set token-count tx-sender (+ current-balance (- id-reached last-nft-id)))
)
(begin
(var-set last-id id-reached)
(map-set token-count tx-sender (+ current-balance (- id-reached last-nft-id)))
(try! (contract-call? 'SP1H1733V5MZ3SZ9XRW9FKYGEZT0JDGEB8Y634C7R.miamicoin-token-v2 transfer total-artist tx-sender (var-get artist-address) (some 0x00)))
(try! (contract-call? 'SP1H1733V5MZ3SZ9XRW9FKYGEZT0JDGEB8Y634C7R.miamicoin-token-v2 transfer total-commission tx-sender COMM-ADDR (some 0x00)))
)
)
(ok id-reached)))
;; Alt Minting Default
(define-data-var total-price-nyc2 uint u60175000000)
(define-read-only (get-price-nyc2)
(ok (var-get total-price-nyc2)))
(define-public (set-price-nyc2 (price uint))
(begin
(asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-INVALID-USER))
(ok (var-set total-price-nyc2 price))))
(define-public (claim-nyc2)
(mint-nyc2 (list true)))
(define-public (claim-two-nyc2) (mint-nyc2 (list true true)))
(define-public (claim-three-nyc2) (mint-nyc2 (list true true true)))
(define-public (claim-four-nyc2) (mint-nyc2 (list true true true true)))
(define-public (claim-five-nyc2) (mint-nyc2 (list true true true true true)))
(define-private (mint-nyc2 (orders (list 25 bool)))
(mint-many-nyc2 orders))
(define-private (mint-many-nyc2 (orders (list 25 bool )))
(let
(
(last-nft-id (var-get last-id))
(enabled (asserts! (<= last-nft-id (var-get mint-limit)) (err ERR-NO-MORE-NFTS)))
(art-addr (var-get artist-address))
(id-reached (fold mint-many-iter orders last-nft-id))
(price (* (var-get total-price-nyc2) (- id-reached last-nft-id)))
(total-commission (/ (* price COMM) u10000))
(current-balance (get-balance tx-sender))
(total-artist (- price total-commission))
)
(if (or (is-eq tx-sender art-addr) (is-eq tx-sender DEPLOYER))
(begin
(var-set last-id id-reached)
(map-set token-count tx-sender (+ current-balance (- id-reached last-nft-id)))
)
(begin
(var-set last-id id-reached)
(map-set token-count tx-sender (+ current-balance (- id-reached last-nft-id)))
(try! (contract-call? 'SPSCWDV3RKV5ZRN1FQD84YE1NQFEDJ9R1F4DYQ11.newyorkcitycoin-token-v2 transfer total-artist tx-sender (var-get artist-address) (some 0x00)))
(try! (contract-call? 'SPSCWDV3RKV5ZRN1FQD84YE1NQFEDJ9R1F4DYQ11.newyorkcitycoin-token-v2 transfer total-commission tx-sender COMM-ADDR (some 0x00)))
)
)
(ok id-reached)))
;; Alt Minting Default
(define-data-var total-price-banana uint u95000000)
(define-read-only (get-price-banana)
(ok (var-get total-price-banana)))
(define-public (set-price-banana (price uint))
(begin
(asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-INVALID-USER))
(ok (var-set total-price-banana price))))
(define-public (claim-banana)
(mint-banana (list true)))
(define-public (claim-two-banana) (mint-banana (list true true)))
(define-public (claim-three-banana) (mint-banana (list true true true)))
(define-public (claim-four-banana) (mint-banana (list true true true true)))
(define-public (claim-five-banana) (mint-banana (list true true true true true)))
(define-private (mint-banana (orders (list 25 bool)))
(mint-many-banana orders))
(define-private (mint-many-banana (orders (list 25 bool )))
(let
(
(last-nft-id (var-get last-id))
(enabled (asserts! (<= last-nft-id (var-get mint-limit)) (err ERR-NO-MORE-NFTS)))
(art-addr (var-get artist-address))
(id-reached (fold mint-many-iter orders last-nft-id))
(price (* (var-get total-price-banana) (- id-reached last-nft-id)))
(total-commission (/ (* price COMM) u10000))
(current-balance (get-balance tx-sender))
(total-artist (- price total-commission))
)
(if (or (is-eq tx-sender art-addr) (is-eq tx-sender DEPLOYER))
(begin
(var-set last-id id-reached)
(map-set token-count tx-sender (+ current-balance (- id-reached last-nft-id)))
)
(begin
(var-set last-id id-reached)
(map-set token-count tx-sender (+ current-balance (- id-reached last-nft-id)))
(try! (contract-call? 'SP2KAF9RF86PVX3NEE27DFV1CQX0T4WGR41X3S45C.btc-monkeys-bananas transfer total-artist tx-sender (var-get artist-address) (some 0x00)))
(try! (contract-call? 'SP2KAF9RF86PVX3NEE27DFV1CQX0T4WGR41X3S45C.btc-monkeys-bananas transfer total-commission tx-sender COMM-ADDR (some 0x00)))
)
)
(ok id-reached)))
;; Alt Minting Default
(define-data-var total-price-slime uint u1459000000)
(define-read-only (get-price-slime)
(ok (var-get total-price-slime)))
(define-public (set-price-slime (price uint))
(begin
(asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-INVALID-USER))
(ok (var-set total-price-slime price))))
(define-public (claim-slime)
(mint-slime (list true)))
(define-public (claim-two-slime) (mint-slime (list true true)))
(define-public (claim-three-slime) (mint-slime (list true true true)))
(define-public (claim-four-slime) (mint-slime (list true true true true)))
(define-public (claim-five-slime) (mint-slime (list true true true true true)))
(define-private (mint-slime (orders (list 25 bool)))
(mint-many-slime orders))
(define-private (mint-many-slime (orders (list 25 bool )))
(let
(
(last-nft-id (var-get last-id))
(enabled (asserts! (<= last-nft-id (var-get mint-limit)) (err ERR-NO-MORE-NFTS)))
(art-addr (var-get artist-address))
(id-reached (fold mint-many-iter orders last-nft-id))
(price (* (var-get total-price-slime) (- id-reached last-nft-id)))
(total-commission (/ (* price COMM) u10000))
(current-balance (get-balance tx-sender))
(total-artist (- price total-commission))
)
(if (or (is-eq tx-sender art-addr) (is-eq tx-sender DEPLOYER))
(begin
(var-set last-id id-reached)
(map-set token-count tx-sender (+ current-balance (- id-reached last-nft-id)))
)
(begin
(var-set last-id id-reached)
(map-set token-count tx-sender (+ current-balance (- id-reached last-nft-id)))
(try! (contract-call? 'SP125J1ADVYWGWB9NQRCVGKYAG73R17ZNMV17XEJ7.slime-token transfer total-artist tx-sender (var-get artist-address) (some 0x00)))
(try! (contract-call? 'SP125J1ADVYWGWB9NQRCVGKYAG73R17ZNMV17XEJ7.slime-token transfer total-commission tx-sender COMM-ADDR (some 0x00)))
)
)
(ok id-reached)))
;; Alt Minting Default
(define-data-var total-price-alex uint u9200000000)
(define-read-only (get-price-alex)
(ok (var-get total-price-alex)))
(define-public (set-price-alex (price uint))
(begin
(asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-INVALID-USER))
(ok (var-set total-price-alex price))))
(define-public (claim-alex)
(mint-alex (list true)))
(define-public (claim-two-alex) (mint-alex (list true true)))
(define-public (claim-three-alex) (mint-alex (list true true true)))
(define-public (claim-four-alex) (mint-alex (list true true true true)))
(define-public (claim-five-alex) (mint-alex (list true true true true true)))
(define-private (mint-alex (orders (list 25 bool)))
(mint-many-alex orders))
(define-private (mint-many-alex (orders (list 25 bool )))
(let
(
(last-nft-id (var-get last-id))
(enabled (asserts! (<= last-nft-id (var-get mint-limit)) (err ERR-NO-MORE-NFTS)))
(art-addr (var-get artist-address))
(id-reached (fold mint-many-iter orders last-nft-id))
(price (* (var-get total-price-alex) (- id-reached last-nft-id)))
(total-commission (/ (* price COMM) u10000))
(current-balance (get-balance tx-sender))
(total-artist (- price total-commission))
)
(if (or (is-eq tx-sender art-addr) (is-eq tx-sender DEPLOYER))
(begin
(var-set last-id id-reached)
(map-set token-count tx-sender (+ current-balance (- id-reached last-nft-id)))
)
(begin
(var-set last-id id-reached)
(map-set token-count tx-sender (+ current-balance (- id-reached last-nft-id)))
(try! (contract-call? 'SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.age000-governance-token transfer total-artist tx-sender (var-get artist-address) (some 0x00)))
(try! (contract-call? 'SP3K8BC0PPEVCV7NZ6QSRWPQ2JE9E5B6N3PA0KBR9.age000-governance-token transfer total-commission tx-sender COMM-ADDR (some 0x00)))
)
)
(ok id-reached)))