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
(define-read-only (get-listing-in-ustx (id uint)) | |
(map-get? market id)) | |
(define-public (list-in-ustx (id uint) (price uint) (comm-trait <commission-trait>)) | |
(let ((listing {price: price, commission: (contract-of comm-trait), royalty: (var-get royalty-percent)})) | |
(asserts! (is-sender-owner id) (err ERR-NOT-AUTHORIZED)) | |
(map-set market id listing) | |
(print (merge listing {a: "list-in-ustx", id: id})) | |
(ok true))) |
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
(define-data-var mint-limit uint u15) | |
(define-data-var last-id uint u1) | |
(define-data-var total-price uint u32000000) | |
(define-data-var artist-address principal 'SP1X6M947Z7E58CNE0H8YJVJTVKS9VW0PHD4Q0A5F) | |
(define-data-var ipfs-root (string-ascii 80) "ipfs://ipfs/QmQDXepX6skZWU7RJn1gW9bsKnQi5hsiuGj9cSeJwJNdDD/json/") | |
(define-data-var mint-paused bool false) | |
(define-data-var premint-enabled bool false) | |
(define-data-var sale-enabled bool false) | |
(define-data-var metadata-frozen bool false) | |
(define-data-var airdrop-called bool false) |
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
(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) |
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
import Data.Bits | |
import Data.List | |
bigrams :: [String] -> [(String, String)] | |
bigrams [x] = [] | |
bigrams (x:y:xs) = (x, y):(bigrams $ y:xs) | |
successors :: String -> [(String, String)] -> [String] | |
successors predecessor bigrams = map snd matches | |
where matches = filter (\p -> fst p == predecessor) bigrams |
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
x = ["the", "quick", "brown", "fox", "jumps", "over", "a", "lazy", "dog", "who", "jumps", "below", "the", "white", "rabbit", "who", "jumps", "over", "the", "green", "turtle", "who", "jumps", "above", "the", "lazy", "cat", "who"] | |
grams = bigrams $ bigrammap x | |
genx = gen grams pseudorand 1 |
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
pseudorand seed = (c * 2685821657736338717) .&. (2 ^ 64 - 1) | |
where a = seed `xor` (seed `shiftR` 12) | |
b = a `xor` (a `shiftL` 25) | |
c = b `xor` (b `shiftR` 27) |
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
gen :: [(String, [String])] -> (Int -> Int) -> Int -> String -> [String] | |
gen lbs rand seed x = case lookup x lbs of | |
Just [] -> [] | |
Just followers -> nxt:(gen lbs rand index nxt) | |
where nxt = followers !! (index `mod` (length followers)) | |
index = rand seed | |
Nothing -> [] |
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
bigrammap :: [(String, String)] -> [(String, [String])] | |
bigrammap bgs = zip leaders followers | |
where followers = map (\l -> successors l bgs) leaders | |
leaders = nub $ map fst bgs |
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
successors :: String -> [(String, String)] -> [String] | |
successors predecessor bigrams = map snd matches | |
where matches = filter (\p -> fst p == predecessor) bigrams |
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
bigrams :: [String] -> [(String, String)] | |
bigrams [x] = [] | |
bigrams (x:y:xs) = (x, y):(bigrams $ y:xs) |
NewerOlder