Address Contract Verified
Address
0x74EE68a33f6c9f113e22B3B77418B75f85d07D22
Balance
0 ETH
Nonce
1
Code Size
6976 bytes
Creator
0x96eBC079...e6FD at tx 0x22a28a6a...eaf162
Indexed Transactions
0
Contract Bytecode
6976 bytes
0x608060405234801561001057600080fd5b50600436106100da5760003560e01c8062fdd58e146100df57806301ffc9a71461010557806306fdde03146101285780630e89341c1461013d57806329dcb0cf146101505780632eb2c2d6146101775780634e1273f41461018c5780634e71d92d146101ac5780634f558e79146101b45780638b58c569146101c757806395d89b41146101da578063a22cb465146101e2578063bd85b039146101f5578063c884ef8314610208578063e8a3d4851461022b578063e985e9c514610233578063f242432a1461026f575b600080fd5b6100f26100ed3660046114cd565b610282565b6040519081526020015b60405180910390f35b6101186101133660046115c7565b610319565b60405190151581526020016100fc565b610130610344565b6040516100fc919061178b565b61013061014b366004611601565b6103d2565b6100f27f000000000000000000000000000000000000000000000000000000006105e40081565b61018a610185366004611384565b61049b565b005b61019f61019a3660046114f7565b610532565b6040516100fc9190611753565b61018a61065b565b6101186101c2366004611601565b6106b7565b6100f26101d5366004611601565b6106ca565b61013061075b565b61018a6101f0366004611491565b610768565b6100f2610203366004611601565b61083f565b61011861021636600461132f565b60046020526000908152604090205460ff1681565b610130610851565b610118610241366004611351565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b61018a61027d36600461142d565b61085e565b60006001600160a01b0383166102f35760405162461bcd60e51b815260206004820152602b60248201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60448201526a65726f206164647265737360a81b60648201526084015b60405180910390fd5b506000908152602081815260408083206001600160a01b03949094168352929052205490565b60006001600160e01b0319821663e8a3d48560e01b148061033e575061033e826108e5565b92915050565b6005805461035190611941565b80601f016020809104026020016040519081016040528092919081815260200182805461037d90611941565b80156103ca5780601f1061039f576101008083540402835291602001916103ca565b820191906000526020600020905b8154815290600101906020018083116103ad57829003601f168201915b505050505081565b60608115806103e15750600a82115b156103fa57505060408051602081019091526000815290565b6000828152600860205260409020805461033e919061041890611941565b80601f016020809104026020016040519081016040528092919081815260200182805461044490611941565b80156104915780601f1061046657610100808354040283529160200191610491565b820191906000526020600020905b81548152906001019060200180831161047457829003601f168201915b5050505050610935565b6001600160a01b0385163314806104b757506104b78533610241565b61051e5760405162461bcd60e51b815260206004820152603260248201527f455243313135353a207472616e736665722063616c6c6572206973206e6f74206044820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b60648201526084016102ea565b61052b858585858561097f565b5050505050565b606081518351146105975760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b60648201526084016102ea565b600083516001600160401b038111156105b2576105b2611a19565b6040519080825280602002602001820160405280156105db578160200160208202803683370190505b50905060005b8451811015610653576106268582815181106105ff576105ff611a03565b602002602001015185838151811061061957610619611a03565b6020026020010151610282565b82828151811061063857610638611a03565b602090810291909101015261064c816119a8565b90506105e1565b509392505050565b3361066581610b5c565b600061067042610c36565b6040805160008152602081019091529091506106929083908390600190610d71565b506001600160a01b03166000908152600460205260409020805460ff19166001179055565b6000806106c38361083f565b1192915050565b60008115806106d95750600a82115b156106e657506000919050565b7f00000000000000000000000000000000000000000000000000000000000003e87f013333338d8d8d8d8d8d000000000000000000000000000000000000000000006107336001856118e3565b600a811061074357610743611a03565b61075191901a6103e86118c4565b61033e91906118b0565b6006805461035190611941565b336001600160a01b03831614156107d35760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b60648201526084016102ea565b3360008181526001602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60009081526003602052604090205490565b6007805461035190611941565b6001600160a01b03851633148061087a575061087a8533610241565b6108d85760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260448201526808185c1c1c9bdd995960ba1b60648201526084016102ea565b61052b8585858585610da6565b60006001600160e01b03198216636cdb3d1360e11b148061091657506001600160e01b031982166303a24d0760e21b145b8061033e57506301ffc9a760e01b6001600160e01b031983161461033e565b606060405180604001604052806007815260200166697066733a2f2f60c81b81525082604051602001610969929190611681565b6040516020818303038152906040529050919050565b81518351146109e15760405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b60648201526084016102ea565b6001600160a01b038416610a075760405162461bcd60e51b81526004016102ea906117e6565b3360005b8451811015610aee576000858281518110610a2857610a28611a03565b602002602001015190506000858381518110610a4657610a46611a03565b602090810291909101810151600084815280835260408082206001600160a01b038e168352909352919091205490915081811015610a965760405162461bcd60e51b81526004016102ea9061182b565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290610ad3908490611898565b9250508190555050505080610ae7906119a8565b9050610a0b565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051610b3e929190611766565b60405180910390a4610b54818787878787610eba565b505050505050565b326001600160a01b03821614610b85576040516358594bc360e11b815260040160405180910390fd5b6001600160a01b03811660009081526004602052604090205460ff1615610bca57604051632058b6db60e01b81526001600160a01b03821660048201526024016102ea565b7f000000000000000000000000000000000000000000000000000000006105e400421115610c3357604051634796c9b760e11b81524260048201527f000000000000000000000000000000000000000000000000000000006105e40060248201526044016102ea565b50565b6040516001600160601b03193360601b1660208201526034810182905260009081907f00000000000000000000000000000000000000000000000000000000000003e8906054016040516020818303038152906040528051906020012060001c610ca091906119c3565b90507f00000000000000000000000000000000000000000000000000000000000003e860095b8015610d39577f013333338d8d8d8d8d8d0000000000000000000000000000000000000000000081600a8110610cfe57610cfe611a03565b610d0a91901a836118e3565b9150818310610d2757610d1e816001611898565b95945050505050565b80610d318161192a565b915050610cc6565b50610d44600161083f565b600a1415610d6757610d5f610d5a856001611898565b610c36565b949350505050565b5060019392505050565b610d7d84848484611025565b60008381526003602052604081208054849290610d9b908490611898565b909155505050505050565b6001600160a01b038416610dcc5760405162461bcd60e51b81526004016102ea906117e6565b33610de5818787610ddc88611114565b61052b88611114565b6000848152602081815260408083206001600160a01b038a16845290915290205483811015610e265760405162461bcd60e51b81526004016102ea9061182b565b6000858152602081815260408083206001600160a01b038b8116855292528083208785039055908816825281208054869290610e63908490611898565b909155505060408051868152602081018690526001600160a01b03808916928a82169291861691600080516020611aeb833981519152910160405180910390a4610eb182888888888861115f565b50505050505050565b6001600160a01b0384163b15610b545760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190610efe90899089908890889088906004016116b0565b602060405180830381600087803b158015610f1857600080fd5b505af1925050508015610f48575060408051601f3d908101601f19168201909252610f45918101906115e4565b60015b610ff557610f54611a2f565b806308c379a01415610f8e5750610f69611a4b565b80610f745750610f90565b8060405162461bcd60e51b81526004016102ea919061178b565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e20455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b60648201526084016102ea565b6001600160e01b0319811663bc197c8160e01b14610eb15760405162461bcd60e51b81526004016102ea9061179e565b6001600160a01b0384166110855760405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b60648201526084016102ea565b3361109681600087610ddc88611114565b6000848152602081815260408083206001600160a01b0389168452909152812080548592906110c6908490611898565b909155505060408051858152602081018590526001600160a01b038088169260009291851691600080516020611aeb833981519152910160405180910390a461052b8160008787878761115f565b6040805160018082528183019092526060916000919060208083019080368337019050509050828160008151811061114e5761114e611a03565b602090810291909101015292915050565b6001600160a01b0384163b15610b545760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906111a3908990899088908890889060040161170e565b602060405180830381600087803b1580156111bd57600080fd5b505af19250505080156111ed575060408051601f3d908101601f191682019092526111ea918101906115e4565b60015b6111f957610f54611a2f565b6001600160e01b0319811663f23a6e6160e01b14610eb15760405162461bcd60e51b81526004016102ea9061179e565b80356001600160a01b038116811461124057600080fd5b919050565b600082601f83011261125657600080fd5b8135602061126382611875565b604051611270828261197c565b8381528281019150858301600585901b8701840188101561129057600080fd5b60005b858110156112af57813584529284019290840190600101611293565b5090979650505050505050565b600082601f8301126112cd57600080fd5b81356001600160401b038111156112e6576112e6611a19565b6040516112fd601f8301601f19166020018261197c565b81815284602083860101111561131257600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561134157600080fd5b61134a82611229565b9392505050565b6000806040838503121561136457600080fd5b61136d83611229565b915061137b60208401611229565b90509250929050565b600080600080600060a0868803121561139c57600080fd5b6113a586611229565b94506113b360208701611229565b935060408601356001600160401b03808211156113cf57600080fd5b6113db89838a01611245565b945060608801359150808211156113f157600080fd5b6113fd89838a01611245565b9350608088013591508082111561141357600080fd5b50611420888289016112bc565b9150509295509295909350565b600080600080600060a0868803121561144557600080fd5b61144e86611229565b945061145c60208701611229565b9350604086013592506060860135915060808601356001600160401b0381111561148557600080fd5b611420888289016112bc565b600080604083850312156114a457600080fd5b6114ad83611229565b9150602083013580151581146114c257600080fd5b809150509250929050565b600080604083850312156114e057600080fd5b6114e983611229565b946020939093013593505050565b6000806040838503121561150a57600080fd5b82356001600160401b038082111561152157600080fd5b818501915085601f83011261153557600080fd5b8135602061154282611875565b60405161154f828261197c565b8381528281019150858301600585901b870184018b101561156f57600080fd5b600096505b848710156115995761158581611229565b835260019690960195918301918301611574565b50965050860135925050808211156115b057600080fd5b506115bd85828601611245565b9150509250929050565b6000602082840312156115d957600080fd5b813561134a81611ad4565b6000602082840312156115f657600080fd5b815161134a81611ad4565b60006020828403121561161357600080fd5b5035919050565b600081518084526020808501945080840160005b8381101561164a5781518752958201959082019060010161162e565b509495945050505050565b6000815180845261166d8160208601602086016118fa565b601f01601f19169290920160200192915050565b600083516116938184602088016118fa565b8351908301906116a78183602088016118fa565b01949350505050565b6001600160a01b0386811682528516602082015260a0604082018190526000906116dc9083018661161a565b82810360608401526116ee818661161a565b905082810360808401526117028185611655565b98975050505050505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061174890830184611655565b979650505050505050565b60208152600061134a602083018461161a565b604081526000611779604083018561161a565b8281036020840152610d1e818561161a565b60208152600061134a6020830184611655565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b60006001600160401b0382111561188e5761188e611a19565b5060051b60200190565b600082198211156118ab576118ab6119d7565b500190565b6000826118bf576118bf6119ed565b500490565b60008160001904831182151516156118de576118de6119d7565b500290565b6000828210156118f5576118f56119d7565b500390565b60005b838110156119155781810151838201526020016118fd565b83811115611924576000848401525b50505050565b600081611939576119396119d7565b506000190190565b600181811c9082168061195557607f821691505b6020821081141561197657634e487b7160e01b600052602260045260246000fd5b50919050565b601f8201601f191681016001600160401b03811182821017156119a1576119a1611a19565b6040525050565b60006000198214156119bc576119bc6119d7565b5060010190565b6000826119d2576119d26119ed565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600060033d1115611a485760046000803e5060005160e01c5b90565b600060443d1015611a595790565b6040516003193d81016004833e81513d6001600160401b038083116024840183101715611a8857505050505090565b8285019150815181811115611aa05750505050505090565b843d8701016020828501011115611aba5750505050505090565b611ac96020828601018761197c565b509095945050505050565b6001600160e01b031981168114610c3357600080fdfec3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62a2646970667358221220954ecf14f652abd352eb7493dcfc2d22b47907154a340bdc738d96e08edf230864736f6c63430008060033
Verified Source Code Full Match
Compiler: v0.8.6+commit.11564f7e
EVM: berlin
Optimization: Yes (10 runs)
ZerionGenesisNFT.sol 134 lines
// SPDX-License-Identifier: MIT
pragma solidity =0.8.6;
import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol";
import "./IZerionGenesisNFT.sol";
contract ZerionGenesisNFT is ERC1155Supply, IZerionGenesisNFT {
/// @inheritdoc IZerionGenesisNFT
mapping(address => bool) public override claimed;
/// @inheritdoc IZerionGenesisNFT
uint256 public immutable override deadline;
/// @inheritdoc IZerionGenesisNFT
string public override name;
/// @inheritdoc IZerionGenesisNFT
string public override symbol;
/// @inheritdoc IZerionGenesisNFT
string public override contractURI;
bytes10 internal immutable rarities;
uint256 internal immutable totalRarity;
mapping(uint256 => string) internal ipfsHashes;
uint256 internal constant TOKEN_AMOUNT = 1;
string internal constant IPFS_PREFIX = "ipfs://";
bytes4 private constant INTERFACE_ID_CONTRACT_URI = 0xe8a3d485;
error AlreadyClaimed(address account);
error ExceedsDeadline(uint256 timestamp, uint256 deadline);
error OnlyTxOrigin();
/// @notice Creates Zerion NFTs, stores all the required parameters.
/// @param ipfsHashes_ IPFS hashes for `tokenId` from 0 to 9.
/// @param contractIpfsHash_ IPFS hash for the collection metadata.
/// @param rarities_ Rarities for `tokenId` from 0 to 9.
/// @param name_ Collection name.
/// @param symbol_ Collection symbol.
/// @param deadline_ Deadline the tokens cannot be claimed after.
constructor(
string[10] memory ipfsHashes_,
string memory contractIpfsHash_,
bytes10 rarities_,
string memory name_,
string memory symbol_,
uint256 deadline_
) ERC1155("") {
for (uint256 i = 0; i < 10; i++) {
ipfsHashes[i + 1] = ipfsHashes_[i];
emit URI(hashToURI(ipfsHashes_[i]), i + 1);
}
contractURI = hashToURI(contractIpfsHash_);
rarities = rarities_;
uint256 temp = 0;
for (uint256 i = 0; i < 10; i++) {
temp += uint256(uint8(rarities_[i]));
}
totalRarity = temp;
name = name_;
symbol = symbol_;
deadline = deadline_;
}
/// @inheritdoc IZerionGenesisNFT
function claim() external override {
address msgSender = _msgSender();
checkRequirements(msgSender);
// solhint-disable-next-line not-rely-on-time
uint256 tokenId = getId(block.timestamp);
_mint(msgSender, tokenId, TOKEN_AMOUNT, new bytes(0));
claimed[msgSender] = true;
}
/// @inheritdoc IZerionGenesisNFT
function rarity(uint256 tokenId) external view override returns (uint256) {
if (tokenId == 0 || tokenId > 10) return uint256(0);
return (uint256(uint8(rarities[tokenId - 1])) * 1000) / uint256(totalRarity);
}
/// @inheritdoc IZerionGenesisNFT
function uri(uint256 tokenId) public view virtual override(ERC1155, IZerionGenesisNFT) returns (string memory) {
if (tokenId == 0 || tokenId > 10) return "";
return hashToURI(ipfsHashes[tokenId]);
}
/// @inheritdoc IERC165
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(ERC1155, IERC165)
returns (bool)
{
return interfaceId == INTERFACE_ID_CONTRACT_URI || super.supportsInterface(interfaceId);
}
/// @dev Reverts if the `account` has already claimed an NFT or is not an EOA.
/// @dev Also reverts if the current timestamp exceeds the deadline.
function checkRequirements(address account) internal view {
// solhint-disable-next-line avoid-tx-origin
if (tx.origin != account) revert OnlyTxOrigin();
if (claimed[account]) revert AlreadyClaimed(account);
// solhint-disable-next-line not-rely-on-time
if (block.timestamp > deadline) revert ExceedsDeadline(block.timestamp, deadline);
}
/// @dev Randomly (based on caller address and block timestamp) gets a token id.
/// @param salt Used to call this function multiple times (initially, `block.timestamp`).
function getId(uint256 salt) internal view returns (uint256) {
// We do not need a true random here as it is not worth manipulating a timestamp.
// slither-disable-next-line weak-prng
uint256 number = uint256(keccak256(abi.encodePacked(_msgSender(), salt))) % totalRarity;
uint256 limit = totalRarity;
for (uint256 i = 9; i > 0; i--) {
limit -= uint256(uint8(rarities[i]));
// slither-disable-next-line timestamp
if (number >= limit) return i + 1;
}
// We limit the amount of NFTs with `id == 1` by 10.
if (totalSupply(1) == 10) return getId(salt + 1);
return uint256(1);
}
/// @dev Adds IPFS prefix for a given IPFS hash.
function hashToURI(string memory ipfsHash) internal pure returns (string memory) {
return string(abi.encodePacked(IPFS_PREFIX, ipfsHash));
}
}
IZerionGenesisNFT.sol 35 lines
// SPDX-License-Identifier: MIT
pragma solidity =0.8.6;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
interface IZerionGenesisNFT is IERC1155 {
/// @notice Claims a random Zerion NFT for the `msg.sender`.
/// @dev Can be called only by an EOA.
/// @dev Can be called once per account.
/// @dev Can be called only prior to the deadline.
function claim() external;
/// @notice Shows the latest time Zerion NFTs can be claimed.
/// @return Timestamp of minting deadline.
function deadline() external view returns (uint256);
/// @notice Shows the rarities for Zerion NFTs.
/// @return Rarity for a given id, multiplied by 1000.
function rarity(uint256 tokenId) external view returns (uint256);
/// @notice Indicates whether the account has already claimed Zerion NFT.
function claimed(address account) external view returns (bool);
/// @notice Collection name.
function name() external view returns (string memory);
/// @notice Collection symbol.
function symbol() external view returns (string memory);
/// @notice Collection metadata URI.
function contractURI() external view returns (string memory);
/// @notice IPFS URI for a given id.
function uri(uint256) external view returns (string memory);
}
Address.sol 210 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize, which returns 0 for contracts in
// construction, since the code is only stored at the end of the
// constructor execution.
uint256 size;
assembly {
size := extcodesize(account)
}
return size > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return _verifyCallResult(success, returndata, errorMessage);
}
function _verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) private pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
Context.sol 23 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
ERC1155.sol 451 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC1155.sol";
import "./IERC1155Receiver.sol";
import "./extensions/IERC1155MetadataURI.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/introspection/ERC165.sol";
/**
* @dev Implementation of the basic standard multi-token.
* See https://eips.ethereum.org/EIPS/eip-1155
* Originally based on code by Enjin: https://github.com/enjin/erc-1155
*
* _Available since v3.1._
*/
contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
// Mapping from token ID to account balances
mapping(uint256 => mapping(address => uint256)) private _balances;
// Mapping from account to operator approvals
mapping(address => mapping(address => bool)) private _operatorApprovals;
// Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
string private _uri;
/**
* @dev See {_setURI}.
*/
constructor(string memory uri_) {
_setURI(uri_);
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
/**
* @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 EIP].
*
* Clients calling this function must replace the `\{id\}` substring with the
* actual token type ID.
*/
function uri(uint256) public view virtual override returns (string memory) {
return _uri;
}
/**
* @dev See {IERC1155-balanceOf}.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: balance query for the zero address");
return _balances[id][account];
}
/**
* @dev See {IERC1155-balanceOfBatch}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts[i], ids[i]);
}
return batchBalances;
}
/**
* @dev See {IERC1155-setApprovalForAll}.
*/
function setApprovalForAll(address operator, bool approved) public virtual override {
require(_msgSender() != operator, "ERC1155: setting approval status for self");
_operatorApprovals[_msgSender()][operator] = approved;
emit ApprovalForAll(_msgSender(), operator, approved);
}
/**
* @dev See {IERC1155-isApprovedForAll}.
*/
function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
return _operatorApprovals[account][operator];
}
/**
* @dev See {IERC1155-safeTransferFrom}.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: caller is not owner nor approved"
);
_safeTransferFrom(from, to, id, amount, data);
}
/**
* @dev See {IERC1155-safeBatchTransferFrom}.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual override {
require(
from == _msgSender() || isApprovedForAll(from, _msgSender()),
"ERC1155: transfer caller is not owner nor approved"
);
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), data);
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
emit TransferSingle(operator, from, to, id, amount);
_doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
}
emit TransferBatch(operator, from, to, ids, amounts);
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
}
/**
* @dev Sets a new URI for all token types, by relying on the token type ID
* substitution mechanism
* https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP].
*
* By this mechanism, any occurrence of the `\{id\}` substring in either the
* URI or any of the amounts in the JSON file at said URI will be replaced by
* clients with the token type ID.
*
* For example, the `https://token-cdn-domain/\{id\}.json` URI would be
* interpreted by clients as
* `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json`
* for token type ID 0x4cce0.
*
* See {uri}.
*
* Because these URIs cannot be meaningfully represented by the {URI} event,
* this function emits no events.
*/
function _setURI(string memory newuri) internal virtual {
_uri = newuri;
}
/**
* @dev Creates `amount` tokens of token type `id`, and assigns them to `account`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - If `account` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(
address account,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(account != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), account, _asSingletonArray(id), _asSingletonArray(amount), data);
_balances[id][account] += amount;
emit TransferSingle(operator, address(0), account, id, amount);
_doSafeTransferAcceptanceCheck(operator, address(0), account, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; i++) {
_balances[ids[i]][to] += amounts[i];
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
/**
* @dev Destroys `amount` tokens of token type `id` from `account`
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens of token type `id`.
*/
function _burn(
address account,
uint256 id,
uint256 amount
) internal virtual {
require(account != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
_beforeTokenTransfer(operator, account, address(0), _asSingletonArray(id), _asSingletonArray(amount), "");
uint256 accountBalance = _balances[id][account];
require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][account] = accountBalance - amount;
}
emit TransferSingle(operator, account, address(0), id, amount);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
*/
function _burnBatch(
address account,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(account != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, account, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 accountBalance = _balances[id][account];
require(accountBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][account] = accountBalance - amount;
}
}
emit TransferBatch(operator, account, address(0), ids, amounts);
}
/**
* @dev Hook that is called before any token transfer. This includes minting
* and burning, as well as batched variants.
*
* The same hook is called on both single and batched variants. For single
* transfers, the length of the `id` and `amount` arrays will be 1.
*
* Calling conditions (for each `id` and `amount` pair):
*
* - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* of token type `id` will be transferred to `to`.
* - When `from` is zero, `amount` tokens of token type `id` will be minted
* for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens of token type `id`
* will be burned.
* - `from` and `to` are never both zero.
* - `ids` and `amounts` have the same, non-zero length.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
if (response != IERC1155Receiver(to).onERC1155Received.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver(to).onERC1155BatchReceived.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non ERC1155Receiver implementer");
}
}
}
function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
uint256[] memory array = new uint256[](1);
array[0] = element;
return array;
}
}
IERC1155.sol 124 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids)
external
view
returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must be have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes calldata data
) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}
ERC165.sol 28 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "./IERC165.sol";
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
IERC165.sol 24 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
IERC1155Receiver.sol 52 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
@dev Handles the receipt of a single ERC1155 token type. This function is
called at the end of a `safeTransferFrom` after the balance has been updated.
To accept the transfer, this must return
`bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
(i.e. 0xf23a6e61, or its own function selector).
@param operator The address which initiated the transfer (i.e. msg.sender)
@param from The address which previously owned the token
@param id The ID of the token being transferred
@param value The amount of tokens being transferred
@param data Additional data with no specified format
@return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
@dev Handles the receipt of a multiple ERC1155 token types. This function
is called at the end of a `safeBatchTransferFrom` after the balances have
been updated. To accept the transfer(s), this must return
`bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
(i.e. 0xbc197c81, or its own function selector).
@param operator The address which initiated the batch transfer (i.e. msg.sender)
@param from The address which previously owned the token
@param ids An array containing ids of each token being transferred (order and length must match values array)
@param values An array containing amounts of each token being transferred (order and length must match ids array)
@param data Additional data with no specified format
@return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
ERC1155Supply.sol 85 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../ERC1155.sol";
/**
* @dev Extension of ERC1155 that adds tracking of total supply per id.
*
* Useful for scenarios where Fungible and Non-fungible tokens have to be
* clearly identified. Note: While a totalSupply of 1 might mean the
* corresponding is an NFT, there is no guarantees that no other token with the
* same id are not going to be minted.
*/
abstract contract ERC1155Supply is ERC1155 {
mapping(uint256 => uint256) private _totalSupply;
/**
* @dev Total amount of tokens in with a given id.
*/
function totalSupply(uint256 id) public view virtual returns (uint256) {
return _totalSupply[id];
}
/**
* @dev Indicates weither any token exist with a given id, or not.
*/
function exists(uint256 id) public view virtual returns (bool) {
return ERC1155Supply.totalSupply(id) > 0;
}
/**
* @dev See {ERC1155-_mint}.
*/
function _mint(
address account,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual override {
super._mint(account, id, amount, data);
_totalSupply[id] += amount;
}
/**
* @dev See {ERC1155-_mintBatch}.
*/
function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual override {
super._mintBatch(to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
_totalSupply[ids[i]] += amounts[i];
}
}
/**
* @dev See {ERC1155-_burn}.
*/
function _burn(
address account,
uint256 id,
uint256 amount
) internal virtual override {
super._burn(account, id, amount);
_totalSupply[id] -= amount;
}
/**
* @dev See {ERC1155-_burnBatch}.
*/
function _burnBatch(
address account,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual override {
super._burnBatch(account, ids, amounts);
for (uint256 i = 0; i < ids.length; ++i) {
_totalSupply[ids[i]] -= amounts[i];
}
}
}
IERC1155MetadataURI.sol 21 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../IERC1155.sol";
/**
* @dev Interface of the optional ERC1155MetadataExtension interface, as defined
* in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP].
*
* _Available since v3.1._
*/
interface IERC1155MetadataURI is IERC1155 {
/**
* @dev Returns the URI for token type `id`.
*
* If the `\{id\}` substring is present in the URI, it must be replaced by
* clients with the actual token type ID.
*/
function uri(uint256 id) external view returns (string memory);
}
Read Contract
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
claimed 0xc884ef83 → bool
contractURI 0xe8a3d485 → string
deadline 0x29dcb0cf → uint256
exists 0x4f558e79 → bool
isApprovedForAll 0xe985e9c5 → bool
name 0x06fdde03 → string
rarity 0x8b58c569 → uint256
supportsInterface 0x01ffc9a7 → bool
symbol 0x95d89b41 → string
totalSupply 0xbd85b039 → uint256
uri 0x0e89341c → string
Write Contract 4 functions
These functions modify contract state and require a wallet transaction to execute.
claim 0x4e71d92d
No parameters
safeBatchTransferFrom 0x2eb2c2d6
address from
address to
uint256[] ids
uint256[] amounts
bytes data
safeTransferFrom 0xf242432a
address from
address to
uint256 id
uint256 amount
bytes data
setApprovalForAll 0xa22cb465
address operator
bool approved
Recent Transactions
No transactions found for this address