Functions


claimScope

Claim a scope, with owner set to caller.

function claimScope(string calldata scopeName) external;

Parameters

NameTypeDescription
scopeNamestringName of the scope

transferScopeOwnership

Transfer ownership of a scope to a new entity.

Must be accepted by transferee (see acceptScopeTransfer)
function transferScopeOwnership(string calldata scopeName, address newOwner) external;

Parameters

NameTypeDescription
scopeNamestringName of the scope
newOwneraddressAddress of the new owner

cancelScopeTransfer

Cancel a pending scope transfer

function cancelScopeTransfer(string calldata scopeName) external;

Parameters

NameTypeDescription
scopeNamestringName of the scope

acceptScopeTransfer

Accept a scope transfer

function acceptScopeTransfer(string calldata scopeName) external;

Parameters

NameTypeDescription
scopeNamestringName of the scope

getScopeOwnerElect

Get owner-elect of a scope

function getScopeOwnerElect(string calldata scopeName) external view returns (address ownerElect);

Parameters

NameTypeDescription
scopeNamestringName of the scope

Returns

NameTypeDescription
ownerElectaddressAddress of the scope’s owner-elect

getScopeOwner

Get owner of a scope

function getScopeOwner(string calldata scopeName) external view returns (address owner);

Parameters

NameTypeDescription
scopeNamestringName of the scope

Returns

NameTypeDescription
owneraddressAddress of the scope owner

addOperator

Add an operator to a scope

function addOperator(string calldata scopeName, address op) external;

Parameters

NameTypeDescription
scopeNamestringName of the scope
opaddressAddress of the operator

removeOperator

Remove an operator from a scope

function removeOperator(string calldata scopeName, address op) external;

Parameters

NameTypeDescription
scopeNamestringName of the scope
opaddressAddress of the operator

setScopeRules

Set rules for a scope

function setScopeRules(string calldata scopeName, bool allowUserPatch, bool allowUserAssign, bool requireWhitelist)
    external;

Parameters

NameTypeDescription
scopeNamestringName of the scope
allowUserPatchboolBoolean indicating whether user patches are allowed
allowUserAssignboolBoolean indicating whether user assignments are allowed
requireWhitelistboolBoolean indicating whether whitelist is required

addWhitelist

Add an address to a scope’s whitelist

function addWhitelist(string calldata scopeName, address addr) external;

Parameters

NameTypeDescription
scopeNamestringName of the scope
addraddressAddress to be whitelisted

removeWhitelist

Remove an address from a scope’s whitelist

function removeWhitelist(string calldata scopeName, address addr) external;

Parameters

NameTypeDescription
scopeNamestringName of the scope
addraddressAddress to be removed from the whitelist

setMintConfiguration

Set the mint configuration for a given address

function setMintConfiguration(address addr, MintConfig memory config) external;

Parameters

NameTypeDescription
addraddressThe address for which to set the mint configuration, must be IPatchworkMintable
configMintConfigThe mint configuration to be set

getMintConfiguration

Get the mint configuration for a given address

function getMintConfiguration(address addr) external view returns (MintConfig memory config);

Parameters

NameTypeDescription
addraddressThe address for which to get the mint configuration

Returns

NameTypeDescription
configMintConfigThe mint configuration of the given address

setPatchFee

Set the patch fee for a given address

Must be banker of scope claimed by addr to call
function setPatchFee(address addr, uint256 baseFee) external;

Parameters

NameTypeDescription
addraddressThe address for which to set the patch fee
baseFeeuint256The patch fee to be set in wei

getPatchFee

Get the patch fee for a given address

function getPatchFee(address addr) external view returns (uint256 baseFee);

Parameters

NameTypeDescription
addraddressThe address for which to get the patch fee

Returns

NameTypeDescription
baseFeeuint256The patch fee of the given address in wei

setAssignFee

Set the assign fee for a given fragment address

Must be Banker of scope claimed by fragmentAddress to call.
function setAssignFee(address fragmentAddress, uint256 baseFee) external;

Parameters

NameTypeDescription
fragmentAddressaddressThe address of the fragment for which to set the fee
baseFeeuint256The assign fee to be set in wei

getAssignFee

Get the assign fee for a given fragment address

function getAssignFee(address fragmentAddress) external view returns (uint256 baseFee);

Parameters

NameTypeDescription
fragmentAddressaddressThe address of the fragment for which to get the fee

Returns

NameTypeDescription
baseFeeuint256The assign fee of the given fragment address in wei

addBanker

Add a banker to a given scope

Must be owner of scope to call.
function addBanker(string memory scopeName, address addr) external;

Parameters

NameTypeDescription
scopeNamestringThe name of the scope
addraddressThe address to be added as a banker

removeBanker

