/
exuberant-sapphire-squid.clar
32 lines (27 loc) · 1.17 KB
/
exuberant-sapphire-squid.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
(define-constant NAME "SP2KAF9RF86PVX3NEE27DFV1CQX0T4WGR41X3S45C.byzantion-bitcoin-tulips::bitcoin-tulips")
(define-public (bid (item-id uint) (price uint))
(as-contract (contract-call? 'SP2KAF9RF86PVX3NEE27DFV1CQX0T4WGR41X3S45C.byzantion-market-v5 bid-item NAME item-id price))
)
(define-public (reset (item-id uint))
(let (
(sender tx-sender)
)
(try! (as-contract (contract-call? 'SP2KAF9RF86PVX3NEE27DFV1CQX0T4WGR41X3S45C.byzantion-market-v5 withdraw-bid NAME item-id)))
(try! (as-contract (contract-call? 'SP2KAF9RF86PVX3NEE27DFV1CQX0T4WGR41X3S45C.byzantion-bitcoin-tulips transfer item-id tx-sender sender)))
(try! (stx-transfer? (stx-get-balance sender) sender (as-contract tx-sender)))
(ok true)
)
)
(define-public (withdraw)
(let (
(sender tx-sender)
)
(as-contract (stx-transfer? (stx-get-balance tx-sender) tx-sender sender))
)
)
(define-public (unlist-item (item-id uint))
(begin
(try! (contract-call? 'SP2KAF9RF86PVX3NEE27DFV1CQX0T4WGR41X3S45C.byzantion-market-v5 buy-item 'SP2KAF9RF86PVX3NEE27DFV1CQX0T4WGR41X3S45C.byzantion-bitcoin-tulips NAME item-id))
(ok true)
)
)