Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to update and freeze updating the metadata uri #6

Open
314159265359879 opened this issue Dec 21, 2021 · 0 comments
Open

Comments

@314159265359879
Copy link

This option provides some more flexibility compared to hard coding the uri yet still makes it immutable after you've checked everything is in order.

Just like in the SP3D6PV2ACBPEKYJTCMH7HEN02KP87QSP8KTEH335.megapont-ape-club-nft (see from line 142 and 150 (and line 019, 037))

Add error
(define-constant ERR-METADATA-FROZEN (err u505))

Add variable
(define-data-var metadata-frozen bool false)
assumes:
(define-data-var base-uri (string-ascii 80) "ipfs://Qmad43sssgNbG9TpC6NfeiTi9X6f9vPYuzgW2S19BEi49m/{id}")

add set base uri
;; Set base uri (define-public (set-base-uri (new-base-uri (string-ascii 80))) (begin (asserts! (is-eq tx-sender CONTRACT-OWNER) ERR-NOT-AUTHORIZED) (asserts! (not (var-get metadata-frozen)) ERR-METADATA-FROZEN) (var-set base-uri new-base-uri) (ok true)))

add Freeze metadata
;; Freeze metadata (define-public (freeze-metadata) (begin (asserts! (is-eq tx-sender CONTRACT-OWNER) ERR-NOT-AUTHORIZED) (var-set metadata-frozen true) (ok true)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant