spaghettipunk-mint-with-referral-v1

SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH

Source Code

;;spaghettipunk-mint-with-referral-v1
;;Author: SpaghettiPunk

(define-constant ERR_NOT_VALID_REFERRAL u100)
(define-constant ERR_NOT_VALID_ID u101)

;; === Helper functions ===
(define-private (validate-referral (ref-code (string-ascii 30)))
  (let ((owner-opt (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code)))
    (match owner-opt
      owner (if (not (is-eq tx-sender owner))
                (ok true)
                (err ERR_NOT_VALID_REFERRAL))
      (err u404))))

;; === Claim functions for SpaghettiPunk Club NFTs ===
(define-public (spaghettipunk-club-claim-one-with-referral (ref-code (string-ascii 30)))
  (let (
    (last-id (unwrap! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club get-last-token-id) (err ERR_NOT_VALID_ID)))
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club))
    (spoint-reward (contract-call? .spaghettipunk-referrals get-spoint-referral-bonus-reward))
    (mints u1)
    (reward (* mints total-reward))
    (spoint (* mints spoint-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club claim))
    (if (> spoint-reward u0)
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints (some (+ last-id u1))))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: spoint })
      )
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints none))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: u0 })
      ))
    (ok true)))

(define-public (spaghettipunk-club-claim-two-with-referral (ref-code (string-ascii 30)))
  (let (
    (last-id (unwrap! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club get-last-token-id) (err ERR_NOT_VALID_ID)))
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club))
    (spoint-reward (contract-call? .spaghettipunk-referrals get-spoint-referral-bonus-reward))
    (mints u2)
    (reward (* mints total-reward))
    (spoint (* mints spoint-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club claim-two))
    (if (> spoint-reward u0)
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints (some (+ last-id u1))))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: spoint })
      )
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints none))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: u0 })
      ))
    (ok true)))

(define-public (spaghettipunk-club-claim-three-with-referral (ref-code (string-ascii 30)))
  (let (
    (last-id (unwrap! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club get-last-token-id) (err ERR_NOT_VALID_ID)))
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club))
    (spoint-reward (contract-call? .spaghettipunk-referrals get-spoint-referral-bonus-reward))
    (mints u3)
    (reward (* mints total-reward))
    (spoint (* mints spoint-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club claim-three))
    (if (> spoint-reward u0)
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints (some (+ last-id u1))))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: spoint })
      )
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints none))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: u0 })
      ))
    (ok true)))

(define-public (spaghettipunk-club-claim-four-with-referral (ref-code (string-ascii 30)))
  (let (
    (last-id (unwrap! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club get-last-token-id) (err ERR_NOT_VALID_ID)))
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club))
    (spoint-reward (contract-call? .spaghettipunk-referrals get-spoint-referral-bonus-reward))
    (mints u4)
    (reward (* mints total-reward))
    (spoint (* mints spoint-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club claim-four))
    (if (> spoint-reward u0)
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints (some (+ last-id u1))))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: spoint })
      )
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints none))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: u0 })
      ))
    (ok true)))

(define-public (spaghettipunk-club-claim-five-with-referral (ref-code (string-ascii 30)))
  (let (
    (last-id (unwrap! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club get-last-token-id) (err ERR_NOT_VALID_ID)))
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club))
    (spoint-reward (contract-call? .spaghettipunk-referrals get-spoint-referral-bonus-reward))
    (mints u5)
    (reward (* mints total-reward))
    (spoint (* mints spoint-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club claim-five))
    (if (> spoint-reward u0)
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints (some (+ last-id u1))))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: spoint })
      )
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints none))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: u0 })
      ))
    (ok true)))

(define-public (spaghettipunk-club-claim-six-with-referral (ref-code (string-ascii 30)))
  (let (
    (last-id (unwrap! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club get-last-token-id) (err ERR_NOT_VALID_ID)))
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club))
    (spoint-reward (contract-call? .spaghettipunk-referrals get-spoint-referral-bonus-reward))
    (mints u6)
    (reward (* mints total-reward))
    (spoint (* mints spoint-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club claim-six))
    (if (> spoint-reward u0)
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints (some (+ last-id u1))))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: spoint })
      )
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints none))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: u0 })
      ))
    (ok true)))

(define-public (spaghettipunk-club-claim-seven-with-referral (ref-code (string-ascii 30)))
  (let (
    (last-id (unwrap! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club get-last-token-id) (err ERR_NOT_VALID_ID)))
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club))
    (spoint-reward (contract-call? .spaghettipunk-referrals get-spoint-referral-bonus-reward))
    (mints u7)
    (reward (* mints total-reward))
    (spoint (* mints spoint-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club claim-seven))
    (if (> spoint-reward u0)
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints (some (+ last-id u1))))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: spoint })
      )
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints none))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: u0 })
      ))
    (ok true)))

