Creating a contract
All 1155 contracts created from Zora are deployed by calling a central factory contract. When calling this factory it will deploy a minimal proxy contract that is upgradeable. All upgrades are opt-in and must be done manually on a per contract basis by the user.
- Factory Contract Code
- Deployed Addresses
- Factory Proxy Address
0x777777C338d93e2C7adf08D102d45CA7CC4Ed021
on all networks
Calling the Factory Contract
The createContract
function on the factory is responsible for deploying a new 1155 contract.
The setupActions
parameter allows for multiple actions to be called when deploying the contract.
Such as creating a token and sale in the same transaction as deploying the contract.
contractURI
: The URI for the contract metadataname
: The name of the contractdefaultRoyaltyConfiguration
: The default royalty configuration for the contractdefaultAdmin
: The default admin for the contractsetupActions
: The actions to perform on the new contract upon initialization (optional)
function createContract(
string calldata newContractURI,
string calldata name,
ICreatorRoyaltiesControl.RoyaltyConfiguration memory defaultRoyaltyConfiguration,
address payable defaultAdmin,
bytes[] calldata setupActions
) external returns (address)
To configure a Splits contract as the recipient address, follow this guide.
Contract URI
The Contract URI contains contract specific details. This metadata is stored in a JSON file on IPFS.
The uri is retrieved via the contractURI()
call on the contract.
Refer to the SDK guide on building contract metadata for schematic info and some sample code.
Setup Actions
An optional param that is encoded function data that can be passed in and can call a separate function within the contract. This allows creating a token and setting permissions in the same transaction of creating the contract. Actions that can be called:
- Creating a token
- Setting the salesConfig
- Granting permissions/minter role
- Admin minting tokens