Remove a banker from a given scope

Must be owner of scope to call.
function removeBanker(string memory scopeName, address addr) external;

Parameters

NameTypeDescription
scopeNamestringThe name of the scope
addraddressThe address to be removed as a banker

withdraw

Withdraw an amount from the balance of a given scope

Must be owner of scope or Banker of scope to call.
Transfers amount to the msg.sender
function withdraw(string memory scopeName, uint256 amount) external;

Parameters

NameTypeDescription
scopeNamestringThe name of the scope
amountuint256The amount to be withdrawn in wei

balanceOf

Get the balance of a given scope

function balanceOf(string memory scopeName) external view returns (uint256 balance);

Parameters

NameTypeDescription
scopeNamestringThe name of the scope

Returns

NameTypeDescription
balanceuint256The balance of the given scope in wei

mint

Mint a new token

function mint(address to, address mintable, bytes calldata data) external payable returns (uint256 tokenId);

Parameters

NameTypeDescription
toaddressThe address to which the token will be minted
mintableaddressThe address of the IPatchworkMintable contract
databytesAdditional data to be passed to the minting

Returns

NameTypeDescription
tokenIduint256The ID of the minted token

mintBatch

Mint a batch of new tokens

function mintBatch(address to, address mintable, bytes calldata data, uint256 quantity)
    external
    payable
    returns (uint256[] memory tokenIds);

Parameters

NameTypeDescription
toaddressThe address to which the tokens will be minted
mintableaddressThe address of the IPatchworkMintable contract
databytesAdditional data to be passed to the minting
quantityuint256The number of tokens to mint

Returns

NameTypeDescription
tokenIdsuint256[]An array of the IDs of the minted tokens

proposeProtocolFeeConfig

Proposes a protocol fee configuration

Must be protocol owner or Banker to call.
Configuration does not apply until commitProtocolFeeConfig is called.
function proposeProtocolFeeConfig(FeeConfig memory config) external;

Parameters

NameTypeDescription
configFeeConfigThe protocol fee configuration to be set

commitProtocolFeeConfig

Commits the current proposed protocol fee configuration

Must be protocol owner or Banker to call.
May only be called after timelock has passed.
function commitProtocolFeeConfig() external;

getProtocolFeeConfig

Get the current protocol fee configuration

function getProtocolFeeConfig() external view returns (FeeConfig memory config);

Returns

NameTypeDescription
configFeeConfigThe current protocol fee configuration

proposeScopeFeeOverride

Proposes a protocol fee override for a scope

Must be protocol owner or Banker to call.
function proposeScopeFeeOverride(string memory scopeName, FeeConfigOverride memory config) external;

Parameters

NameTypeDescription
scopeNamestring
configFeeConfigOverrideThe protocol fee override configuration to be set

commitScopeFeeOverride

Commits the current proposed protocol fee override configuration for a scope

Must be protocol owner or Banker to call.
May only be called after timelock has passed.
function commitScopeFeeOverride(string memory scopeName) external;

getScopeFeeOverride

Get the protocol fee override for a scope

function getScopeFeeOverride(string memory scopeName) external view returns (FeeConfigOverride memory config);

Returns

NameTypeDescription
configFeeConfigOverrideThe current protocol fee override

addProtocolBanker

Add a banker to the protocol

Must be protocol owner to call.
function addProtocolBanker(address addr) external;

Parameters

NameTypeDescription
addraddressThe address to be added as a protocol banker

removeProtocolBanker

Remove a banker from the protocol

Must be protocol owner to call.
function removeProtocolBanker(address addr) external;

Parameters

NameTypeDescription
addraddressThe address to be removed as a protocol banker

withdrawFromProtocol

Withdraw a specified amount from the protocol balance

Must be protocol owner or Banker to call.
Transfers to the msg.sender
function withdrawFromProtocol(uint256 balance) external;

Parameters

NameTypeDescription
balanceuint256The amount to be withdrawn in wei

balanceOfProtocol

Get the current balance of the protocol

function balanceOfProtocol() external view returns (uint256 balance);

Returns

NameTypeDescription
balanceuint256The balance of the protocol in wei

patch

Create a new patch

function patch(address owner, address originalAddress, uint256 originalTokenId, address patchAddress)
    external
    payable
    returns (uint256 tokenId);

Parameters

NameTypeDescription
owneraddressThe owner of the patch
originalAddressaddressAddress of the original 721
originalTokenIduint256Token ID of the original 721
patchAddressaddressAddress of the IPatchworkPatch to mint

Returns

NameTypeDescription
tokenIduint256Token ID of the newly created patch

patchBurned

Callback for when a patch is burned

Can only be called from the patchAddress.
function patchBurned(address originalAddress, uint256 originalTokenId, address patchAddress) external;

