All Downloads are FREE. Search and download functionalities are using the official Maven repository.

convex.trust.ownership-monitor.cvx Maven / Gradle / Ivy

The newest version!
'convex.trust.ownership-monitor

;; A simple trust monitor that can test for ownership of some asset quantity
;; 
;; Example: a subject must hold tokens representing shares in a company 
;; in order to be eligible to vote in a general meeting.
;;
;; (import convex.trust.ownership-monitor :as ownership)
;;
;; (trust/trusted? *caller* [ownership [share-token 1000]])
;;


(import convex.asset :as asset)

(defn check-trusted?
  ^{:callable true
    :doc {:description ["Trust monitor SPI for testing asset ownership."
                        "Ignores action and object, simply checks if the subject owns the asset specified in *scope*."]
          :examples    [{:code "(call [ownership-monitor [some-token 1000]] (check-trusted *caller* nil nil))"}]
          :signature   [{:params [ subject action object]}]}}
  [subject action object]  
  (asset/owns? subject *scope*))




© 2015 - 2024 Weber Informatics LLC | Privacy Policy