Source Code

;; Price Oracle
;; Provides price feeds for DEX

(define-constant contract-owner tx-sender)

(define-map prices (string-ascii 32) uint)

(define-read-only (get-price (asset (string-ascii 32)))
  (default-to u0 (map-get? prices asset))
)

(define-public (update-price (asset (string-ascii 32)) (price uint))
  (begin
    (asserts! (is-eq tx-sender contract-owner) (err u100))
    (map-set prices asset price)
    (ok price)
  )
)

Functions (2)

FunctionAccessArgs
get-priceread-onlyasset: (string-ascii 32
update-pricepublicasset: (string-ascii 32