Parameters

NameTypeDescription
originalAddressaddressAddress of the original 721
originalTokenIduint256Token ID of the original 721
patchAddressaddressAddress of the IPatchworkPatch to mint

patch1155

Create a new 1155 patch

function patch1155(
    address to,
    address originalAddress,
    uint256 originalTokenId,
    address originalAccount,
    address patchAddress
) external payable returns (uint256 tokenId);

Parameters

NameTypeDescription
toaddress
originalAddressaddressAddress of the original 1155
originalTokenIduint256Token ID of the original 1155
originalAccountaddressAddress of the account to patch
patchAddressaddressAddress of the IPatchworkPatch to mint

Returns

NameTypeDescription
tokenIduint256Token ID of the newly created patch

patchBurned1155

Callback for when an 1155 patch is burned

Can only be called from the patchAddress.
function patchBurned1155(
    address originalAddress,
    uint256 originalTokenId,
    address originalAccount,
    address patchAddress
) external;

Parameters

NameTypeDescription
originalAddressaddressAddress of the original 1155
originalTokenIduint256Token ID of the original 1155
originalAccountaddressAddress of the account to patch
patchAddressaddressAddress of the IPatchworkPatch to mint

patchAccount

Create a new account patch

function patchAccount(address owner, address originalAddress, address patchAddress)
    external
    payable
    returns (uint256 tokenId);

Parameters

NameTypeDescription
owneraddressThe owner of the patch
originalAddressaddressAddress of the original account
patchAddressaddressAddress of the IPatchworkPatch to mint

Returns

NameTypeDescription
tokenIduint256Token ID of the newly created patch

patchBurnedAccount

Callback for when an account patch is burned

Can only be called from the patchAddress.
function patchBurnedAccount(address originalAddress, address patchAddress) external;

Parameters

NameTypeDescription
originalAddressaddressAddress of the original 1155
patchAddressaddressAddress of the IPatchworkPatch to mint

assign

Assigns a relation to have an IPatchworkLiteRef form a LiteRef to a IPatchworkAssignable

function assign(address fragment, uint256 fragmentTokenId, address target, uint256 targetTokenId) external payable;

Parameters

NameTypeDescription
fragmentaddressThe IPatchworkAssignable address to assign
fragmentTokenIduint256The IPatchworkAssignable Token ID to assign
targetaddressThe IPatchworkLiteRef address to hold the reference to the fragment
targetTokenIduint256The IPatchworkLiteRef Token ID to hold the reference to the fragment

assign

Assigns a relation to have an IPatchworkLiteRef form a LiteRef to a IPatchworkAssignable

function assign(
    address fragment,
    uint256 fragmentTokenId,
    address target,
    uint256 targetTokenId,
    uint256 targetMetadataId
) external payable;

Parameters

NameTypeDescription
fragmentaddressThe IPatchworkAssignable address to assign
fragmentTokenIduint256The IPatchworkAssignable Token ID to assign
targetaddressThe IPatchworkLiteRef address to hold the reference to the fragment
targetTokenIduint256The IPatchworkLiteRef Token ID to hold the reference to the fragment
targetMetadataIduint256The metadata ID on the target to store the reference in

assignBatch

Assign multiple fragments to a target in batch

function assignBatch(address[] calldata fragments, uint256[] calldata tokenIds, address target, uint256 targetTokenId)
    external
    payable;

Parameters

NameTypeDescription
fragmentsaddress[]The array of addresses of the fragment IPatchworkAssignables
tokenIdsuint256[]The array of token IDs of the fragment IPatchworkAssignables
targetaddressThe address of the target IPatchworkLiteRef
targetTokenIduint256The token ID of the target IPatchworkLiteRef

assignBatch

Assign multiple fragments to a target in batch

function assignBatch(
    address[] calldata fragments,
    uint256[] calldata tokenIds,
    address target,
    uint256 targetTokenId,
    uint256 targetMetadataId
) external payable;

Parameters

NameTypeDescription
fragmentsaddress[]The array of addresses of the fragment IPatchworkAssignables
tokenIdsuint256[]The array of token IDs of the fragment IPatchworkAssignables
targetaddressThe address of the target IPatchworkLiteRef
targetTokenIduint256The token ID of the target IPatchworkLiteRef
targetMetadataIduint256The metadata ID on the target to store the references in

unassignSingle

Unassign a fragment from a target

Reverts if Fragment is not an IPatchworkSingleAssignable.
function unassignSingle(address fragment, uint256 fragmentTokenId) external;

Parameters

NameTypeDescription
fragmentaddressThe IPatchworkSingleAssignable address of the fragment
fragmentTokenIduint256The IPatchworkSingleAssignable token ID of the fragment

