-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ee7cc2
commit e5d7d16
Showing
16 changed files
with
1,540 additions
and
1 deletion.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
contracts/SP17YZQB1228EK9MPHQXA8GC4G3HVWZ66X7VRPMAX/convincing-gray-tern.clar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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))) |
38 changes: 38 additions & 0 deletions
38
contracts/SP17YZQB1228EK9MPHQXA8GC4G3HVWZ66X7VRPMAX/vocal-olive-cicada.clar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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))) |
126 changes: 126 additions & 0 deletions
126
contracts/SP1C319GJCV4P4JMVRHT8S2HV5XE7JRFG4AQKCQCX/bns-1697653985255-v1.clar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <commission-trait>)) | ||
(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 <commission-trait>)) | ||
(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 <commission-trait>) (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) | ||
|
126 changes: 126 additions & 0 deletions
126
contracts/SP1G06JV3YFJFN5WXCD6H04X1N9K33KZB7TXB5PMY/bns-1697665213925-v1.clar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <commission-trait>)) | ||
(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 <commission-trait>)) | ||
(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 <commission-trait>) (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) | ||
|
38 changes: 38 additions & 0 deletions
38
contracts/SP1GP4KVRKDBCEHN8947PH4RXFWG2R9K0R6FNE8PF/sanishbadnecontract1.clar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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))) |
Oops, something went wrong.