-
Notifications
You must be signed in to change notification settings - Fork 538
/
ONFT1155.sol
38 lines (32 loc) · 1.29 KB
/
ONFT1155.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
pragma solidity ^0.8.0;
import "./interfaces/IONFT1155.sol";
import "./ONFT1155Core.sol";
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
// NOTE: this ONFT contract has no public minting logic.
// must implement your own minting logic in child classes
contract ONFT1155 is ONFT1155Core, ERC1155, IONFT1155 {
constructor(string memory _uri, address _lzEndpoint) ERC1155(_uri) ONFT1155Core(_lzEndpoint) {}
function supportsInterface(bytes4 interfaceId) public view virtual override(ONFT1155Core, ERC1155, IERC165) returns (bool) {
return interfaceId == type(IONFT1155).interfaceId || super.supportsInterface(interfaceId);
}
function _debitFrom(
address _from,
uint16,
bytes memory,
uint[] memory _tokenIds,
uint[] memory _amounts
) internal virtual override {
address spender = _msgSender();
require(spender == _from || isApprovedForAll(_from, spender), "ONFT1155: send caller is not owner nor approved");
_burnBatch(_from, _tokenIds, _amounts);
}
function _creditTo(
uint16,
address _toAddress,
uint[] memory _tokenIds,
uint[] memory _amounts
) internal virtual override {
_mintBatch(_toAddress, _tokenIds, _amounts, "");
}
}