unassignSingle

Unassign a fragment from a target

Reverts if Fragment is not an IPatchworkSingleAssignable.
function unassignSingle(address fragment, uint256 fragmentTokenId, uint256 targetMetadataId) external;

Parameters

NameTypeDescription
fragmentaddressThe IPatchworkSingleAssignable address of the fragment
fragmentTokenIduint256The IPatchworkSingleAssignable token ID of the fragment
targetMetadataIduint256The metadata ID on the target to unassign from

unassignMulti

Unassigns a multi relation

Reverts if Fragment is not an IPatchworkMultiAssignable.
function unassignMulti(address fragment, uint256 fragmentTokenId, address target, uint256 targetTokenId) external;

Parameters

NameTypeDescription
fragmentaddressThe IPatchworMultiAssignable address to unassign
fragmentTokenIduint256The IPatchworkMultiAssignable Token ID to unassign
targetaddressThe IPatchworkLiteRef address which holds a reference to the fragment
targetTokenIduint256The IPatchworkLiteRef Token ID which holds a reference to the fragment

unassignMulti

Unassigns a multi relation

Reverts if Fragment is not an IPatchworkMultiAssignable.
function unassignMulti(
    address fragment,
    uint256 fragmentTokenId,
    address target,
    uint256 targetTokenId,
    uint256 targetMetadataId
) external;

Parameters

NameTypeDescription
fragmentaddressThe IPatchworMultiAssignable address to unassign
fragmentTokenIduint256The IPatchworkMultiAssignable Token ID to unassign
targetaddressThe IPatchworkLiteRef address which holds a reference to the fragment
targetTokenIduint256The IPatchworkLiteRef Token ID which holds a reference to the fragment
targetMetadataIduint256The metadata ID on the target to unassign from

unassign

Unassigns a relation (single or multi)

function unassign(address fragment, uint256 fragmentTokenId, address target, uint256 targetTokenId) external;

Parameters

NameTypeDescription
fragmentaddressThe IPatchworkAssignable address to unassign
fragmentTokenIduint256The IPatchworkAssignable Token ID to unassign
targetaddressThe IPatchworkLiteRef address which holds a reference to the fragment
targetTokenIduint256The IPatchworkLiteRef Token ID which holds a reference to the fragment

unassign

Unassigns a relation (single or multi)

function unassign(
    address fragment,
    uint256 fragmentTokenId,
    address target,
    uint256 targetTokenId,
    uint256 targetMetadataId
) external;

Parameters

NameTypeDescription
fragmentaddressThe IPatchworkAssignable address to unassign
fragmentTokenIduint256The IPatchworkAssignable Token ID to unassign
targetaddressThe IPatchworkLiteRef address which holds a reference to the fragment
targetTokenIduint256The IPatchworkLiteRef Token ID which holds a reference to the fragment
targetMetadataIduint256The metadata ID on the target to unassign from

applyTransfer

Apply transfer rules and actions of a specific token from one address to another

function applyTransfer(address from, address to, uint256 tokenId) external;

Parameters

NameTypeDescription
fromaddressThe address of the sender
toaddressThe address of the receiver
tokenIduint256The ID of the token to be transferred

updateOwnershipTree

Update the ownership tree of a specific Patchwork 721

function updateOwnershipTree(address addr, uint256 tokenId) external;

Parameters

NameTypeDescription
addraddressThe address of the Patchwork 721
tokenIduint256The ID of the token whose ownership tree needs to be updated

proposeAssignerDelegate

Propose an assigner delegate module

function proposeAssignerDelegate(address addr) external;

Parameters

NameTypeDescription
addraddressThe address of the new delegate module

commitAssignerDelegate

Commit the proposed assigner delegate module

Must be called at a later datetime than timelock.
function commitAssignerDelegate() external;

Events


Assign

Emitted when a fragment is assigned

event Assign(
    address indexed owner,
    address fragmentAddress,
    uint256 fragmentTokenId,
    address indexed targetAddress,
    uint256 indexed targetTokenId,
    uint256 scopeFee,
    uint256 protocolFee
);

Parameters

NameTypeDescription
owneraddressThe owner of the target and fragment
fragmentAddressaddressThe address of the fragment’s contract
fragmentTokenIduint256The tokenId of the fragment
targetAddressaddressThe address of the target’s contract
targetTokenIduint256The tokenId of the target
scopeFeeuint256The fee collected to the scope
protocolFeeuint256The fee collected to the protocol

Unassign

Emitted when a fragment is unassigned

event Unassign(
    address indexed owner,
    address fragmentAddress,
    uint256 fragmentTokenId,
    address indexed targetAddress,
    uint256 indexed targetTokenId
);

Parameters

