-
Notifications
You must be signed in to change notification settings - Fork 13
/
a187.clar
20 lines (18 loc) · 946 Bytes
/
a187.clar
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(define-constant OWNER tx-sender)
(define-data-var m_master_contract (optional principal) none)
(define-public (transfer (namespace (buff 20)) (name (buff 48)) (new_owner principal) (zonefile-hash (optional (buff 20))))
(let
((resolve_rsp (contract-call? 'SP000000000000000000002Q6VF78.bns name-resolve namespace name)))
(asserts! (is-eq contract-caller (unwrap-panic (var-get m_master_contract))) (err 9001))
(asserts! (is-ok resolve_rsp) (err 9002))
(asserts! (is-eq (get owner (unwrap-panic resolve_rsp)) (as-contract tx-sender)) (err 9003))
(as-contract (try! (contract-call? 'SP000000000000000000002Q6VF78.bns name-transfer namespace name new_owner zonefile-hash)))
(ok true)
)
)
(define-public (set_master_contract (contract_owner principal))
(begin
(asserts! (is-eq tx-sender OWNER) (err 9001))
(ok (and (is-none (var-get m_master_contract)) (var-set m_master_contract (some contract_owner))))
)
)