Skip to content

Commit

Permalink
refactor: add helper to read uups implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
kulkarohan committed Sep 27, 2023
1 parent 16c839b commit 7b92825
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
18 changes: 11 additions & 7 deletions src/factory/ZoraCreator1155FactoryImpl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@ import {ContractVersionBase} from "../version/ContractVersionBase.sol";
/// @title ZoraCreator1155FactoryImpl
/// @notice Factory contract for creating new ZoraCreator1155 contracts
contract ZoraCreator1155FactoryImpl is IZoraCreator1155Factory, ContractVersionBase, FactoryManagedUpgradeGate, UUPSUpgradeable, IContractMetadata {
IZoraCreator1155 public immutable implementation;

IZoraCreator1155 public immutable zora1155impl;
IMinter1155 public immutable merkleMinter;
IMinter1155 public immutable fixedPriceMinter;
IMinter1155 public immutable redeemMinterFactory;

constructor(IZoraCreator1155 _implementation, IMinter1155 _merkleMinter, IMinter1155 _fixedPriceMinter, IMinter1155 _redeemMinterFactory) initializer {
implementation = _implementation;
if (address(implementation) == address(0)) {
constructor(IZoraCreator1155 _zora1155impl, IMinter1155 _merkleMinter, IMinter1155 _fixedPriceMinter, IMinter1155 _redeemMinterFactory) initializer {
if (address(_zora1155impl) == address(0)) {
revert Constructor_ImplCannotBeZero();
}
zora1155impl = _zora1155impl;
merkleMinter = _merkleMinter;
fixedPriceMinter = _fixedPriceMinter;
redeemMinterFactory = _redeemMinterFactory;
Expand Down Expand Up @@ -74,7 +73,7 @@ contract ZoraCreator1155FactoryImpl is IZoraCreator1155Factory, ContractVersionB
address payable defaultAdmin,
bytes[] calldata setupActions
) external returns (address) {
Zora1155 newContract = new Zora1155(address(implementation));
Zora1155 newContract = new Zora1155(address(zora1155impl));

_initializeContract(Zora1155(newContract), newContractURI, name, defaultRoyaltyConfiguration, defaultAdmin, setupActions);

Expand All @@ -90,7 +89,7 @@ contract ZoraCreator1155FactoryImpl is IZoraCreator1155Factory, ContractVersionB
) external returns (address) {
bytes32 digest = _hashContract(msg.sender, newContractURI, name, defaultAdmin);

address createdContract = CREATE3.deploy(digest, abi.encodePacked(type(Zora1155).creationCode, abi.encode(implementation)), 0);
address createdContract = CREATE3.deploy(digest, abi.encodePacked(type(Zora1155).creationCode, abi.encode(zora1155impl)), 0);

Zora1155 newContract = Zora1155(payable(createdContract));

Expand Down Expand Up @@ -151,6 +150,11 @@ contract ZoraCreator1155FactoryImpl is IZoraCreator1155Factory, ContractVersionB
}
}

/// @notice Returns the current implementation address
function implementation() external view returns (address) {
return _getImplementation();
}

function _equals(string memory a, string memory b) internal pure returns (bool) {
return (keccak256(bytes(a)) == keccak256(bytes(b)));
}
Expand Down
7 changes: 6 additions & 1 deletion src/nft/ZoraCreator1155Impl.sol
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ contract ZoraCreator1155Impl is
return firstMinters[tokenId];
}

function mintFee() external view returns (uint256) {
function mintFee() external pure returns (uint256) {
return TOTAL_REWARD_PER_MINT;
}

Expand Down Expand Up @@ -776,6 +776,11 @@ contract ZoraCreator1155Impl is
}
}

/// @notice Returns the current implementation address
function implementation() external view returns (address) {
return _getImplementation();
}

function delegateSetupNewToken(PremintConfig calldata premintConfig, bytes calldata signature) public nonReentrant returns (uint256 newTokenId) {
// if a token has already been created for a premint config with this uid:
if (delegatedTokenId[premintConfig.uid] != 0) {
Expand Down

0 comments on commit 7b92825

Please sign in to comment.