Scopes
Scopes are application-level Patchwork namespaces for configuring settings and permissions or your app.
When creating a new application, the first thing you’ll do is create a Patchwork Scope for your app. You’ll then define within that scope which contracts can mint, assign NFTs, and modify metadata. Scopes are free to claim on a first-come-first-serve basis, and can be transferred to other parties.
Scope creation
Scopes are claimed using PatchworkProtocol:claimScope()
. Typically you’ll call this in your contracts’ deploy script, but it can be manually called if desired.
For example, this Forge deploy script claims the Scope fooscope123
.
Scope permissions
Operators
Scope Operators are added and removed by the scope owner.
Operators may perform the following functions:
- Add/Remove bankers
- Add/Remove whitelisted addresses
- Configure minting
- Set patch and assignment fees
It is common to have an EOA or a contract act as an operator. Contracts as operators are often used to have the contract perform logic and run assignment routines.
Bankers
Scope Bankers are added and removed by scope owners or operators.
Bankers may perform the following functions:
- Withdraw fees collected by the protocol
Whitelist
Whitelisting is how scopes prevent spoofing. Whitelisting can be disabled for a scope for cases where spoofing doesn’t matter, but by defualt an address must be whitelisted in order to claim it is part of the scope.
Adding contracts to your Scope
Registering a contract to your Scope is a 2-part process. The first part is declaring the Scope in your contract’s Patchwork721 constructor, where the first param is the name of your claimed Scope.
The second part is granting your deployed contract the relevant Scope permissions. This is typically done in your contract’s deploy script.
Adding and removing operators
Transfering Scopes
Scope transfers must first elect a new owner by calling transferScopeOwner
from the current owner’s address, then the new owner must call acceptScopeTransfer
for the transfer to execute.
To cancel a transfer before the scope has been accepted, call cancelScopeTransfer