-
Notifications
You must be signed in to change notification settings - Fork 13
/
wrapped-lydian-helper-v1-1.clar
46 lines (38 loc) · 1.31 KB
/
wrapped-lydian-helper-v1-1.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
;; @contract Wrapped Lydian Helper
;; @version 1
;; ---------------------------------------------------------
;; LDN to wLDN
;; ---------------------------------------------------------
(define-public (ldn-to-wldn (amount uint))
(begin
(try! (contract-call? .staking-v1-1 stake .staking-distributor-v1-1 .treasury-v1-1 amount))
(contract-call? .wrapped-lydian-creator-v1-1 wrap amount)
)
)
;; ---------------------------------------------------------
;; Auction
;; ---------------------------------------------------------
(define-public (auction-withdraw-wldn (auction-id uint))
(let (
(ldn-amount (unwrap-panic (contract-call? .auction-v1-1 withdraw-tokens auction-id)))
)
(ldn-to-wldn ldn-amount)
)
)
;; ---------------------------------------------------------
;; Bond
;; ---------------------------------------------------------
(define-public (redeem-bond-wldn (bond-type uint) (bond-id uint))
(let (
(sldn-amount (unwrap-panic (contract-call? .bond-teller-v1-1 redeem bond-type bond-id)))
)
(contract-call? .wrapped-lydian-creator-v1-1 wrap sldn-amount)
)
)
(define-public (redeem-all-bonds-wldn (bond-type uint))
(let (
(sldn-amount (unwrap-panic (contract-call? .bond-teller-v1-1 redeem-all bond-type)))
)
(contract-call? .wrapped-lydian-creator-v1-1 wrap sldn-amount)
)
)