;; your-black-flowers

(impl-trait 'SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait.nft-trait)

(define-non-fungible-token your-black-flowers 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)

;; Internal variables
(define-data-var mint-limit uint u49)
(define-data-var last-id uint u0)
(define-data-var total-price uint u299000000)
(define-data-var artist-address principal 'SP35K3WCA9GCJV2XC7X021MR2D9D2PKF855CVCKB0)
(define-data-var ipfs-root (string-ascii 80) "ipfs://ipfs/QmPp36D9dinfGzyMZU7MZXhoMgGVQoyQmmgS9VsdzZ2LyE/")
(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)))

;; Mintpass Minting
(define-private (mint (orders (list 25 bool)))
  (let 
    (
      (passes (get-passes tx-sender))
    )
    (if (var-get premint-enabled)
      (begin
        (asserts! (>= passes (len orders)) (err ERR-NOT-ENOUGH-PASSES))
        (map-set mint-passes tx-sender (- passes (len orders)))
        (mint-many orders)
      )
      (begin
        (asserts! (var-get sale-enabled) (err ERR-PUBLIC-SALE-DISABLED))
        (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? your-black-flowers 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))
    (nft-burn? your-black-flowers token-id tx-sender)))

(define-private (is-owner (token-id uint) (user principal))
    (is-eq user (unwrap! (nft-get-owner? your-black-flowers 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))
    (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? your-black-flowers 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-mints (caller principal))
  (default-to u0 (map-get? mints-per-user caller)))

(define-read-only (get-mint-limit)
  (ok (var-get mint-limit)))

;; 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})

(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? your-black-flowers 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? your-black-flowers 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)}))
    (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? your-black-flowers id) (err ERR-NOT-FOUND)))
      (listing (unwrap! (map-get? market id) (err ERR-LISTING)))
      (price (get price 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))
    (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-private (pay-royalty (price uint))
  (let (
    (royalty (/ (* price (var-get royalty-percent)) u10000))
  )
  (if (> (var-get royalty-percent) u0)
    (try! (stx-transfer? royalty tx-sender (var-get artist-address)))
    (print false)
  )
  (ok true)))

;; Extra functionality required for mintpass
(define-public (toggle-sale-state)
  (let 
    (
      ;; (premint (not (var-get premint-enabled)))
      (sale (not (var-get sale-enabled)))
    )
    (asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-NOT-AUTHORIZED))
    (var-set premint-enabled false)
    (var-set sale-enabled sale)
    (print { sale: sale })
    (ok true)))

(define-public (enable-premint)
  (begin
    (asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-NOT-AUTHORIZED))
    (ok (var-set premint-enabled true))))

(define-public (disable-premint)
  (begin
    (asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-NOT-AUTHORIZED))
    (ok (var-set premint-enabled false))))

(define-read-only (get-passes (caller principal))
  (default-to u0 (map-get? mint-passes caller)))

(define-read-only (get-premint-enabled)
  (ok (var-get premint-enabled)))

(define-read-only (get-sale-enabled)
  (ok (var-get sale-enabled)))  