NameTypeDescription
owneraddressThe owner of the fragment
fragmentAddressaddressThe address of the fragment’s contract
fragmentTokenIduint256The tokenId of the fragment
targetAddressaddressThe address of the target’s contract
targetTokenIduint256The tokenId of the target

Patch

Emitted when a patch is minted

event Patch(
    address indexed owner,
    address originalAddress,
    uint256 originalTokenId,
    address indexed patchAddress,
    uint256 indexed patchTokenId,
    uint256 scopeFee,
    uint256 protocolFee
);

Parameters

NameTypeDescription
owneraddressThe owner of the patch
originalAddressaddressThe address of the original 721’s contract
originalTokenIduint256The tokenId of the original 721
patchAddressaddressThe address of the patch’s contract
patchTokenIduint256The tokenId of the patch
scopeFeeuint256The fee collected to the scope
protocolFeeuint256The fee collected to the protocol

ERC1155Patch

Emitted when a patch is minted

event ERC1155Patch(
    address indexed owner,
    address originalAddress,
    uint256 originalTokenId,
    address originalAccount,
    address indexed patchAddress,
    uint256 indexed patchTokenId,
    uint256 scopeFee,
    uint256 protocolFee
);

Parameters

NameTypeDescription
owneraddressThe owner of the patch
originalAddressaddressThe address of the original 1155’s contract
originalTokenIduint256The tokenId of the original 1155
originalAccountaddressThe address of the original 1155’s account
patchAddressaddressThe address of the patch’s contract
patchTokenIduint256The tokenId of the patch
scopeFeeuint256The fee collected to the scope
protocolFeeuint256The fee collected to the protocol

AccountPatch

Emitted when an account patch is minted

event AccountPatch(
    address indexed owner,
    address originalAddress,
    address indexed patchAddress,
    uint256 indexed patchTokenId,
    uint256 scopeFee,
    uint256 protocolFee
);

Parameters

NameTypeDescription
owneraddressThe owner of the patch
originalAddressaddressThe address of the original account
patchAddressaddressThe address of the patch’s contract
patchTokenIduint256The tokenId of the patch
scopeFeeuint256The fee collected to the scope
protocolFeeuint256The fee collected to the protocol

ScopeClaim

Emitted when a new scope is claimed

event ScopeClaim(string scopeName, address indexed owner);

Parameters

NameTypeDescription
scopeNamestringThe name of the claimed scope
owneraddressThe owner of the scope

ScopeTransferElect

Emitted when a scope has elected a new owner to transfer to

event ScopeTransferElect(string scopeName, address indexed from, address indexed to);

Parameters

NameTypeDescription
scopeNamestringThe name of the transferred scope
fromaddressThe owner of the scope
toaddressThe owner-elect of the scope

ScopeTransferCancel

Emitted when a scope transfer is canceled

event ScopeTransferCancel(string scopeName, address indexed from, address indexed to);

Parameters

NameTypeDescription
scopeNamestringThe name of the transferred scope
fromaddressThe owner of the scope
toaddressThe owner-elect of the scope

ScopeTransfer

Emitted when a scope is transferred

event ScopeTransfer(string scopeName, address indexed from, address indexed to);

Parameters

NameTypeDescription
scopeNamestringThe name of the transferred scope
fromaddressThe address transferring the scope
toaddressThe recipient of the scope

ScopeAddOperator

Emitted when a scope has an operator added

event ScopeAddOperator(string scopeName, address indexed actor, address indexed operator);

Parameters

NameTypeDescription
scopeNamestringThe name of the scope
actoraddressThe address responsible for the action
operatoraddressThe new operator’s address

ScopeRemoveOperator

Emitted when a scope has an operator removed

event ScopeRemoveOperator(string scopeName, address indexed actor, address indexed operator);

Parameters

NameTypeDescription
scopeNamestringThe name of the scope
actoraddressThe address responsible for the action
operatoraddressThe operator’s address being removed

ScopeRuleChange

Emitted when a scope’s rules are changed

event ScopeRuleChange(
    string scopeName, address indexed actor, bool allowUserPatch, bool allowUserAssign, bool requireWhitelist
);

Parameters

NameTypeDescription
scopeNamestringThe name of the scope
actoraddressThe address responsible for the action
allowUserPatchboolIndicates whether user patches are allowed
allowUserAssignboolIndicates whether user assignments are allowed
requireWhitelistboolIndicates whether a whitelist is required

ScopeWhitelistAdd

Emitted when a scope has an address added to the whitelist

event ScopeWhitelistAdd(string scopeName, address indexed actor, address indexed addr);

Parameters

NameTypeDescription
scopeNamestringThe name of the scope
actoraddressThe address responsible for the action
addraddressThe address being added to the whitelist