(define-public (spaghettipunk-club-claim-eight-with-referral (ref-code (string-ascii 30)))
  (let (
    (last-id (unwrap! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club get-last-token-id) (err ERR_NOT_VALID_ID)))
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club))
    (spoint-reward (contract-call? .spaghettipunk-referrals get-spoint-referral-bonus-reward))
    (mints u8)
    (reward (* mints total-reward))
    (spoint (* mints spoint-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club claim-eight))
    (if (> spoint-reward u0)
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints (some (+ last-id u1))))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: spoint })
      )
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints none))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: u0 })
      ))
    (ok true)))

(define-public (spaghettipunk-club-claim-nine-with-referral (ref-code (string-ascii 30)))
  (let (
    (last-id (unwrap! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club get-last-token-id) (err ERR_NOT_VALID_ID)))
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club))
    (spoint-reward (contract-call? .spaghettipunk-referrals get-spoint-referral-bonus-reward))
    (mints u9)
    (reward (* mints total-reward))
    (spoint (* mints spoint-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club claim-nine))
    (if (> spoint-reward u0)
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints (some (+ last-id u1))))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: spoint })
      )
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints none))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: u0 })
      ))
    (ok true)))

(define-public (spaghettipunk-club-claim-ten-with-referral (ref-code (string-ascii 30)))
  (let (
    (last-id (unwrap! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club get-last-token-id) (err ERR_NOT_VALID_ID)))
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club))
    (spoint-reward (contract-call? .spaghettipunk-referrals get-spoint-referral-bonus-reward))
    (mints u10)
    (reward (* mints total-reward))
    (spoint (* mints spoint-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club claim-ten))
    (if (> spoint-reward u0)
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints (some (+ last-id u1))))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: spoint })
      )
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints none))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: u0 })
      ))
    (ok true)))

(define-public (spaghettipunk-club-claim-fifteen-with-referral (ref-code (string-ascii 30)))
  (let (
    (last-id (unwrap! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club get-last-token-id) (err ERR_NOT_VALID_ID)))
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club))
    (spoint-reward (contract-call? .spaghettipunk-referrals get-spoint-referral-bonus-reward))
    (mints u15)
    (reward (* mints total-reward))
    (spoint (* mints spoint-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club claim-fifteen))
    (if (> spoint-reward u0)
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints (some (+ last-id u1))))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: spoint })
      )
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints none))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: u0 })
      ))
    (ok true)))

(define-public (spaghettipunk-club-claim-twenty-with-referral (ref-code (string-ascii 30)))
  (let (
    (last-id (unwrap! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club get-last-token-id) (err ERR_NOT_VALID_ID)))
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club))
    (spoint-reward (contract-call? .spaghettipunk-referrals get-spoint-referral-bonus-reward))
    (mints u20)
    (reward (* mints total-reward))
    (spoint (* mints spoint-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club claim-twenty))
    (if (> spoint-reward u0)
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints (some (+ last-id u1))))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: spoint })
      )
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints none))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: u0 })
      ))
    (ok true)))

(define-public (spaghettipunk-club-claim-twentyfive-with-referral (ref-code (string-ascii 30)))
  (let (
    (last-id (unwrap! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club get-last-token-id) (err ERR_NOT_VALID_ID)))
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club))
    (spoint-reward (contract-call? .spaghettipunk-referrals get-spoint-referral-bonus-reward))
    (mints u25)
    (reward (* mints total-reward))
    (spoint (* mints spoint-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club claim-twentyfive))
    (if (> spoint-reward u0)
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints (some (+ last-id u1))))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: spoint })
      )
      (begin
        (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.spaghettipunk-club mints none))
        (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward, spoint-reward: u0 })
      ))
    (ok true)))

;; === Claim functions for Bitcoin Bears ===
(define-public (bitcoin-whales-claim-one-with-referral (ref-code (string-ascii 30)))
  (let (
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales))
    (mints u1)
    (reward (* mints total-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales claim))
    (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales mints none))
    (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward })
    (ok true)))

(define-public (bitcoin-whales-claim-two-with-referral (ref-code (string-ascii 30)))
  (let (
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales))
    (mints u2)
    (reward (* mints total-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales claim-two))
    (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales mints none))
    (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward })
    (ok true)))

(define-public (bitcoin-whales-claim-three-with-referral (ref-code (string-ascii 30)))
  (let (
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales))
    (mints u3)
    (reward (* mints total-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales claim-three))
    (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales mints none))
    (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward })
    (ok true)))

(define-public (bitcoin-whales-claim-four-with-referral (ref-code (string-ascii 30)))
  (let (
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales))
    (mints u4)
    (reward (* mints total-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales claim-four))
    (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales mints none))
    (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward })
    (ok true)))

(define-public (bitcoin-whales-claim-five-with-referral (ref-code (string-ascii 30)))
  (let (
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales))
    (mints u5)
    (reward (* mints total-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales claim-five))
    (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales mints none))
    (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward })
    (ok true)))

(define-public (bitcoin-whales-claim-six-with-referral (ref-code (string-ascii 30)))
  (let (
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales))
    (mints u6)
    (reward (* mints total-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales claim-six))
    (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales mints none))
    (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward })
    (ok true)))

