Source Code

;; alcove-index-22
(define-map grantss principal
  { username: (string-ascii 32), bio: (string-ascii 128), verified: bool, joined: uint })

(define-public (create-profile (username (string-ascii 32)) (bio (string-ascii 128)))
  (if (is-none (map-get? grantss tx-sender))
    (begin
      (map-set grantss tx-sender
        { username: username, bio: bio, verified: false, joined: block-height })
      (ok true))
    (err u1)))

(define-public (update-bio (bio (string-ascii 128)))
  (match (map-get? grantss tx-sender)
    profile
    (begin
      (map-set grantss tx-sender (merge profile { bio: bio }))
      (ok true))
    (err u2)))

(define-read-only (get-profile (who principal))
  (ok (map-get? grantss who)))

Functions (3)

FunctionAccessArgs
create-profilepublicusername: (string-ascii 32
update-biopublicbio: (string-ascii 128
get-profileread-onlywho: principal