ScopeWhitelistRemove

Emitted when a scope has an address removed from the whitelist

event ScopeWhitelistRemove(string scopeName, address indexed actor, address indexed addr);

Parameters

NameTypeDescription
scopeNamestringThe name of the scope
actoraddressThe address responsible for the action
addraddressThe address being removed from the whitelist

MintConfigure

Emitted when a mint is configured

event MintConfigure(string scopeName, address indexed actor, address indexed mintable, MintConfig config);

Parameters

NameTypeDescription
scopeNamestringThe name of the scope
actoraddress
mintableaddressThe address of the IPatchworkMintable
configMintConfigThe mint configuration

ScopeBankerAdd

Emitted when a banker is added to a scope

event ScopeBankerAdd(string scopeName, address indexed actor, address indexed banker);

Parameters

NameTypeDescription
scopeNamestringThe name of the scope
actoraddressThe address responsible for the action
bankeraddressThe banker that was added

ScopeBankerRemove

Emitted when a banker is removed from a scope

event ScopeBankerRemove(string scopeName, address indexed actor, address indexed banker);

Parameters

NameTypeDescription
scopeNamestringThe name of the scope
actoraddressThe address responsible for the action
bankeraddressThe banker that was removed

ScopeWithdraw

Emitted when a withdrawl is made from a scope

event ScopeWithdraw(string scopeName, address indexed actor, uint256 amount);

Parameters

NameTypeDescription
scopeNamestringThe name of the scope
actoraddressThe address responsible for the action
amountuint256The amount withdrawn

ProtocolBankerAdd

Emitted when a banker is added to the protocol

event ProtocolBankerAdd(address indexed actor, address indexed banker);

Parameters

NameTypeDescription
actoraddressThe address responsible for the action
bankeraddressThe banker that was added

ProtocolBankerRemove

Emitted when a banker is removed from the protocol

event ProtocolBankerRemove(address indexed actor, address indexed banker);

Parameters

NameTypeDescription
actoraddressThe address responsible for the action
bankeraddressThe banker that was removed

ProtocolWithdraw

Emitted when a withdrawl is made from the protocol

event ProtocolWithdraw(address indexed actor, uint256 amount);

Parameters

NameTypeDescription
actoraddressThe address responsible for the action
amountuint256The amount withdrawn

Mint

Emitted on mint

event Mint(
    address indexed actor,
    string scopeName,
    address indexed to,
    address indexed mintable,
    bytes data,
    uint256 scopeFee,
    uint256 protocolFee
);

Parameters

NameTypeDescription
actoraddressThe address responsible for the action
scopeNamestringThe scope of the IPatchworkMintable
toaddressThe receipient of the mint
mintableaddressThe IPatchworkMintable minted
databytesThe data used to mint
scopeFeeuint256The fee collected to the scope
protocolFeeuint256The fee collected to the protocol

MintBatch

Emitted on batch mint

event MintBatch(
    address indexed actor,
    string scopeName,
    address indexed to,
    address indexed mintable,
    bytes data,
    uint256 quantity,
    uint256 scopeFee,
    uint256 protocolFee
);

Parameters

NameTypeDescription
actoraddressThe address responsible for the action
scopeNamestringThe scope of the IPatchworkMintable
toaddressThe receipient of the mint
mintableaddressThe IPatchworkMintable minted
databytesThe data used to mint
quantityuint256The quantity minted
scopeFeeuint256The fee collected to the scope
protocolFeeuint256The fee collected to the protocol

ProtocolFeeConfigPropose

Emitted on protocol fee config proposed

event ProtocolFeeConfigPropose(FeeConfig config);

Parameters

NameTypeDescription
configFeeConfigThe fee configuration

ProtocolFeeConfigCommit

Emitted on protocol fee config committed

event ProtocolFeeConfigCommit(FeeConfig config);

Parameters

NameTypeDescription
configFeeConfigThe fee configuration

ScopeFeeOverridePropose

Emitted on scope fee config override proposed

event ScopeFeeOverridePropose(string scopeName, FeeConfigOverride config);

Parameters

NameTypeDescription
scopeNamestringThe scope
configFeeConfigOverrideThe fee configuration

ScopeFeeOverrideCommit

Emitted on scope fee config override committed

event ScopeFeeOverrideCommit(string scopeName, FeeConfigOverride config);

Parameters

NameTypeDescription
scopeNamestringThe scope
configFeeConfigOverrideThe fee configuration

PatchFeeChange

Emitted on patch fee change

event PatchFeeChange(string scopeName, address indexed addr, uint256 fee);

Parameters

NameTypeDescription
scopeNamestringThe scope of the patch
addraddressThe address of the patch
feeuint256The new fee

AssignFeeChange

