Skip to content

scroll-tech/canvas-contracts

Repository files navigation

Scroll Canvas Contracts

Components overview

(Editable link)

ScrollBadge Schema and Resolver

We define a Scroll badge EAS schema:

address badge
bytes   payload

This schema is tied to ScrollBadgeResolver. Every time a Scroll badge attestation is created or revoked, ScrollBadgeResolver executes some checks. After that, it forwards the call to the actual badge implementation.

Profiles

Each user can create a Profile contract, minted through the ProfileRegistry contract. Each wallet can mint only one profile. All profiles share the same implementation, upgradable by Scroll to enable new features.

The main use of profiles is personalization. Users can configure a username and an avatar. Users can also decide which badges they atach to their profile, and in which order.

Badges

Each badge is an EAS attestation that goes through the ScrollBadgeResolver contract and a badge contract.

Each badge type is a standalone contract, inheriting from ScrollBadge. This badge contract can implement arbitrary logic attached to the attestation. Badges implement a badgeTokenURI interface, similar to ERC721.tokenURI.

Badges are minted to the user's wallet address. The user can express their personalization preferences (attach and order badges, choose a profile photo) through their Profile.

See badges for details.

Extensions

This repo contains some useful extensions:

  • ScrollBadgeAccessControl restricts who can create and revoke this badge.
  • ScrollBadgeCustomPayload adds custom payload support to the badge.
  • ScrollBadgeDefaultURI sets a default badge token URI.
  • ScrollBadgeEligibilityCheck adds a standard on-chain eligibility check interface.
  • ScrollBadgeNoExpiry disables expiration for the badge.
  • ScrollBadgeNonRevocable disables revocation for the badge.
  • ScrollBadgeSBT attaches an SBT token to each badge attestation.
  • ScrollBadgeSelfAttest ensures that only the recipient of the badge can create the badge.
  • ScrollBadgeSingleton ensures that each user can only have at most one of the badge.

Examples

This repo also contains some examples:

  • ScrollBadgeSimple is a simple badge with fixed metadata.
  • ScrollBadgePermissionless is a permissionless badge that anyone can mint to themselves.
  • ScrollBadgeLevels is an SBT badge that stores a level in its payload and renders different images based on this level.
  • ScrollBadgeTokenOwner is a badge that is tied to the ownership of a Scroll Origins NFT.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •