Sound Protocol
Core Contracts
SoundCreatorV1

SoundCreatorV1

contracts/core/SoundCreatorV1.sol

A factory that allows for a single transaction setup that:

  1. Deploys a minimal proxy of SoundEdition to a deterministic address with a salt, and calls its initialize function with the provided initData calldata.
  2. Authorize one or more minter contracts on SoundEdition.
  3. Configure one or more minter contracts to mint on SoundEdition.

These three steps are performed 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 and data must be the same.
  • All of the contracts must exist, and all of data must be properly encoded to be valid calldata for each of the the contracts.
Params:
saltThe salt used for the CREATE2 to deploy the clone to a deterministic address.
initDataThe calldata to initialize SoundEdition via abi.encodeWithSelector.
contractsA list of contracts to call.
dataA list of calldata created via abi.encodeWithSelector This must contain the same number of entries as contracts.
Returns:
soundEditionReturns the address of the created contract.
resultsThe 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:
newImplementationThe 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:
byThe caller of the createSoundAndMints function.
saltThe salt, generated on the client side.
Returns:
addrThe computed address.
existsWhether 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:
soundEditionThe address of the edition.
deployerThe address of the deployer.
initDataThe calldata to initialize SoundEdition via abi.encodeWithSelector.
contractsThe list of contracts called.
dataThe list of calldata created via abi.encodeWithSelector
resultsThe 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:
newImplementationThe 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.