Emitted on assign fee change

event AssignFeeChange(string scopeName, address indexed addr, uint256 fee);

Parameters

NameTypeDescription
scopeNamestringThe scope of the assignable
addraddressThe address of the assignable
feeuint256The new fee

AssignerDelegatePropose

Emitted on assigner delegate propose

event AssignerDelegatePropose(address indexed addr);

Parameters

NameTypeDescription
addraddressThe address of the delegate

AssignerDelegateCommit

Emitted on assigner delegate commit

event AssignerDelegateCommit(address indexed addr);

Parameters

NameTypeDescription
addraddressThe address of the delegate

Errors

NotAuthorized

The address is not authorized to perform this action

error NotAuthorized(address addr);

Parameters

NameTypeDescription
addraddressThe address attempting to perform the action

ScopeExists

The scope with the provided name already exists

error ScopeExists(string scopeName);

Parameters

NameTypeDescription
scopeNamestringName of the scope

ScopeDoesNotExist

The scope with the provided name does not exist

error ScopeDoesNotExist(string scopeName);

Parameters

NameTypeDescription
scopeNamestringName of the scope

ScopeTransferNotAllowed

Transfer of the scope to the provided address is not allowed

error ScopeTransferNotAllowed(address to);

Parameters

NameTypeDescription
toaddressAddress not allowed for scope transfer

Frozen

The token with the provided ID at the given address is frozen

error Frozen(address addr, uint256 tokenId);

Parameters

NameTypeDescription
addraddressAddress of the token owner
tokenIduint256ID of the frozen token

Locked

The token with the provided ID at the given address is locked

error Locked(address addr, uint256 tokenId);

Parameters

NameTypeDescription
addraddressAddress of the token owner
tokenIduint256ID of the locked token

NotWhitelisted

The address is not whitelisted for the given scope

error NotWhitelisted(string scopeName, address addr);

Parameters

NameTypeDescription
scopeNamestringName of the scope
addraddressAddress that isn’t whitelisted

AccountAlreadyPatched

The address at the given address has already been patched

error AccountAlreadyPatched(address addr, address patchAddress);

Parameters

NameTypeDescription
addraddressThe address that was patched
patchAddressaddressAddress of the patch applied

AlreadyPatched

The token at the given address has already been patched

error AlreadyPatched(address addr, uint256 tokenId, address patchAddress);

Parameters

NameTypeDescription
addraddressAddress of the original 721
tokenIduint256ID of the patched token
patchAddressaddressAddress of the patch applied

ERC1155AlreadyPatched

The ERC1155 path has already been patched

error ERC1155AlreadyPatched(address addr, uint256 tokenId, address account, address patchAddress);

Parameters

NameTypeDescription
addraddressAddress of the 1155
tokenIduint256ID of the patched token
accountaddressThe account patched
patchAddressaddressAddress of the patch applied

BadInputLengths

The provided input lengths are not compatible or valid

for any multi array inputs, they must be the same length

error BadInputLengths();

FragmentUnregistered

The fragment at the given address is unregistered

error FragmentUnregistered(address addr);

Parameters

NameTypeDescription
addraddressAddress of the unregistered fragment

FragmentRedacted

The fragment at the given address has been redacted

error FragmentRedacted(address addr);

Parameters

NameTypeDescription
addraddressAddress of the redacted fragment

FragmentAlreadyAssigned

The fragment with the provided ID at the given address is already assigned

error FragmentAlreadyAssigned(address addr, uint256 tokenId);

Parameters

NameTypeDescription
addraddressAddress of the fragment
tokenIduint256ID of the assigned fragment

RefNotFound

The reference was not found for the given fragment and target

error RefNotFound(address target, address fragment, uint256 tokenId);

Parameters

NameTypeDescription
targetaddressAddress of the target token
fragmentaddressAddress of the fragment
tokenIduint256ID of the fragment

FragmentNotAssigned

The fragment with the provided ID at the given address is not assigned

error FragmentNotAssigned(address addr, uint256 tokenId);

Parameters

NameTypeDescription
addraddressAddress of the fragment
tokenIduint256ID of the fragment

FragmentNotAssignedToTarget

The fragment with the provided ID at the given address is not assigned to the target

error FragmentNotAssignedToTarget(address addr, uint256 tokenId, address targetAddress, uint256 targetTokenId);

Parameters

NameTypeDescription
addraddressAddress of the fragment
tokenIduint256ID of the fragment
targetAddressaddressAddress of the target
targetTokenIduint256ID of the target

FragmentAlreadyRegistered

The fragment at the given address is already registered

error FragmentAlreadyRegistered(address addr);

Parameters

NameTypeDescription
addraddressAddress of the registered fragment

OutOfIDs

Ran out of available IDs for allocation

