(impl-trait 'SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.sip-010-trait-ft-standard.sip-010-trait)

(define-fungible-token GREEN)
(define-data-var supply int 100000000)

;; error codes
(define-constant sender-is-recipient u120)

;; get the token balance of owner
(define-read-only (get-balance (owner principal))
  (begin
    (ok (ft-get-balance GREEN owner))))

;; returns the total number of tokens
(define-read-only (total-supply)
  (ok (to-uint (var-get supply)))
)

;; the token name
(define-read-only (get-name)
  (ok "GREEN"))

;; the symbol
(define-read-only (get-symbol)
  (ok "GRE"))

;; the number of decimals used
(define-read-only (get-decimals)
  (ok u6))

(define-public (get-token-uri)
  (ok (some u"https://www.green.org/token/")))
              
;; transfers tokens to a recipient
(define-public (transfer (amount uint) (sender principal) (recipient principal) (memo (optional (buff 34))))
  (if (is-eq tx-sender sender)
    (begin
      (try! (ft-transfer? GREEN amount sender recipient))
      (print memo)
      (ok true)
    )
    (err sender-is-recipient)))

;; fund the treasury
(ft-mint? GREEN u100000000000000 'SP32XCD69XPS3GKDEXAQ29PJRDSD5AR643GNEEBXZ)