/
only-olive-swift.clar
51 lines (41 loc) · 1.2 KB
/
only-olive-swift.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
;; hello-world contract
(define-constant sender 'SZ2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQ9H6DPR)
(define-constant recipient 'SM2J6ZY48GV1EZ5V2V5RB9MP66SW86PYKKQVX8X0G)
(define-fungible-token novel-token-19)
(ft-mint? novel-token-19 u12 sender)
(ft-transfer? novel-token-19 u2 sender recipient)
(define-non-fungible-token hello-nft uint)
(nft-mint? hello-nft u1 sender)
(nft-mint? hello-nft u2 sender)
(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)
)
)