-
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.
- Loading branch information
1 parent
91c03a5
commit 4d770b6
Showing
7 changed files
with
284 additions
and
4 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 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,40 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.15; | ||
|
||
import "chiru-labs/ERC721A-Upgradeable/IERC721AUpgradeable.sol"; | ||
import "openzeppelin-upgradeable/access/OwnableUpgradeable.sol"; | ||
|
||
/* | ||
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ | ||
▒███████████████████████████████████████████████████████████ | ||
▒███████████████████████████████████████████████████████████ | ||
▒▓▓▓▓▓▓▓▓▓▓▓▓▓████████████████▓▓▓▓▓▓▓▓▓▓▓▓▓▓██████████████████████████████▓▒▒▒▒▒▒▒▒▒▒▒▒▒ | ||
█████████████████████████████▓ ████████████████████████████████████████████ | ||
█████████████████████████████▓ ████████████████████████████████████████████ | ||
█████████████████████████████▓ ▒▒▒▒▒▒▒▒▒▒▒▒▒██████████████████████████████ | ||
█████████████████████████████▓ ▒█████████████████████████████ | ||
█████████████████████████████▓ ▒████████████████████████████ | ||
█████████████████████████████████████████████████████████▓ | ||
███████████████████████████████████████████████████████████ | ||
███████████████████████████████████████████████████████████▒ | ||
███████████████████████████████████████████████████████████▒ | ||
▓██████████████████████████████████████████████████████████▒ | ||
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓███████████████████████████████▒ | ||
█████████████████████████████ ▒█████████████████████████████▒ | ||
██████████████████████████████ ▒█████████████████████████████▒ | ||
██████████████████████████████▓▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒█████████████████████████████▒ | ||
████████████████████████████████████████████▒ ▒█████████████████████████████▒ | ||
████████████████████████████████████████████▒ ▒█████████████████████████████▒ | ||
▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████▓▓▓▓▓▓▓▓▓▓▓▓▓███████████████▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒ | ||
▓██████████████████████████████████████████████████████████▒ | ||
▓██████████████████████████████████████████████████████████ | ||
*/ | ||
|
||
/// @title ISoundNftV1 | ||
/// @author Sound.xyz | ||
interface ISoundNftV1 is IERC721AUpgradeable { | ||
function initialize(string memory _name, string memory _symbol) external; | ||
|
||
function mint(address to, uint256 quantity) external payable; | ||
} |
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 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,65 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.15; | ||
|
||
import "chiru-labs/ERC721A-Upgradeable/ERC721AUpgradeable.sol"; | ||
import "openzeppelin-upgradeable/access/OwnableUpgradeable.sol"; | ||
import "openzeppelin-upgradeable/access/AccessControlUpgradeable.sol"; | ||
|
||
/* | ||
▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒ | ||
▒███████████████████████████████████████████████████████████ | ||
▒███████████████████████████████████████████████████████████ | ||
▒▓▓▓▓▓▓▓▓▓▓▓▓▓████████████████▓▓▓▓▓▓▓▓▓▓▓▓▓▓██████████████████████████████▓▒▒▒▒▒▒▒▒▒▒▒▒▒ | ||
█████████████████████████████▓ ████████████████████████████████████████████ | ||
█████████████████████████████▓ ████████████████████████████████████████████ | ||
█████████████████████████████▓ ▒▒▒▒▒▒▒▒▒▒▒▒▒██████████████████████████████ | ||
█████████████████████████████▓ ▒█████████████████████████████ | ||
█████████████████████████████▓ ▒████████████████████████████ | ||
█████████████████████████████████████████████████████████▓ | ||
███████████████████████████████████████████████████████████ | ||
███████████████████████████████████████████████████████████▒ | ||
███████████████████████████████████████████████████████████▒ | ||
▓██████████████████████████████████████████████████████████▒ | ||
▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓███████████████████████████████▒ | ||
█████████████████████████████ ▒█████████████████████████████▒ | ||
██████████████████████████████ ▒█████████████████████████████▒ | ||
██████████████████████████████▓▒▒▒▒▒▒▒▒▒▒▒▒▒ ▒█████████████████████████████▒ | ||
████████████████████████████████████████████▒ ▒█████████████████████████████▒ | ||
████████████████████████████████████████████▒ ▒█████████████████████████████▒ | ||
▒▒▒▒▒▒▒▒▒▒▒▒▒▒███████████████████████████████▓▓▓▓▓▓▓▓▓▓▓▓▓███████████████▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒ | ||
▓██████████████████████████████████████████████████████████▒ | ||
▓██████████████████████████████████████████████████████████ | ||
*/ | ||
|
||
/// @title SoundNftV1 | ||
/// @author Sound.xyz | ||
contract SoundNftV1 is ERC721AUpgradeable, OwnableUpgradeable, AccessControlUpgradeable { | ||
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); | ||
|
||
function initialize(string memory _name, string memory _symbol) | ||
public | ||
initializerERC721A | ||
initializer | ||
{ | ||
__ERC721A_init(_name, _symbol); | ||
__Ownable_init(); | ||
__AccessControl_init(); | ||
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender); | ||
} | ||
|
||
function mint(address to, uint256 quantity) public payable onlyRole(MINTER_ROLE) { | ||
_mint(to, quantity); | ||
} | ||
|
||
function supportsInterface(bytes4 interfaceId) | ||
public | ||
view | ||
override(ERC721AUpgradeable, AccessControlUpgradeable) | ||
returns (bool) | ||
{ | ||
return | ||
ERC721AUpgradeable.supportsInterface(interfaceId) || | ||
AccessControlUpgradeable.supportsInterface(interfaceId); | ||
} | ||
} |
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,54 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.15; | ||
|
||
contract EditionMintControllers { | ||
|
||
event EditionMintControllerUpdated(address indexed edition, address indexed newController); | ||
|
||
mapping(address => address) private _controllers; | ||
|
||
modifier onlyEditionMintController(address edition) virtual { | ||
require(msg.sender == _controllers[edition], "Unauthorized."); | ||
_; | ||
} | ||
|
||
function _initEditionMintController(address edition) internal { | ||
_initEditionMintController(edition, msg.sender); | ||
} | ||
|
||
function _initEditionMintController(address edition, address editionMintController) internal { | ||
require(editionMintController != address(0), "Edition mint controller cannot be the zero address."); | ||
require(_controllers[edition] == address(0), "Edition mint controller already exists."); | ||
|
||
_controllers[edition] = editionMintController; | ||
|
||
emit EditionMintControllerUpdated(edition, editionMintController); | ||
} | ||
|
||
function _deleteEditionMintController(address edition) internal { | ||
require(_controllers[edition] != address(0), "Edition mint controller does not exist."); | ||
|
||
delete _controllers[edition]; | ||
|
||
emit EditionMintControllerUpdated(edition, address(0)); | ||
} | ||
|
||
function _deleteEditionMintController() internal { | ||
_deleteEditionMintController(msg.sender); | ||
} | ||
|
||
function _editionMintController(address edition) internal view returns (address) { | ||
return _controllers[edition]; | ||
} | ||
|
||
function setEditionMintController( | ||
address edition, | ||
address newController | ||
) public virtual onlyEditionMintController(edition) { | ||
require(newController != address(0), ""); | ||
|
||
_controllers[edition] = newController; | ||
emit EditionMintControllerUpdated(edition, newController); | ||
} | ||
} |
49 changes: 49 additions & 0 deletions
49
contracts/modules/Minting/FixedPricePermissionedSaleMinter.sol
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,49 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
pragma solidity ^0.8.15; | ||
|
||
import "./EditionMintControllers.sol"; | ||
import "../../SoundEdition/ISoundEditionV1.sol"; | ||
|
||
contract FixedPricePermissionedMinter is EditionMintControllers { | ||
|
||
struct EditionMintData { | ||
// The price at which each token will be sold, in ETH. | ||
uint256 price; | ||
// Whitelist signer address. | ||
address signer; | ||
// The maximum number of tokens that can can be minted for this sale. | ||
uint32 maxMinted; | ||
// The total number of tokens minted so far for this sale. | ||
uint32 totalMinted; | ||
} | ||
|
||
mapping(address => EditionMintData) public editionMintData; | ||
|
||
function createEditionMint( | ||
address edition, | ||
uint256 price, | ||
address signer, | ||
uint32 maxMinted | ||
) public { | ||
_initEditionMintController(edition); | ||
EditionMintData storage data = editionMintData[edition]; | ||
data.price = price; | ||
data.signer = signer; | ||
data.maxMinted = maxMinted; | ||
} | ||
|
||
function deleteMintee(address edition) public onlyEditionMintController(edition) { | ||
_deleteEditionMintController(); | ||
delete editionMintData[edition]; | ||
} | ||
|
||
function mint(address edition, uint256 quantity) public payable { | ||
// EditionMintData storage data = editionMintData[edition]; | ||
// require(data.startTime <= block.timestamp, "Mint not started."); | ||
// require(data.endTime > block.timestamp, "Mint has ended."); | ||
// require(data.price * quantity == msg.value, "Wrong ether value."); | ||
// require((data.totalMinted += quantity) <= data.maxMinted, "No more mints."); | ||
ISoundEditionV1(edition).mint{value: msg.value}(edition, quantity); | ||
} | ||
} |
Oops, something went wrong.