Skip to content

Commit 38ce0dc

Browse files
authored
feat: update docs (#52)
* feat: update docs (wip) * fix image link * add explore section * update badges.md * update * update README * nit * add section about upgradability * improve docs and add examples * add license * fix code formatting
1 parent c08e809 commit 38ce0dc

File tree

8 files changed

+747
-74
lines changed

8 files changed

+747
-74
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2024 Scroll
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 67 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,63 +2,88 @@
22

33
[![test](https://github.com/scroll-tech/canvas-contracts/actions/workflows/contracts.yml/badge.svg)](https://github.com/scroll-tech/canvas-contracts/actions/workflows/contracts.yml)
44

5-
![Components overview](images/overview.png "Overview")
5+
## Welcome to Scroll Canvas
66

7-
([Editable link](https://viewer.diagrams.net/?tags=%7B%7D&highlight=0000ff&edit=_blank&layers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nxVq8J%2BJ7ySlbD5WecpBq1OPzm9T5atS1T4y6cFRR12uperCkqR5mOrXFzpQ3G5XyzNVjDNobNuU9VX%2FOqPRnHwlwnFG6RGp%2FR6JcyuiTykdHljk4zsgyh%2FZVoibYDsXXsaM6XeZuU%2BZwYJk77ybzLiDbFN9saPEB%2BJv48ld9NOjaRzeufxoB0G0gADRUmwcdPaqHS2Hb%2B3%2FUO37Zeocx304KHrAGTN06E%2B5FsmiqH4v6DD1WPxYfQFe%2F1pRnZQrMxwT202Ppm5Hs2I26Rn%2BVonbForfgCU8tSIBqOaIoTrxfQQLOhwq4512KwFEz6L36FFyql3CymbAE55QborauFYS4MBw%2BRWlKfEPWbKBnPfadEIFZw1y9hrnmQGolRFIq6FBh0z7mzevc%2FBy%2FfMh30GnQMkKvBK3LLFFRUaN5Mf%2FK2f782vMorpWwKeyha9HwI3vIMEbSdIuzu%2FSYsodXUuXOUom5Z00tS6JzMfechV2%2FuM1U38yZyX%2FHdW3YV2CyPpBYXtiWh7YfXGGKQxmCWDImjPYIS5DBEngAQMe1JDgXdec596ae58zmnu1CD3p9AXPgb2PKetJDte%2B59PiVTCtAaZTtC5yVNRk38Ktlv27LyUh7Q340Dst5EX%2Fn25M1BZb51uNns9n%2BCxoGWhUdyQxwTej4ytzNTwtm3sDpnH3sK68hndfkTZXxM%2FzRqa8oDbpedUhlvdC27XpKZGp9I7ah9usin2Mk2iY0Ij9nsNtFjRdA68zCrinkNt9b9Ki09iuLwvH19klW1y4RgndzibJZfjWdK6H89ty%2B%2Fh8%3D))
7+
We are thrilled to have you join us in building unique discoveries with [Scroll Canvas](https://scroll.io/canvas), a new product designed for ecosystem projects to interact with users in a more tailored way.
88

9-
## ScrollBadge Schema and Resolver
9+
Try Canvas at [scroll.io/canvas](https://scroll.io/canvas)
1010

11-
We define a *Scroll badge* [EAS schema](https://docs.attest.sh/docs/core--concepts/schemas):
11+
## Overview
1212

13-
```
14-
address badge
15-
bytes payload
13+
**Scroll Canvas** allows users to showcase on-chain credentials, status, and achievements called **Badges** issued and collected across the Scroll ecosystem.
14+
Users can mint a non-transferable and unique personal persona to collect and display their **Badges**.
15+
16+
### Key Features
17+
18+
- **Canvas**: Each Canvas is a smart contract minted through the `ProfileRegistry` contract by the user on Scroll’s website.
19+
- **Badges**: Attestations of achievements and traits verified through the [Ethereum Attestation Service](https://docs.attest.sh/docs/welcome) (EAS), issued by different projects and the Scroll Foundation.
20+
Badges are wallet-bound and non-transferable.
21+
22+
Differences between attestations and NFTs:
23+
24+
| Attestation | NFT |
25+
| --- | --- |
26+
| Witness Proofs | Tokenized Assets |
27+
| Non-transferable | Transferable |
28+
| Recorded on disk (blockchain history) | Recorded in memory (blockchain states) |
29+
| Prove ownership at a point in time | Exercise custodianship of an asset |
30+
31+
## Developer Quickstart
32+
33+
Visit the [Developer Documentation](./docs) in this repo to learn more about Canvas.
34+
35+
See [Deployments](./docs/deployments.md) for the official Canvas contract addresses.
36+
37+
See the [Integration Guide](https://scrollzkp.notion.site/Introducing-Scroll-Canvas-Badge-Integration-Guide-8656463ab63b42e8baf924763ed8c9d5) for more information.
38+
39+
## Support
40+
41+
For questions regarding Canvas and custom badge development, please join [Scroll dev support channel](https://discord.com/channels/853955156100907018/1028102371894624337) on Discord.
42+
43+
## Running the Code
44+
45+
### Node.js
46+
47+
First install [`Node.js`](https://nodejs.org/en) and [`npm`](https://www.npmjs.com/).
48+
Run the following command to install [`yarn`](https://classic.yarnpkg.com/en/):
49+
50+
```bash
51+
npm install --global yarn
1652
```
1753

18-
This schema is tied to `ScrollBadgeResolver`.
19-
Every time a Scroll badge attestation is created or revoked, `ScrollBadgeResolver` executes some checks.
20-
After that, it forwards the call to the actual badge implementation.
54+
### Foundry
2155

22-
## Profiles
56+
Install `foundryup`, the Foundry toolchain installer:
2357

24-
Each user can create a `Profile` contract, minted through the `ProfileRegistry` contract.
25-
Each wallet can mint only one profile.
26-
All profiles share the same implementation, upgradable by Scroll to enable new features.
58+
```bash
59+
curl -L https://foundry.paradigm.xyz | bash
60+
```
2761

28-
The main use of profiles is personalization.
29-
Users can configure a username and an avatar.
30-
Users can also decide which badges they atach to their profile, and in which order.
62+
If you do not want to use the redirect, feel free to manually download the `foundryup` installation script from [here](https://github.com/foundry-rs/foundry/master/foundryup/foundryup). Then, run `foundryup` in a new terminal session or after reloading `PATH`.
3163

32-
## Badges
64+
Other ways to install Foundry can be found [here](https://github.com/foundry-rs/foundry#installation).
3365

34-
Each badge is an EAS attestation that goes through the `ScrollBadgeResolver` contract and a badge contract.
66+
### Install Dependencies
3567

36-
Each badge type is a standalone contract, inheriting from `ScrollBadge`.
37-
This badge contract can implement arbitrary logic attached to the attestation.
38-
Badges implement a `badgeTokenURI` interface, similar to `ERC721.tokenURI`.
68+
Run the following command to install all dependencies locally.
3969

40-
Badges are minted to the user's wallet address.
41-
The user can express their personalization preferences (attach and order badges, choose a profile photo) through their `Profile`.
70+
```
71+
yarn
72+
```
73+
74+
### Run Contract Tests
75+
76+
Run the following command to run the contract tests.
4277

43-
See [badges](./docs/badges.md) for details.
78+
```
79+
yarn test
80+
```
4481

45-
### Extensions
82+
## Contributing
4683

47-
This repo contains some useful [extensions](src/badge/extensions):
48-
- `ScrollBadgeAccessControl` restricts who can create and revoke this badge.
49-
- `ScrollBadgeCustomPayload` adds custom payload support to the badge.
50-
- `ScrollBadgeDefaultURI` sets a default badge token URI.
51-
- `ScrollBadgeEligibilityCheck` adds a standard on-chain eligibility check interface.
52-
- `ScrollBadgeNoExpiry` disables expiration for the badge.
53-
- `ScrollBadgeNonRevocable` disables revocation for the badge.
54-
- `ScrollBadgeSBT` attaches an SBT token to each badge attestation.
55-
- `ScrollBadgeSelfAttest` ensures that only the recipient of the badge can create the badge.
56-
- `ScrollBadgeSingleton` ensures that each user can only have at most one of the badge.
84+
We welcome community contributions to this repository.
85+
For larger changes, please [open an issue](https://github.com/scroll-tech/canvas-contracts/issues/new/choose) and discuss with the team before submitting code changes.
5786

58-
### Examples
87+
## License
5988

60-
This repo also contains some [examples](src/badge/examples):
61-
- `ScrollBadgeSimple` is a simple badge with fixed metadata.
62-
- `ScrollBadgePermissionless` is a permissionless badge that anyone can mint to themselves.
63-
- `ScrollBadgeLevels` is an SBT badge that stores a level in its payload and renders different images based on this level.
64-
- `ScrollBadgeTokenOwner` is a badge that is tied to the ownership of a Scroll Origins NFT.
89+
Scroll Monorepo is licensed under the [MIT](./LICENSE) license.

docs/README.md

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Scroll Canvas Developer Documentation
2+
3+
![Components overview](../images/overview.png "Overview")
4+
5+
([Editable link](https://viewer.diagrams.net/?tags=%7B%7D&highlight=0000ff&edit=_blank&layers=1&nav=1&title=skelly-v4.drawio#R7VpLc6M4EP41rpo5xIWEMeYYx8nsIdma2Rx2clRABs0K5BVybO%2BvXwkknk7ijCEwNalUyqjVenV%2F%2FVDDxL6K91842kR3LMB0Aq1gP7FXEwgBsIH8UZRDTllY85wQchJoppJwT%2F7Dmmhp6pYEOK0xCsaoIJs60WdJgn1RoyHO2a7Otma0vuoGhbhFuPcRbVP%2FJoGI9Ckcq6T%2FgUkYmZWBpXtiZJg1IY1QwHYVkn09sa84YyJ%2FivdXmCrhGbnk426e6S02xnEiThkQf%2Ft2uwvggibu7Q9%2Fk1hfCbzQykjFwRwYB%2FL8usm4iFjIEkSvS%2BqSs20SYDWrJVslzy1jG0kEkvgDC3HQykRbwSQpEjHVvXLD%2FPBdj88aD6oxdUxzta92rg66lQrO%2FinUIAW4XBNKrxhlPNu7vV742PcLzkrP48KZOWqOttS0IFO25T5%2BQVQGfYiHWLzAZ%2Bd8So6VBbROvmAWY3kmycAxRYI81XGGNFzDgq%2FUqHzQSn2DgsEsn%2FgJ0a1eagLnVB5gGZCnmurn%2F24VFpd%2BLrZLtcfw8ZPjTaBc2yp%2FP2dylLaUiIs1igk95Nx3OKEsZ7qTgPD1s5wZxRIZSz3%2FlZQ0wVz2%2FIl3zc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hUdyQxwTej4ytzNTwtm3sDpnH3sK68hndfkTZXxM%2FzRqa8oDbpedUhlvdC27XpKZGp9I7ah9usin2Mk2iY0Ij9nsNtFjRdA68zCrinkNt9b9Ki09iuLwvH19klW1y4RgndzibJZfjWdK6H89ty%2B%2Fh8%3D))
6+
7+
8+
# Overview
9+
10+
Scroll Canvas consists of the following components:
11+
- [**ProfileRegistry**](../src/profile/ProfileRegistry.sol): A contract for users to mint and query their Canvases.
12+
- [**Profile**](../src/profile/Profile.sol): Each Canvas is an instance of the profile smart contract.
13+
- [**EAS**](https://docs.attest.org/docs/welcome): A technology for issuing on-chain attestations.
14+
- [**ScrollBadgeResolver**](../src/resolver/ScrollBadgeResolver.sol): Each attestation passes through this resolver before the badge is minted. It enforces Canvas badge rules.
15+
- [**ScrollBadge**](../src/badge/ScrollBadge.sol): Each badge is a contract the conforms to a certain [interface](../src/interfaces/IScrollBadge.sol).
16+
17+
18+
## Profiles
19+
20+
Each user can mint a [`Profile`](../src/profile/Profile.sol) instance through [`ProfileRegistry`](../src/profile/ProfileRegistry.sol).
21+
This contract is the user's Canvas, and minting it is a prerequisite to collecting badges.
22+
Each wallet can only mint one profile.
23+
All profiles share the same implementation, upgradable by Scroll to enable new features.
24+
25+
The main use of profiles is personalization.
26+
Users can configure a username and an avatar.
27+
Users can also decide which badges they attach to their profile, and in which order they want to display them.
28+
29+
See the [Canvas Interaction Guide](./canvas-interaction-guide.md) section for more details.
30+
31+
32+
## ScrollBadge Schema and Resolver
33+
34+
We define a *Scroll badge* [EAS schema](https://docs.attest.org/docs/core--concepts/schemas):
35+
36+
```
37+
address badge
38+
bytes payload
39+
```
40+
41+
This schema is tied to `ScrollBadgeResolver`.
42+
Every time a Scroll badge attestation is created or revoked through EAS, `ScrollBadgeResolver` executes some checks and actions.
43+
After this, it forwards the call to the actual badge implementation.
44+
45+
You can find the schema UID in the [Deployments](./deployments.md) section.
46+
Browse the Scroll mainnet badge attestations on the [EAS Explorer](https://scroll.easscan.org/schema/view/0xd57de4f41c3d3cc855eadef68f98c0d4edd22d57161d96b7c06d2f4336cc3b49).
47+
48+
49+
## Badges
50+
51+
Each badge is an [EAS attestation](https://docs.attest.org/docs/core--concepts/attestations) that goes through the [`ScrollBadgeResolver`](../src/resolver/ScrollBadgeResolver.sol) contract and a badge contract.
52+
53+
Each badge type is a standalone contract that inherits from [`ScrollBadge`](../src/badge/ScrollBadge.sol).
54+
This badge contract can implement arbitrary logic attached to the attestation.
55+
Badges implement a `badgeTokenURI` interface, similar to `ERC721.tokenURI`.
56+
57+
Badges are minted to the user's wallet address.
58+
The user can express their personalization preferences (attach and reorder badges, choose a profile photo) through their Canvas [`Profile`](../src/profile/Profile.sol).
59+
60+
See the [Badges](./badges.md) section for more details, and [Badge Examples](./badge-examples.md) for Solidity code examples.
61+
62+
63+
## Explore the Documentation
64+
65+
Explore the following pages to learn more about different aspects of Canvas:
66+
- [Deployments](./deployments.md) lists the official Canvas contract addresses on Scroll mainnet and on the Scroll Sepolia testnet.
67+
- [Badges](./badges.md) introduces the basic requirements for badge contracts and lists resources for getting started as a badge developer.
68+
- [Badge Examples](./badge-examples.md) shows the process of developing custom badges by going through some common examples and use cases.
69+
- [Canvas Interaction Guide](./canvas-interaction-guide.md) lists common questions and examples for interacting with Canvas profiles and badges.
70+
- [Official Badges](./official-badges) contains addresses and documentation for some badges issued by Scroll.

0 commit comments

Comments
 (0)