Contract is not verified. However, we found a verified contract with the same bytecode in Blockscout DB 0xd88ebefd07bb1c2c62b5c2455be39ff29c60b5af.
All metadata displayed below is from that contract. In order to verify current contract, click Verify & Publish button
Verify & Publish
All metadata displayed below is from that contract. In order to verify current contract, click Verify & Publish button
- Contract name:
- PLSOGCrate
- Optimization enabled
- true
- Compiler version
- v0.8.19+commit.7dd6d404
- Optimization runs
- 200
- Verified at
- 2024-06-14T15:04:17.296386Z
contracts/PlsMafia/OGCrate/OGCrate.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.7;
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol';
import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
contract PLSOGCrate is Ownable, ERC1155URIStorage {
string public name;
string public symbol;
mapping(address => bool) public isAuthorized;
constructor(string memory _name, string memory _symbol) ERC1155('') {
name = _name;
symbol = _symbol;
}
function preMint(address[] memory users, uint256[] memory amounts) external onlyOwner {
uint256 length = users.length;
bytes memory data;
for (uint256 i = 0; i < length; i++) {
_mint(users[i], 0, amounts[i], data);
}
}
function mint(address user, uint256 amount) external {
require(isAuthorized[msg.sender], 'not authorized');
bytes memory data;
_mint(user, 0, amount, data);
}
function setAuthorized(address addr, bool value) external onlyOwner {
isAuthorized[addr] = value;
}
function setTokenURI(string memory uri) external onlyOwner {
_setURI(0, uri);
}
function burn(uint256 amount) external {
_burn(msg.sender, 0, amount);
}
}
@openzeppelin/contracts/utils/Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}
@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/ERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/ERC1155.sol)
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: address zero is not a valid owner");
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 {
_setApprovalForAll(_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 token owner or 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: caller is not token owner or 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();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, to, ids, amounts, 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);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_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);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_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 `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function _mint(address to, uint256 id, uint256 amount, bytes memory data) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
_balances[id][to] += amount;
emit TransferSingle(operator, address(0), to, id, amount);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}.
*
* 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 _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);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
/**
* @dev Destroys `amount` tokens of token type `id` from `from`
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `from` must have at least `amount` tokens of token type `id`.
*/
function _burn(address from, uint256 id, uint256 amount) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
address operator = _msgSender();
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
emit TransferSingle(operator, from, address(0), id, amount);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
*/
function _burnBatch(address from, uint256[] memory ids, uint256[] memory amounts) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = _msgSender();
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
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: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
}
emit TransferBatch(operator, from, address(0), ids, amounts);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
/**
* @dev Approve `operator` to operate on all of `owner` tokens
*
* Emits an {ApprovalForAll} event.
*/
function _setApprovalForAll(address owner, address operator, bool approved) internal virtual {
require(owner != operator, "ERC1155: setting approval status for self");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
/**
* @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 `ids` and `amounts` 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 {}
/**
* @dev Hook that is called after 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 _afterTokenTransfer(
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;
}
}
@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/token/ERC1155/IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)
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.
*
* NOTE: 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.
*
* NOTE: 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);
}
@openzeppelin/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155URIStorage.sol)
pragma solidity ^0.8.0;
import "../../../utils/Strings.sol";
import "../ERC1155.sol";
/**
* @dev ERC1155 token with storage based token URI management.
* Inspired by the ERC721URIStorage extension
*
* _Available since v4.6._
*/
abstract contract ERC1155URIStorage is ERC1155 {
using Strings for uint256;
// Optional base URI
string private _baseURI = "";
// Optional mapping for token URIs
mapping(uint256 => string) private _tokenURIs;
/**
* @dev See {IERC1155MetadataURI-uri}.
*
* This implementation returns the concatenation of the `_baseURI`
* and the token-specific uri if the latter is set
*
* This enables the following behaviors:
*
* - if `_tokenURIs[tokenId]` is set, then the result is the concatenation
* of `_baseURI` and `_tokenURIs[tokenId]` (keep in mind that `_baseURI`
* is empty per default);
*
* - if `_tokenURIs[tokenId]` is NOT set then we fallback to `super.uri()`
* which in most cases will contain `ERC1155._uri`;
*
* - if `_tokenURIs[tokenId]` is NOT set, and if the parents do not have a
* uri value set, then the result is empty.
*/
function uri(uint256 tokenId) public view virtual override returns (string memory) {
string memory tokenURI = _tokenURIs[tokenId];
// If token URI is set, concatenate base URI and tokenURI (via abi.encodePacked).
return bytes(tokenURI).length > 0 ? string(abi.encodePacked(_baseURI, tokenURI)) : super.uri(tokenId);
}
/**
* @dev Sets `tokenURI` as the tokenURI of `tokenId`.
*/
function _setURI(uint256 tokenId, string memory tokenURI) internal virtual {
_tokenURIs[tokenId] = tokenURI;
emit URI(uri(tokenId), tokenId);
}
/**
* @dev Sets `baseURI` as the `_baseURI` for all tokens
*/
function _setBaseURI(string memory baseURI) internal virtual {
_baseURI = baseURI;
}
}
@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol)
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);
}
@openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
@openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or 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 {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// 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
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
@openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
@openzeppelin/contracts/utils/introspection/ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
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;
}
}
@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);
}
@openzeppelin/contracts/utils/math/Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// ā `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// ā `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}
@openzeppelin/contracts/utils/math/SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}
Compiler Settings
{"viaIR":true,"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"string","name":"_name","internalType":"string"},{"type":"string","name":"_symbol","internalType":"string"}]},{"type":"event","name":"ApprovalForAll","inputs":[{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"bool","name":"approved","internalType":"bool","indexed":false}],"anonymous":false},{"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":"TransferBatch","inputs":[{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256[]","name":"ids","internalType":"uint256[]","indexed":false},{"type":"uint256[]","name":"values","internalType":"uint256[]","indexed":false}],"anonymous":false},{"type":"event","name":"TransferSingle","inputs":[{"type":"address","name":"operator","internalType":"address","indexed":true},{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"id","internalType":"uint256","indexed":false},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"URI","inputs":[{"type":"string","name":"value","internalType":"string","indexed":false},{"type":"uint256","name":"id","internalType":"uint256","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balanceOf","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"uint256","name":"id","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256[]","name":"","internalType":"uint256[]"}],"name":"balanceOfBatch","inputs":[{"type":"address[]","name":"accounts","internalType":"address[]"},{"type":"uint256[]","name":"ids","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"burn","inputs":[{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isApprovedForAll","inputs":[{"type":"address","name":"account","internalType":"address"},{"type":"address","name":"operator","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isAuthorized","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mint","inputs":[{"type":"address","name":"user","internalType":"address"},{"type":"uint256","name":"amount","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"name","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"preMint","inputs":[{"type":"address[]","name":"users","internalType":"address[]"},{"type":"uint256[]","name":"amounts","internalType":"uint256[]"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeBatchTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256[]","name":"ids","internalType":"uint256[]"},{"type":"uint256[]","name":"amounts","internalType":"uint256[]"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"safeTransferFrom","inputs":[{"type":"address","name":"from","internalType":"address"},{"type":"address","name":"to","internalType":"address"},{"type":"uint256","name":"id","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setApprovalForAll","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"bool","name":"approved","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setAuthorized","inputs":[{"type":"address","name":"addr","internalType":"address"},{"type":"bool","name":"value","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTokenURI","inputs":[{"type":"string","name":"uri","internalType":"string"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"symbol","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"","internalType":"string"}],"name":"uri","inputs":[{"type":"uint256","name":"tokenId","internalType":"uint256"}]}]
Contract Creation Code
0x6080604052346200038757620021d6803803806200001d816200038c565b928339810190604081830312620003875780516001600160401b03919082811162000387578362000050918301620003b2565b906020938482015184811162000387576200006c9201620003b2565b90604051918483018381108582111762000371576040526000928390528254336001600160a01b0319821681178555906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08580a3600392620000d8845462000424565b92601f9384811162000351575b50818555620000f660045462000424565b84811162000330575b5060006004558051908682116200031c5781906200011f60065462000424565b868111620002eb575b5088908683116001146200028257849262000276575b50508160011b9160001990871b1c1916176006555b815194851162000262576200016a60075462000424565b83811162000226575b5085928511600114620001ba5784955093620001ae575b50508260011b92600019911b1c1916176007555b604051611d5b90816200047b8239f35b0151915038806200018a565b929190601f198516956007855280852094905b8782106200020d5750508460019610620001f2575b50505050811b016007556200019e565b01519060f884600019921b161c1916905538808080620001e2565b80600185978294968601518155019601930190620001cd565b6200025190600783528783208580890160051c8201928a8a1062000258575b0160051c019062000461565b3862000173565b9250819262000245565b634e487b7160e01b81526041600452602490fd5b0151905038806200013e565b600685528985209250601f198416855b8b828210620002d4575050908460019594939210620002bb575b505050811b0160065562000153565b015160001983891b60f8161c19169055388080620002ac565b600185968293968601518155019501930162000292565b6200031590600686528a86208880860160051c8201928d871062000258570160051c019062000461565b3862000128565b634e487b7160e01b83526041600452602483fd5b600483528783206200034a91860160051c81019062000461565b38620000ff565b8583528783206200036a91860160051c81019062000461565b38620000e5565b634e487b7160e01b600052604160045260246000fd5b600080fd5b6040519190601f01601f191682016001600160401b038111838210176200037157604052565b919080601f84011215620003875782516001600160401b0381116200037157602090620003e8601f8201601f191683016200038c565b92818452828287010111620003875760005b8181106200041057508260009394955001015290565b8581018301518482018401528201620003fa565b90600182811c9216801562000456575b60208310146200044057565b634e487b7160e01b600052602260045260246000fd5b91607f169162000434565b8181106200046d575050565b600081556001016200046156fe6040608081526004908136101561001557600080fd5b600091823560e01c908162fdd58e1461125c57816301ffc9a7146111ee57816306fdde03146111445781630e89341c146110425781632eb2c2d614610d2c57816340c10f1914610cbc57816342966c6814610b575781634e1273f414610a58578163711bf9b214610a15578163715018a6146109bb5781637d5a91921461095b5781638da5cb5b1461093357816395d89b411461084a578163a22cb46514610776578163e0df5b6f146104b8578163e985e9c51461046a578163f242432a146101fa578163f2fde38b14610133575063fe9fbb80146100f357600080fd5b3461012f57602036600319011261012f5760209160ff9082906001600160a01b0361011c61128c565b1681526008855220541690519015158152f35b5080fd5b9050346101f65760203660031901126101f65761014e61128c565b906101576116f6565b6001600160a01b039182169283156101a457505082546001600160a01b0319811683178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152fd5b8280fd5b919050346101f65760a03660031901126101f65761021661128c565b8361021f6112a7565b916044359060643560843567ffffffffffffffff81116104665761024690369089016115ce565b926001600160a01b03928316923384148015610447575b6102669061182f565b861690610274821515611892565b61027d81611aa3565b5061028783611aa3565b5080865260209660018852888720858852885283898820546102ab828210156118ec565b83895260018a528a8920878a528a5203898820558187526001885288872083885288528887206102dc85825461194b565b905582858a51848152868b8201527fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628c3392a43b610318578580f35b889587946103598a519788968795869463f23a6e6160e01b9c8d8752339087015260248601526044850152606484015260a0608484015260a48301906114ec565b03925af1869181610418575b506103e75750506001906103776119c1565b6308c379a0146103b4575b506103975750505b3880808381808080808580f35b5162461bcd60e51b8152915081906103b0908201611a4e565b0390fd5b6103bc6119df565b806103c75750610382565b6103b08591855193849362461bcd60e51b855284015260248301906114ec565b6001600160e01b0319160390506103ff57505061038a565b5162461bcd60e51b8152915081906103b0908201611978565b610439919250843d8611610440575b6104318183611345565b810190611958565b9038610365565b503d610427565b508386526002602090815288872033885290528786205460ff1661025d565b8480fd5b50503461012f578060031936011261012f5760ff8160209361048a61128c565b6104926112a7565b6001600160a01b0391821683526002875283832091168252855220549151911615158152f35b83833461012f57602092836003193601126101f65767ffffffffffffffff81358181116104665736602382011215610466576104fd9036906024818601359101611587565b906105066116f6565b8480526005865283852091805191821161076357819061052684546112bd565b601f8111610715575b508790601f83116001146106b25787926106a7575b50508160011b916000199060031b1c19161790555b8280526005845261056b828420611425565b8051909190156106825782519184918054610585816112bd565b9160019180831690811561065557506001146105f1575b505050826105da600080516020611d06833981519152959488856105cb868b9c986105eb9851948592016114c9565b0103601f198101835282611345565b925b519282849384528301906114ec565b0390a280f35b87529192509085907f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b838310610642575050508201850190826105da600080516020611d0683398151915261059c565b80548684018a015291880191810161061b565b60ff1916878b015250505080151502830186019150826105da600080516020611d0683398151915261059c565b5050600080516020611d068339815191529082936105eb6106a1611367565b926105dc565b015190508780610544565b8488528888209250601f198416885b8a8282106106ff5750509084600195949392106106e6575b505050811b019055610559565b015160001960f88460031b161c191690558780806106d9565b60018596829396860151815501950193016106c1565b909150838752878720601f840160051c810191898510610759575b90601f859493920160051c01905b81811061074b575061052f565b88815584935060010161073e565b9091508190610730565b634e487b7160e01b865260418452602486fd5b919050346101f657610787366116c7565b6001600160a01b03909116929091903384146107f6575033845260026020528084208385526020526107c7828286209060ff801983541691151516179055565b5190151581527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a380f35b6020608492519162461bcd60e51b8352820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152fd5b50503461012f578160031936011261012f578051908260075461086c816112bd565b8085529160019180831690811561090b57506001146108ae575b505050610898826108aa940383611345565b519182916020835260208301906114ec565b0390f35b9450600785527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6885b8286106108f3575050506108988260206108aa9582010194610886565b805460208787018101919091529095019481016108d6565b6108aa97508693506020925061089894915060ff191682840152151560051b82010194610886565b50503461012f578160031936011261012f57905490516001600160a01b039091168152602090f35b83346109b85761096a366115ec565b6109726116f6565b815191835b838110610982578480f35b6109b3906109ae6001600160a01b0361099b838661181b565b51166109a7838761181b565b5190611ac8565b6117d3565b610977565b80fd5b83346109b857806003193601126109b8576109d46116f6565b80546001600160a01b03198116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50503461012f57610a5590610a29366116c7565b9190610a336116f6565b60018060a01b03168452600860205283209060ff801983541691151516179055565b80f35b8284346109b857610a68366115ec565b938151855103610b025750805191610a7f83611511565b92610a8c85519485611345565b808452610a9b601f1991611511565b013660208501375b8151811015610aed57610ae890610ad86001600160a01b03610ac5838661181b565b5116610ad1838961181b565b519061174e565b610ae2828661181b565b526117d3565b610aa3565b8351602080825281906108aa90820186611693565b608490602085519162461bcd60e51b8352820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152fd5b9050346101f65760209081600319360112610cb8578035903315610c695784610b938551610b84816112f7565b600181528536818301376117f8565b52610b9d82611aa3565b50848451610baa81611329565b528480526001835283852033865283528385205490828210610c1a575091818592610a559594848052600184528585203386528452038484205583519183835282015233907fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62843392a451611329565b845162461bcd60e51b81529081018490526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b6064820152608490fd5b835162461bcd60e51b8152908101839052602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b6064820152608490fd5b8380fd5b9050346101f657816003193601126101f657610cd661128c565b91338452600860205260ff818520541615610cf85783610a5560243585611ac8565b906020606492519162461bcd60e51b8352820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b6044820152fd5b9050346101f6576003199160a036840112610cb857610d4961128c565b92610d526112a7565b9367ffffffffffffffff9360443585811161103e57610d749036908301611529565b9060643586811161103a57610d8c9036908301611529565b9560843590811161103a57610da490369083016115ce565b936001600160a01b0393841693338514801561101b575b610dc49061182f565b8351885103610fc757881694610ddb861515611892565b895b8a8551821015610e63579089610e578a610e5e948a610e0786610e00818e61181b565b519661181b565b51948083526001908660209383855286862081875285528686205490610e2f838310156118ec565b8387528486528787209087528552038585205583528152828220908d8352522091825461194b565b90556117d3565b610ddd565b50509094939596929197848789518a81527f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb610ea18c830188611693565b91808303602082015280610eb633948b611693565b0390a43b610ec2578880f35b8651948593849363bc197c8160e01b98898652338c87015260248601526044850160a0905260a48501610ef491611693565b82858203016064860152610f0791611693565b90838203016084840152610f1a916114ec565b0381885a94602095f1859181610fa7575b50610f915750506001610f3c6119c1565b6308c379a014610f5a575b6103975750505b38808080808080808880f35b610f626119df565b80610f6d5750610f47565b90506103b091602094505193849362461bcd60e51b855284015260248301906114ec565b6001600160e01b031916036103ff575050610f4e565b610fc091925060203d8111610440576104318183611345565b9038610f2b565b865162461bcd60e51b8152602081850152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608490fd5b50848a5260026020908152878b20338c529052868a205460ff16610dbb565b8880fd5b8780fd5b8391503461012f57602091826003193601126109b8578290823581526005825261106d858220611425565b80511561113557855193828154611083816112bd565b9260019180831690811561111257506001146110b8575b50505050928092826105cb866105da956108aa9851948592016114c9565b825292935090917f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b8383106110fd57505050830182019082816105cb6105da61109a565b805487840187015287959092019181016110e1565b60ff1916888a0152505050508015150284018301915082816105cb6105da61109a565b505050506108aa6106a1611367565b50503461012f578160031936011261012f5780519082600654611166816112bd565b8085529160019180831690811561090b575060011461119157505050610898826108aa940383611345565b9450600685527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f5b8286106111d6575050506108988260206108aa9582010194610886565b805460208787018101919091529095019481016111b9565b9050346101f65760203660031901126101f657359063ffffffff60e01b82168092036101f65760209250636cdb3d1360e11b821491821561124b575b821561123a575b50519015158152f35b6301ffc9a760e01b14915038611231565b6303a24d0760e21b8114925061122a565b50503461012f578060031936011261012f5760209061128561127c61128c565b6024359061174e565b9051908152f35b600435906001600160a01b03821682036112a257565b600080fd5b602435906001600160a01b03821682036112a257565b90600182811c921680156112ed575b60208310146112d757565b634e487b7160e01b600052602260045260246000fd5b91607f16916112cc565b6040810190811067ffffffffffffffff82111761131357604052565b634e487b7160e01b600052604160045260246000fd5b6020810190811067ffffffffffffffff82111761131357604052565b90601f8019910116810190811067ffffffffffffffff82111761131357604052565b604051906000826003549161137b836112bd565b8083529260019081811690811561140357506001146113a4575b506113a292500383611345565b565b6003600090815291507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8483106113e857506113a2935050810160200138611395565b81935090816020925483858a010152019101909185926113cf565b9050602092506113a294915060ff191682840152151560051b82010138611395565b9060405191826000825492611439846112bd565b9081845260019485811690816000146114a65750600114611463575b50506113a292500383611345565b9093915060005260209081600020936000915b81831061148e5750506113a293508201013880611455565b85548884018501529485019487945091830191611476565b9150506113a294506020925060ff191682840152151560051b8201013880611455565b60005b8381106114dc5750506000910152565b81810151838201526020016114cc565b90602091611505815180928185528580860191016114c9565b601f01601f1916010190565b67ffffffffffffffff81116113135760051b60200190565b81601f820112156112a25780359161154083611511565b9261154e6040519485611345565b808452602092838086019260051b8201019283116112a2578301905b828210611578575050505090565b8135815290830190830161156a565b92919267ffffffffffffffff821161131357604051916115b1601f8201601f191660200184611345565b8294818452818301116112a2578281602093846000960137010152565b9080601f830112156112a2578160206115e993359101611587565b90565b9060406003198301126112a25767ffffffffffffffff6004358181116112a257836023820112156112a257806004013561162581611511565b916116336040519384611345565b81835260209160248385019160051b830101918783116112a257602401905b8282106116745750505050926024359182116112a2576115e991600401611529565b81356001600160a01b03811681036112a2578152908301908301611652565b90815180825260208080930193019160005b8281106116b3575050505090565b8351855293810193928101926001016116a5565b60409060031901126112a2576004356001600160a01b03811681036112a2579060243580151581036112a25790565b6000546001600160a01b0316330361170a57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6001600160a01b031690811561177b57600052600160205260406000209060005260205260406000205490565b60405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b6064820152608490fd5b60001981146117e25760010190565b634e487b7160e01b600052601160045260246000fd5b8051156118055760200190565b634e487b7160e01b600052603260045260246000fd5b80518210156118055760209160051b010190565b1561183657565b60405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b6064820152608490fd5b1561189957565b60405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b6064820152608490fd5b156118f357565b60405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b6064820152608490fd5b919082018092116117e257565b908160209103126112a257516001600160e01b0319811681036112a25790565b60809060208152602860208201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b60608201520190565b60009060033d116119ce57565b905060046000803e60005160e01c90565b600060443d106115e957604051600319913d83016004833e815167ffffffffffffffff918282113d602484011117611a3d57818401948551938411611a45573d85010160208487010111611a3d57506115e992910160200190611345565b949350505050565b50949350505050565b60809060208152603460208201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356040820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b60608201520190565b60405190611ab0826112f7565b6001825260203681840137611ac4826117f8565b5290565b6001600160a01b038116918215611cb657611b0390604093845193611aec856112f7565b6001855260209485368183013760009485916117f8565b52611b0d83611aa3565b50838052600185528584208285528552858420611b2b84825461194b565b90558184875181815285888201527fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62893392a43b611b6b575b5050505050565b838551809263f23a6e6160e01b94858352336004840152866024840152866044840152606483015260a06084830152856060518060a4850152815b818110611c9c57509060c484838383839684010152601f801991011681010301925af1839181611c7d575b50611c4d575050600191611be36119c1565b6308c379a014611c17575b5050611c0057505b3880808080611b64565b5162461bcd60e51b8152806103b060048201611a4e565b611c1f6119df565b9182611c2b5750611bee565b846103b091505192839262461bcd60e51b8452600484015260248301906114ec565b6001600160e01b031916039150611c6690505750611bf6565b5162461bcd60e51b8152806103b060048201611978565b611c95919250853d8711610440576104318183611345565b9038611bd1565b608081015187820160c40152899587955089935001611ba6565b60405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b6064820152608490fdfe6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529ba2646970667358221220d44b6ae7a5d6898c6972218274bf926554a91483af1a8395663483743f4798bc64736f6c6343000813003300000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000e4d61666961204f4720437261746500000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000074f47437261746500000000000000000000000000000000000000000000000000
Deployed ByteCode
0x6040608081526004908136101561001557600080fd5b600091823560e01c908162fdd58e1461125c57816301ffc9a7146111ee57816306fdde03146111445781630e89341c146110425781632eb2c2d614610d2c57816340c10f1914610cbc57816342966c6814610b575781634e1273f414610a58578163711bf9b214610a15578163715018a6146109bb5781637d5a91921461095b5781638da5cb5b1461093357816395d89b411461084a578163a22cb46514610776578163e0df5b6f146104b8578163e985e9c51461046a578163f242432a146101fa578163f2fde38b14610133575063fe9fbb80146100f357600080fd5b3461012f57602036600319011261012f5760209160ff9082906001600160a01b0361011c61128c565b1681526008855220541690519015158152f35b5080fd5b9050346101f65760203660031901126101f65761014e61128c565b906101576116f6565b6001600160a01b039182169283156101a457505082546001600160a01b0319811683178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b906020608492519162461bcd60e51b8352820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152fd5b8280fd5b919050346101f65760a03660031901126101f65761021661128c565b8361021f6112a7565b916044359060643560843567ffffffffffffffff81116104665761024690369089016115ce565b926001600160a01b03928316923384148015610447575b6102669061182f565b861690610274821515611892565b61027d81611aa3565b5061028783611aa3565b5080865260209660018852888720858852885283898820546102ab828210156118ec565b83895260018a528a8920878a528a5203898820558187526001885288872083885288528887206102dc85825461194b565b905582858a51848152868b8201527fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628c3392a43b610318578580f35b889587946103598a519788968795869463f23a6e6160e01b9c8d8752339087015260248601526044850152606484015260a0608484015260a48301906114ec565b03925af1869181610418575b506103e75750506001906103776119c1565b6308c379a0146103b4575b506103975750505b3880808381808080808580f35b5162461bcd60e51b8152915081906103b0908201611a4e565b0390fd5b6103bc6119df565b806103c75750610382565b6103b08591855193849362461bcd60e51b855284015260248301906114ec565b6001600160e01b0319160390506103ff57505061038a565b5162461bcd60e51b8152915081906103b0908201611978565b610439919250843d8611610440575b6104318183611345565b810190611958565b9038610365565b503d610427565b508386526002602090815288872033885290528786205460ff1661025d565b8480fd5b50503461012f578060031936011261012f5760ff8160209361048a61128c565b6104926112a7565b6001600160a01b0391821683526002875283832091168252855220549151911615158152f35b83833461012f57602092836003193601126101f65767ffffffffffffffff81358181116104665736602382011215610466576104fd9036906024818601359101611587565b906105066116f6565b8480526005865283852091805191821161076357819061052684546112bd565b601f8111610715575b508790601f83116001146106b25787926106a7575b50508160011b916000199060031b1c19161790555b8280526005845261056b828420611425565b8051909190156106825782519184918054610585816112bd565b9160019180831690811561065557506001146105f1575b505050826105da600080516020611d06833981519152959488856105cb868b9c986105eb9851948592016114c9565b0103601f198101835282611345565b925b519282849384528301906114ec565b0390a280f35b87529192509085907f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b838310610642575050508201850190826105da600080516020611d0683398151915261059c565b80548684018a015291880191810161061b565b60ff1916878b015250505080151502830186019150826105da600080516020611d0683398151915261059c565b5050600080516020611d068339815191529082936105eb6106a1611367565b926105dc565b015190508780610544565b8488528888209250601f198416885b8a8282106106ff5750509084600195949392106106e6575b505050811b019055610559565b015160001960f88460031b161c191690558780806106d9565b60018596829396860151815501950193016106c1565b909150838752878720601f840160051c810191898510610759575b90601f859493920160051c01905b81811061074b575061052f565b88815584935060010161073e565b9091508190610730565b634e487b7160e01b865260418452602486fd5b919050346101f657610787366116c7565b6001600160a01b03909116929091903384146107f6575033845260026020528084208385526020526107c7828286209060ff801983541691151516179055565b5190151581527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a380f35b6020608492519162461bcd60e51b8352820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152fd5b50503461012f578160031936011261012f578051908260075461086c816112bd565b8085529160019180831690811561090b57506001146108ae575b505050610898826108aa940383611345565b519182916020835260208301906114ec565b0390f35b9450600785527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c6885b8286106108f3575050506108988260206108aa9582010194610886565b805460208787018101919091529095019481016108d6565b6108aa97508693506020925061089894915060ff191682840152151560051b82010194610886565b50503461012f578160031936011261012f57905490516001600160a01b039091168152602090f35b83346109b85761096a366115ec565b6109726116f6565b815191835b838110610982578480f35b6109b3906109ae6001600160a01b0361099b838661181b565b51166109a7838761181b565b5190611ac8565b6117d3565b610977565b80fd5b83346109b857806003193601126109b8576109d46116f6565b80546001600160a01b03198116825581906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50503461012f57610a5590610a29366116c7565b9190610a336116f6565b60018060a01b03168452600860205283209060ff801983541691151516179055565b80f35b8284346109b857610a68366115ec565b938151855103610b025750805191610a7f83611511565b92610a8c85519485611345565b808452610a9b601f1991611511565b013660208501375b8151811015610aed57610ae890610ad86001600160a01b03610ac5838661181b565b5116610ad1838961181b565b519061174e565b610ae2828661181b565b526117d3565b610aa3565b8351602080825281906108aa90820186611693565b608490602085519162461bcd60e51b8352820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152fd5b9050346101f65760209081600319360112610cb8578035903315610c695784610b938551610b84816112f7565b600181528536818301376117f8565b52610b9d82611aa3565b50848451610baa81611329565b528480526001835283852033865283528385205490828210610c1a575091818592610a559594848052600184528585203386528452038484205583519183835282015233907fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62843392a451611329565b845162461bcd60e51b81529081018490526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b6064820152608490fd5b835162461bcd60e51b8152908101839052602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b6064820152608490fd5b8380fd5b9050346101f657816003193601126101f657610cd661128c565b91338452600860205260ff818520541615610cf85783610a5560243585611ac8565b906020606492519162461bcd60e51b8352820152600e60248201526d1b9bdd08185d5d1a1bdc9a5e995960921b6044820152fd5b9050346101f6576003199160a036840112610cb857610d4961128c565b92610d526112a7565b9367ffffffffffffffff9360443585811161103e57610d749036908301611529565b9060643586811161103a57610d8c9036908301611529565b9560843590811161103a57610da490369083016115ce565b936001600160a01b0393841693338514801561101b575b610dc49061182f565b8351885103610fc757881694610ddb861515611892565b895b8a8551821015610e63579089610e578a610e5e948a610e0786610e00818e61181b565b519661181b565b51948083526001908660209383855286862081875285528686205490610e2f838310156118ec565b8387528486528787209087528552038585205583528152828220908d8352522091825461194b565b90556117d3565b610ddd565b50509094939596929197848789518a81527f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb610ea18c830188611693565b91808303602082015280610eb633948b611693565b0390a43b610ec2578880f35b8651948593849363bc197c8160e01b98898652338c87015260248601526044850160a0905260a48501610ef491611693565b82858203016064860152610f0791611693565b90838203016084840152610f1a916114ec565b0381885a94602095f1859181610fa7575b50610f915750506001610f3c6119c1565b6308c379a014610f5a575b6103975750505b38808080808080808880f35b610f626119df565b80610f6d5750610f47565b90506103b091602094505193849362461bcd60e51b855284015260248301906114ec565b6001600160e01b031916036103ff575050610f4e565b610fc091925060203d8111610440576104318183611345565b9038610f2b565b865162461bcd60e51b8152602081850152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608490fd5b50848a5260026020908152878b20338c529052868a205460ff16610dbb565b8880fd5b8780fd5b8391503461012f57602091826003193601126109b8578290823581526005825261106d858220611425565b80511561113557855193828154611083816112bd565b9260019180831690811561111257506001146110b8575b50505050928092826105cb866105da956108aa9851948592016114c9565b825292935090917f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b5b8383106110fd57505050830182019082816105cb6105da61109a565b805487840187015287959092019181016110e1565b60ff1916888a0152505050508015150284018301915082816105cb6105da61109a565b505050506108aa6106a1611367565b50503461012f578160031936011261012f5780519082600654611166816112bd565b8085529160019180831690811561090b575060011461119157505050610898826108aa940383611345565b9450600685527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f5b8286106111d6575050506108988260206108aa9582010194610886565b805460208787018101919091529095019481016111b9565b9050346101f65760203660031901126101f657359063ffffffff60e01b82168092036101f65760209250636cdb3d1360e11b821491821561124b575b821561123a575b50519015158152f35b6301ffc9a760e01b14915038611231565b6303a24d0760e21b8114925061122a565b50503461012f578060031936011261012f5760209061128561127c61128c565b6024359061174e565b9051908152f35b600435906001600160a01b03821682036112a257565b600080fd5b602435906001600160a01b03821682036112a257565b90600182811c921680156112ed575b60208310146112d757565b634e487b7160e01b600052602260045260246000fd5b91607f16916112cc565b6040810190811067ffffffffffffffff82111761131357604052565b634e487b7160e01b600052604160045260246000fd5b6020810190811067ffffffffffffffff82111761131357604052565b90601f8019910116810190811067ffffffffffffffff82111761131357604052565b604051906000826003549161137b836112bd565b8083529260019081811690811561140357506001146113a4575b506113a292500383611345565b565b6003600090815291507fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b5b8483106113e857506113a2935050810160200138611395565b81935090816020925483858a010152019101909185926113cf565b9050602092506113a294915060ff191682840152151560051b82010138611395565b9060405191826000825492611439846112bd565b9081845260019485811690816000146114a65750600114611463575b50506113a292500383611345565b9093915060005260209081600020936000915b81831061148e5750506113a293508201013880611455565b85548884018501529485019487945091830191611476565b9150506113a294506020925060ff191682840152151560051b8201013880611455565b60005b8381106114dc5750506000910152565b81810151838201526020016114cc565b90602091611505815180928185528580860191016114c9565b601f01601f1916010190565b67ffffffffffffffff81116113135760051b60200190565b81601f820112156112a25780359161154083611511565b9261154e6040519485611345565b808452602092838086019260051b8201019283116112a2578301905b828210611578575050505090565b8135815290830190830161156a565b92919267ffffffffffffffff821161131357604051916115b1601f8201601f191660200184611345565b8294818452818301116112a2578281602093846000960137010152565b9080601f830112156112a2578160206115e993359101611587565b90565b9060406003198301126112a25767ffffffffffffffff6004358181116112a257836023820112156112a257806004013561162581611511565b916116336040519384611345565b81835260209160248385019160051b830101918783116112a257602401905b8282106116745750505050926024359182116112a2576115e991600401611529565b81356001600160a01b03811681036112a2578152908301908301611652565b90815180825260208080930193019160005b8281106116b3575050505090565b8351855293810193928101926001016116a5565b60409060031901126112a2576004356001600160a01b03811681036112a2579060243580151581036112a25790565b6000546001600160a01b0316330361170a57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b6001600160a01b031690811561177b57600052600160205260406000209060005260205260406000205490565b60405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b6064820152608490fd5b60001981146117e25760010190565b634e487b7160e01b600052601160045260246000fd5b8051156118055760200190565b634e487b7160e01b600052603260045260246000fd5b80518210156118055760209160051b010190565b1561183657565b60405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b6064820152608490fd5b1561189957565b60405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b6064820152608490fd5b156118f357565b60405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b6064820152608490fd5b919082018092116117e257565b908160209103126112a257516001600160e01b0319811681036112a25790565b60809060208152602860208201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b60608201520190565b60009060033d116119ce57565b905060046000803e60005160e01c90565b600060443d106115e957604051600319913d83016004833e815167ffffffffffffffff918282113d602484011117611a3d57818401948551938411611a45573d85010160208487010111611a3d57506115e992910160200190611345565b949350505050565b50949350505050565b60809060208152603460208201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356040820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b60608201520190565b60405190611ab0826112f7565b6001825260203681840137611ac4826117f8565b5290565b6001600160a01b038116918215611cb657611b0390604093845193611aec856112f7565b6001855260209485368183013760009485916117f8565b52611b0d83611aa3565b50838052600185528584208285528552858420611b2b84825461194b565b90558184875181815285888201527fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62893392a43b611b6b575b5050505050565b838551809263f23a6e6160e01b94858352336004840152866024840152866044840152606483015260a06084830152856060518060a4850152815b818110611c9c57509060c484838383839684010152601f801991011681010301925af1839181611c7d575b50611c4d575050600191611be36119c1565b6308c379a014611c17575b5050611c0057505b3880808080611b64565b5162461bcd60e51b8152806103b060048201611a4e565b611c1f6119df565b9182611c2b5750611bee565b846103b091505192839262461bcd60e51b8452600484015260248301906114ec565b6001600160e01b031916039150611c6690505750611bf6565b5162461bcd60e51b8152806103b060048201611978565b611c95919250853d8711610440576104318183611345565b9038611bd1565b608081015187820160c40152899587955089935001611ba6565b60405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b6064820152608490fdfe6bb7ff708619ba0610cba295a58592e0451dee2622938c8755667688daf3529ba2646970667358221220d44b6ae7a5d6898c6972218274bf926554a91483af1a8395663483743f4798bc64736f6c63430008130033