(define-public (bitcoin-whales-claim-seven-with-referral (ref-code (string-ascii 30)))
  (let (
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales))
    (mints u7)
    (reward (* mints total-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales claim-seven))
    (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales mints none))
    (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward })
    (ok true)))

(define-public (bitcoin-whales-claim-eight-with-referral (ref-code (string-ascii 30)))
  (let (
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales))
    (mints u8)
    (reward (* mints total-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales claim-eight))
    (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales mints none))
    (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward })
    (ok true)))

(define-public (bitcoin-whales-claim-nine-with-referral (ref-code (string-ascii 30)))
  (let (
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales))
    (mints u9)
    (reward (* mints total-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales claim-nine))
    (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales mints none))
    (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward })
    (ok true)))

(define-public (bitcoin-whales-claim-ten-with-referral (ref-code (string-ascii 30)))
  (let (
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales))
    (mints u10)
    (reward (* mints total-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales claim-ten))
    (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales mints none))
    (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward })
    (ok true)))

(define-public (bitcoin-whales-claim-fifteen-with-referral (ref-code (string-ascii 30)))
  (let (
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales))
    (mints u15)
    (reward (* mints total-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales claim-fifteen))
    (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales mints none))
    (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward })
    (ok true)))

(define-public (bitcoin-whales-claim-twenty-with-referral (ref-code (string-ascii 30)))
  (let (
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales))
    (mints u20)
    (reward (* mints total-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales claim-twenty))
    (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales mints none))
    (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward })
    (ok true)))

(define-public (bitcoin-whales-claim-twentyfive-with-referral (ref-code (string-ascii 30)))
  (let (
    (some-ref-addr (unwrap! (contract-call? .spaghettipunk-referral-codes get-referral-address ref-code) (err ERR_NOT_VALID_REFERRAL)))
    (total-reward (contract-call? .spaghettipunk-referrals get-total-reward 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales))
    (mints u25)
    (reward (* mints total-reward))
  )
    (asserts! (is-eq (validate-referral ref-code) (ok true)) (err ERR_NOT_VALID_REFERRAL))
    (try! (contract-call? 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales claim-twentyfive))
    (try! (contract-call? .spaghettipunk-referrals handout-referral-reward ref-code 'SP1C2K603TGWJGKPT2Z3WWHA0ARM66D352385TTWH.bitcoin-whales mints none))
    (print { action: "claim-with-referral", code: ref-code, address: some-ref-addr, mints: mints, reward: reward })
    (ok true)))

Functions (27)

FunctionAccessArgs
validate-referralprivateref-code: (string-ascii 30
spaghettipunk-club-claim-one-with-referralpublicref-code: (string-ascii 30
spaghettipunk-club-claim-two-with-referralpublicref-code: (string-ascii 30
spaghettipunk-club-claim-three-with-referralpublicref-code: (string-ascii 30
spaghettipunk-club-claim-four-with-referralpublicref-code: (string-ascii 30
spaghettipunk-club-claim-five-with-referralpublicref-code: (string-ascii 30
spaghettipunk-club-claim-six-with-referralpublicref-code: (string-ascii 30
spaghettipunk-club-claim-seven-with-referralpublicref-code: (string-ascii 30
spaghettipunk-club-claim-eight-with-referralpublicref-code: (string-ascii 30
spaghettipunk-club-claim-nine-with-referralpublicref-code: (string-ascii 30
spaghettipunk-club-claim-ten-with-referralpublicref-code: (string-ascii 30
spaghettipunk-club-claim-fifteen-with-referralpublicref-code: (string-ascii 30
spaghettipunk-club-claim-twenty-with-referralpublicref-code: (string-ascii 30
spaghettipunk-club-claim-twentyfive-with-referralpublicref-code: (string-ascii 30
bitcoin-whales-claim-one-with-referralpublicref-code: (string-ascii 30
bitcoin-whales-claim-two-with-referralpublicref-code: (string-ascii 30
bitcoin-whales-claim-three-with-referralpublicref-code: (string-ascii 30
bitcoin-whales-claim-four-with-referralpublicref-code: (string-ascii 30
bitcoin-whales-claim-five-with-referralpublicref-code: (string-ascii 30
bitcoin-whales-claim-six-with-referralpublicref-code: (string-ascii 30
bitcoin-whales-claim-seven-with-referralpublicref-code: (string-ascii 30
bitcoin-whales-claim-eight-with-referralpublicref-code: (string-ascii 30
bitcoin-whales-claim-nine-with-referralpublicref-code: (string-ascii 30
bitcoin-whales-claim-ten-with-referralpublicref-code: (string-ascii 30
bitcoin-whales-claim-fifteen-with-referralpublicref-code: (string-ascii 30
bitcoin-whales-claim-twenty-with-referralpublicref-code: (string-ascii 30
bitcoin-whales-claim-twentyfive-with-referralpublicref-code: (string-ascii 30