Source Code

;; tipstream-listings
;; Marketplace listings

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

(define-map listings uint {
  creator: principal,
  value: uint,
  at-block: uint
})

(define-public (list-item (price uint))
  (let
    (
      (id (var-get total-listings))
    )
    (map-set listings id {
      creator: tx-sender,
      value: price,
      at-block: block-height
    })
    (var-set total-listings (+ id u1))
    (ok id)
  )
)

(define-read-only (get-entry (id uint))
  (map-get? listings id)
)

(define-read-only (get-total)
  (ok (var-get total-listings))
)

Functions (3)

FunctionAccessArgs
list-itempublicprice: uint
get-entryread-onlyid: uint
get-totalread-only