-
Notifications
You must be signed in to change notification settings - Fork 0
/
Factory.sol
38 lines (32 loc) · 1.02 KB
/
Factory.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// SPDX-License-Identifier: MIT
// Fragnova Simple NFT Factory
pragma solidity ^0.8.7;
import "./ClonesWithCalldata.sol";
import "./IBootstrapped.sol";
contract FragnovaSimpleNFTFactory {
event Created(address indexed newContract);
function create(
string memory name,
string memory symbol,
string memory baseUrl,
uint256 quantity,
address implementation
) public {
bytes32 name32 = bytes32(bytes(name));
bytes32 symbol32 = bytes32(bytes(symbol));
bytes32 baseUrl32 = bytes32(bytes(baseUrl));
bytes memory ptr = new bytes(128);
assembly {
mstore(add(ptr, 0x20), name32)
mstore(add(ptr, 0x40), symbol32)
mstore(add(ptr, 0x60), baseUrl32)
mstore(add(ptr, 0x80), quantity)
}
address newContract = ClonesWithCallData.cloneWithCallDataProvision(
implementation,
ptr
);
IBootstrapped(newContract).bootstrap();
emit Created(newContract);
}
}