/
zolana.clar
178 lines (151 loc) · 5.75 KB
/
zolana.clar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
;; This is an absolute experiment of a token.
;; do not take anything here seriously, it is suppose to be a joke
;; please do not invest on this token, it is just for fun
;; there some unusual mechanics here that may block your wallet from using the token
;; there are also some functions to mint the token using different methods, use them at your own risk
;; sometimes the token may be offline
;; sometimes the token may be censored
;; sometimes the token may be back online
(impl-trait .traits.ft-trait)
(define-constant ERR_NOT_MINTER (err u200))
(define-constant ERR_AMOUNT_ZERO (err u201))
(define-constant ERR_ZOLANA_OFFLINE (err u202))
(define-constant ERR_NOT_TOKEN_OWNER (err u203))
(define-constant ERR_USER_NOT_AUTHORISED (err u204))
(define-constant receiver_address_mint 'SP18MTB6VXR499WNTDDWDK2Q1KG960ABY8VJB37ZR) ;;central wallet
(define-constant receiver_address_switch 'SP18MTB6VXR499WNTDDWDK2Q1KG960ABY8VJB37ZR) ;;degen wallet
(define-constant price_on u100000000) ;; 100 ROOs -> burn
(define-constant price_off u1000000000) ;; 100 ROOs -> burn
(define-constant price_censor u1000000000) ;; 1k ROOs -> airdrop
(define-constant price_remove_censor u1000000000) ;; 100 ROOs -> airdrop
;; censor -> for certain amount of time
(define-constant price_mint_1k_w u1000000000) ;; $0.00632 - 1k Welsh
(define-constant price_mint_1k_l u5000000000) ;; $0.00156 - 5k Leo
(define-constant price_mint_1k_n u50000000000000000) ;; $0.000000000906 5(8)k nothing
(define-data-var on_off_switch bool true)
(define-data-var TOKEN_URI (optional (string-utf8 256)) none)
(define-map authorised_users principal bool)
(define-fungible-token zolana u5722900000000000 )
(define-read-only (get-name)
(ok "Zolana")
)
(define-read-only (get-symbol)
(ok "ZOL")
)
(define-read-only (get-decimals)
(ok u6)
)
(define-read-only (get-network-online)
(ok (var-get on_off_switch))
)
(define-read-only (get-balance (user principal))
(begin
(asserts! (is-eq (var-get on_off_switch) true) ERR_ZOLANA_OFFLINE)
(ok (ft-get-balance zolana user))
)
)
(define-read-only (get-total-supply)
(ok (ft-get-supply zolana))
)
(define-read-only (get-token-uri)
(ok (var-get TOKEN_URI))
)
(define-public (set-token-uri (value (string-utf8 256)))
(if
(is-eq tx-sender receiver_address_mint)
;; #[allow(unchecked_data)]
(ok (var-set TOKEN_URI (some value)))
(err ERR_NOT_MINTER)
)
)
(define-public (transfer (amount uint) (sender principal) (receiver principal) (memo (optional (buff 34))))
(begin
(asserts! (is-eq (var-get on_off_switch) true) ERR_ZOLANA_OFFLINE)
(asserts! (is-eq (default-to false (map-get? authorised_users sender)) true) ERR_USER_NOT_AUTHORISED)
(asserts! (is-eq tx-sender sender) ERR_NOT_TOKEN_OWNER)
;; #[allow(unchecked_data)]
(try! (ft-transfer? zolana amount sender receiver))
(match memo to-print (print to-print) 0x)
(ok true)
)
)
(define-public (mint (amount uint))
(begin
(asserts! (is-eq tx-sender receiver_address_mint) ERR_NOT_MINTER)
(asserts! (> amount u0) ERR_AMOUNT_ZERO)
(ft-mint? zolana amount receiver_address_mint)
)
)
(define-public (burn (amount uint))
(begin
(asserts! (is-eq (var-get on_off_switch) true) ERR_ZOLANA_OFFLINE)
(ft-burn? zolana amount tx-sender)
)
)
;; Function to set Zolana on
(define-public (zolana_on)
(begin
(try! (contract-call? 'SP2C1WREHGM75C7TGFAEJPFKTFTEGZKF6DFT6E2GE.kangaroo transfer price_on tx-sender receiver_address_switch none))
(var-set on_off_switch true)
(ok "zolana back up again")
)
)
;; Function to set Zolana off
(define-public (zolana_off)
(begin
(try! (contract-call? 'SP2C1WREHGM75C7TGFAEJPFKTFTEGZKF6DFT6E2GE.kangaroo transfer price_off tx-sender receiver_address_switch none))
(var-set on_off_switch false)
(ok "zolana down. ")
)
)
;; function to mint using Welsh
(define-public (mint_welsh_1000)
(begin
(try! (contract-call? 'SP3NE50GEXFG9SZGTT51P40X2CKYSZ5CC4ZTZ7A2G.welshcorgicoin-token transfer price_mint_1k_w tx-sender receiver_address_mint none))
(try! (ft-mint? zolana u1000000000 tx-sender ))
(ok "minted using Welsh")
)
)
;; function to mint using Leo
(define-public (mint_leo_1000)
(begin
(try! (contract-call? 'SP1AY6K3PQV5MRT6R4S671NWW2FRVPKM0BR162CT6.leo-token transfer price_mint_1k_l tx-sender receiver_address_mint none))
(try! (ft-mint? zolana u1000000000 tx-sender ))
(ok "minted using Leo")
)
)
;; function to mint using Nothing
(define-public (mint_nothing_1000)
(begin
(try! (contract-call? 'SP32AEEF6WW5Y0NMJ1S8SBSZDAY8R5J32NBZFPKKZ.nope transfer price_mint_1k_n tx-sender receiver_address_mint none))
(try! (ft-mint? zolana u1000000000 tx-sender ))
(ok "minted using Nothing")
)
)
;; function to black list user
(define-public (censor_user (user principal))
(begin
(try! (contract-call? 'SP2C1WREHGM75C7TGFAEJPFKTFTEGZKF6DFT6E2GE.kangaroo transfer price_censor tx-sender receiver_address_switch none))
;; #[allow(unchecked_data)]
(map-set authorised_users user false)
(ok "user blocked")
)
)
;; function to add user to authorised list
(define-public (authorised_user (user principal))
(begin
;; try attempts to unwrap the value of stx-transfer (either OK or ERR), if successful it will extract that value that return it, otherwise it will exit the function
(try! (contract-call? 'SP2C1WREHGM75C7TGFAEJPFKTFTEGZKF6DFT6E2GE.kangaroo transfer price_censor tx-sender receiver_address_switch none))
;; #[allow(unchecked_data)]
(map-set authorised_users user true)
(ok "user authorised")
)
)
(define-public (authorised_user_mint (user principal))
(begin
(asserts! (is-eq tx-sender receiver_address_mint) ERR_NOT_MINTER)
;; #[allow(unchecked_data)]
(map-set authorised_users user true)
(ok "user authorised")
)
)