Address Contract Partially Verified
Address
0x49B3bCaCBa13557500B63Cb7E0757086aA87B602
Balance
0 ETH
Nonce
1
Code Size
7986 bytes
Creator
0xA26F815a...8DFD at tx 0xd0ad71f3...c4dd76
Indexed Transactions
0
Contract Bytecode
7986 bytes
0x608060405234801561001057600080fd5b50600436106101365760003560e01c80637c69e207116100b8578063adf2131b1161007c578063adf2131b1461024c578063c884ef8314610254578063e1a283d614610267578063e985e9c51461026f578063f242432a14610282578063f2fde38b1461029557610136565b80637c69e2071461020e5780637d55094d146102165780638da5cb5b1461021e57806399dfdb3e14610226578063a22cb4651461023957610136565b806349a772b5116100ff57806349a772b5146101c15780634e1273f4146101c9578063582abd12146101e9578063715018a6146101fe5780637b8edb5e1461020657610136565b8062fdd58e1461013b57806301ffc9a7146101645780630e89341c146101845780632eb2c2d6146101a45780633f879faf146101b9575b600080fd5b61014e61014936600461149e565b6102a8565b60405161015b9190611ccd565b60405180910390f35b610177610172366004611585565b6102ff565b60405161015b91906117cd565b6101976101923660046115bd565b610347565b60405161015b91906117f6565b6101b76101b236600461135b565b6103db565b005b61014e610439565b61014e61043f565b6101dc6101d73660046114c7565b610445565b60405161015b919061178c565b6101f1610565565b60405161015b91906116d5565b6101b7610589565b61014e6105d4565b6101b76105d9565b6101b76106b3565b6101f1610713565b6101b76102343660046115d5565b610723565b6101b7610247366004611464565b610883565b610177610951565b610177610262366004611308565b610961565b610177610976565b61017761027d366004611329565b610986565b6101b7610290366004611401565b6109b4565b6101b76102a3366004611308565b610a0b565b60006001600160a01b0383166102d95760405162461bcd60e51b81526004016102d0906118cd565b60405180910390fd5b506000908152602081815260408083206001600160a01b03949094168352929052205490565b60006001600160e01b03198216636cdb3d1360e11b148061033057506001600160e01b031982166303a24d0760e21b145b8061033f575061033f82610a7c565b90505b919050565b60606002805461035690611d99565b80601f016020809104026020016040519081016040528092919081815260200182805461038290611d99565b80156103cf5780601f106103a4576101008083540402835291602001916103cf565b820191906000526020600020905b8154815290600101906020018083116103b257829003601f168201915b50505050509050919050565b6103e3610a95565b6001600160a01b0316856001600160a01b0316148061040957506104098561027d610a95565b6104255760405162461bcd60e51b81526004016102d0906119ec565b6104328585858585610a99565b5050505050565b6102bc81565b60065481565b606081518351146104685760405162461bcd60e51b81526004016102d090611b96565b6000835167ffffffffffffffff81111561049257634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156104bb578160200160208202803683370190505b50905060005b845181101561055d576105228582815181106104ed57634e487b7160e01b600052603260045260246000fd5b602002602001015185838151811061051557634e487b7160e01b600052603260045260246000fd5b60200260200101516102a8565b82828151811061054257634e487b7160e01b600052603260045260246000fd5b602090810291909101015261055681611dd4565b90506104c1565b509392505050565b7f000000000000000000000000c04b4a394305cff3e69446a28f8cc4bd53ecf34281565b610591610a95565b6001600160a01b03166105a2610713565b6001600160a01b0316146105c85760405162461bcd60e51b81526004016102d090611ab6565b6105d26000610c6a565b565b600981565b6105e1610a95565b6001600160a01b03166105f2610713565b6001600160a01b0316146106185760405162461bcd60e51b81526004016102d090611ab6565b600454600160a81b900460ff16156106425760405162461bcd60e51b81526004016102d0906118a5565b6004805460ff60a81b1916600160a81b17815560005b600981101561068e5761067c33828460405180602001604052806000815250610cbc565b8061068681611dd4565b915050610658565b5061069a816009611d4a565b600660008282546106ab9190611d32565b909155505050565b6106bb610a95565b6001600160a01b03166106cc610713565b6001600160a01b0316146106f25760405162461bcd60e51b81526004016102d090611ab6565b6004805460ff60a01b198116600160a01b9182900460ff1615909102179055565b6004546001600160a01b03165b90565b600260035414156107465760405162461bcd60e51b81526004016102d090611c68565b60026003556006546102bc1161076e5760405162461bcd60e51b81526004016102d090611c9f565b600454600160a01b900460ff16156107985760405162461bcd60e51b81526004016102d090611b22565b3360009081526005602052604090205460ff16156107c85760405162461bcd60e51b81526004016102d090611aeb565b6107d433848484610dab565b6107f05760405162461bcd60e51b81526004016102d090611a3e565b6000600933444260405160200161080993929190611674565b6040516020818303038152906040528051906020012060001c61082c9190611def565b336000908152600560205260408120805460ff19166001179055600680549293509061085783611dd4565b91905055506108783382600160405180602001604052806000815250610cbc565b505060016003555050565b816001600160a01b0316610895610a95565b6001600160a01b031614156108bc5760405162461bcd60e51b81526004016102d090611b4d565b80600160006108c9610a95565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff19169215159290921790915561090d610a95565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405161094591906117cd565b60405180910390a35050565b600454600160a81b900460ff1681565b60056020526000908152604090205460ff1681565b600454600160a01b900460ff1681565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205460ff1690565b6109bc610a95565b6001600160a01b0316856001600160a01b031614806109e257506109e28561027d610a95565b6109fe5760405162461bcd60e51b81526004016102d09061195e565b6104328585858585610ea8565b610a13610a95565b6001600160a01b0316610a24610713565b6001600160a01b031614610a4a5760405162461bcd60e51b81526004016102d090611ab6565b6001600160a01b038116610a705760405162461bcd60e51b81526004016102d090611918565b610a7981610c6a565b50565b6001600160e01b031981166301ffc9a760e01b14919050565b3390565b8151835114610aba5760405162461bcd60e51b81526004016102d090611bdf565b6001600160a01b038416610ae05760405162461bcd60e51b81526004016102d0906119a7565b6000610aea610a95565b9050610afa818787878787610c62565b60005b8451811015610bfc576000858281518110610b2857634e487b7160e01b600052603260045260246000fd5b602002602001015190506000858381518110610b5457634e487b7160e01b600052603260045260246000fd5b602090810291909101810151600084815280835260408082206001600160a01b038e168352909352919091205490915081811015610ba45760405162461bcd60e51b81526004016102d090611a6c565b6000838152602081815260408083206001600160a01b038e8116855292528083208585039055908b16825281208054849290610be1908490611d32565b9250508190555050505080610bf590611dd4565b9050610afd565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051610c4c92919061179f565b60405180910390a4610c62818787878787610fdc565b505050505050565b600480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6001600160a01b038416610ce25760405162461bcd60e51b81526004016102d090611c27565b6000610cec610a95565b9050610d0d81600087610cfe886110ea565b610d07886110ea565b87610c62565b6000848152602081815260408083206001600160a01b038916845290915281208054859290610d3d908490611d32565b92505081905550846001600160a01b031660006001600160a01b0316826001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628787604051610d94929190611cd6565b60405180910390a461043281600087878787611143565b6000806040518060400160405280601c81526020017f19457468657265756d205369676e6564204d6573736167653a0a323000000000815250905060008187604051602001610dfb92919061169e565b604051602081830303815290604052805190602001209050600060018288888860405160008152602001604052604051610e3894939291906117d8565b6020604051602081039080840390855afa158015610e5a573d6000803e3d6000fd5b5050506020604051035190507f000000000000000000000000c04b4a394305cff3e69446a28f8cc4bd53ecf3426001600160a01b0316816001600160a01b0316149350505050949350505050565b6001600160a01b038416610ece5760405162461bcd60e51b81526004016102d0906119a7565b6000610ed8610a95565b9050610ee9818787610cfe886110ea565b6000848152602081815260408083206001600160a01b038a16845290915290205483811015610f2a5760405162461bcd60e51b81526004016102d090611a6c565b6000858152602081815260408083206001600160a01b038b8116855292528083208785039055908816825281208054869290610f67908490611d32565b92505081905550856001600160a01b0316876001600160a01b0316836001600160a01b03167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628888604051610fbd929190611cd6565b60405180910390a4610fd3828888888888611143565b50505050505050565b610fee846001600160a01b0316611214565b15610c625760405163bc197c8160e01b81526001600160a01b0385169063bc197c819061102790899089908890889088906004016116e9565b602060405180830381600087803b15801561104157600080fd5b505af1925050508015611071575060408051601f3d908101601f1916820190925261106e918101906115a1565b60015b6110ba5761107d611e41565b8061108857506110a2565b8060405162461bcd60e51b81526004016102d091906117f6565b60405162461bcd60e51b81526004016102d090611809565b6001600160e01b0319811663bc197c8160e01b14610fd35760405162461bcd60e51b81526004016102d09061185d565b6040805160018082528183019092526060916000919060208083019080368337019050509050828160008151811061113257634e487b7160e01b600052603260045260246000fd5b602090810291909101015292915050565b611155846001600160a01b0316611214565b15610c625760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e619061118e9089908990889088908890600401611747565b602060405180830381600087803b1580156111a857600080fd5b505af19250505080156111d8575060408051601f3d908101601f191682019092526111d5918101906115a1565b60015b6111e45761107d611e41565b6001600160e01b0319811663f23a6e6160e01b14610fd35760405162461bcd60e51b81526004016102d09061185d565b3b151590565b80356001600160a01b038116811461034257600080fd5b600082601f830112611241578081fd5b8135602061125661125183611d0e565b611ce4565b8281528181019085830183850287018401881015611272578586fd5b855b8581101561129057813584529284019290840190600101611274565b5090979650505050505050565b600082601f8301126112ad578081fd5b813567ffffffffffffffff8111156112c7576112c7611e25565b6112da601f8201601f1916602001611ce4565b8181528460208386010111156112ee578283fd5b816020850160208301379081016020019190915292915050565b600060208284031215611319578081fd5b6113228261121a565b9392505050565b6000806040838503121561133b578081fd5b6113448361121a565b91506113526020840161121a565b90509250929050565b600080600080600060a08688031215611372578081fd5b61137b8661121a565b94506113896020870161121a565b9350604086013567ffffffffffffffff808211156113a5578283fd5b6113b189838a01611231565b945060608801359150808211156113c6578283fd5b6113d289838a01611231565b935060808801359150808211156113e7578283fd5b506113f48882890161129d565b9150509295509295909350565b600080600080600060a08688031215611418578081fd5b6114218661121a565b945061142f6020870161121a565b93506040860135925060608601359150608086013567ffffffffffffffff811115611458578182fd5b6113f48882890161129d565b60008060408385031215611476578182fd5b61147f8361121a565b915060208301358015158114611493578182fd5b809150509250929050565b600080604083850312156114b0578182fd5b6114b98361121a565b946020939093013593505050565b600080604083850312156114d9578182fd5b823567ffffffffffffffff808211156114f0578384fd5b818501915085601f830112611503578384fd5b8135602061151361125183611d0e565b82815281810190858301838502870184018b101561152f578889fd5b8896505b84871015611558576115448161121a565b835260019690960195918301918301611533565b509650508601359250508082111561156e578283fd5b5061157b85828601611231565b9150509250929050565b600060208284031215611596578081fd5b813561132281611ee6565b6000602082840312156115b2578081fd5b815161132281611ee6565b6000602082840312156115ce578081fd5b5035919050565b6000806000606084860312156115e9578081fd5b833560ff811681146115f9578182fd5b95602085013595506040909401359392505050565b6000815180845260208085019450808401835b8381101561163d57815187529582019590820190600101611621565b509495945050505050565b60008151808452611660816020860160208601611d69565b601f01601f19169290920160200192915050565b60609390931b6bffffffffffffffffffffffff191683526014830191909152603482015260540190565b600083516116b0818460208801611d69565b60609390931b6bffffffffffffffffffffffff19169190920190815260140192915050565b6001600160a01b0391909116815260200190565b6001600160a01b0386811682528516602082015260a0604082018190526000906117159083018661160e565b8281036060840152611727818661160e565b9050828103608084015261173b8185611648565b98975050505050505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061178190830184611648565b979650505050505050565b600060208252611322602083018461160e565b6000604082526117b2604083018561160e565b82810360208401526117c4818561160e565b95945050505050565b901515815260200190565b93845260ff9290921660208401526040830152606082015260800190565b6000602082526113226020830184611648565b60208082526034908201527f455243313135353a207472616e7366657220746f206e6f6e20455243313135356040820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b606082015260800190565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b6020808252600e908201526d105b1c9958591e481b5a5b9d195960921b604082015260600190565b6020808252602b908201527f455243313135353a2062616c616e636520717565727920666f7220746865207a60408201526a65726f206164647265737360a81b606082015260800190565b60208082526026908201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160408201526564647265737360d01b606082015260800190565b60208082526029908201527f455243313135353a2063616c6c6572206973206e6f74206f776e6572206e6f7260408201526808185c1c1c9bdd995960ba1b606082015260800190565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b60208082526032908201527f455243313135353a207472616e736665722063616c6c6572206973206e6f74206040820152711bdddb995c881b9bdc88185c1c1c9bdd995960721b606082015260800190565b60208082526014908201527314da59db985d1d5c99481a5cc81a5b9d985b1a5960621b604082015260600190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526018908201527f596f75206861766520616c726561647920636c61696d65640000000000000000604082015260600190565b602080825260119082015270135a5b9d1a5b99c81a5cc81c185d5cd959607a1b604082015260600190565b60208082526029908201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604082015268103337b91039b2b63360b91b606082015260800190565b60208082526029908201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604082015268040dad2e6dac2e8c6d60bb1b606082015260800190565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206040820152670dad2e6dac2e8c6d60c31b606082015260800190565b60208082526021908201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736040820152607360f81b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b602080825260149082015273135a5b9d1a5b99c81a5cc818dbdb98db1d59195960621b604082015260600190565b90815260200190565b918252602082015260400190565b60405181810167ffffffffffffffff81118282101715611d0657611d06611e25565b604052919050565b600067ffffffffffffffff821115611d2857611d28611e25565b5060209081020190565b60008219821115611d4557611d45611e0f565b500190565b6000816000190483118215151615611d6457611d64611e0f565b500290565b60005b83811015611d84578181015183820152602001611d6c565b83811115611d93576000848401525b50505050565b600281046001821680611dad57607f821691505b60208210811415611dce57634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415611de857611de8611e0f565b5060010190565b600082611e0a57634e487b7160e01b81526012600452602481fd5b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60e01c90565b600060443d1015611e5157610720565b600481823e6308c379a0611e658251611e3b565b14611e6f57610720565b6040513d600319016004823e80513d67ffffffffffffffff8160248401118184111715611e9f5750505050610720565b82840192508251915080821115611eb95750505050610720565b503d83016020828401011115611ed157505050610720565b601f01601f1916810160200160405291505090565b6001600160e01b031981168114610a7957600080fdfea2646970667358221220d6e24f2b7fa28059e7f0c5b3f11f81d053b5ef655294596bb3b64ba0a1fde3d664736f6c63430008000033
Verified Source Code Partial Match
Compiler: v0.8.0+commit.c7dfd78e
EVM: istanbul
Optimization: Yes (200 runs)
SignedPhotoNFT.sol 67 lines
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
contract SignedPhotoNFT is ERC1155, ReentrancyGuard, Ownable {
uint256 public constant MAX_MINTABLE = 700;
uint256 public constant NO_OF_TYPES = 9;
address public immutable SIGNER;
bool public mintingPaused = false;
bool public devMinted = false;
mapping(address => bool) public claimed;
uint256 public numberMinted;
constructor(address signer) ERC1155("ipfs://QmZ2tsEATkcLmz3gkX5TXgqRTdFG674W3A9thP2duEEbAj/{id}.json") {
SIGNER = signer;
}
/**
* @dev Premints
*/
function devMint() external onlyOwner {
require(devMinted == false, "Already minted");
uint256 devmintPerType = 4;
devMinted = true;
for (uint256 i = 0; i < NO_OF_TYPES; i++) {
_mint(msg.sender, i, devmintPerType, "");
}
numberMinted += NO_OF_TYPES * devmintPerType;
}
/**
* @dev Pauses / Unpauses minting.
*/
function toggleMinting() external onlyOwner {
mintingPaused = !mintingPaused;
}
/**
* @dev Mints an NFT of a certain type (Pseudo-randomly determined).
* Signature parameters representing signed data comprising the minter's address, by the SIGNER address
*/
function mint(uint8 v, bytes32 r, bytes32 s) external nonReentrant {
require(numberMinted < MAX_MINTABLE, "Minting is concluded");
require(!mintingPaused, "Minting is paused");
require(!claimed[msg.sender], "You have already claimed");
require(verify(msg.sender, v, r, s), "Signature is invalid");
uint256 tokenType = uint(keccak256(abi.encodePacked(msg.sender, block.difficulty, block.timestamp))) % NO_OF_TYPES;
claimed[msg.sender] = true;
numberMinted++;
_mint(msg.sender, tokenType, 1, "");
}
/**
* @dev Verifies if the given signature matches the _sender address and is by the SIGNER.
*/
function verify(address _sender, uint8 _v, bytes32 _r, bytes32 _s) internal view returns (bool) {
bytes memory prefix = "\x19Ethereum Signed Message:\n20";
bytes32 prefixedHash = keccak256(abi.encodePacked(prefix, _sender));
address signer = ecrecover(prefixedHash, _v, _r, _s);
return signer == SIGNER;
}
}
Address.sol 216 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);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal 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;
}
}
Ownable.sol 71 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_setOwner(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_setOwner(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_setOwner(newOwner);
}
function _setOwner(address newOwner) private {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
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.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.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;
}
ReentrancyGuard.sol 62 lines
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and make it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
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);
}
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
MAX_MINTABLE 0x3f879faf → uint256
NO_OF_TYPES 0x7b8edb5e → uint256
SIGNER 0x582abd12 → address
balanceOf 0x00fdd58e → uint256
balanceOfBatch 0x4e1273f4 → uint256[]
claimed 0xc884ef83 → bool
devMinted 0xadf2131b → bool
isApprovedForAll 0xe985e9c5 → bool
mintingPaused 0xe1a283d6 → bool
numberMinted 0x49a772b5 → uint256
owner 0x8da5cb5b → address
supportsInterface 0x01ffc9a7 → bool
uri 0x0e89341c → string
Write Contract 8 functions
These functions modify contract state and require a wallet transaction to execute.
devMint 0x7c69e207
No parameters
mint 0x99dfdb3e
uint8 v
bytes32 r
bytes32 s
renounceOwnership 0x715018a6
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
toggleMinting 0x7d55094d
No parameters
transferOwnership 0xf2fde38b
address newOwner
Recent Transactions
No transactions found for this address