diff --git a/contracts/SP17YZQB1228EK9MPHQXA8GC4G3HVWZ66X7VRPMAX/convincing-gray-tern.clar b/contracts/SP17YZQB1228EK9MPHQXA8GC4G3HVWZ66X7VRPMAX/convincing-gray-tern.clar new file mode 100644 index 0000000000..6e0b64bd98 --- /dev/null +++ b/contracts/SP17YZQB1228EK9MPHQXA8GC4G3HVWZ66X7VRPMAX/convincing-gray-tern.clar @@ -0,0 +1,38 @@ +;; hello-world contract + +(define-constant sender 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR) +(define-constant recipient 'SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G) + +(define-fungible-token novel-token-19) +(begin (ft-mint? novel-token-19 u12 sender)) +(begin (ft-transfer? novel-token-19 u2 sender recipient)) + +(define-non-fungible-token hello-nft uint) +(begin (nft-mint? hello-nft u1 sender)) +(begin (nft-mint? hello-nft u2 sender)) +(begin (nft-transfer? hello-nft u1 sender recipient)) + +(define-public (test-emit-event) + (begin + (print "Event! Hello world") + (ok u1))) +(begin (test-emit-event)) + +(define-public (test-event-types) + (begin + (unwrap-panic (ft-mint? novel-token-19 u3 recipient)) + (unwrap-panic (nft-mint? hello-nft u2 recipient)) + (unwrap-panic (stx-transfer? u60 tx-sender 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR)) + (unwrap-panic (stx-burn? u20 tx-sender)) + (ok u1))) + +(define-map store {key: (buff 32)} {value: (buff 32)}) +(define-public (get-value (key (buff 32))) + (begin + (match (map-get? store {key: key}) + entry (ok (get value entry)) + (err 0)))) +(define-public (set-value (key (buff 32)) (value (buff 32))) + (begin + (map-set store {key: key} {value: value}) + (ok u1))) \ No newline at end of file diff --git a/contracts/SP17YZQB1228EK9MPHQXA8GC4G3HVWZ66X7VRPMAX/vocal-olive-cicada.clar b/contracts/SP17YZQB1228EK9MPHQXA8GC4G3HVWZ66X7VRPMAX/vocal-olive-cicada.clar new file mode 100644 index 0000000000..6e0b64bd98 --- /dev/null +++ b/contracts/SP17YZQB1228EK9MPHQXA8GC4G3HVWZ66X7VRPMAX/vocal-olive-cicada.clar @@ -0,0 +1,38 @@ +;; hello-world contract + +(define-constant sender 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR) +(define-constant recipient 'SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G) + +(define-fungible-token novel-token-19) +(begin (ft-mint? novel-token-19 u12 sender)) +(begin (ft-transfer? novel-token-19 u2 sender recipient)) + +(define-non-fungible-token hello-nft uint) +(begin (nft-mint? hello-nft u1 sender)) +(begin (nft-mint? hello-nft u2 sender)) +(begin (nft-transfer? hello-nft u1 sender recipient)) + +(define-public (test-emit-event) + (begin + (print "Event! Hello world") + (ok u1))) +(begin (test-emit-event)) + +(define-public (test-event-types) + (begin + (unwrap-panic (ft-mint? novel-token-19 u3 recipient)) + (unwrap-panic (nft-mint? hello-nft u2 recipient)) + (unwrap-panic (stx-transfer? u60 tx-sender 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR)) + (unwrap-panic (stx-burn? u20 tx-sender)) + (ok u1))) + +(define-map store {key: (buff 32)} {value: (buff 32)}) +(define-public (get-value (key (buff 32))) + (begin + (match (map-get? store {key: key}) + entry (ok (get value entry)) + (err 0)))) +(define-public (set-value (key (buff 32)) (value (buff 32))) + (begin + (map-set store {key: key} {value: value}) + (ok u1))) \ No newline at end of file diff --git a/contracts/SP1C319GJCV4P4JMVRHT8S2HV5XE7JRFG4AQKCQCX/bns-1697653985255-v1.clar b/contracts/SP1C319GJCV4P4JMVRHT8S2HV5XE7JRFG4AQKCQCX/bns-1697653985255-v1.clar new file mode 100644 index 0000000000..6e45ad9950 --- /dev/null +++ b/contracts/SP1C319GJCV4P4JMVRHT8S2HV5XE7JRFG4AQKCQCX/bns-1697653985255-v1.clar @@ -0,0 +1,126 @@ + + ;; version: 1 + ;; name: austriabtc + ;; namespace: btc + + (use-trait commission-trait 'SP3D6PV2ACBPEKYJTCMH7HEN02KP87QSP8KTEH335.commission-trait.commission) + + (define-constant DEPLOYER_CONTRACT_PRINCIPAL (as-contract tx-sender)) + (define-constant COMM-ADDR 'SP7NDX6YRAH6C99WCZJWKF2SYR1GQRF7X6894QSJ) + + (define-constant ERR-ALREADY-LISTED (err u401)) + (define-constant ERR-WRONG-COMMISSION (err u402)) + (define-constant ERR-NOT-AUTHORIZED (err u403)) + (define-constant ERR-NOT-FOUND (err u404)) + (define-constant ERR-WRONG-PRICE (err u405)) + (define-constant ERR-TRANSFER-FAILED (err u500)) + + (define-data-var current-namespace (buff 20) 0x00) + (define-data-var current-name (buff 48) 0x00) + + (define-map listings { namespace: (buff 20), name: (buff 48) } { price: uint, lister: principal, commission: principal }) + + (define-read-only (is-admin) + (is-eq tx-sender COMM-ADDR) + ) + + (define-read-only (get-listing) + (map-get? listings { namespace: (var-get current-namespace), name: (var-get current-name) }) + ) + + (define-read-only (get-current-name) + { namespace: (var-get current-namespace), name: (var-get current-name) } + ) + + (define-private (list-name (namespace (buff 20)) (name (buff 48)) (price uint) (commission )) + (begin + (asserts! (is-none (get-listing)) ERR-ALREADY-LISTED) + (try! (to-bool-response (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + DEPLOYER_CONTRACT_PRINCIPAL + none + ))) + (var-set current-namespace namespace) + (var-set current-name name) + (ok (map-set listings {name: name, namespace: namespace} + {price: price, lister: tx-sender, commission: (contract-of commission)})) + ) + ) + + (define-public (change-price (namespace (buff 20)) (name (buff 48)) (new-price uint) (commission )) + (let ( + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing))) + (asserts! (is-eq tx-sender lister) ERR-NOT-AUTHORIZED) + (ok (map-set listings { namespace: namespace, name: name } { price: new-price, lister: lister, commission: (contract-of commission) })) + ) + ) + + (define-public (unlist-name (namespace (buff 20)) (name (buff 48))) + (let ( + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing))) + (asserts! (or (is-eq tx-sender lister) (is-admin)) ERR-NOT-AUTHORIZED) + (map-delete listings {namespace: namespace, name: name}) + (as-contract + (to-bool-response (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + lister + none + )) + ) + ) + ) + + (define-public (purchase-name (namespace (buff 20)) (name (buff 48)) (expected-price uint) (commission ) (recipient (optional principal))) + (let ( + (new-owner (if (is-some recipient) (unwrap-panic recipient) tx-sender)) + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing)) + (list-commission (get commission listing)) + ) + (asserts! (is-eq (contract-of commission) list-commission) ERR-WRONG-COMMISSION) + (asserts! (is-eq price expected-price) ERR-WRONG-PRICE) + (try! (contract-call? commission pay u0 price)) + (try! (stx-transfer? price tx-sender lister)) + (map-delete listings {namespace: namespace, name: name}) + (to-bool-response (as-contract + (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + new-owner + none + ) + )) + ) + ) + + (define-public (withdraw-stx (amount uint)) + (let ( + (listing (unwrap! (get-listing) ERR-NOT-FOUND)) + (lister (get lister listing)) + ) + (asserts! (or (is-eq tx-sender lister) (is-admin)) ERR-NOT-AUTHORIZED) + (try! (as-contract (stx-transfer? amount tx-sender lister))) + (ok amount) + ) + ) + + (define-private (to-bool-response (value (response bool int))) + (match value + success (ok success) + error (err (to-uint error)))) + + (list-name 0x627463 0x61757374726961627463 u96618357488 'SPNWZ5V2TPWGQGVDR6T7B6RQ4XMGZ4PXTEE0VQ0S.gamma-commission-3-5) + \ No newline at end of file diff --git a/contracts/SP1G06JV3YFJFN5WXCD6H04X1N9K33KZB7TXB5PMY/bns-1697665213925-v1.clar b/contracts/SP1G06JV3YFJFN5WXCD6H04X1N9K33KZB7TXB5PMY/bns-1697665213925-v1.clar new file mode 100644 index 0000000000..2ecc9b5db1 --- /dev/null +++ b/contracts/SP1G06JV3YFJFN5WXCD6H04X1N9K33KZB7TXB5PMY/bns-1697665213925-v1.clar @@ -0,0 +1,126 @@ + + ;; version: 1 + ;; name: btcgermany + ;; namespace: btc + + (use-trait commission-trait 'SP3D6PV2ACBPEKYJTCMH7HEN02KP87QSP8KTEH335.commission-trait.commission) + + (define-constant DEPLOYER_CONTRACT_PRINCIPAL (as-contract tx-sender)) + (define-constant COMM-ADDR 'SP7NDX6YRAH6C99WCZJWKF2SYR1GQRF7X6894QSJ) + + (define-constant ERR-ALREADY-LISTED (err u401)) + (define-constant ERR-WRONG-COMMISSION (err u402)) + (define-constant ERR-NOT-AUTHORIZED (err u403)) + (define-constant ERR-NOT-FOUND (err u404)) + (define-constant ERR-WRONG-PRICE (err u405)) + (define-constant ERR-TRANSFER-FAILED (err u500)) + + (define-data-var current-namespace (buff 20) 0x00) + (define-data-var current-name (buff 48) 0x00) + + (define-map listings { namespace: (buff 20), name: (buff 48) } { price: uint, lister: principal, commission: principal }) + + (define-read-only (is-admin) + (is-eq tx-sender COMM-ADDR) + ) + + (define-read-only (get-listing) + (map-get? listings { namespace: (var-get current-namespace), name: (var-get current-name) }) + ) + + (define-read-only (get-current-name) + { namespace: (var-get current-namespace), name: (var-get current-name) } + ) + + (define-private (list-name (namespace (buff 20)) (name (buff 48)) (price uint) (commission )) + (begin + (asserts! (is-none (get-listing)) ERR-ALREADY-LISTED) + (try! (to-bool-response (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + DEPLOYER_CONTRACT_PRINCIPAL + none + ))) + (var-set current-namespace namespace) + (var-set current-name name) + (ok (map-set listings {name: name, namespace: namespace} + {price: price, lister: tx-sender, commission: (contract-of commission)})) + ) + ) + + (define-public (change-price (namespace (buff 20)) (name (buff 48)) (new-price uint) (commission )) + (let ( + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing))) + (asserts! (is-eq tx-sender lister) ERR-NOT-AUTHORIZED) + (ok (map-set listings { namespace: namespace, name: name } { price: new-price, lister: lister, commission: (contract-of commission) })) + ) + ) + + (define-public (unlist-name (namespace (buff 20)) (name (buff 48))) + (let ( + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing))) + (asserts! (or (is-eq tx-sender lister) (is-admin)) ERR-NOT-AUTHORIZED) + (map-delete listings {namespace: namespace, name: name}) + (as-contract + (to-bool-response (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + lister + none + )) + ) + ) + ) + + (define-public (purchase-name (namespace (buff 20)) (name (buff 48)) (expected-price uint) (commission ) (recipient (optional principal))) + (let ( + (new-owner (if (is-some recipient) (unwrap-panic recipient) tx-sender)) + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing)) + (list-commission (get commission listing)) + ) + (asserts! (is-eq (contract-of commission) list-commission) ERR-WRONG-COMMISSION) + (asserts! (is-eq price expected-price) ERR-WRONG-PRICE) + (try! (contract-call? commission pay u0 price)) + (try! (stx-transfer? price tx-sender lister)) + (map-delete listings {namespace: namespace, name: name}) + (to-bool-response (as-contract + (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + new-owner + none + ) + )) + ) + ) + + (define-public (withdraw-stx (amount uint)) + (let ( + (listing (unwrap! (get-listing) ERR-NOT-FOUND)) + (lister (get lister listing)) + ) + (asserts! (or (is-eq tx-sender lister) (is-admin)) ERR-NOT-AUTHORIZED) + (try! (as-contract (stx-transfer? amount tx-sender lister))) + (ok amount) + ) + ) + + (define-private (to-bool-response (value (response bool int))) + (match value + success (ok success) + error (err (to-uint error)))) + + (list-name 0x627463 0x6274636765726d616e79 u96618357488 'SPNWZ5V2TPWGQGVDR6T7B6RQ4XMGZ4PXTEE0VQ0S.gamma-commission-3-5) + \ No newline at end of file diff --git a/contracts/SP1GP4KVRKDBCEHN8947PH4RXFWG2R9K0R6FNE8PF/sanishbadnecontract1.clar b/contracts/SP1GP4KVRKDBCEHN8947PH4RXFWG2R9K0R6FNE8PF/sanishbadnecontract1.clar new file mode 100644 index 0000000000..6e0b64bd98 --- /dev/null +++ b/contracts/SP1GP4KVRKDBCEHN8947PH4RXFWG2R9K0R6FNE8PF/sanishbadnecontract1.clar @@ -0,0 +1,38 @@ +;; hello-world contract + +(define-constant sender 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR) +(define-constant recipient 'SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G) + +(define-fungible-token novel-token-19) +(begin (ft-mint? novel-token-19 u12 sender)) +(begin (ft-transfer? novel-token-19 u2 sender recipient)) + +(define-non-fungible-token hello-nft uint) +(begin (nft-mint? hello-nft u1 sender)) +(begin (nft-mint? hello-nft u2 sender)) +(begin (nft-transfer? hello-nft u1 sender recipient)) + +(define-public (test-emit-event) + (begin + (print "Event! Hello world") + (ok u1))) +(begin (test-emit-event)) + +(define-public (test-event-types) + (begin + (unwrap-panic (ft-mint? novel-token-19 u3 recipient)) + (unwrap-panic (nft-mint? hello-nft u2 recipient)) + (unwrap-panic (stx-transfer? u60 tx-sender 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR)) + (unwrap-panic (stx-burn? u20 tx-sender)) + (ok u1))) + +(define-map store {key: (buff 32)} {value: (buff 32)}) +(define-public (get-value (key (buff 32))) + (begin + (match (map-get? store {key: key}) + entry (ok (get value entry)) + (err 0)))) +(define-public (set-value (key (buff 32)) (value (buff 32))) + (begin + (map-set store {key: key} {value: value}) + (ok u1))) \ No newline at end of file diff --git a/contracts/SP1ZA9H7ZH3Z5YKNM9MF52W7JDZFXXVDPPPQNVS9P/bns-1697664244898-v1.clar b/contracts/SP1ZA9H7ZH3Z5YKNM9MF52W7JDZFXXVDPPPQNVS9P/bns-1697664244898-v1.clar new file mode 100644 index 0000000000..4234651bd8 --- /dev/null +++ b/contracts/SP1ZA9H7ZH3Z5YKNM9MF52W7JDZFXXVDPPPQNVS9P/bns-1697664244898-v1.clar @@ -0,0 +1,126 @@ + + ;; version: 1 + ;; name: francebtc + ;; namespace: btc + + (use-trait commission-trait 'SP3D6PV2ACBPEKYJTCMH7HEN02KP87QSP8KTEH335.commission-trait.commission) + + (define-constant DEPLOYER_CONTRACT_PRINCIPAL (as-contract tx-sender)) + (define-constant COMM-ADDR 'SP7NDX6YRAH6C99WCZJWKF2SYR1GQRF7X6894QSJ) + + (define-constant ERR-ALREADY-LISTED (err u401)) + (define-constant ERR-WRONG-COMMISSION (err u402)) + (define-constant ERR-NOT-AUTHORIZED (err u403)) + (define-constant ERR-NOT-FOUND (err u404)) + (define-constant ERR-WRONG-PRICE (err u405)) + (define-constant ERR-TRANSFER-FAILED (err u500)) + + (define-data-var current-namespace (buff 20) 0x00) + (define-data-var current-name (buff 48) 0x00) + + (define-map listings { namespace: (buff 20), name: (buff 48) } { price: uint, lister: principal, commission: principal }) + + (define-read-only (is-admin) + (is-eq tx-sender COMM-ADDR) + ) + + (define-read-only (get-listing) + (map-get? listings { namespace: (var-get current-namespace), name: (var-get current-name) }) + ) + + (define-read-only (get-current-name) + { namespace: (var-get current-namespace), name: (var-get current-name) } + ) + + (define-private (list-name (namespace (buff 20)) (name (buff 48)) (price uint) (commission )) + (begin + (asserts! (is-none (get-listing)) ERR-ALREADY-LISTED) + (try! (to-bool-response (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + DEPLOYER_CONTRACT_PRINCIPAL + none + ))) + (var-set current-namespace namespace) + (var-set current-name name) + (ok (map-set listings {name: name, namespace: namespace} + {price: price, lister: tx-sender, commission: (contract-of commission)})) + ) + ) + + (define-public (change-price (namespace (buff 20)) (name (buff 48)) (new-price uint) (commission )) + (let ( + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing))) + (asserts! (is-eq tx-sender lister) ERR-NOT-AUTHORIZED) + (ok (map-set listings { namespace: namespace, name: name } { price: new-price, lister: lister, commission: (contract-of commission) })) + ) + ) + + (define-public (unlist-name (namespace (buff 20)) (name (buff 48))) + (let ( + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing))) + (asserts! (or (is-eq tx-sender lister) (is-admin)) ERR-NOT-AUTHORIZED) + (map-delete listings {namespace: namespace, name: name}) + (as-contract + (to-bool-response (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + lister + none + )) + ) + ) + ) + + (define-public (purchase-name (namespace (buff 20)) (name (buff 48)) (expected-price uint) (commission ) (recipient (optional principal))) + (let ( + (new-owner (if (is-some recipient) (unwrap-panic recipient) tx-sender)) + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing)) + (list-commission (get commission listing)) + ) + (asserts! (is-eq (contract-of commission) list-commission) ERR-WRONG-COMMISSION) + (asserts! (is-eq price expected-price) ERR-WRONG-PRICE) + (try! (contract-call? commission pay u0 price)) + (try! (stx-transfer? price tx-sender lister)) + (map-delete listings {namespace: namespace, name: name}) + (to-bool-response (as-contract + (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + new-owner + none + ) + )) + ) + ) + + (define-public (withdraw-stx (amount uint)) + (let ( + (listing (unwrap! (get-listing) ERR-NOT-FOUND)) + (lister (get lister listing)) + ) + (asserts! (or (is-eq tx-sender lister) (is-admin)) ERR-NOT-AUTHORIZED) + (try! (as-contract (stx-transfer? amount tx-sender lister))) + (ok amount) + ) + ) + + (define-private (to-bool-response (value (response bool int))) + (match value + success (ok success) + error (err (to-uint error)))) + + (list-name 0x627463 0x6672616e6365627463 u96618357488 'SPNWZ5V2TPWGQGVDR6T7B6RQ4XMGZ4PXTEE0VQ0S.gamma-commission-3-5) + \ No newline at end of file diff --git a/contracts/SP24156ZMEP2NAGF6TFYJGR2JW5J4SKDW83MJ61VD/bns-1697650321081-v1.clar b/contracts/SP24156ZMEP2NAGF6TFYJGR2JW5J4SKDW83MJ61VD/bns-1697650321081-v1.clar new file mode 100644 index 0000000000..1743bd225e --- /dev/null +++ b/contracts/SP24156ZMEP2NAGF6TFYJGR2JW5J4SKDW83MJ61VD/bns-1697650321081-v1.clar @@ -0,0 +1,126 @@ + + ;; version: 1 + ;; name: btcaustria + ;; namespace: btc + + (use-trait commission-trait 'SP3D6PV2ACBPEKYJTCMH7HEN02KP87QSP8KTEH335.commission-trait.commission) + + (define-constant DEPLOYER_CONTRACT_PRINCIPAL (as-contract tx-sender)) + (define-constant COMM-ADDR 'SP7NDX6YRAH6C99WCZJWKF2SYR1GQRF7X6894QSJ) + + (define-constant ERR-ALREADY-LISTED (err u401)) + (define-constant ERR-WRONG-COMMISSION (err u402)) + (define-constant ERR-NOT-AUTHORIZED (err u403)) + (define-constant ERR-NOT-FOUND (err u404)) + (define-constant ERR-WRONG-PRICE (err u405)) + (define-constant ERR-TRANSFER-FAILED (err u500)) + + (define-data-var current-namespace (buff 20) 0x00) + (define-data-var current-name (buff 48) 0x00) + + (define-map listings { namespace: (buff 20), name: (buff 48) } { price: uint, lister: principal, commission: principal }) + + (define-read-only (is-admin) + (is-eq tx-sender COMM-ADDR) + ) + + (define-read-only (get-listing) + (map-get? listings { namespace: (var-get current-namespace), name: (var-get current-name) }) + ) + + (define-read-only (get-current-name) + { namespace: (var-get current-namespace), name: (var-get current-name) } + ) + + (define-private (list-name (namespace (buff 20)) (name (buff 48)) (price uint) (commission )) + (begin + (asserts! (is-none (get-listing)) ERR-ALREADY-LISTED) + (try! (to-bool-response (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + DEPLOYER_CONTRACT_PRINCIPAL + none + ))) + (var-set current-namespace namespace) + (var-set current-name name) + (ok (map-set listings {name: name, namespace: namespace} + {price: price, lister: tx-sender, commission: (contract-of commission)})) + ) + ) + + (define-public (change-price (namespace (buff 20)) (name (buff 48)) (new-price uint) (commission )) + (let ( + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing))) + (asserts! (is-eq tx-sender lister) ERR-NOT-AUTHORIZED) + (ok (map-set listings { namespace: namespace, name: name } { price: new-price, lister: lister, commission: (contract-of commission) })) + ) + ) + + (define-public (unlist-name (namespace (buff 20)) (name (buff 48))) + (let ( + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing))) + (asserts! (or (is-eq tx-sender lister) (is-admin)) ERR-NOT-AUTHORIZED) + (map-delete listings {namespace: namespace, name: name}) + (as-contract + (to-bool-response (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + lister + none + )) + ) + ) + ) + + (define-public (purchase-name (namespace (buff 20)) (name (buff 48)) (expected-price uint) (commission ) (recipient (optional principal))) + (let ( + (new-owner (if (is-some recipient) (unwrap-panic recipient) tx-sender)) + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing)) + (list-commission (get commission listing)) + ) + (asserts! (is-eq (contract-of commission) list-commission) ERR-WRONG-COMMISSION) + (asserts! (is-eq price expected-price) ERR-WRONG-PRICE) + (try! (contract-call? commission pay u0 price)) + (try! (stx-transfer? price tx-sender lister)) + (map-delete listings {namespace: namespace, name: name}) + (to-bool-response (as-contract + (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + new-owner + none + ) + )) + ) + ) + + (define-public (withdraw-stx (amount uint)) + (let ( + (listing (unwrap! (get-listing) ERR-NOT-FOUND)) + (lister (get lister listing)) + ) + (asserts! (or (is-eq tx-sender lister) (is-admin)) ERR-NOT-AUTHORIZED) + (try! (as-contract (stx-transfer? amount tx-sender lister))) + (ok amount) + ) + ) + + (define-private (to-bool-response (value (response bool int))) + (match value + success (ok success) + error (err (to-uint error)))) + + (list-name 0x627463 0x62746361757374726961 u96618357488 'SPNWZ5V2TPWGQGVDR6T7B6RQ4XMGZ4PXTEE0VQ0S.gamma-commission-3-5) + \ No newline at end of file diff --git a/contracts/SP28EWC2JBVE689QFXTNMQTKDJGGQAVBA8Q7A0MHS/bns-1697549029442-v1.clar b/contracts/SP28EWC2JBVE689QFXTNMQTKDJGGQAVBA8Q7A0MHS/bns-1697549029442-v1.clar new file mode 100644 index 0000000000..54a3f4fd31 --- /dev/null +++ b/contracts/SP28EWC2JBVE689QFXTNMQTKDJGGQAVBA8Q7A0MHS/bns-1697549029442-v1.clar @@ -0,0 +1,126 @@ + + ;; version: 1 + ;; name: bitcoinaustria + ;; namespace: btc + + (use-trait commission-trait 'SP3D6PV2ACBPEKYJTCMH7HEN02KP87QSP8KTEH335.commission-trait.commission) + + (define-constant DEPLOYER_CONTRACT_PRINCIPAL (as-contract tx-sender)) + (define-constant COMM-ADDR 'SP7NDX6YRAH6C99WCZJWKF2SYR1GQRF7X6894QSJ) + + (define-constant ERR-ALREADY-LISTED (err u401)) + (define-constant ERR-WRONG-COMMISSION (err u402)) + (define-constant ERR-NOT-AUTHORIZED (err u403)) + (define-constant ERR-NOT-FOUND (err u404)) + (define-constant ERR-WRONG-PRICE (err u405)) + (define-constant ERR-TRANSFER-FAILED (err u500)) + + (define-data-var current-namespace (buff 20) 0x00) + (define-data-var current-name (buff 48) 0x00) + + (define-map listings { namespace: (buff 20), name: (buff 48) } { price: uint, lister: principal, commission: principal }) + + (define-read-only (is-admin) + (is-eq tx-sender COMM-ADDR) + ) + + (define-read-only (get-listing) + (map-get? listings { namespace: (var-get current-namespace), name: (var-get current-name) }) + ) + + (define-read-only (get-current-name) + { namespace: (var-get current-namespace), name: (var-get current-name) } + ) + + (define-private (list-name (namespace (buff 20)) (name (buff 48)) (price uint) (commission )) + (begin + (asserts! (is-none (get-listing)) ERR-ALREADY-LISTED) + (try! (to-bool-response (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + DEPLOYER_CONTRACT_PRINCIPAL + none + ))) + (var-set current-namespace namespace) + (var-set current-name name) + (ok (map-set listings {name: name, namespace: namespace} + {price: price, lister: tx-sender, commission: (contract-of commission)})) + ) + ) + + (define-public (change-price (namespace (buff 20)) (name (buff 48)) (new-price uint) (commission )) + (let ( + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing))) + (asserts! (is-eq tx-sender lister) ERR-NOT-AUTHORIZED) + (ok (map-set listings { namespace: namespace, name: name } { price: new-price, lister: lister, commission: (contract-of commission) })) + ) + ) + + (define-public (unlist-name (namespace (buff 20)) (name (buff 48))) + (let ( + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing))) + (asserts! (or (is-eq tx-sender lister) (is-admin)) ERR-NOT-AUTHORIZED) + (map-delete listings {namespace: namespace, name: name}) + (as-contract + (to-bool-response (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + lister + none + )) + ) + ) + ) + + (define-public (purchase-name (namespace (buff 20)) (name (buff 48)) (expected-price uint) (commission ) (recipient (optional principal))) + (let ( + (new-owner (if (is-some recipient) (unwrap-panic recipient) tx-sender)) + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing)) + (list-commission (get commission listing)) + ) + (asserts! (is-eq (contract-of commission) list-commission) ERR-WRONG-COMMISSION) + (asserts! (is-eq price expected-price) ERR-WRONG-PRICE) + (try! (contract-call? commission pay u0 price)) + (try! (stx-transfer? price tx-sender lister)) + (map-delete listings {namespace: namespace, name: name}) + (to-bool-response (as-contract + (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + new-owner + none + ) + )) + ) + ) + + (define-public (withdraw-stx (amount uint)) + (let ( + (listing (unwrap! (get-listing) ERR-NOT-FOUND)) + (lister (get lister listing)) + ) + (asserts! (or (is-eq tx-sender lister) (is-admin)) ERR-NOT-AUTHORIZED) + (try! (as-contract (stx-transfer? amount tx-sender lister))) + (ok amount) + ) + ) + + (define-private (to-bool-response (value (response bool int))) + (match value + success (ok success) + error (err (to-uint error)))) + + (list-name 0x627463 0x626974636f696e61757374726961 u96618357488 'SPNWZ5V2TPWGQGVDR6T7B6RQ4XMGZ4PXTEE0VQ0S.gamma-commission-3-5) + \ No newline at end of file diff --git a/contracts/SP2KJJ3R339YDWRW6EW8CJAN0P6QFAN46CCJTD7BC/bns-1697566537191-v1.clar b/contracts/SP2KJJ3R339YDWRW6EW8CJAN0P6QFAN46CCJTD7BC/bns-1697566537191-v1.clar new file mode 100644 index 0000000000..80f847b847 --- /dev/null +++ b/contracts/SP2KJJ3R339YDWRW6EW8CJAN0P6QFAN46CCJTD7BC/bns-1697566537191-v1.clar @@ -0,0 +1,126 @@ + + ;; version: 1 + ;; name: austriabitcoin + ;; namespace: btc + + (use-trait commission-trait 'SP3D6PV2ACBPEKYJTCMH7HEN02KP87QSP8KTEH335.commission-trait.commission) + + (define-constant DEPLOYER_CONTRACT_PRINCIPAL (as-contract tx-sender)) + (define-constant COMM-ADDR 'SP7NDX6YRAH6C99WCZJWKF2SYR1GQRF7X6894QSJ) + + (define-constant ERR-ALREADY-LISTED (err u401)) + (define-constant ERR-WRONG-COMMISSION (err u402)) + (define-constant ERR-NOT-AUTHORIZED (err u403)) + (define-constant ERR-NOT-FOUND (err u404)) + (define-constant ERR-WRONG-PRICE (err u405)) + (define-constant ERR-TRANSFER-FAILED (err u500)) + + (define-data-var current-namespace (buff 20) 0x00) + (define-data-var current-name (buff 48) 0x00) + + (define-map listings { namespace: (buff 20), name: (buff 48) } { price: uint, lister: principal, commission: principal }) + + (define-read-only (is-admin) + (is-eq tx-sender COMM-ADDR) + ) + + (define-read-only (get-listing) + (map-get? listings { namespace: (var-get current-namespace), name: (var-get current-name) }) + ) + + (define-read-only (get-current-name) + { namespace: (var-get current-namespace), name: (var-get current-name) } + ) + + (define-private (list-name (namespace (buff 20)) (name (buff 48)) (price uint) (commission )) + (begin + (asserts! (is-none (get-listing)) ERR-ALREADY-LISTED) + (try! (to-bool-response (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + DEPLOYER_CONTRACT_PRINCIPAL + none + ))) + (var-set current-namespace namespace) + (var-set current-name name) + (ok (map-set listings {name: name, namespace: namespace} + {price: price, lister: tx-sender, commission: (contract-of commission)})) + ) + ) + + (define-public (change-price (namespace (buff 20)) (name (buff 48)) (new-price uint) (commission )) + (let ( + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing))) + (asserts! (is-eq tx-sender lister) ERR-NOT-AUTHORIZED) + (ok (map-set listings { namespace: namespace, name: name } { price: new-price, lister: lister, commission: (contract-of commission) })) + ) + ) + + (define-public (unlist-name (namespace (buff 20)) (name (buff 48))) + (let ( + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing))) + (asserts! (or (is-eq tx-sender lister) (is-admin)) ERR-NOT-AUTHORIZED) + (map-delete listings {namespace: namespace, name: name}) + (as-contract + (to-bool-response (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + lister + none + )) + ) + ) + ) + + (define-public (purchase-name (namespace (buff 20)) (name (buff 48)) (expected-price uint) (commission ) (recipient (optional principal))) + (let ( + (new-owner (if (is-some recipient) (unwrap-panic recipient) tx-sender)) + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing)) + (list-commission (get commission listing)) + ) + (asserts! (is-eq (contract-of commission) list-commission) ERR-WRONG-COMMISSION) + (asserts! (is-eq price expected-price) ERR-WRONG-PRICE) + (try! (contract-call? commission pay u0 price)) + (try! (stx-transfer? price tx-sender lister)) + (map-delete listings {namespace: namespace, name: name}) + (to-bool-response (as-contract + (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + new-owner + none + ) + )) + ) + ) + + (define-public (withdraw-stx (amount uint)) + (let ( + (listing (unwrap! (get-listing) ERR-NOT-FOUND)) + (lister (get lister listing)) + ) + (asserts! (or (is-eq tx-sender lister) (is-admin)) ERR-NOT-AUTHORIZED) + (try! (as-contract (stx-transfer? amount tx-sender lister))) + (ok amount) + ) + ) + + (define-private (to-bool-response (value (response bool int))) + (match value + success (ok success) + error (err (to-uint error)))) + + (list-name 0x627463 0x61757374726961626974636f696e u96618357488 'SPNWZ5V2TPWGQGVDR6T7B6RQ4XMGZ4PXTEE0VQ0S.gamma-commission-3-5) + \ No newline at end of file diff --git a/contracts/SP380V4A6SDZ35VG90BD0AWRVATA53ZSC185YE8KA/bns-1697656894771-v1.clar b/contracts/SP380V4A6SDZ35VG90BD0AWRVATA53ZSC185YE8KA/bns-1697656894771-v1.clar new file mode 100644 index 0000000000..3f05c0b09e --- /dev/null +++ b/contracts/SP380V4A6SDZ35VG90BD0AWRVATA53ZSC185YE8KA/bns-1697656894771-v1.clar @@ -0,0 +1,126 @@ + + ;; version: 1 + ;; name: francebitcoin + ;; namespace: btc + + (use-trait commission-trait 'SP3D6PV2ACBPEKYJTCMH7HEN02KP87QSP8KTEH335.commission-trait.commission) + + (define-constant DEPLOYER_CONTRACT_PRINCIPAL (as-contract tx-sender)) + (define-constant COMM-ADDR 'SP7NDX6YRAH6C99WCZJWKF2SYR1GQRF7X6894QSJ) + + (define-constant ERR-ALREADY-LISTED (err u401)) + (define-constant ERR-WRONG-COMMISSION (err u402)) + (define-constant ERR-NOT-AUTHORIZED (err u403)) + (define-constant ERR-NOT-FOUND (err u404)) + (define-constant ERR-WRONG-PRICE (err u405)) + (define-constant ERR-TRANSFER-FAILED (err u500)) + + (define-data-var current-namespace (buff 20) 0x00) + (define-data-var current-name (buff 48) 0x00) + + (define-map listings { namespace: (buff 20), name: (buff 48) } { price: uint, lister: principal, commission: principal }) + + (define-read-only (is-admin) + (is-eq tx-sender COMM-ADDR) + ) + + (define-read-only (get-listing) + (map-get? listings { namespace: (var-get current-namespace), name: (var-get current-name) }) + ) + + (define-read-only (get-current-name) + { namespace: (var-get current-namespace), name: (var-get current-name) } + ) + + (define-private (list-name (namespace (buff 20)) (name (buff 48)) (price uint) (commission )) + (begin + (asserts! (is-none (get-listing)) ERR-ALREADY-LISTED) + (try! (to-bool-response (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + DEPLOYER_CONTRACT_PRINCIPAL + none + ))) + (var-set current-namespace namespace) + (var-set current-name name) + (ok (map-set listings {name: name, namespace: namespace} + {price: price, lister: tx-sender, commission: (contract-of commission)})) + ) + ) + + (define-public (change-price (namespace (buff 20)) (name (buff 48)) (new-price uint) (commission )) + (let ( + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing))) + (asserts! (is-eq tx-sender lister) ERR-NOT-AUTHORIZED) + (ok (map-set listings { namespace: namespace, name: name } { price: new-price, lister: lister, commission: (contract-of commission) })) + ) + ) + + (define-public (unlist-name (namespace (buff 20)) (name (buff 48))) + (let ( + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing))) + (asserts! (or (is-eq tx-sender lister) (is-admin)) ERR-NOT-AUTHORIZED) + (map-delete listings {namespace: namespace, name: name}) + (as-contract + (to-bool-response (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + lister + none + )) + ) + ) + ) + + (define-public (purchase-name (namespace (buff 20)) (name (buff 48)) (expected-price uint) (commission ) (recipient (optional principal))) + (let ( + (new-owner (if (is-some recipient) (unwrap-panic recipient) tx-sender)) + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing)) + (list-commission (get commission listing)) + ) + (asserts! (is-eq (contract-of commission) list-commission) ERR-WRONG-COMMISSION) + (asserts! (is-eq price expected-price) ERR-WRONG-PRICE) + (try! (contract-call? commission pay u0 price)) + (try! (stx-transfer? price tx-sender lister)) + (map-delete listings {namespace: namespace, name: name}) + (to-bool-response (as-contract + (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + new-owner + none + ) + )) + ) + ) + + (define-public (withdraw-stx (amount uint)) + (let ( + (listing (unwrap! (get-listing) ERR-NOT-FOUND)) + (lister (get lister listing)) + ) + (asserts! (or (is-eq tx-sender lister) (is-admin)) ERR-NOT-AUTHORIZED) + (try! (as-contract (stx-transfer? amount tx-sender lister))) + (ok amount) + ) + ) + + (define-private (to-bool-response (value (response bool int))) + (match value + success (ok success) + error (err (to-uint error)))) + + (list-name 0x627463 0x6672616e6365626974636f696e u96618357488 'SPNWZ5V2TPWGQGVDR6T7B6RQ4XMGZ4PXTEE0VQ0S.gamma-commission-3-5) + \ No newline at end of file diff --git a/contracts/SP3KSTCNAYY8NZTWFFK38K5G0FGWH08B1B4M5THHC/bitcoin-unleashed-2023.clar b/contracts/SP3KSTCNAYY8NZTWFFK38K5G0FGWH08B1B4M5THHC/bitcoin-unleashed-2023.clar new file mode 100644 index 0000000000..a4b6899305 --- /dev/null +++ b/contracts/SP3KSTCNAYY8NZTWFFK38K5G0FGWH08B1B4M5THHC/bitcoin-unleashed-2023.clar @@ -0,0 +1,281 @@ +;; bitcoin-unleashed-2023 +;; contractType: editions + +(impl-trait 'SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait.nft-trait) + +(define-non-fungible-token bitcoin-unleashed-2023 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) +(define-constant ERR-CONTRACT-LOCKED u115) + +;; Internal variables +(define-data-var mint-limit uint u100) +(define-data-var last-id uint u1) +(define-data-var total-price uint u0) +(define-data-var artist-address principal 'SP3KSTCNAYY8NZTWFFK38K5G0FGWH08B1B4M5THHC) +(define-data-var ipfs-root (string-ascii 80) "ipfs://ipfs/QmWdRtucuvhoaqyqSJk1o7KZUXR7gtJGPuX5B6whHPpN4u/") +(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-data-var locked bool false) + +(define-map mints-per-user principal uint) +(define-map mint-passes principal uint) + +(define-public (lock-contract) + (begin + (asserts! (or (is-eq tx-sender (var-get artist-address)) (is-eq tx-sender DEPLOYER)) (err ERR-NOT-AUTHORIZED)) + (var-set locked true) + (ok true))) + +(define-public (claim) + (mint (list true))) + +(define-public (claim-twentyfive) (mint (list true true true true true true true true true true true true true true true true true true true true 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! (or (is-eq (var-get mint-limit) u0) (<= 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! (is-eq (var-get locked) false) (err ERR-CONTRACT-LOCKED)) + (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 (or (is-eq (var-get mint-limit) u0) (<= next-id (var-get mint-limit))) + (begin + (unwrap! (nft-mint? bitcoin-unleashed-2023 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? bitcoin-unleashed-2023 token-id tx-sender))) + +(define-private (is-owner (token-id uint) (user principal)) + (is-eq user (unwrap! (nft-get-owner? bitcoin-unleashed-2023 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? bitcoin-unleashed-2023 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 (var-get ipfs-root)))) + +(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-locked) + (ok (var-get locked))) + +(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? bitcoin-unleashed-2023 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? bitcoin-unleashed-2023 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 )) + (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 )) + (let ((owner (unwrap! (nft-get-owner? bitcoin-unleashed-2023 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))) + + diff --git a/contracts/SP3YK6ZESB1XXVWKSMK5164KMAD6GV4XM0P6R35VC/bns-1697666284871-v1.clar b/contracts/SP3YK6ZESB1XXVWKSMK5164KMAD6GV4XM0P6R35VC/bns-1697666284871-v1.clar new file mode 100644 index 0000000000..dcccf6ecc8 --- /dev/null +++ b/contracts/SP3YK6ZESB1XXVWKSMK5164KMAD6GV4XM0P6R35VC/bns-1697666284871-v1.clar @@ -0,0 +1,126 @@ + + ;; version: 1 + ;; name: xn--bt-gfb + ;; namespace: btc + + (use-trait commission-trait 'SP3D6PV2ACBPEKYJTCMH7HEN02KP87QSP8KTEH335.commission-trait.commission) + + (define-constant DEPLOYER_CONTRACT_PRINCIPAL (as-contract tx-sender)) + (define-constant COMM-ADDR 'SP7NDX6YRAH6C99WCZJWKF2SYR1GQRF7X6894QSJ) + + (define-constant ERR-ALREADY-LISTED (err u401)) + (define-constant ERR-WRONG-COMMISSION (err u402)) + (define-constant ERR-NOT-AUTHORIZED (err u403)) + (define-constant ERR-NOT-FOUND (err u404)) + (define-constant ERR-WRONG-PRICE (err u405)) + (define-constant ERR-TRANSFER-FAILED (err u500)) + + (define-data-var current-namespace (buff 20) 0x00) + (define-data-var current-name (buff 48) 0x00) + + (define-map listings { namespace: (buff 20), name: (buff 48) } { price: uint, lister: principal, commission: principal }) + + (define-read-only (is-admin) + (is-eq tx-sender COMM-ADDR) + ) + + (define-read-only (get-listing) + (map-get? listings { namespace: (var-get current-namespace), name: (var-get current-name) }) + ) + + (define-read-only (get-current-name) + { namespace: (var-get current-namespace), name: (var-get current-name) } + ) + + (define-private (list-name (namespace (buff 20)) (name (buff 48)) (price uint) (commission )) + (begin + (asserts! (is-none (get-listing)) ERR-ALREADY-LISTED) + (try! (to-bool-response (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + DEPLOYER_CONTRACT_PRINCIPAL + none + ))) + (var-set current-namespace namespace) + (var-set current-name name) + (ok (map-set listings {name: name, namespace: namespace} + {price: price, lister: tx-sender, commission: (contract-of commission)})) + ) + ) + + (define-public (change-price (namespace (buff 20)) (name (buff 48)) (new-price uint) (commission )) + (let ( + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing))) + (asserts! (is-eq tx-sender lister) ERR-NOT-AUTHORIZED) + (ok (map-set listings { namespace: namespace, name: name } { price: new-price, lister: lister, commission: (contract-of commission) })) + ) + ) + + (define-public (unlist-name (namespace (buff 20)) (name (buff 48))) + (let ( + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing))) + (asserts! (or (is-eq tx-sender lister) (is-admin)) ERR-NOT-AUTHORIZED) + (map-delete listings {namespace: namespace, name: name}) + (as-contract + (to-bool-response (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + lister + none + )) + ) + ) + ) + + (define-public (purchase-name (namespace (buff 20)) (name (buff 48)) (expected-price uint) (commission ) (recipient (optional principal))) + (let ( + (new-owner (if (is-some recipient) (unwrap-panic recipient) tx-sender)) + (listing (unwrap! (map-get? listings {namespace: namespace, name: name}) ERR-NOT-FOUND)) + (price (get price listing)) + (lister (get lister listing)) + (list-commission (get commission listing)) + ) + (asserts! (is-eq (contract-of commission) list-commission) ERR-WRONG-COMMISSION) + (asserts! (is-eq price expected-price) ERR-WRONG-PRICE) + (try! (contract-call? commission pay u0 price)) + (try! (stx-transfer? price tx-sender lister)) + (map-delete listings {namespace: namespace, name: name}) + (to-bool-response (as-contract + (contract-call? + 'SP000000000000000000002Q6VF78.bns + name-transfer + namespace + name + new-owner + none + ) + )) + ) + ) + + (define-public (withdraw-stx (amount uint)) + (let ( + (listing (unwrap! (get-listing) ERR-NOT-FOUND)) + (lister (get lister listing)) + ) + (asserts! (or (is-eq tx-sender lister) (is-admin)) ERR-NOT-AUTHORIZED) + (try! (as-contract (stx-transfer? amount tx-sender lister))) + (ok amount) + ) + ) + + (define-private (to-bool-response (value (response bool int))) + (match value + success (ok success) + error (err (to-uint error)))) + + (list-name 0x627463 0x786e2d2d62742d676662 u1777777778 'SPNWZ5V2TPWGQGVDR6T7B6RQ4XMGZ4PXTEE0VQ0S.gamma-commission-3-5) + \ No newline at end of file diff --git a/contracts/SP6FV9H1CW8RPVV92TQTF6PW3PSBQN15CYVZVEKY/Bwisal.clar b/contracts/SP6FV9H1CW8RPVV92TQTF6PW3PSBQN15CYVZVEKY/Bwisal.clar new file mode 100644 index 0000000000..6e0b64bd98 --- /dev/null +++ b/contracts/SP6FV9H1CW8RPVV92TQTF6PW3PSBQN15CYVZVEKY/Bwisal.clar @@ -0,0 +1,38 @@ +;; hello-world contract + +(define-constant sender 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR) +(define-constant recipient 'SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G) + +(define-fungible-token novel-token-19) +(begin (ft-mint? novel-token-19 u12 sender)) +(begin (ft-transfer? novel-token-19 u2 sender recipient)) + +(define-non-fungible-token hello-nft uint) +(begin (nft-mint? hello-nft u1 sender)) +(begin (nft-mint? hello-nft u2 sender)) +(begin (nft-transfer? hello-nft u1 sender recipient)) + +(define-public (test-emit-event) + (begin + (print "Event! Hello world") + (ok u1))) +(begin (test-emit-event)) + +(define-public (test-event-types) + (begin + (unwrap-panic (ft-mint? novel-token-19 u3 recipient)) + (unwrap-panic (nft-mint? hello-nft u2 recipient)) + (unwrap-panic (stx-transfer? u60 tx-sender 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR)) + (unwrap-panic (stx-burn? u20 tx-sender)) + (ok u1))) + +(define-map store {key: (buff 32)} {value: (buff 32)}) +(define-public (get-value (key (buff 32))) + (begin + (match (map-get? store {key: key}) + entry (ok (get value entry)) + (err 0)))) +(define-public (set-value (key (buff 32)) (value (buff 32))) + (begin + (map-set store {key: key} {value: value}) + (ok u1))) \ No newline at end of file diff --git a/contracts/SPM6S3AESTK9NAYE3Z7RS00T11ER8JJCDQTBHB4W/non-fungible-token.clar b/contracts/SPM6S3AESTK9NAYE3Z7RS00T11ER8JJCDQTBHB4W/non-fungible-token.clar new file mode 100644 index 0000000000..77159dba8f --- /dev/null +++ b/contracts/SPM6S3AESTK9NAYE3Z7RS00T11ER8JJCDQTBHB4W/non-fungible-token.clar @@ -0,0 +1,60 @@ +;; This contract implements the SIP-009 community-standard Non-Fungible Token trait +(impl-trait 'SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait.nft-trait) + +;; Define the NFT's name +(define-non-fungible-token Your-NFT-Name uint) + +;; Keep track of the last minted token ID +(define-data-var last-token-id uint u0) + +;; Define constants +(define-constant CONTRACT_OWNER tx-sender) +(define-constant COLLECTION_LIMIT u1000) ;; Limit to series of 1000 + +(define-constant ERR_OWNER_ONLY (err u100)) +(define-constant ERR_NOT_TOKEN_OWNER (err u101)) +(define-constant ERR_SOLD_OUT (err u300)) + +(define-data-var base-uri (string-ascii 80) "https://your.api.com/path/to/collection/{id}") + +;; SIP-009 function: Get the last minted token ID. +(define-read-only (get-last-token-id) + (ok (var-get last-token-id)) +) + +;; SIP-009 function: Get link where token metadata is hosted +(define-read-only (get-token-uri (token-id uint)) + (ok (some (var-get base-uri))) +) + +;; SIP-009 function: Get the owner of a given token +(define-read-only (get-owner (token-id uint)) + (ok (nft-get-owner? Your-NFT-Name token-id)) +) + +;; SIP-009 function: Transfer NFT token to another owner. +(define-public (transfer (token-id uint) (sender principal) (recipient principal)) + (begin + ;; #[filter(sender)] + (asserts! (is-eq tx-sender sender) ERR_NOT_TOKEN_OWNER) + (nft-transfer? Your-NFT-Name token-id sender recipient) + ) +) + +;; Mint a new NFT. +(define-public (mint (recipient principal)) + ;; Create the new token ID by incrementing the last minted ID. + (let ((token-id (+ (var-get last-token-id) u1))) + ;; Ensure the collection stays within the limit. + (asserts! (< (var-get last-token-id) COLLECTION_LIMIT) ERR_SOLD_OUT) + ;; Only the contract owner can mint. + (asserts! (is-eq tx-sender CONTRACT_OWNER) ERR_OWNER_ONLY) + ;; Mint the NFT and send it to the given recipient. + (try! (nft-mint? Your-NFT-Name token-id recipient)) + + ;; Update the last minted token ID. + (var-set last-token-id token-id) + ;; Return a success status and the newly minted NFT ID. + (ok token-id) + ) +) diff --git a/contracts/SPMGBGCFE9T5FMR1Z34GDSKDA9SSVT65Q19N4P1D/related-amber-gamefowl.clar b/contracts/SPMGBGCFE9T5FMR1Z34GDSKDA9SSVT65Q19N4P1D/related-amber-gamefowl.clar new file mode 100644 index 0000000000..6e0b64bd98 --- /dev/null +++ b/contracts/SPMGBGCFE9T5FMR1Z34GDSKDA9SSVT65Q19N4P1D/related-amber-gamefowl.clar @@ -0,0 +1,38 @@ +;; hello-world contract + +(define-constant sender 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR) +(define-constant recipient 'SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G) + +(define-fungible-token novel-token-19) +(begin (ft-mint? novel-token-19 u12 sender)) +(begin (ft-transfer? novel-token-19 u2 sender recipient)) + +(define-non-fungible-token hello-nft uint) +(begin (nft-mint? hello-nft u1 sender)) +(begin (nft-mint? hello-nft u2 sender)) +(begin (nft-transfer? hello-nft u1 sender recipient)) + +(define-public (test-emit-event) + (begin + (print "Event! Hello world") + (ok u1))) +(begin (test-emit-event)) + +(define-public (test-event-types) + (begin + (unwrap-panic (ft-mint? novel-token-19 u3 recipient)) + (unwrap-panic (nft-mint? hello-nft u2 recipient)) + (unwrap-panic (stx-transfer? u60 tx-sender 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR)) + (unwrap-panic (stx-burn? u20 tx-sender)) + (ok u1))) + +(define-map store {key: (buff 32)} {value: (buff 32)}) +(define-public (get-value (key (buff 32))) + (begin + (match (map-get? store {key: key}) + entry (ok (get value entry)) + (err 0)))) +(define-public (set-value (key (buff 32)) (value (buff 32))) + (begin + (map-set store {key: key} {value: value}) + (ok u1))) \ No newline at end of file diff --git a/last-block.txt b/last-block.txt index 3a1f1a4d4a..c0e2b782d2 100644 --- a/last-block.txt +++ b/last-block.txt @@ -1 +1 @@ -125202 \ No newline at end of file +125334 \ No newline at end of file