From 9fe4c4f65bf2f3846ff8a25796b5d243cfd1a7e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Garamv=C3=B6lgyi?= Date: Fri, 16 Aug 2024 15:45:52 +0200 Subject: [PATCH] update badges.md --- docs/badges.md | 56 +++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/docs/badges.md b/docs/badges.md index 9d6ec21..674edcd 100644 --- a/docs/badges.md +++ b/docs/badges.md @@ -26,6 +26,32 @@ Refer to the examples in [examples](../src/badge/examples). > While this is not mandatory, we recommend creating badges that do no expire, are non-revocable, and are singletons (at most 1 badge per user). +### Badge Token URI + +Each badge must define a badge token URI. + +The badge token URI is very similar to the tokenURI in ERC-721. +It must point to a metadata JSON object that contains `name`, `description`, `image`, and `issuerName`. +You can use a normal URL, an IPFS link, or a [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs) as your token URI. +The metadata is used by the Canvas frontend to render the badge. + + +For example, the badge token URI https://nft.scroll.io/canvas/year/2024.json points to the following metadata: + +```json +{ + "name": "Ethereum Year", + "description": "Check out the Ethereum Year Badge! It's like a digital trophy that shows off the year your wallet made its debut on Ethereum. It's a little present from Scroll to celebrate all the cool stuff you've done in the Ethereum ecosystem.", + "image": "https://nft.scroll.io/canvas/year/2024.webp", + "issuerName": "Scroll" +} +``` + +Your badge contract can provide a single URI for all badges, in which case all instances of your badge will look the same. +Alternatively, you can also render a different image for different instances of your badge, see [`EthereumYearBadge`](../src/badge/examples/EthereumYearBadge.sol). +You should also configure a default badge token URI, see [`ScrollBadgeDefaultURI`](../src/badge/extensions/ScrollBadgeDefaultURI.sol). + + ### Badge Types Badges are created by attesting to the recipient using the [`BADGE_SCHEMA`](./deployments.md). @@ -59,8 +85,7 @@ There are three main badge types of badges: Type Description -Basic Requirements -Additional Requirements +Requirements Examples @@ -79,6 +104,9 @@ There are three main badge types of badges: + + **Basic Requirements**: +