-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add FixedPricePublicSaleMinter tests
- Loading branch information
1 parent
4d770b6
commit c9a21d2
Showing
11 changed files
with
371 additions
and
187 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.15; | ||
|
||
contract EditionMinter { | ||
error MintControllerUnauthorized(); | ||
|
||
error MintControllerSetToZeroAddress(); | ||
|
||
error MintNotFound(); | ||
|
||
error MintAlreadyExists(); | ||
|
||
event MintControllerUpdated(address indexed edition, address indexed controller); | ||
|
||
mapping(address => address) private _controllers; | ||
|
||
modifier onlyEditionMintController(address edition) virtual { | ||
address controller = _controllers[edition]; | ||
if (controller == address(0)) revert MintNotFound(); | ||
if (msg.sender != controller) revert MintControllerUnauthorized(); | ||
_; | ||
} | ||
|
||
function _createEditionMint(address edition) internal { | ||
_createEditionMint(edition, msg.sender); | ||
} | ||
|
||
function _createEditionMint(address edition, address controller) internal { | ||
if (controller == address(0)) revert MintControllerSetToZeroAddress(); | ||
if (_controllers[edition] != address(0)) revert MintAlreadyExists(); | ||
|
||
_controllers[edition] = controller; | ||
|
||
emit MintControllerUpdated(edition, controller); | ||
} | ||
|
||
function _deleteEditionMint(address edition) internal { | ||
address controller = _controllers[edition]; | ||
if (controller == address(0)) revert MintNotFound(); | ||
if (msg.sender != controller) revert MintControllerUnauthorized(); | ||
delete _controllers[edition]; | ||
emit MintControllerUpdated(edition, address(0)); | ||
} | ||
|
||
function editionMintController(address edition) public view returns (address) { | ||
return _controllers[edition]; | ||
} | ||
|
||
function setEditionMintController(address edition, address controller) | ||
public | ||
virtual | ||
onlyEditionMintController(edition) | ||
{ | ||
if (controller == address(0)) revert MintControllerSetToZeroAddress(); | ||
|
||
_controllers[edition] = controller; | ||
emit MintControllerUpdated(edition, controller); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.