22pragma solidity ^ 0.8.17 ;
33
44import {IERC1155Sale } from "@0xsequence/contracts-library/tokens/ERC1155/presets/sale/IERC1155Sale.sol " ;
5- import {ERC1155Supply , ERC1155Token } from "@0xsequence/contracts-library/tokens/ERC1155/extensions/supply/ERC1155Supply.sol " ;
6- import {WithdrawControlled, AccessControl, SafeERC20, IERC20 } from "@0xsequence/contracts-library/tokens/common/WithdrawControlled.sol " ;
7- import {MerkleProofSingleUse} from "@0xsequence/contracts-library/tokens/common/MerkleProofSingleUse.sol " ;
8-
9- contract ERC1155Sale is
10- IERC1155Sale ,
5+ import {
116 ERC1155Supply ,
7+ ERC1155Token
8+ } from "@0xsequence/contracts-library/tokens/ERC1155/extensions/supply/ERC1155Supply.sol " ;
9+ import {
1210 WithdrawControlled,
13- MerkleProofSingleUse
14- {
11+ AccessControl,
12+ SafeERC20,
13+ IERC20
14+ } from "@0xsequence/contracts-library/tokens/common/WithdrawControlled.sol " ;
15+ import {MerkleProofSingleUse} from "@0xsequence/contracts-library/tokens/common/MerkleProofSingleUse.sol " ;
16+
17+ contract ERC1155Sale is IERC1155Sale , ERC1155Supply , WithdrawControlled , MerkleProofSingleUse {
1518 bytes32 public constant MINT_ADMIN_ROLE = keccak256 ("MINT_ADMIN_ROLE " );
1619
1720 bytes4 private constant _ERC20_TRANSFERFROM_SELECTOR =
@@ -27,20 +30,30 @@ contract ERC1155Sale is
2730
2831 /**
2932 * Initialize the contract.
30- * @param owner Owner address.
31- * @param tokenName Token name.
32- * @param tokenBaseURI Base URI for token metadata.
33+ * @param owner Owner address
34+ * @param tokenName Token name
35+ * @param tokenBaseURI Base URI for token metadata
36+ * @param royaltyReceiver Address of who should be sent the royalty payment
37+ * @param royaltyFeeNumerator The royalty fee numerator in basis points (e.g. 15% would be 1500)
3338 * @dev This should be called immediately after deployment.
3439 */
35- function initialize (address owner , string memory tokenName , string memory tokenBaseURI ) public virtual override {
40+ function initialize (
41+ address owner ,
42+ string memory tokenName ,
43+ string memory tokenBaseURI ,
44+ address royaltyReceiver ,
45+ uint96 royaltyFeeNumerator
46+ )
47+ public
48+ virtual
49+ {
3650 if (_initialized) {
3751 revert InvalidInitialization ();
3852 }
39- ERC1155Token .initialize (owner, tokenName, tokenBaseURI);
4053
41- name = tokenName;
42- baseURI = tokenBaseURI ;
43- _setupRole (DEFAULT_ADMIN_ROLE, owner);
54+ ERC1155Token . _initialize (owner, tokenName, tokenBaseURI) ;
55+ _setDefaultRoyalty (royaltyReceiver, royaltyFeeNumerator) ;
56+
4457 _setupRole (MINT_ADMIN_ROLE, owner);
4558 _setupRole (WITHDRAW_ROLE, owner);
4659
@@ -64,7 +77,9 @@ contract ERC1155Sale is
6477 * @param _amounts Amounts of tokens to mint.
6578 * @param _proof Merkle proof for allowlist minting.
6679 */
67- function _payForActiveMint (uint256 [] memory _tokenIds , uint256 [] memory _amounts , bytes32 [] calldata _proof ) private {
80+ function _payForActiveMint (uint256 [] memory _tokenIds , uint256 [] memory _amounts , bytes32 [] calldata _proof )
81+ private
82+ {
6883 uint256 lastTokenId;
6984 uint256 totalCost;
7085 uint256 totalAmount;
@@ -127,7 +142,13 @@ contract ERC1155Sale is
127142 * @dev tokenIds must be sorted ascending without duplicates.
128143 * @dev An empty proof is supplied when no proof is required.
129144 */
130- function mint (address to , uint256 [] memory tokenIds , uint256 [] memory amounts , bytes memory data , bytes32 [] calldata proof )
145+ function mint (
146+ address to ,
147+ uint256 [] memory tokenIds ,
148+ uint256 [] memory amounts ,
149+ bytes memory data ,
150+ bytes32 [] calldata proof
151+ )
131152 public
132153 payable
133154 {
0 commit comments