-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUMinter.sol
59 lines (42 loc) · 1.93 KB
/
GUMinter.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// Owner of this software is Nikola Radošević PR Innolab Solutions Serbia. All rights reserved.
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;
import "./GUCollections.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./GUTradeManager.sol";
import "./TradeLib.sol";
contract GUMinter {
GUTradeManager manager;
address adminSafe;
event MintSuccessful(uint256 indexed id, uint256 amount, address receiver, address indexed initiator);
event ManagerAddressChanged(address indexed managerAddress);
constructor(address managerAddress, address safeAddress) {
adminSafe = safeAddress;
setManagerAddress(managerAddress);
}
modifier onlyAdminSafe {
require(msg.sender == adminSafe, 'You are not whitelisted.');
_;
}
function setManagerAddress(address managerAddress) public onlyAdminSafe
{
manager = GUTradeManager(managerAddress);
emit ManagerAddressChanged(managerAddress);
}
function mintTo(TradeLib.MintTo calldata data) external
{
GUCollections collections = GUCollections(data.nftData.nftContract);
TradeLib.checkMintToPreconditions(collections, manager, data);
collections.mint(data.to, data.nftData.nftId, data.amount, data.nftSignature, data.nftData.cid);
emit MintSuccessful(data.nftData.nftId, data.amount, data.to, data.nftData.creator);
}
function batchMintTo(TradeLib.MintTo[] calldata data) external
{
for(uint i; i < data.length; i++){
GUCollections collections = GUCollections(data[i].nftData.nftContract);
TradeLib.checkMintToPreconditions(collections, manager, data[i]);
collections.mint(data[i].to,data[i].nftData.nftId,data[i].amount, data[i].nftSignature, data[i].nftData.cid);
emit MintSuccessful(data[i].nftData.nftId, data[i].amount, data[i].to, data[i].nftData.creator);
}
}
}