PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.6.0
Code Block Pro – Beautiful Syntax Highlighting v1.6.0
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / build / shiki / samples / clarity.sample

clarity.sample in Code Block Pro – Beautiful Syntax Highlighting 1.6.0, at build/shiki/samples/clarity.sample

53 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (impl-trait .sip010-ft-trait.sip010-ft-trait)
2
3 ;; SIP010 trait on mainnet
4 ;; (impl-trait 'SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.sip-010-trait-ft-standard.sip-010-trait)
5
6 (define-constant contract-owner tx-sender)
7 (define-constant err-owner-only (err u100))
8 (define-constant err-not-token-owner (err u101))
9
10 ;; No maximum supply!
11 (define-fungible-token clarity-coin)
12
13 (define-public (transfer (amount uint) (sender principal) (recipient principal) (memo (optional (buff 34))))
14 (begin
15 (asserts! (is-eq tx-sender sender) err-owner-only)
16 (try! (ft-transfer? clarity-coin amount sender recipient))
17 (match memo to-print (print to-print) 0x)
18 (ok true)
19 )
20 )
21
22 (define-read-only (get-name)
23 (ok "Clarity Coin")
24 )
25
26 (define-read-only (get-symbol)
27 (ok "CC")
28 )
29
30 (define-read-only (get-decimals)
31 (ok u0)
32 )
33
34 (define-read-only (get-balance (who principal))
35 (ok (ft-get-balance clarity-coin who))
36 )
37
38 (define-read-only (get-total-supply)
39 (ok (ft-get-supply clarity-coin))
40 )
41
42 (define-read-only (get-token-uri)
43 (ok none)
44 )
45
46 (define-public (mint (amount uint) (recipient principal))
47 (begin
48 (asserts! (is-eq tx-sender contract-owner) err-owner-only)
49 (ft-mint? clarity-coin amount recipient)
50 )
51 )
52
53 ;; From https://github.com/clarity-lang/book/blob/main/projects/sip010-ft/contracts/clarity-coin.clar