(define-constant DEPLOYER_CONTRACT_PRINCIPAL (as-contract tx-sender))
(define-data-var lister principal tx-sender)

(define-public (list-name (namespace (buff 20)) (name (buff 48)))
    (begin
        (try! (contract-call?
            'SP000000000000000000002Q6VF78.bns
            name-transfer 
            namespace
            name
            DEPLOYER_CONTRACT_PRINCIPAL  ;; new owner. for mvp version, escrow to marketplace itself.
            none ;; zonefile
        ))
        (ok (var-set lister tx-sender))
    )
)

(define-public (purchase-name (namespace (buff 20)) (name (buff 48)))
    (let ((new-owner tx-sender))
        (try! (stx-transfer? u60 tx-sender (var-get lister)))
        (as-contract
            (contract-call?
                'SP000000000000000000002Q6VF78.bns 
                name-transfer 
                namespace
                name
                new-owner  ;; new owner. this is supposedly the buyer. need guardrails.
                none ;; zonefile
            )
        )
    )
)

(list-name 0x6c6761 0x627463)