(map-set mint-passes 'SP5JMWT45ZF0RHJZSR4XPAEW8MS7J3DFQS5FAJ0X u1)
(map-set mint-passes 'SP26C9TWJYK6DTCD4T6HKBC76DPMK2DXXRNWS3E2D u1)
(map-set mint-passes 'SPS2RBYAXSCXMVPYXSG724CFY4W2WA2NPG44V191 u1)
(map-set mint-passes 'SPXKPY2NMKPQW7W5PCNKD1YG67GVBJKATQKNA1ZH u1)
(map-set mint-passes 'SPQVG91FWDN2KZ6V8DTSKYCXC5FEZFDZSQC8ZNM1 u1)
(map-set mint-passes 'SP36BHKET7TJKBH4Q7G2EY1SMA390Q52VJTEF181K u1)
(map-set mint-passes 'SP2HVP68NY5BD2RDFX0JNXSYRS8AA6R7S30N08NJZ u1)
(map-set mint-passes 'SP1J4SFHSMMT5Z0PG3WDD1TNGZVCWMB5QBYHNFECG u1)
(map-set mint-passes 'SP1RYWKCXYWAHWS3RC9QJSFK5EPEH07E4DG1GCFWV u1)
(map-set mint-passes 'SP3N0TH3N7BDG4WBSYV6FE2ASSAPEGWK47EEWD9TV u1)
(map-set mint-passes 'SP384CVPNDTYA0E92TKJZQTYXQHNZSWGCAG7SAPVB u2)
(map-set mint-passes 'SPN4Y5QPGQA8882ZXW90ADC2DHYXMSTN8VAR8C3X u2)
(map-set mint-passes 'SP2DFX28F1S3CB46B5XH9M5JQ7N4SMCE7CQY1TNYS u1)
(map-set mint-passes 'SP1Z84TMVM83HXE5VFHTXF27JPF73HPWT618RR26Y u1)
(map-set mint-passes 'SP2Z4MCB2488PSASQHWDA2J3G2CG7TDETT8TK5QA0 u1)
(map-set mint-passes 'SP3F50PNGA4PY5PVB590SKY4WE8NHZEYQKRDBSJX8 u1)
(map-set mint-passes 'SP1FR2M102H4DE4DH96R4D29RC8AGQZG5D5Y4S7CH u1)
(map-set mint-passes 'SP3R2PCDYP8DA38P3SH7K67Q626T45FDMSNFDZR9V u1)
(map-set mint-passes 'SP1C671AAKE9M5T7BPR7X8F9WRK5W7A4PVMHSSPGZ u1)
(map-set mint-passes 'SP28W9AFP15D25MBPPQNQ64JZY8MX5F9SFTB67Q68 u1)
(map-set mint-passes 'SP1FZKAJ5V0QSV19RB5T2DG1PJQ6R6MKSB5ZJF5A5 u1)
(map-set mint-passes 'SPQDDGJG6KVGAYA5ED386MAFH17C5HCXW2VZ9XZ3 u1)
(map-set mint-passes 'SPAX2SZCDFTVV76SR4JY4RYEPC5PBH2QAHEJXHTF u1)
(map-set mint-passes 'SPW05PZKP6CXKF0YAKBAMHV5XY2VXFVSCVKJCDVE u1)
(map-set mint-passes 'SP1WYHPJJVN3P0PS32BMF33P6WVVK1SNRRS28ZF0G u1)
(map-set mint-passes 'SP3DW5P0EPZX7KB4N381QTWGDYTJN98M80PFR0X62 u1)
(map-set mint-passes 'SP2H4D75YFX3ZYQY2DK5GEEHF7X9V5GA4ZMM9EJW7 u1)
(map-set mint-passes 'SPDRK8AEWS9G2E2WG22H8SZPPV3AEQ6BX9DT42RJ u1)
(map-set mint-passes 'SP162D87CY84QVVCMJKNKGHC7GGXFGA0TAR9D0XJW u1)
(map-set mint-passes 'SP3JXAXGZA5JJJ4YHTEW6Q46PKX3VMT0Q0F7JDYF7 u1)
(map-set mint-passes 'SP3YBQRESRPX4B90BZHE77J2YK5DG8BBBXWJHZ0M9 u1)
(map-set mint-passes 'SP1C0EGYWYDZ2JVJVCGASH1G5HJ2GE2KB2SMN54D u1)
(map-set mint-passes 'SP2FQ7FY41RKCP6E2Z53Q70S5V99F2PETQZVAD3V3 u1)
(map-set mint-passes 'SP3356JJ54Q0YB2Q7EN3ZPV7DAY8E2NAS9P8E2WZ0 u1)
(map-set mint-passes 'SP1ZHVKGVT1KZETT4J9CGYXZE9D20N375V4M323SQ u1)
(map-set mint-passes 'SPPT6DNNC9KQW9MXNYTX4FH3CJXWQP90E5B6K64G u1)
(map-set mint-passes 'SP235VD14JSA9EZJT2SPWAYS70BV5QFGF9JFS754A u1)
(map-set mint-passes 'SPA5P51076FPT6JPC0H09ENXTCMW55ZXQCR27JSZ u1)
(map-set mint-passes 'SP7MAP8XJCMRZ9901ETFA3EKVVPJ4X51AWQ2VG4F u1)
(map-set mint-passes 'SP30Z954NBY6E3BGMMCM87VAFHJVZQE29HT3VZ6PJ u1)
(map-set mint-passes 'SPP39B6RGNGXD42ZCDF8XDCT6RWNQ322M58NBKSG u1)
(map-set mint-passes 'SP3T7SA543GTWEPD3022B66RYN2WZ4SQW64S686AA u1)
(map-set mint-passes 'SP277HZA8AGXV42MZKDW5B2NNN61RHQ42MTAHVNB1 u1)
(map-set mint-passes 'SP3NFPNNJ6QCMWH99474QP92FPJQHJA3A07NSDX9H u1)
(map-set mint-passes 'SP1NFRJJFQAA5AB4R8RDA3F0WEBZHK0HQSKW1PPNY u1)
(map-set mint-passes 'SPCRHA45AXN05RYBDYY5WZK5F7J5SH574F0R0VR6 u1)
(map-set mint-passes 'SP1XAR0A0J2AFWXQXCJ07SPV3TSZV2BCQQAQ6H5B5 u1)
(map-set mint-passes 'SP8JVD8G9RRXPWF13STYZSJDDP25WSM8GWB46MAX u1)
(map-set mint-passes 'SP2MAWMYQPPVD3KH8SXC9M0HHERQ45YAKJFTWKXQ1 u1)
(map-set mint-passes 'SPBF5K5X0CB0SSCQQKNJTP388SKK0SV9WKG5KZVX u1)
(map-set mint-passes 'SPEXAF3YRNCR01Z4DFZ567Z0FB4RKPHM88DMKJSQ u1)
(map-set mint-passes 'SP1WY2NB1DXCV4K2H5H88D4G1QNKKZ3VZ398CET8G u1)
(map-set mint-passes 'SP3B84QWAXRAKB67Z4TB33SY5G0BGGVQC36526QN6 u1)
(map-set mint-passes 'SPZNTAFC849F9TTSD9T12Q6E57JMY8KFHS9FXZ21 u1)
(map-set mint-passes 'SP1RQZCECRGR5W7J9PBX6TGF7Q0JN923E47W22KN7 u1)
(map-set mint-passes 'SP3JPR7XNR60AMBBEZAGF1YHRSFY1JCKE14HBKGTY u2)
(map-set mint-passes 'SP356400A5XM1ZKNXCQ7BJRE8PXXG1EJHV3954Z27 u1)
(map-set mint-passes 'SP3546SSJVXVH1XS65WK3ESKMDZ2RA6K3680H66TE u1)
(map-set mint-passes 'SP1XBS03PFDTV1HSD7BY02V6VG16VTNRDP9N1QZAV u1)
(map-set mint-passes 'SPKXP6A04Z6EZTJGKV6RDNGQD1T6J792A6ER6WKV u1)
(map-set mint-passes 'SP3BWAHYMTHQZHSB8N49AXQNTYWBACQBAN8Z4QFRD u1)
(map-set mint-passes 'SP3YF5XZN4CNKRANEHVFWS18DAG5M2CHQTSBZQX35 u1)
(map-set mint-passes 'SP14814KM6CBCJZMD15JJ58Q3E2S3NCB6SDXM8C79 u1)
(map-set mint-passes 'SP27E3TDKYNH3C11RBDFPD5WGR6FV0VN08RKX4D2N u1)
(map-set mint-passes 'SP1KBVBP3AZP7YA968Y3G14A17P9XXFPBPEVF5EG9 u1)
(map-set mint-passes 'SP3CK642B6119EVC6CT550PW5EZZ1AJW661ZMQTYD u1)
(map-set mint-passes 'SP37N35P4903CB8S91SHHYYQ3Q44Q3HCJSBP8DCVF u1)
(map-set mint-passes 'SPQY88E87FNMP1NTY2YQ7X5DPTVY810PS8T6D2Y3 u1)
(map-set mint-passes 'SP1Z8M48EK5KFVSKW0VMX0J4A4KKKQHKS95NSS7QW u1)
(map-set mint-passes 'SPR6RNTSP1TRMNXG17DHN7S2EVQ4AVDK9Y38MK88 u1)
(map-set mint-passes 'SP2BB2Y38C8EDNEK8JTR126GWEFYKY97AG9HRW9CW u1)
(map-set mint-passes 'SP3J1W2FS54ZEB5W64S0DFFPS86AGYGFB4VM0CFC2 u1)
(map-set mint-passes 'SP32AEEF6WW5Y0NMJ1S8SBSZDAY8R5J32NBZFPKKZ u1)
(map-set mint-passes 'SP3EYCZ3EW2Q69GWBYADH9J008YQJ4HPKEBY08N7E u1)
(map-set mint-passes 'SP2791RKSYJJ39MVHC09J8NARWBMK5G9C79EJB0RV u1)
(map-set mint-passes 'SP1RWWPH1DMKVHK22ZHC008T5RARCZMM4GCBA78TX u1)
(map-set mint-passes 'SP3ST6K5W36V2MTSNYYXE56SCXR7DGTW9N4NMZHYV u1)
(map-set mint-passes 'SP3ZMEFW7VH796ZQAH1JMAJT4WC4VPEZZFB6W5CAD u1)
(map-set mint-passes 'SP2H6HVZK6X3Z8F4PKF284AZJR6FH4H9J4W6KVV8T u1)
(map-set mint-passes 'SP12BEEDG31J0AH68DFDJJYZ36D002PKDZCP1DZQE u1)
(map-set mint-passes 'SP398XE371G08T84A99TCBD8XKWY3S7VVX6JKJWKY u1)
(map-set mint-passes 'SP7NW9XVEG45SW1367SAHHZG67BFA4GMA9DVGZ0F u1)
(map-set mint-passes 'SP18QG8A8943KY9S15M08AMAWWF58W9X1M90BRCSJ u1)
(map-set mint-passes 'SP26GZCVY8FYHNZ6C73W68TCFJHS8F8C9E772XX7X u1)
(map-set mint-passes 'SP3A09H1JEB4F85FZ6XEXRSZA210SC6RB7Q7V7DAF u1)
(map-set mint-passes 'SP2BZQ48MADDN62X044NNJCNXF5BA33C3BFQ3TZJW u1)
(map-set mint-passes 'SP32DFA3HXYZ2BV3P8H6XQM8EN94D2212QM71BRYG u1)
(map-set mint-passes 'SPNNXMY01SNT92EEK9DRRG2QW1FA256MCNBPPSRX u1)
(map-set mint-passes 'SP2DW9RTN82J2MR2FHQXY5EE0Y616JJ076RYG8PTY u1)
(map-set mint-passes 'SP2HJVJQS0TRBTQ1WAWWN9H9W2HKGDZ7H5EZCEAQC u1)
(map-set mint-passes 'SP1NQJF5Z38JYZNEPH3Y02ZERF587V2W39A1WXYH5 u1)
(map-set mint-passes 'SP284KTW6YXVAQGMVCKRGPHJFTCVK1MFMPMH9VZHV u1)
(map-set mint-passes 'SP18WRH4SF7F1M5QZZ2BQDZZYBCJWT9VWQMDSTFY5 u1)
(map-set mint-passes 'SP23RS2V3BAWHNQ3RHVZHK10F51RA99C1FHQKY9QH u1)
(map-set mint-passes 'SP28RZ1QXMXJXVKRRCR3D7GR5D48XY0NNA9MZWHJB u1)
(map-set mint-passes 'SP33N5R751MG99QAM4CN6HQ3MDTYBR71SB4NXVGT1 u1)
(map-set mint-passes 'SP1VARC5XTG0G93FZGH760PFFV1CPXMG0SFSWSY1W u2)
(map-set mint-passes 'SP30KD0JV9B3XX6DSPXSH90J621R7VBSSY2GNBC26 u2)
(map-set mint-passes 'SP2A4AHARKR9PNPNYWCE9RT1EF9BQ7GDPTRJ03EAA u1)
(map-set mint-passes 'SP364J7EDJXRE1FPDZDABP9M58HPY4G88BFCP2HD0 u1)
(map-set mint-passes 'SP3CRGM0QHHD36B57FXZW60EQS7NM6XJK8WC7T34S u1)
(map-set mint-passes 'SPJ6RD5PYMM75KQNGH588RHE153JMWRMCSWP4Q2H u1)
(map-set mint-passes 'SP25KJH4N4YNKTVXSWSHDPVCWDFAN2BA4H2VQVN0G u1)
(map-set mint-passes 'SP21728T40XTN7EV3PZXXZDHVT8GJH1JPKDEC8WGX u1)
(map-set mint-passes 'SP3GNAE8V8KZ24T31JC10TT184F6NQ4YDYHGVFZ10 u1)
(map-set mint-passes 'SP17NZ4FXJAKJYM3976YT216ZTJVMJ6XACRB089XH u1)
(map-set mint-passes 'SP9XD6041FFN5BW6ZR9J3FSESR4S442JPYZJVXBW u1)
(map-set mint-passes 'SP27A09VG1SH1J8Z76NXHBGKB0ZWSBZ99DRGAC8NB u1)
(map-set mint-passes 'SP79JMAGQVWMVWRXG2AE5GF8Z27VF1W4KZ3J03WG u1)
(map-set mint-passes 'SPCRDMAJ0RJYPQ3BMNN9VV01BFSCG1SQ1WJZB558 u1)
(map-set mint-passes 'SP12ZVZNKA89JFHH5WJ4YQ999Q57NRBX3WCCJ04VS u1)
(map-set mint-passes 'SP5QB32W2AQFPDJ822AM87DGYRQ6D68JDVQZKMM9 u1)
(map-set mint-passes 'SP3BRRCHKMPBR60V8ES9J5YF40VXWMABWXK4SEB9G u1)
(map-set mint-passes 'SP1G4Z5J9AYVKZCHZ8RVPH593FPWJX5P6QM6JEV27 u1)
(map-set mint-passes 'SP3AJC728JY0Y43E8RT6K4VDWPT265RDMXJ8M0VH0 u1)
(map-set mint-passes 'SP36KZRX2ET7W215D568EDTA4A392EWN14FT12TAN u1)
(map-set mint-passes 'SP1T07GK9H4M0WP4N1DSSA7NJ7GNTQZ0GBZM0GAR2 u1)
(map-set mint-passes 'SP2G4M87CA0AACNS5ZHG0FPGQ77WXERZJE8DGA878 u1)
(map-set mint-passes 'SP3ZTYBN9PYVVFKBEFVSZ2BEGK3HXRNVP6FDG79WV u1)
(map-set mint-passes 'SPHSJ8X8NM1B59FRR9H643J93TC8G75F3TGWNRJ1 u1)
(map-set mint-passes 'SP1VCG4HXMG02BMJCSAZDBS1WR4N2YG3RPHMNP9WR u1)
(map-set mint-passes 'SP2WPTFTP17PGJM8328QWG3SNV9EZ9W1C7EGTD5BQ u1)
(map-set mint-passes 'SP3RW6BW9F5STYG2K8XS5EP5PM33E0DNQT4XEG864 u1)
(map-set mint-passes 'SP1KWCYXS5N2C0CWDBXFJWRXXWVGVPDBG008Q1C6D u1)
(map-set mint-passes 'SP2F18PH7FP22EHS0J0X3A6EFZ9PAW0EZJRET0GXZ u1)
(map-set mint-passes 'SP3C5JYPB8YE5H9WC2SM196RVJ0JXN2GHCWXJWSES u1)
(map-set mint-passes 'SP29TD2E52QWP2403TE7MVVXB5Q0BQDS5EHMDM208 u1)
(map-set mint-passes 'SPN7C68VE0HZJ2812V5ZT444GJPZXE9G3TT9QFYT u1)
(map-set mint-passes 'SP6M4JARC501VCQ3S86G537H87NXJ176PNVHN2PQ u2)
(map-set mint-passes 'SP2R3CHRAP1HE4M64X1NZXHZT41JG3XGNHJW4HX2W u2)
(map-set mint-passes 'SPKFSJ4T8T39ZJN455QBY7TJX4DYF47J7344HNNF u1)
(map-set mint-passes 'SP4QA0NHP03T3T9GJKR5KEA7VQ2KNSXRK5JC74NG u1)
(map-set mint-passes 'SP779SC9CDWQVMTRXT0HZCEHSDBXCHNGG7BC1H9B u1)
(map-set mint-passes 'SP349J1ZTEE71M1J5D4YS0BPQCCFJ3YSNM1P8BJY4 u1)
(map-set mint-passes 'SP2VG7S0R4Z8PYNYCAQ04HCBX1MH75VT11VXCWQ6G u1)
(map-set mint-passes 'SP39RDA7SBJKD3M8TH5W41RZY12C9XGHKY8S4ACTY u1)
(map-set mint-passes 'SP2NBCT6WVMD8PX46VTNRT4ENTQBZZ8ZYYYZY65RB u2)
(map-set mint-passes 'SPFZJAWND9GDB2QC54524J73DGBQ07XJ6JM1E3GN u1)
(map-set mint-passes 'SP1ZQBAJAB9S0QFJCJSK6J0NR80334T7GBVMW7ABS u1)
(map-set mint-passes 'SP1JF9VSNJBP4YZVC7AJ9CE6CXBD2ZV0W67T0E4T0 u1)
(map-set mint-passes 'SP643H4YMDRDNAE89EHY4B65S9K047XWX3QNW3W9 u1)
(map-set mint-passes 'SPPMGZTRGMBVCFW3RMEVQJEF26MW9G6EKT51EMD8 u1)
(map-set mint-passes 'SPDXC0NM3YQDHV1HN3V9P5Y4P26QWY709NB86EYB u1)
(map-set mint-passes 'SP71N7X6G8KYGQPHZW7TB4PD1JZ6ND9AESF9JPZ8 u1)
(map-set mint-passes 'SP9227STGNCZPRTP2T2G3S02M7XB5ENAQB1J82FA u1)
(map-set mint-passes 'SPM1Q7YG18378H6W254YN8PABEVRPT38ZCY01SJD u1)
(map-set mint-passes 'SP3MMG05H6T48W5NJEEST0RR3FTPGKPM7C19X5M16 u1)
(map-set mint-passes 'SPAA2NPKN1DN7A8TQWQH6P72V4HMDASVTY1NS1MN u1)
(map-set mint-passes 'SP3GARS14D25RNGWRS85V5VZWJ6TKNFY8Y2TPZV3K u1)
(map-set mint-passes 'SP3M16X85R7ED2RR70ANNB3X0HXPHGSAXBEGGZKK0 u1)
(map-set mint-passes 'SP1YT6QRRHPGJVDKQY89MSGGFHYAETD4FKVTBRH1P u1)
(map-set mint-passes 'SP3VCX5NFQ8VCHFS9M6N40ZJNVTRT4HZ62WFH5C4Q u1)
(map-set mint-passes 'SP2AYJHP9H3JM3T26ZBW0SKBCXJ9S4JW03VQBP7K1 u1)
(map-set mint-passes 'SP1RDVQHYK1DGF3WR2BM83BCCKPWDS2M8FX11WDWP u1)
(map-set mint-passes 'SP5CQR0EPFKM8WET982GNG3GJF59K7CBFBF4S71G u1)
(map-set mint-passes 'SP2AZQEX25ZH3DBATPXAEBZ7M642WWM4NQ4XZNVSY u1)
(map-set mint-passes 'SPXQS1T1T2BKGSHH8H75PVFEY0R1X39F0B3MQWTJ u1)
(map-set mint-passes 'SPCJ0JZVB02YYVSR5XVS1JJ17G4ZP1KFGD15B049 u1)
(map-set mint-passes 'SP1JX2RYKPR0G7H81SQHZQ187H50RR6QSM8GX839X u1)
(map-set mint-passes 'SP3YSG653BZZNTJVFHFMBSQCTP3GK6NAQEHC82TNK u1)
(map-set mint-passes 'SP197GMEG6WGBRDTCTGGWMRA1G77E65TRXWYKGCT7 u2)
(map-set mint-passes 'SP2DEYX2D5T4Y440M7S7B07F3MKWA0C44QFNDM9WA u1)
(map-set mint-passes 'SP1K8RG4PV202FHT8J9023G1WJRPFTSZXN9TPNEJX u1)
(map-set mint-passes 'SP2F2KH0RVX6GF1Y9FWMMSR9RHG0TW3NN72D724NX u1)
(map-set mint-passes 'SP9MZHJH0FQB746YZ7D22ZBHJFQVBYN8M8FQ4PCX u1)
(map-set mint-passes 'SP2CZMH9A6FH5QPAJAR8ZG091Z15JKAGY1X0F3EJ0 u1)
(map-set mint-passes 'SP3SF0PSD7KYVJQPKKRBYJFF7NENGFHZSBVHM3B27 u1)
(map-set mint-passes 'SP2JZ2WJVNQ6ECEKJHEBW8663CFXFCZHHKN64BVFM u1)
(map-set mint-passes 'SP3PPBWF44PSCFN9BPVFZYZD6R8JJNQW0CPDPYB6D u1)
(map-set mint-passes 'SPZ5DJGRVZHXEEEYYGWEX84KQB8P69GC715ZRNW1 u1)
(map-set mint-passes 'SP1CQF008B5KJ477RQQQQJAQZZG4B0KHDHMJ4W444 u1)
(map-set mint-passes 'SP3QC4R6M7M0DAZBXSZCW4FWGDCNDD05FV8Y0AY8C u1)
(map-set mint-passes 'SP1B8CHAEDJH87WCC78K8BZ1DF4DJG0DTG3FCMSQB u1)
(map-set mint-passes 'SP3R4NKXMGW6YXA44X2ESZPKJNV25X4ZN7DPW0RXR u1)
(map-set mint-passes 'SP3K22XKPT9WJFCE957J94J6XXVZHP7747YNPDTFD u1)
(map-set mint-passes 'SP18BABNMFCZNMBBKMT6433T2BNQ4V815STR5TXHG u1)
(map-set mint-passes 'SP3QK75VP0Y64SAJNKTNH5WBBR798C8XAR8T4PJ6W u1)
(map-set mint-passes 'SP2ZQSG2619ETZWE9QMDFTG07T6BPGD3QS9HTP1AM u1)
(map-set mint-passes 'SP1H6RRVDYQS4D2VEY7AZ1FD7FPBAGVRQ5WJ9RBE0 u1)
(map-set mint-passes 'SP1CE3NQXDKCJ2KEFFGCVFA5C196S9F0RRX93HY87 u2)
(map-set mint-passes 'SP3MCBTS2V2AJCKBAHZSMJM16RF0TEQBZMRWSSK3Q u1)
(map-set mint-passes 'SPZ5P0V21GEG4271KMEPH5BHC9SCDG73HAKSTY38 u1)
(map-set mint-passes 'SP2V6HR6CTCKYSBC47F1V6D1FMCSHJ0SXM0MJZYVY u1)
(map-set mint-passes 'SP3XCPRFXWG6GK954XX78QBN7GAM94GGDRD4J49F1 u1)
(map-set mint-passes 'SP3SKH6YB515J76KVDHDHBTE2GQ4CV6QJHC5GJKRF u1)
(map-set mint-passes 'SP15G5PXB159632KGCVWD76FNSK0CSRAP66A8YY01 u1)
(map-set mint-passes 'SP1YBP35K01SG2G8NG7NHSDXFSVEAKWKFEHF09PMG u1)
(map-set mint-passes 'SPYZ2K1ZTG8NGKNY8VCX8NDKCGCCE9WZT85AGQR u1)
(map-set mint-passes 'SP2YQCF4DMRWRPKD0EVNDY3AJ0BBS9FQH548GCHND u1)
(map-set mint-passes 'SP21A89VNFKAHRFGN0KBXWC97T0EFKXWBH4MJP6MQ u1)
(map-set mint-passes 'SP14PVWDVKVK1P1SZV72MJQMNX5N5XDZ8AGNG9M0C u1)
(map-set mint-passes 'SP1QP7250V66NR4S0H86PXBRNRJ9BXC6743HRA64D u1)
(map-set mint-passes 'SPC1KF4NNCVFRG3H4T3XQXRQNBPW7PDS7EY303CP u1)
(map-set mint-passes 'SP1BSM0HS0WPJXMWPR5S1N21WQZRDTH1Y46BYQXMQ u1)
(map-set mint-passes 'SP3ZRRE4QQZHJHM9CEM4YBBVXX3SVSQ0D7W9DZZT7 u1)
(map-set mint-passes 'SP3EMMPNHQQ24CK3ZMTX6JEBDFMDFXHVVEZ776JGY u1)
(map-set mint-passes 'SP3273YEPG4QZWX0ENQ98FBT1N2Y06XW820STP7NN u1)
(map-set mint-passes 'SPSEBFRZZEZSHGRKRR1Z55RX5AWHER3CYM0H9BMW u1)
(map-set mint-passes 'SP1XPG9QFX5M95G36SGN9R8YJ4KJ0JB7ZXNH892N6 u1)
(map-set mint-passes 'SP1VZ743H2Y4K983JNN4DE13BB6410A7R8N16WAXF u1)
(map-set mint-passes 'SP35EWH2ZV6TX3QR65HEXR22HVKZ16NW9ZCAZW1P3 u1)
(map-set mint-passes 'SP2NDK60R7JKQ3SJ98CEHV2CMNDVTFBR541C4KV5Y u2)
(map-set mint-passes 'SP30R5X0EC0TTW2YE3HWW5NZ8NSWBD0QFHMQTDE1B u1)

;; Airdrop
(define-public (admin-airdrop)
  (let
    (
      (last-nft-id (var-get last-id))
    )
    (begin
      (asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-NOT-AUTHORIZED))
      (asserts! (is-eq false (var-get airdrop-called)) (err ERR-AIRDROP-CALLED))
      (try! (nft-mint? your-black-flowers (+ last-nft-id u0) 'SP35K3WCA9GCJV2XC7X021MR2D9D2PKF855CVCKB0))
      (map-set token-count 'SP35K3WCA9GCJV2XC7X021MR2D9D2PKF855CVCKB0 (+ (get-balance 'SP35K3WCA9GCJV2XC7X021MR2D9D2PKF855CVCKB0) u1))
      (try! (nft-mint? your-black-flowers (+ last-nft-id u1) 'SP35K3WCA9GCJV2XC7X021MR2D9D2PKF855CVCKB0))
      (map-set token-count 'SP35K3WCA9GCJV2XC7X021MR2D9D2PKF855CVCKB0 (+ (get-balance 'SP35K3WCA9GCJV2XC7X021MR2D9D2PKF855CVCKB0) u1))
      (try! (nft-mint? your-black-flowers (+ last-nft-id u2) 'SP1WYHPJJVN3P0PS32BMF33P6WVVK1SNRRS28ZF0G))
      (map-set token-count 'SP1WYHPJJVN3P0PS32BMF33P6WVVK1SNRRS28ZF0G (+ (get-balance 'SP1WYHPJJVN3P0PS32BMF33P6WVVK1SNRRS28ZF0G) u1))
      (try! (nft-mint? your-black-flowers (+ last-nft-id u3) 'SPZ5DJGRVZHXEEEYYGWEX84KQB8P69GC715ZRNW1))
      (map-set token-count 'SPZ5DJGRVZHXEEEYYGWEX84KQB8P69GC715ZRNW1 (+ (get-balance 'SPZ5DJGRVZHXEEEYYGWEX84KQB8P69GC715ZRNW1) u1))
      (try! (nft-mint? your-black-flowers (+ last-nft-id u4) 'SP2AZQEX25ZH3DBATPXAEBZ7M642WWM4NQ4XZNVSY))
      (map-set token-count 'SP2AZQEX25ZH3DBATPXAEBZ7M642WWM4NQ4XZNVSY (+ (get-balance 'SP2AZQEX25ZH3DBATPXAEBZ7M642WWM4NQ4XZNVSY) u1))

      (var-set last-id (+ last-nft-id u5))
      (var-set airdrop-called true)
      (ok true))))