(define-data-var total-supply uint u0)

(define-fungible-token wrapped-token)

(define-read-only (get-total-supply)  
  (ok (var-get total-supply)))
(define-read-only (get-balance-of (owner principal))
  (begin
    (ok (ft-get-balance wrapped-token owner))
  ))

(define-read-only (get-name)  
  (ok "wrapped-nothing"))

(define-read-only (decimals)
  (ok u6))

(define-public (transfer (recipient principal) (amount uint))  
  (begin
    (ft-transfer? wrapped-token amount tx-sender recipient)  
  ))

(define-public (transfer-from (sender principal) (recipient principal) (amount uint))  
  (ft-transfer? wrapped-token amount sender recipient))

(define-public (wrap (amount uint))  
  (let ((contract-address (as-contract tx-sender)))
    (if
      (and
        (is-ok (contract-call? .micro-nthng contract-address amount))
        (is-ok (ft-mint? wrapped-token amount tx-sender))
      )
      (begin
        (var-set total-supply (+ (var-get total-supply) amount))

        (print amount)

        (print (var-get total-supply))

        (ok (list amount (var-get total-supply)))
      )
      (err false)
    )  
  ))
