Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- GameNftCollection
- Optimization enabled
- true
- Compiler version
- v0.8.9+commit.e5eed63a
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2024-03-13T03:49:23.752742Z
Constructor Arguments
0x000000000000000000000000a0782ea41afe61e9aac45a408e51d9ed1b3eda07
Arg [0] (address) : 0xa0782ea41afe61e9aac45a408e51d9ed1b3eda07
contracts/gesoten-nft-game-collection.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract GameNftCollection is Ownable { IERC1155 public erc1155Contract; address public erc1155ContractAddress; event PackOpened(address indexed user, uint256[] tokenIds, uint256[] amounts); constructor(address _erc1155ContractAddress) { erc1155ContractAddress = _erc1155ContractAddress; erc1155Contract = IERC1155(_erc1155ContractAddress); } function openPack(address to, uint256[] memory tokenIds, uint256[] memory amounts, bytes memory data) external onlyOwner { require(to != address(0), "Invalid receiver address"); require(erc1155ContractAddress != address(0), "ERC1155 contract address not set"); require(tokenIds.length == amounts.length, "Arrays length mismatch"); (bool success, ) = erc1155ContractAddress.call( abi.encodeWithSignature("mintBatch(address,uint256[],uint256[],bytes)", to, tokenIds, amounts, data) ); require(success, "MintBatch call failed"); emit PackOpened(to, tokenIds, amounts); } function setERC1155Contract(address _erc1155ContractAddress) external onlyOwner { require(_erc1155ContractAddress != address(0), "Invalid address"); erc1155ContractAddress = _erc1155ContractAddress; erc1155Contract = IERC1155(_erc1155ContractAddress); } function getERC1155ContractAddress() external view returns (address) { return erc1155ContractAddress; } }
@openzeppelin/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) 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() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(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"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
@openzeppelin/contracts/token/ERC1155/IERC1155.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol) 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 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; }
@openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) 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; } }
@openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) 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); }
Compiler Settings
{"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_erc1155ContractAddress","internalType":"address"}]},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"PackOpened","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256[]","name":"tokenIds","internalType":"uint256[]","indexed":false},{"type":"uint256[]","name":"amounts","internalType":"uint256[]","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract IERC1155"}],"name":"erc1155Contract","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"erc1155ContractAddress","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getERC1155ContractAddress","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"openPack","inputs":[{"type":"address","name":"to","internalType":"address"},{"type":"uint256[]","name":"tokenIds","internalType":"uint256[]"},{"type":"uint256[]","name":"amounts","internalType":"uint256[]"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setERC1155Contract","inputs":[{"type":"address","name":"_erc1155ContractAddress","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b5060405161095d38038061095d83398101604081905261002f916100b7565b61003833610067565b600280546001600160a01b039092166001600160a01b03199283168117909155600180549092161790556100e7565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156100c957600080fd5b81516001600160a01b03811681146100e057600080fd5b9392505050565b610867806100f66000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c806383cf55761161005b57806383cf5576146100ec5780638da5cb5b146100fd578063ea3f17211461010e578063f2fde38b1461012157600080fd5b80634a76506a1461008d578063706029d2146100a2578063715018a6146100b55780637a564970146100bd575b600080fd5b6100a061009b366004610539565b610134565b005b6100a06100b0366004610622565b6101b5565b6100a06103e6565b6001546100d0906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6002546001600160a01b03166100d0565b6000546001600160a01b03166100d0565b6002546100d0906001600160a01b031681565b6100a061012f366004610539565b6103fa565b61013c610473565b6001600160a01b0381166101895760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b60448201526064015b60405180910390fd5b600280546001600160a01b039092166001600160a01b0319928316811790915560018054909216179055565b6101bd610473565b6001600160a01b0384166102135760405162461bcd60e51b815260206004820152601860248201527f496e76616c6964207265636569766572206164647265737300000000000000006044820152606401610180565b6002546001600160a01b031661026b5760405162461bcd60e51b815260206004820181905260248201527f4552433131353520636f6e74726163742061646472657373206e6f74207365746044820152606401610180565b81518351146102b55760405162461bcd60e51b8152602060048201526016602482015275082e4e4c2f2e640d8cadccee8d040dad2e6dac2e8c6d60531b6044820152606401610180565b6002546040516000916001600160a01b0316906102dc90879087908790879060240161077c565b60408051601f198184030181529181526020820180516001600160e01b0316630fbfeffd60e11b1790525161031191906107e7565b6000604051808303816000865af19150503d806000811461034e576040519150601f19603f3d011682016040523d82523d6000602084013e610353565b606091505b505090508061039c5760405162461bcd60e51b8152602060048201526015602482015274135a5b9d10985d18da0818d85b1b0819985a5b1959605a1b6044820152606401610180565b846001600160a01b03167ff7abfe87506a99dfe239c7c8cdb614b8c0bd515135b3897f983d0dd4c657aeaf85856040516103d7929190610803565b60405180910390a25050505050565b6103ee610473565b6103f860006104cd565b565b610402610473565b6001600160a01b0381166104675760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610180565b610470816104cd565b50565b6000546001600160a01b031633146103f85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610180565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461053457600080fd5b919050565b60006020828403121561054b57600080fd5b6105548261051d565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561059a5761059a61055b565b604052919050565b600082601f8301126105b357600080fd5b8135602067ffffffffffffffff8211156105cf576105cf61055b565b8160051b6105de828201610571565b92835284810182019282810190878511156105f857600080fd5b83870192505b84831015610617578235825291830191908301906105fe565b979650505050505050565b6000806000806080858703121561063857600080fd5b6106418561051d565b935060208086013567ffffffffffffffff8082111561065f57600080fd5b61066b89838a016105a2565b9550604088013591508082111561068157600080fd5b61068d89838a016105a2565b945060608801359150808211156106a357600080fd5b818801915088601f8301126106b757600080fd5b8135818111156106c9576106c961055b565b6106db601f8201601f19168501610571565b915080825289848285010111156106f157600080fd5b808484018584013760008482840101525080935050505092959194509250565b600081518084526020808501945080840160005b8381101561074157815187529582019590820190600101610725565b509495945050505050565b60005b8381101561076757818101518382015260200161074f565b83811115610776576000848401525b50505050565b6001600160a01b03851681526080602082018190526000906107a090830186610711565b82810360408401526107b28186610711565b9050828103606084015283518082526107d281602084016020880161074c565b601f01601f1916016020019695505050505050565b600082516107f981846020870161074c565b9190910192915050565b6040815260006108166040830185610711565b82810360208401526108288185610711565b9594505050505056fea26469706673582212209b65725bab678f9ab791ebfac4a90722d72ac5e36815347b9bc96cc6066f534564736f6c63430008090033000000000000000000000000a0782ea41afe61e9aac45a408e51d9ed1b3eda07
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100885760003560e01c806383cf55761161005b57806383cf5576146100ec5780638da5cb5b146100fd578063ea3f17211461010e578063f2fde38b1461012157600080fd5b80634a76506a1461008d578063706029d2146100a2578063715018a6146100b55780637a564970146100bd575b600080fd5b6100a061009b366004610539565b610134565b005b6100a06100b0366004610622565b6101b5565b6100a06103e6565b6001546100d0906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b6002546001600160a01b03166100d0565b6000546001600160a01b03166100d0565b6002546100d0906001600160a01b031681565b6100a061012f366004610539565b6103fa565b61013c610473565b6001600160a01b0381166101895760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b60448201526064015b60405180910390fd5b600280546001600160a01b039092166001600160a01b0319928316811790915560018054909216179055565b6101bd610473565b6001600160a01b0384166102135760405162461bcd60e51b815260206004820152601860248201527f496e76616c6964207265636569766572206164647265737300000000000000006044820152606401610180565b6002546001600160a01b031661026b5760405162461bcd60e51b815260206004820181905260248201527f4552433131353520636f6e74726163742061646472657373206e6f74207365746044820152606401610180565b81518351146102b55760405162461bcd60e51b8152602060048201526016602482015275082e4e4c2f2e640d8cadccee8d040dad2e6dac2e8c6d60531b6044820152606401610180565b6002546040516000916001600160a01b0316906102dc90879087908790879060240161077c565b60408051601f198184030181529181526020820180516001600160e01b0316630fbfeffd60e11b1790525161031191906107e7565b6000604051808303816000865af19150503d806000811461034e576040519150601f19603f3d011682016040523d82523d6000602084013e610353565b606091505b505090508061039c5760405162461bcd60e51b8152602060048201526015602482015274135a5b9d10985d18da0818d85b1b0819985a5b1959605a1b6044820152606401610180565b846001600160a01b03167ff7abfe87506a99dfe239c7c8cdb614b8c0bd515135b3897f983d0dd4c657aeaf85856040516103d7929190610803565b60405180910390a25050505050565b6103ee610473565b6103f860006104cd565b565b610402610473565b6001600160a01b0381166104675760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610180565b610470816104cd565b50565b6000546001600160a01b031633146103f85760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610180565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80356001600160a01b038116811461053457600080fd5b919050565b60006020828403121561054b57600080fd5b6105548261051d565b9392505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561059a5761059a61055b565b604052919050565b600082601f8301126105b357600080fd5b8135602067ffffffffffffffff8211156105cf576105cf61055b565b8160051b6105de828201610571565b92835284810182019282810190878511156105f857600080fd5b83870192505b84831015610617578235825291830191908301906105fe565b979650505050505050565b6000806000806080858703121561063857600080fd5b6106418561051d565b935060208086013567ffffffffffffffff8082111561065f57600080fd5b61066b89838a016105a2565b9550604088013591508082111561068157600080fd5b61068d89838a016105a2565b945060608801359150808211156106a357600080fd5b818801915088601f8301126106b757600080fd5b8135818111156106c9576106c961055b565b6106db601f8201601f19168501610571565b915080825289848285010111156106f157600080fd5b808484018584013760008482840101525080935050505092959194509250565b600081518084526020808501945080840160005b8381101561074157815187529582019590820190600101610725565b509495945050505050565b60005b8381101561076757818101518382015260200161074f565b83811115610776576000848401525b50505050565b6001600160a01b03851681526080602082018190526000906107a090830186610711565b82810360408401526107b28186610711565b9050828103606084015283518082526107d281602084016020880161074c565b601f01601f1916016020019695505050505050565b600082516107f981846020870161074c565b9190910192915050565b6040815260006108166040830185610711565b82810360208401526108288185610711565b9594505050505056fea26469706673582212209b65725bab678f9ab791ebfac4a90722d72ac5e36815347b9bc96cc6066f534564736f6c63430008090033