Repository navigation
Expand file tree
/
Copy pathFToken.sol
More file actions
96 lines (83 loc) · 2.53 KB
/
Copy pathFToken.sol
File metadata and controls
96 lines (83 loc) · 2.53 KB
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
/**
* @title FToken
* @author Siegfried Bozza
*/
import {ERC1155} from "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
/**
* errors
*/
error FToken__OnlyOwnerAllowed();
/**
* @title
* @author
* @notice address:
*/
contract FToken is ERC1155 {
using Strings for uint256;
/**
* state
*/
address public immutable I_OWNER;
/**
* modifiers
*/
modifier onlyOwner() {
_onlyOwner();
_;
}
function _onlyOwner() internal view {
if (msg.sender != I_OWNER) {
revert FToken__OnlyOwnerAllowed();
}
}
/**
* functions
*/
constructor(string memory uri_) ERC1155(uri_) {
I_OWNER = msg.sender;
}
/**
* @param _to the address to mint to
* @param _id the tokenId to mint
* @param _value the amount of tokens to mint
* @notice onlyOwner modifier => only the Forge contract can call this function
*/
function mint(address _to, uint256 _id, uint256 _value) external onlyOwner {
_mint(_to, _id, _value, hex"");
}
/**
* @param _from the address to burn from
* @param _ids the array of tokenIds to burn
* @param _values the array of amount of token _ids to burn
* @notice onlyOwner modifier => only the Forge contract can call this function
*/
function burnBatch(address _from, uint256[] memory _ids, uint256[] memory _values) external onlyOwner {
_burnBatch(_from, _ids, _values);
}
/**
* @param _from the address to burn from
* @param _id the tokenId to burn
* @param _value the amount of tokens to burn
* @notice onlyOwner modifier => only the Forge contract can call this function
*/
function burn(address _from, uint256 _id, uint256 _value) external onlyOwner {
_burn(_from, _id, _value);
}
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the same URI for *all* token types. It relies
* on the token type ID substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the ERC].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256 id) public view override returns (string memory) {
string memory baseURI = super.uri(id);
return bytes(baseURI).length > 0 ? string.concat(baseURI, id.toString()) : "";
}
}