SoundCreatorV1
contracts/core/SoundCreatorV1.sol
(opens in a new tab)
A factory that allows for a single transaction setup that:
- Deploys a minimal proxy of SoundEdition to a deterministic address with a
salt
, and calls itsinitialize
function with the providedinitData
calldata. - Authorize one or more minter contracts on SoundEdition.
- Configure one or more minter contracts to mint on SoundEdition.
These three steps are perfomed in the createSoundAndMints
function.
Inherits:
Write Functions
createSoundAndMints
function createSoundAndMints(
bytes32 salt,
bytes calldata initData,
address[] calldata contracts,
bytes[] calldata data
) external returns (address soundEdition, bytes[] memory results)
Creates a Sound Edition proxy, initializes it, and creates mint configurations on a given set of minter addresses.
Calling conditions:
- The lengths of
contracts
anddata
must be the same. - All of the
contracts
must exist, and all ofdata
must be properly encoded to be valid calldata for each of the the contracts.
Params: | |
---|---|
salt | The salt used for the CREATE2 to deploy the clone to a deterministic address. |
initData | The calldata to initialize SoundEdition via abi.encodeWithSelector . |
contracts | A list of contracts to call. |
data | A list of calldata created via abi.encodeWithSelector This must contain the same number of entries as contracts . |
Returns: | |
---|---|
soundEdition | Returns the address of the created contract. |
results | The results of calling the contracts. Use abi.decode to decode them. |
setEditionImplementation
function setEditionImplementation(address newImplementation) external
Changes the SoundEdition implementation contract address.
Calling conditions:
- The caller must be the owner of the contract.
Params: | |
---|---|
newImplementation | The new implementation address to be set. |
Read-only Functions
soundEditionImplementation
function soundEditionImplementation() external returns (address)
The address of the sound edition implementation.
soundEditionAddress
function soundEditionAddress(
address by,
bytes32 salt
) external view returns (address addr, bool exists)
Returns the deterministic address for the sound edition clone.
Params: | |
---|---|
by | The caller of the createSoundAndMints function. |
salt | The salt, generated on the client side. |
Returns: | |
---|---|
addr | The computed address. |
exists | Whether the contract exists. |
Events
SoundEditionCreated
event SoundEditionCreated(
address indexed soundEdition,
address indexed deployer,
bytes initData,
address[] contracts,
bytes[] data,
bytes[] results
)
Emitted when an edition is created.
Params: | |
---|---|
soundEdition | The address of the edition. |
deployer | The address of the deployer. |
initData | The calldata to initialize SoundEdition via abi.encodeWithSelector . |
contracts | The list of contracts called. |
data | The list of calldata created via abi.encodeWithSelector |
results | The results of calling the contracts. Use abi.decode to decode them. |
SoundEditionImplementationSet
event SoundEditionImplementationSet(address newImplementation)
Emitted when the edition implementation address is set.
Params: | |
---|---|
newImplementation | The new implementation address to be set. |
Errors
ImplementationAddressCantBeZero
error ImplementationAddressCantBeZero()
Thrown if the implementation address is zero.
ArrayLengthsMismatch
error ArrayLengthsMismatch()
Thrown if the lengths of the input arrays are not equal.