Max 255 IDs per target.
error OutOfIDs();

UnsupportedTokenId

The provided token ID is unsupported

TokenIds may only be 56 bits long.
error UnsupportedTokenId(uint256 tokenId);

Parameters

NameTypeDescription
tokenIduint256The unsupported token ID

CannotLockSoulboundPatch

Cannot lock the soulbound patch at the given address

error CannotLockSoulboundPatch(address addr);

Parameters

NameTypeDescription
addraddressAddress of the soulbound patch

NotFrozen

The token with the provided ID at the given address is not frozen

error NotFrozen(address addr, uint256 tokenId);

Parameters

NameTypeDescription
addraddressAddress of the token owner
tokenIduint256ID of the token

IncorrectNonce

The nonce for the token with the provided ID at the given address is incorrect

It may be incorrect or a newer nonce may be present.
error IncorrectNonce(address addr, uint256 tokenId, uint256 nonce);

Parameters

NameTypeDescription
addraddressAddress of the token owner
tokenIduint256ID of the token
nonceuint256The incorrect nonce

SelfAssignmentNotAllowed

Self assignment of the token with the provided ID at the given address is not allowed

error SelfAssignmentNotAllowed(address addr, uint256 tokenId);

Parameters

NameTypeDescription
addraddressAddress of the token owner
tokenIduint256ID of the token

TransferNotAllowed

Transfer of the token with the provided ID at the given address is not allowed

error TransferNotAllowed(address addr, uint256 tokenId);

Parameters

NameTypeDescription
addraddressAddress of the token owner
tokenIduint256ID of the token

TransferBlockedByAssignment

Transfer of the token with the provided ID at the given address is blocked by an assignment

error TransferBlockedByAssignment(address addr, uint256 tokenId);

Parameters

NameTypeDescription
addraddressAddress of the token owner
tokenIduint256ID of the token

MintNotAllowed

A rule is blocking the mint to this owner address

error MintNotAllowed(address addr);

Parameters

NameTypeDescription
addraddressAddress of the token owner

NotPatchworkAssignable

The token at the given address is not IPatchworkAssignable

error NotPatchworkAssignable(address addr);

Parameters

NameTypeDescription
addraddressAddress of the non-assignable token

DataIntegrityError

A data integrity error has been detected

addr+tokenId is expected where addr2+tokenId2 is present.
error DataIntegrityError(address addr, uint256 tokenId, address addr2, uint256 tokenId2);

Parameters

NameTypeDescription
addraddressAddress of the first token
tokenIduint256ID of the first token
addr2addressAddress of the second token
tokenId2uint256ID of the second token

InsufficientFunds

The available balance does not satisfy the amount

error InsufficientFunds();

IncorrectFeeAmount

The supplied fee is not the corret amount

error IncorrectFeeAmount();

MintNotActive

Minting is not active for this address

error MintNotActive();

FailedToSend

The value could not be sent

error FailedToSend();

UnsupportedContract

The contract is not supported

error UnsupportedContract();

UnsupportedOperation

The operation is not supported

error UnsupportedOperation();

NoProposedFeeSet

No proposed fee is set

error NoProposedFeeSet();

TimelockNotElapsed

Timelock has not elapsed

error TimelockNotElapsed();

InvalidFeeValue

Invalid fee value

error InvalidFeeValue();

NoDelegateProposed

No delegate proposed

error NoDelegateProposed();

Structs


FeeConfig

Fee Configuration

struct FeeConfig {
    uint256 mintBp;
    uint256 patchBp;
    uint256 assignBp;
}

FeeConfigOverride

Fee Configuration Override

struct FeeConfigOverride {
    uint256 mintBp;
    uint256 patchBp;
    uint256 assignBp;
    bool active;
}

ProposedFeeConfig

Proposal to change a fee configuration for either protocol or scope override

struct ProposedFeeConfig {
    FeeConfig config;
    uint256 timestamp;
    bool active;
}

MintConfig

Mint configuration

struct MintConfig {
    uint256 flatFee;
    bool active;
}

ProposedAssignerDelegate

Proposed assigner delegate

struct ProposedAssignerDelegate {
    uint256 timestamp;
    address addr;
}

Scope

Represents a defined scope within the system

Contains details about the scope ownership, permissions, and mappings for references and assignments.
struct Scope {
    address owner;
    address ownerElect;
    bool allowUserPatch;
    bool allowUserAssign;
    bool requireWhitelist;
    mapping(address => bool) operators;
    mapping(address => bool) whitelist;
    mapping(address => MintConfig) mintConfigurations;
    mapping(address => uint256) patchFees;
    mapping(address => uint256) assignFees;
    uint256 balance;
    mapping(address => bool) bankers;
}