Source Code
Overview
POL Balance
More Info
ContractCreator
Multichain Info
N/A
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0xac9aCe08...84f4c623b The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
CustomCollection
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
No with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // _____ _____ _____ ____ _ _ // /\ / ____|/ ____|_ _/ __ \| \ | | // / \ | (___ | | | || | | | \| | // / /\ \ \___ \| | | || | | | . ` | // / ____ \ ____) | |____ _| || |__| | |\ | // /_/ \_\_____/ \_____|_____\____/|_| \_| // // This smart contract is part of the Ascion ecosystem. // It facilitates the integration of blockchain technology // into the Ascion game, providing secure and efficient // management of in-game assets. // Visit https://ascion.space for more information. pragma solidity ^0.8.24; import "./Collection.sol"; // Import the base contract contract CustomCollection is Collection { // Constructor to initialize the CustomCollection constructor(string memory _name, string memory _symbol, string memory _uri, address _owner, address _forwarder) Collection(_name, _symbol, _uri, _owner, _forwarder) { } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/AccessControl.sol) pragma solidity ^0.8.20; import {IAccessControl} from "./IAccessControl.sol"; import {Context} from "../utils/Context.sol"; import {ERC165} from "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address account => bool) hasRole; bytes32 adminRole; } mapping(bytes32 role => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with an {AccessControlUnauthorizedAccount} error including the required role. */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual returns (bool) { return _roles[role].hasRole[account]; } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `_msgSender()` * is missing `role`. Overriding this function changes the behavior of the {onlyRole} modifier. */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Reverts with an {AccessControlUnauthorizedAccount} error if `account` * is missing `role`. */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert AccessControlUnauthorizedAccount(account, role); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address callerConfirmation) public virtual { if (callerConfirmation != _msgSender()) { revert AccessControlBadConfirmation(); } _revokeRole(role, callerConfirmation); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Attempts to grant `role` to `account` and returns a boolean indicating if `role` was granted. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual returns (bool) { if (!hasRole(role, account)) { _roles[role].hasRole[account] = true; emit RoleGranted(role, account, _msgSender()); return true; } else { return false; } } /** * @dev Attempts to revoke `role` to `account` and returns a boolean indicating if `role` was revoked. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual returns (bool) { if (hasRole(role, account)) { _roles[role].hasRole[account] = false; emit RoleRevoked(role, account, _msgSender()); return true; } else { return false; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/IAccessControl.sol) pragma solidity ^0.8.20; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev The `account` is missing a role. */ error AccessControlUnauthorizedAccount(address account, bytes32 neededRole); /** * @dev The caller of a function is not the expected one. * * NOTE: Don't confuse with {AccessControlUnauthorizedAccount}. */ error AccessControlBadConfirmation(); /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `callerConfirmation`. */ function renounceRole(bytes32 role, address callerConfirmation) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../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. * * The initial owner is set to the address provided by the deployer. 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; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @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 { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @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 { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.20; import {IERC1155} from "./IERC1155.sol"; import {IERC1155Receiver} from "./IERC1155Receiver.sol"; import {IERC1155MetadataURI} from "./extensions/IERC1155MetadataURI.sol"; import {Context} from "../../utils/Context.sol"; import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol"; import {Arrays} from "../../utils/Arrays.sol"; import {IERC1155Errors} from "../../interfaces/draft-IERC6093.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 */ abstract contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI, IERC1155Errors { using Arrays for uint256[]; using Arrays for address[]; mapping(uint256 id => mapping(address account => uint256)) private _balances; mapping(address account => mapping(address operator => 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 /* id */) public view virtual returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. */ function balanceOf(address account, uint256 id) public view virtual returns (uint256) { 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 returns (uint256[] memory) { if (accounts.length != ids.length) { revert ERC1155InvalidArrayLength(ids.length, accounts.length); } uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts.unsafeMemoryAccess(i), ids.unsafeMemoryAccess(i)); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 id, uint256 value, bytes memory data) public virtual { address sender = _msgSender(); if (from != sender && !isApprovedForAll(from, sender)) { revert ERC1155MissingApprovalForAll(sender, from); } _safeTransferFrom(from, to, id, value, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) public virtual { address sender = _msgSender(); if (from != sender && !isApprovedForAll(from, sender)) { revert ERC1155MissingApprovalForAll(sender, from); } _safeBatchTransferFrom(from, to, ids, values, data); } /** * @dev Transfers a `value` amount of tokens of type `id` from `from` to `to`. Will mint (or burn) if `from` * (or `to`) is the zero address. * * Emits a {TransferSingle} event if the arrays contain one element, and {TransferBatch} otherwise. * * Requirements: * * - If `to` refers to a smart contract, it must implement either {IERC1155Receiver-onERC1155Received} * or {IERC1155Receiver-onERC1155BatchReceived} and return the acceptance magic value. * - `ids` and `values` must have the same length. * * NOTE: The ERC-1155 acceptance check is not performed in this function. See {_updateWithAcceptanceCheck} instead. */ function _update(address from, address to, uint256[] memory ids, uint256[] memory values) internal virtual { if (ids.length != values.length) { revert ERC1155InvalidArrayLength(ids.length, values.length); } address operator = _msgSender(); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids.unsafeMemoryAccess(i); uint256 value = values.unsafeMemoryAccess(i); if (from != address(0)) { uint256 fromBalance = _balances[id][from]; if (fromBalance < value) { revert ERC1155InsufficientBalance(from, fromBalance, value, id); } unchecked { // Overflow not possible: value <= fromBalance _balances[id][from] = fromBalance - value; } } if (to != address(0)) { _balances[id][to] += value; } } if (ids.length == 1) { uint256 id = ids.unsafeMemoryAccess(0); uint256 value = values.unsafeMemoryAccess(0); emit TransferSingle(operator, from, to, id, value); } else { emit TransferBatch(operator, from, to, ids, values); } } /** * @dev Version of {_update} that performs the token acceptance check by calling * {IERC1155Receiver-onERC1155Received} or {IERC1155Receiver-onERC1155BatchReceived} on the receiver address if it * contains code (eg. is a smart contract at the moment of execution). * * IMPORTANT: Overriding this function is discouraged because it poses a reentrancy risk from the receiver. So any * update to the contract state after this function would break the check-effect-interaction pattern. Consider * overriding {_update} instead. */ function _updateWithAcceptanceCheck( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) internal virtual { _update(from, to, ids, values); if (to != address(0)) { address operator = _msgSender(); if (ids.length == 1) { uint256 id = ids.unsafeMemoryAccess(0); uint256 value = values.unsafeMemoryAccess(0); _doSafeTransferAcceptanceCheck(operator, from, to, id, value, data); } else { _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, values, data); } } } /** * @dev Transfers a `value` 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 `value` 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 value, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(from, to, ids, values, 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. * - `ids` and `values` must have the same length. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } _updateWithAcceptanceCheck(from, to, ids, values, 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 values 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 a `value` amount of tokens of 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 value, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(address(0), to, ids, values, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `values` must have the same length. * - `to` cannot be the zero address. * - 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 values, bytes memory data) internal { if (to == address(0)) { revert ERC1155InvalidReceiver(address(0)); } _updateWithAcceptanceCheck(address(0), to, ids, values, data); } /** * @dev Destroys a `value` amount of tokens of type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `value` amount of tokens of type `id`. */ function _burn(address from, uint256 id, uint256 value) internal { if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } (uint256[] memory ids, uint256[] memory values) = _asSingletonArrays(id, value); _updateWithAcceptanceCheck(from, address(0), ids, values, ""); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Emits a {TransferBatch} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `value` amount of tokens of type `id`. * - `ids` and `values` must have the same length. */ function _burnBatch(address from, uint256[] memory ids, uint256[] memory values) internal { if (from == address(0)) { revert ERC1155InvalidSender(address(0)); } _updateWithAcceptanceCheck(from, address(0), ids, values, ""); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the zero address. */ function _setApprovalForAll(address owner, address operator, bool approved) internal virtual { if (operator == address(0)) { revert ERC1155InvalidOperator(address(0)); } _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Performs an acceptance check by calling {IERC1155-onERC1155Received} on the `to` address * if it contains code at the moment of execution. */ function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 value, bytes memory data ) private { if (to.code.length > 0) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, value, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { // Tokens rejected revert ERC1155InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { // non-ERC1155Receiver implementer revert ERC1155InvalidReceiver(to); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } } /** * @dev Performs a batch acceptance check by calling {IERC1155-onERC1155BatchReceived} on the `to` address * if it contains code at the moment of execution. */ function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory values, bytes memory data ) private { if (to.code.length > 0) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, values, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { // Tokens rejected revert ERC1155InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { // non-ERC1155Receiver implementer revert ERC1155InvalidReceiver(to); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } } /** * @dev Creates an array in memory with only one value for each of the elements provided. */ function _asSingletonArrays( uint256 element1, uint256 element2 ) private pure returns (uint256[] memory array1, uint256[] memory array2) { /// @solidity memory-safe-assembly assembly { // Load the free memory pointer array1 := mload(0x40) // Set array length to 1 mstore(array1, 1) // Store the single element at the next word after the length (where content starts) mstore(add(array1, 0x20), element1) // Repeat for next array locating it right after the first array array2 := add(array1, 0x40) mstore(array2, 1) mstore(add(array2, 0x20), element2) // Update the free memory pointer by pointing after the second array mstore(0x40, add(array2, 0x40)) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^0.8.20; import {IERC1155} from "../IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. */ 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` amount of tokens of 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 value 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 a `value` amount of tokens of type `id` from `from` to `to`. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155Received} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * 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 `value` 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 value, bytes calldata data) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * WARNING: This function can potentially allow a reentrancy attack when transferring tokens * to an untrusted contract, when invoking {onERC1155BatchReceived} on the receiver. * Ensure to follow the checks-effects-interactions pattern and consider employing * reentrancy guards when interacting with untrusted contracts. * * Emits either a {TransferSingle} or a {TransferBatch} event, depending on the length of the array arguments. * * Requirements: * * - `ids` and `values` 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 values, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Interface that must be implemented by smart contracts in order to receive * ERC-1155 token transfers. */ 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Arrays.sol) pragma solidity ^0.8.20; import {StorageSlot} from "./StorageSlot.sol"; import {Math} from "./math/Math.sol"; /** * @dev Collection of functions related to array types. */ library Arrays { using StorageSlot for bytes32; /** * @dev Searches a sorted `array` and returns the first index that contains * a value greater or equal to `element`. If no such index exists (i.e. all * values in the array are strictly less than `element`), the array length is * returned. Time complexity O(log n). * * `array` is expected to be sorted in ascending order, and to contain no * repeated elements. */ function findUpperBound(uint256[] storage array, uint256 element) internal view returns (uint256) { uint256 low = 0; uint256 high = array.length; if (high == 0) { return 0; } while (low < high) { uint256 mid = Math.average(low, high); // Note that mid will always be strictly less than high (i.e. it will be a valid array index) // because Math.average rounds towards zero (it does integer division with truncation). if (unsafeAccess(array, mid).value > element) { high = mid; } else { low = mid + 1; } } // At this point `low` is the exclusive upper bound. We will return the inclusive upper bound. if (low > 0 && unsafeAccess(array, low - 1).value == element) { return low - 1; } else { return low; } } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(address[] storage arr, uint256 pos) internal pure returns (StorageSlot.AddressSlot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getAddressSlot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(bytes32[] storage arr, uint256 pos) internal pure returns (StorageSlot.Bytes32Slot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getBytes32Slot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeAccess(uint256[] storage arr, uint256 pos) internal pure returns (StorageSlot.Uint256Slot storage) { bytes32 slot; // We use assembly to calculate the storage slot of the element at index `pos` of the dynamic array `arr` // following https://docs.soliditylang.org/en/v0.8.20/internals/layout_in_storage.html#mappings-and-dynamic-arrays. /// @solidity memory-safe-assembly assembly { mstore(0, arr.slot) slot := add(keccak256(0, 0x20), pos) } return slot.getUint256Slot(); } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeMemoryAccess(uint256[] memory arr, uint256 pos) internal pure returns (uint256 res) { assembly { res := mload(add(add(arr, 0x20), mul(pos, 0x20))) } } /** * @dev Access an array in an "unsafe" way. Skips solidity "index-out-of-range" check. * * WARNING: Only use if you are certain `pos` is lower than the array length. */ function unsafeMemoryAccess(address[] memory arr, uint256 pos) internal pure returns (address res) { assembly { res := mload(add(add(arr, 0x20), mul(pos, 0x20))) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "./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); * } * ``` */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @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 towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (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 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) 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. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 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. uint256 twos = denominator & (0 - denominator); 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 (unsignedRoundsUp(rounding) && 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 * towards zero. * * 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 + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * 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 + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * 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 + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * 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 + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @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); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant NOT_ENTERED = 1; uint256 private constant ENTERED = 2; uint256 private _status; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); constructor() { _status = NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be NOT_ENTERED if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // Any calls to nonReentrant after this point will fail _status = ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.20; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(newImplementation.code.length > 0); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @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), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(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) { uint256 localValue = value; 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] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } 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 bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // _____ _____ _____ ____ _ _ // /\ / ____|/ ____|_ _/ __ \| \ | | // / \ | (___ | | | || | | | \| | // / /\ \ \___ \| | | || | | | . ` | // / ____ \ ____) | |____ _| || |__| | |\ | // /_/ \_\_____/ \_____|_____\____/|_| \_| // // This smart contract is part of the Ascion ecosystem. // It facilitates the integration of blockchain technology // into the Ascion game, providing secure and efficient // management of in-game assets. // Visit https://ascion.space for more information. pragma solidity ^0.8.24; import "@openzeppelin/contracts/utils/Context.sol"; /** * @dev Context variant with ERC2771 support and upgradeable trusted forwarder. */ abstract contract AscionContextUpgradeable is Context { address public trustedForwarder; constructor(address _trustedForwarder) { trustedForwarder = _trustedForwarder; } function isTrustedForwarder(address forwarder) public view virtual returns (bool) { return forwarder == trustedForwarder; } function _upgradeTrustedForwarder(address _trustedForwarder) internal { trustedForwarder = _trustedForwarder; } function _msgSender() internal view virtual override returns (address sender) { if (isTrustedForwarder(msg.sender)) { // The assembly code is more direct than the Solidity version using `abi.decode`. /// @solidity memory-safe-assembly assembly { sender := shr(96, calldataload(sub(calldatasize(), 20))) } } else { return super._msgSender(); } } function _msgData() internal view virtual override returns (bytes calldata) { if (isTrustedForwarder(msg.sender)) { return msg.data[:msg.data.length - 20]; } else { return super._msgData(); } } }
// SPDX-License-Identifier: MIT // _____ _____ _____ ____ _ _ // /\ / ____|/ ____|_ _/ __ \| \ | | // / \ | (___ | | | || | | | \| | // / /\ \ \___ \| | | || | | | . ` | // / ____ \ ____) | |____ _| || |__| | |\ | // /_/ \_\_____/ \_____|_____\____/|_| \_| // // This smart contract is part of the Ascion ecosystem. // It facilitates the integration of blockchain technology // into the Ascion game, providing secure and efficient // management of in-game assets. // Visit https://ascion.space for more information. pragma solidity ^0.8.24; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; import "./ICollection.sol"; import "./AscionContextUpgradeable.sol"; import "./Roles.sol"; contract Collection is ICollection, ERC1155, AscionContextUpgradeable, Roles, AccessControl, Ownable, ReentrancyGuard { using Strings for uint256; string private _name; string private _symbol; // Array to store all item IDs uint256[] public itemIds; // Base URI for items string public itemBaseURI; // Mapping to check if an item exists (itemId => bool) mapping(uint256 => bool) public itemExists; // Mapping to track the supply of each item (itemId => supply) mapping(uint256 => uint256) public itemSupplies; // Mapping to handle transfer timelocks for items (itemId => timestamp) mapping(uint256 => uint256) public itemTransferTimelocks; // Mapping to store URIs for each item (itemId => URI) mapping(uint256 => string) private itemURIs; /** * @dev Constructor to initialize the contract * @param _collectionName The name of the collection * @param _collectionSymbol The symbol of the collection * @param _metadataUri Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json * @param _initialOwner The address of the initial owner * @param _forwarder The address of the trusted forwarder for meta-transactions */ constructor(string memory _collectionName, string memory _collectionSymbol, string memory _metadataUri, address _initialOwner, address _forwarder) ERC1155(_metadataUri) AscionContextUpgradeable(_forwarder) Ownable(_initialOwner) { _name = _collectionName; _symbol = _collectionSymbol; // Grant the deployer the default admin and minter roles _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); _grantRole(MANAGER_ROLE, _msgSender()); _grantRole(MINTER_ROLE, _msgSender()); } function name() public view returns (string memory) { return _name; } function symbol() public view returns (string memory) { return _symbol; } /** * @dev Sets the base URI for all items * @param _itemBaseURI The base URI to be set */ function setItemBaseURI(string memory _itemBaseURI) external { itemBaseURI = _itemBaseURI; } /** * @dev Returns the URI for a specific item * @param _itemId The ID of the item * @return The URI for the item */ function uri(uint256 _itemId) public view override returns (string memory) { require(itemExists[_itemId], "URI request for non existent itemId"); return bytes(itemBaseURI).length > 0 ? string(abi.encodePacked(itemBaseURI, _itemId.toString())) : itemURIs[_itemId]; } /** * @dev Sets the URI for a specific item * @param _itemId The ID of the item * @param _uri The URI to be set */ function setItemURI(uint256 _itemId, string memory _uri) external onlyRole(MANAGER_ROLE) { itemURIs[_itemId] = _uri; setItemIdExists(_itemId); } /** * @dev Checks if an item is transferable based on the transfer timelock * @param _itemId The ID of the item * @return True if the item is transferable, otherwise false */ function isItemTransferrable(uint256 _itemId) public view returns (bool) { return itemTransferTimelocks[_itemId] < block.timestamp; } /** * @dev Sets a transfer timelock for a specific item * @param _itemId The ID of the item * @param _unlockTimestamp The timestamp when the item becomes transferable */ function setItemTransferTimelock(uint256 _itemId, uint256 _unlockTimestamp) external onlyRole(MANAGER_ROLE) { itemTransferTimelocks[_itemId] = _unlockTimestamp; } /** * @dev Mints an item to a specific address * @param _toAddress The address to mint the item to * @param _itemId The ID of the item to be minted * @param _quantity The quantity of the item to be minted */ function mintToAddress(address _toAddress, uint256 _itemId, uint256 _quantity) external canMint { _mint(_toAddress, _itemId, _quantity, ""); } /** * @dev Mints multiple items to a specific address * @param _toAddress The address to mint the items to * @param _itemIds The IDs of the items to be minted * @param _quantities The quantities of the items to be minted */ function mintBatchToAddress(address _toAddress, uint256[] calldata _itemIds, uint256[] calldata _quantities) external nonReentrant canMint { _mintBatch(_toAddress, _itemIds, _quantities, ""); } /** * @dev Burns an item from a specific address * @param _fromAddress The address to burn the item from * @param _itemId The ID of the item to be burned * @param _quantity The quantity of the item to be burned */ function burnFromAddress(address _fromAddress, uint256 _itemId, uint256 _quantity) external nonReentrant canBurn(_fromAddress) { _burn(_fromAddress, _itemId, _quantity); } /** * @dev Burns multiple items from a specific address * @param _fromAddress The address to burn the items from * @param _itemIds The IDs of the items to be burned * @param _quantities The quantities of the items to be burned */ function burnBatchFromAddress(address _fromAddress, uint256[] calldata _itemIds, uint256[] calldata _quantities) external nonReentrant canBurn(_fromAddress) { _burnBatch(_fromAddress, _itemIds, _quantities); } /** * @dev Transfers items in bulk from one address to multiple addresses * @param _fromAddress The address to transfer the items from * @param _toAddresses The addresses to transfer the items to * @param _itemIds The IDs of the items to be transferred * @param _quantitiesPerAddress The quantities of the items to be transferred to each address */ function bulkSafeBatchTransferFrom(address _fromAddress, address[] calldata _toAddresses, uint256[] calldata _itemIds, uint256[] calldata _quantitiesPerAddress) external nonReentrant { for (uint256 i = 0; i < _toAddresses.length; i++) { safeBatchTransferFrom(_fromAddress, _toAddresses[i], _itemIds, _quantitiesPerAddress, ""); } } /** * @dev Returns the total number of item IDs * @return The total number of item IDs */ function totalItemIds() external view returns (uint256) { return itemIds.length; } /** * @dev Returns all item IDs * @return An array of all item IDs */ function allItemIds() external view returns (uint256[] memory) { return itemIds; } /** * @dev Returns the supplies of all items * @return A 2D array where each element contains the item ID and its supply */ function allItemSupplies() external view returns (uint256[][] memory) { uint256[][] memory supplies = new uint256[][](itemIds.length); for (uint256 i = 0; i < itemIds.length; i++) { uint256[] memory itemSupply = new uint256[](2); itemSupply[0] = itemIds[i]; itemSupply[1] = itemSupplies[itemSupply[0]]; supplies[i] = itemSupply; } return supplies; } /** * @dev Returns the URIs of all items * @return An array of all item URIs */ function allItemURIs() external view returns (string[] memory) { string[] memory uris = new string[](itemIds.length); for (uint256 i = 0; i < itemIds.length; i++) { uris[i] = uri(itemIds[i]); } return uris; } /** * @dev Returns the balances of all items for a specific address * @param _address The address to check the balances for * @return A 2D array where each element contains the item ID and its balance */ function balanceOfAll(address _address) external view returns (uint256[][] memory) { uint256[][] memory balances = new uint256[][](itemIds.length); for (uint256 i = 0; i < itemIds.length; i++) { uint256[] memory itemBalance = new uint256[](2); itemBalance[0] = itemIds[i]; itemBalance[1] = balanceOf(_address, itemIds[i]); balances[i] = itemBalance; } return balances; } /** * @dev Paginates item IDs * @param _itemIdsStartIndexInclusive The start index for pagination * @param _limit The maximum number of items to return * @return An array of paginated item IDs */ function paginateItemIds(uint256 _itemIdsStartIndexInclusive, uint256 _limit) external view returns (uint256[] memory) { uint256 totalPaginatable = _itemIdsStartIndexInclusive < itemIds.length ? itemIds.length - _itemIdsStartIndexInclusive : 0; uint256 totalPaginate = totalPaginatable <= _limit ? totalPaginatable : _limit; uint256[] memory ids = new uint256[](totalPaginate); for (uint256 i = 0; i < totalPaginate; i++) { ids[i] = itemIds[_itemIdsStartIndexInclusive + i]; } return ids; } /** * @dev Paginates item supplies * @param _itemIdsStartIndexInclusive The start index for pagination * @param _limit The maximum number of items to return * @return A 2D array where each element contains the item ID and its supply */ function paginateItemSupplies(uint256 _itemIdsStartIndexInclusive, uint256 _limit) external view returns (uint256[][] memory) { uint256 totalPaginatable = _itemIdsStartIndexInclusive < itemIds.length ? itemIds.length - _itemIdsStartIndexInclusive : 0; uint256 totalPaginate = totalPaginatable <= _limit ? totalPaginatable : _limit; uint256[][] memory supplies = new uint256[][](totalPaginate); for (uint256 i = 0; i < totalPaginate; i++) { uint256[] memory supply = new uint256[](2); supply[0] = itemIds[_itemIdsStartIndexInclusive + i]; supply[1] = itemSupplies[supply[0]]; supplies[i] = supply; } return supplies; } /** * @dev Paginates item URIs * @param _itemIdsStartIndexInclusive The start index for pagination * @param _limit The maximum number of items to return * @return An array of paginated item URIs */ function paginateItemURIs(uint256 _itemIdsStartIndexInclusive, uint256 _limit) external view returns (string[] memory) { uint256 totalPaginatable = _itemIdsStartIndexInclusive < itemIds.length ? itemIds.length - _itemIdsStartIndexInclusive : 0; uint256 totalPaginate = totalPaginatable <= _limit ? totalPaginatable : _limit; string[] memory uris = new string[](totalPaginate); for (uint256 i = 0; i < totalPaginate; i++) { uris[i] = uri(itemIds[_itemIdsStartIndexInclusive + i]); } return uris; } // Support for gasless transactions /** * @dev Upgrades the trusted forwarder address * @param _newTrustedForwarder The new trusted forwarder address */ function upgradeTrustedForwarder(address _newTrustedForwarder) external onlyRole(MANAGER_ROLE) { _upgradeTrustedForwarder(_newTrustedForwarder); } /** * @dev Returns the message sender, supporting meta-transactions * @return The address of the message sender */ function _msgSender() internal view override(Context, AscionContextUpgradeable) returns (address) { return super._msgSender(); } /** * @dev Returns the message data, supporting meta-transactions * @return The calldata of the message */ function _msgData() internal view override(Context, AscionContextUpgradeable) returns (bytes calldata) { return super._msgData(); } /** * @dev Hook that is called before any token transfer. This includes minting and burning. * @param from The address of the sender * @param to The address of the receiver * @param ids The IDs of the items being transferred * @param values The amounts of the items being transferred */ function _update( address from, address to, uint256[] memory ids, uint256[] memory values ) internal override { super._update(from, to, ids, values); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 value = values[i]; require( ( isItemTransferrable(id) || from == address(0) || // allow mint hasRole(MANAGER_ROLE, from) || // allow manager transfers hasRole(MINTER_ROLE, from) || // allow minter transfers to == address(0) // allow burn ), "Item is not currently transferable." ); if (from == address(0)) { // Minting setItemIdExists(id); itemSupplies[id] += value; } else if (to == address(0)) { // Burning require(itemSupplies[id] >= value, "ERC1155: burn amount exceeds itemSupply"); itemSupplies[id] -= value; } } } /** * @dev Grants a role to a specific account * @param _role The role to be granted * @param _account The account to grant the role to */ function grantRole(bytes32 _role, address _account) public virtual override { bool isAdmin = hasRole(DEFAULT_ADMIN_ROLE, _msgSender()); bool isManager = hasRole(MANAGER_ROLE, _msgSender()); require(isAdmin || isManager, "Role granting requires admin or manager role."); if (_role == DEFAULT_ADMIN_ROLE || _role == MANAGER_ROLE) { require(isAdmin, "Only admin can grant admin or manager role."); } _grantRole(_role, _account); } /** * @dev Transfers ownership and updates roles accordingly * @param _newOwner The new owner of the contract */ function transferOwnershipControl(address _newOwner) external onlyOwner { transferOwnership(_newOwner); _grantRole(DEFAULT_ADMIN_ROLE, _newOwner); _revokeRole(DEFAULT_ADMIN_ROLE, _msgSender()); } /** * @dev Checks if the contract supports a given interface * @param interfaceId The interface ID to check * @return True if the interface is supported, otherwise false */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155, IERC165, AccessControl) returns (bool) { return interfaceId == type(ICollection).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Marks an item ID as existing * @param _id The ID of the item to mark as existing */ function setItemIdExists(uint256 _id) private { if (!itemExists[_id]) { itemIds.push(_id); // set, so only adds if unique itemExists[_id] = true; } } /** * @dev Modifier to check if the caller can mint items */ modifier canMint { require(hasRole(MANAGER_ROLE, _msgSender()) || hasRole(MINTER_ROLE, _msgSender()), "Not authorized to mint."); _; } /** * @dev Modifier to check if the caller can burn items * @param _fromAddress The address to burn the items from */ modifier canBurn(address _fromAddress) { require(_fromAddress == _msgSender() || isApprovedForAll(_fromAddress, _msgSender()), "Not approved to burn."); _; } }
// SPDX-License-Identifier: MIT // _____ _____ _____ ____ _ _ // /\ / ____|/ ____|_ _/ __ \| \ | | // / \ | (___ | | | || | | | \| | // / /\ \ \___ \| | | || | | | . ` | // / ____ \ ____) | |____ _| || |__| | |\ | // /_/ \_\_____/ \_____|_____\____/|_| \_| // // This smart contract is part of the Ascion ecosystem. // It facilitates the integration of blockchain technology // into the Ascion game, providing secure and efficient // management of in-game assets. // Visit https://ascion.space for more information. pragma solidity ^0.8.24; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; interface ICollection is IERC1155 { // autogenerated getters function itemIds(uint256 index) external view returns (uint256); function itemExists(uint256 index) external view returns (bool); function itemSupplies(uint256 itemId) external view returns (uint256); function itemTransferTimelocks(uint256 itemId) external view returns(uint256); // functions function setItemBaseURI(string memory _itemBaseURI) external; function setItemURI(uint256 _itemId, string memory _uri) external; function isItemTransferrable(uint256 _itemId) external view returns (bool); function setItemTransferTimelock(uint256 _itemId, uint256 _unlockTimestamp) external; function mintToAddress(address _toAddress, uint256 _itemId, uint256 _quantity) external; function mintBatchToAddress(address _toAddress, uint256[] calldata _itemIds, uint256[] calldata _quantities) external; function burnFromAddress(address _fromAddress, uint256 _itemId, uint256 _quantity) external; function burnBatchFromAddress(address _fromAddress, uint256[] calldata _itemIds, uint256[] calldata _quantities) external; function bulkSafeBatchTransferFrom(address _from, address[] calldata _toAddresses, uint256[] calldata _itemIds, uint256[] calldata _quantitiesPerAddress) external; function totalItemIds() external view returns (uint256); function allItemIds() external view returns (uint256[] memory); function allItemSupplies() external view returns (uint256[][] memory); function allItemURIs() external view returns (string[] memory); function balanceOfAll(address _address) external view returns(uint256[][] memory); function paginateItemIds(uint256 itemIdsStartIndexInclusive, uint256 limit) external view returns (uint256[] memory); function paginateItemSupplies(uint256 itemIdsStartIndexInclusive, uint256 limit) external view returns (uint256[][] memory); function paginateItemURIs(uint256 itemIdsStartIndexInclusive, uint256 limit) external view returns (string[] memory); function transferOwnershipControl(address _newOwner) external; }
// SPDX-License-Identifier: MIT // _____ _____ _____ ____ _ _ // /\ / ____|/ ____|_ _/ __ \| \ | | // / \ | (___ | | | || | | | \| | // / /\ \ \___ \| | | || | | | . ` | // / ____ \ ____) | |____ _| || |__| | |\ | // /_/ \_\_____/ \_____|_____\____/|_| \_| // // This smart contract is part of the Ascion ecosystem. // It facilitates the integration of blockchain technology // into the Ascion game, providing secure and efficient // management of in-game assets. // Visit https://ascion.space for more information. pragma solidity ^0.8.24; contract Roles { bytes32 internal constant MINTER_ROLE = keccak256("ASCION_MINTER_ROLE"); bytes32 internal constant MANAGER_ROLE = keccak256("ASCION_MANAGER_ROLE"); bytes32 internal constant PLAYER_ROLE = keccak256("ASCION_PLAYER_ROLE"); }
{ "evmVersion": "paris", "optimizer": { "enabled": false, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"},{"internalType":"string","name":"_uri","type":"string"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_forwarder","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccessControlBadConfirmation","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32","name":"neededRole","type":"bytes32"}],"name":"AccessControlUnauthorizedAccount","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC1155InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC1155InvalidApprover","type":"error"},{"inputs":[{"internalType":"uint256","name":"idsLength","type":"uint256"},{"internalType":"uint256","name":"valuesLength","type":"uint256"}],"name":"ERC1155InvalidArrayLength","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC1155InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC1155InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC1155InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC1155MissingApprovalForAll","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"values","type":"uint256[]"}],"name":"TransferBatch","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"TransferSingle","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"value","type":"string"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"URI","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allItemIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allItemSupplies","outputs":[{"internalType":"uint256[][]","name":"","type":"uint256[][]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"allItemURIs","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"balanceOfAll","outputs":[{"internalType":"uint256[][]","name":"","type":"uint256[][]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_fromAddress","type":"address"},{"internalType":"address[]","name":"_toAddresses","type":"address[]"},{"internalType":"uint256[]","name":"_itemIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_quantitiesPerAddress","type":"uint256[]"}],"name":"bulkSafeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_fromAddress","type":"address"},{"internalType":"uint256[]","name":"_itemIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_quantities","type":"uint256[]"}],"name":"burnBatchFromAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_fromAddress","type":"address"},{"internalType":"uint256","name":"_itemId","type":"uint256"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"burnFromAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_role","type":"bytes32"},{"internalType":"address","name":"_account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_itemId","type":"uint256"}],"name":"isItemTransferrable","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"itemBaseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"itemExists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"itemIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"itemSupplies","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"itemTransferTimelocks","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_toAddress","type":"address"},{"internalType":"uint256[]","name":"_itemIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_quantities","type":"uint256[]"}],"name":"mintBatchToAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_toAddress","type":"address"},{"internalType":"uint256","name":"_itemId","type":"uint256"},{"internalType":"uint256","name":"_quantity","type":"uint256"}],"name":"mintToAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_itemIdsStartIndexInclusive","type":"uint256"},{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"paginateItemIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_itemIdsStartIndexInclusive","type":"uint256"},{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"paginateItemSupplies","outputs":[{"internalType":"uint256[][]","name":"","type":"uint256[][]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_itemIdsStartIndexInclusive","type":"uint256"},{"internalType":"uint256","name":"_limit","type":"uint256"}],"name":"paginateItemURIs","outputs":[{"internalType":"string[]","name":"","type":"string[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"callerConfirmation","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeBatchTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_itemBaseURI","type":"string"}],"name":"setItemBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_itemId","type":"uint256"},{"internalType":"uint256","name":"_unlockTimestamp","type":"uint256"}],"name":"setItemTransferTimelock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_itemId","type":"uint256"},{"internalType":"string","name":"_uri","type":"string"}],"name":"setItemURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalItemIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newOwner","type":"address"}],"name":"transferOwnershipControl","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"trustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_newTrustedForwarder","type":"address"}],"name":"upgradeTrustedForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_itemId","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061027e5760003560e01c8063843bd6411161015c578063b1da7a55116100ce578063dc7aa9ef11610087578063dc7aa9ef146107f3578063e985e9c51461080f578063efa52e901461083f578063f242432a1461085d578063f2fde38b14610879578063fe992c98146108955761027e565b8063b1da7a5514610721578063b3dc00fe1461073d578063b9babeba1461076d578063bbdc827614610789578063d547741f146107a7578063d8e14175146107c35761027e565b806395d89b411161012057806395d89b4114610661578063a217fddf1461067f578063a22cb4651461069d578063a9c47d12146106b9578063aa2a7eea146106d5578063ae06363f146106f15761027e565b8063843bd641146105955780638c892cfd146105c55780638da5cb5b146105e357806391d1485414610601578063951549b9146106315761027e565b80632f2ff15d116101f55780634e1273f4116101b95780634e1273f4146104c1578063572b6c05146104f157806358ec07c714610521578063715018a6146105515780637bc6cb741461055b5780637da0a877146105775761027e565b80632f2ff15d1461043357806336568abe1461044f5780634252ac3f1461046b57806348e1219a146104875780634b7c78dc146104a55761027e565b806308f427c71161024757806308f427c71461033b5780630e89341c1461035757806313f2f6bd146103875780632257eb7e146103b7578063248a9ca3146103e75780632eb2c2d6146104175761027e565b8062fdd58e1461028357806301ffc9a7146102b357806303cb92fc146102e35780630515cf8d146102ff57806306fdde031461031d575b600080fd5b61029d60048036038101906102989190613bbf565b6108c5565b6040516102aa9190613c0e565b60405180910390f35b6102cd60048036038101906102c89190613c81565b61091f565b6040516102da9190613cc9565b60405180910390f35b6102fd60048036038101906102f89190613e2a565b610999565b005b6103076109f2565b6040516103149190614006565b60405180910390f35b610325610b6c565b60405161033291906140a7565b60405180910390f35b61035560048036038101906103509190614129565b610bfe565b005b610371600480360381019061036c91906141be565b610d5a565b60405161037e91906140a7565b60405180910390f35b6103a1600480360381019061039c91906141eb565b610ea6565b6040516103ae9190614006565b60405180910390f35b6103d160048036038101906103cc91906141be565b611063565b6040516103de9190613c0e565b60405180910390f35b61040160048036038101906103fc9190614261565b61107b565b60405161040e919061429d565b60405180910390f35b610431600480360381019061042c919061441c565b61109b565b005b61044d600480360381019061044891906144eb565b611143565b005b610469600480360381019061046491906144eb565b61125f565b005b6104856004803603810190610480919061452b565b6112da565b005b61048f611311565b60405161049c9190613c0e565b60405180910390f35b6104bf60048036038101906104ba9190614129565b61131e565b005b6104db60048036038101906104d6919061461b565b611451565b6040516104e89190614702565b60405180910390f35b61050b6004803603810190610506919061452b565b61155a565b6040516105189190613cc9565b60405180910390f35b61053b600480360381019061053691906141be565b6115b4565b6040516105489190613c0e565b60405180910390f35b6105596115cc565b005b610575600480360381019061057091906141eb565b6115e0565b005b61057f611627565b60405161058c9190614733565b60405180910390f35b6105af60048036038101906105aa91906141be565b61164d565b6040516105bc9190613cc9565b60405180910390f35b6105cd61166d565b6040516105da9190614702565b60405180910390f35b6105eb6116c5565b6040516105f89190614733565b60405180910390f35b61061b600480360381019061061691906144eb565b6116ef565b6040516106289190613cc9565b60405180910390f35b61064b600480360381019061064691906141eb565b61175a565b6040516106589190614702565b60405180910390f35b610669611854565b60405161067691906140a7565b60405180910390f35b6106876118e6565b604051610694919061429d565b60405180910390f35b6106b760048036038101906106b2919061477a565b6118ed565b005b6106d360048036038101906106ce91906147ba565b611903565b005b6106ef60048036038101906106ea919061452b565b611916565b005b61070b600480360381019061070691906141be565b61194d565b6040516107189190613cc9565b60405180910390f35b61073b60048036038101906107369190614859565b61196c565b005b610757600480360381019061075291906141be565b611a66565b6040516107649190613c0e565b60405180910390f35b61078760048036038101906107829190614922565b611a8a565b005b610791611b39565b60405161079e91906140a7565b60405180910390f35b6107c160048036038101906107bc91906144eb565b611bc7565b005b6107dd60048036038101906107d891906141eb565b611be9565b6040516107ea9190614a81565b60405180910390f35b61080d60048036038101906108089190614922565b611cef565b005b61082960048036038101906108249190614aa3565b611db7565b6040516108369190613cc9565b60405180910390f35b610847611e4b565b6040516108549190614a81565b60405180910390f35b61087760048036038101906108729190614ae3565b611f0e565b005b610893600480360381019061088e919061452b565b611fb6565b005b6108af60048036038101906108aa919061452b565b61203c565b6040516108bc9190614006565b60405180910390f35b600080600083815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b60007f69148814000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806109925750610991826121b1565b5b9050919050565b7f65ed49cf024b70ea8dcfe9ae13e522103c17d83f251c42b88528392b06a87a1e6109c38161222b565b81600e600085815260200190815260200160002090816109e39190614d86565b506109ed8361223f565b505050565b6060600060098054905067ffffffffffffffff811115610a1557610a14613cff565b5b604051908082528060200260200182016040528015610a4857816020015b6060815260200190600190039081610a335790505b50905060005b600980549050811015610b64576000600267ffffffffffffffff811115610a7857610a77613cff565b5b604051908082528060200260200182016040528015610aa65781602001602082028036833780820191505090505b50905060098281548110610abd57610abc614e58565b5b906000526020600020015481600081518110610adc57610adb614e58565b5b602002602001018181525050600c600082600081518110610b0057610aff614e58565b5b602002602001015181526020019081526020016000205481600181518110610b2b57610b2a614e58565b5b60200260200101818152505080838381518110610b4b57610b4a614e58565b5b6020026020010181905250508080600101915050610a4e565b508091505090565b606060078054610b7b90614ba9565b80601f0160208091040260200160405190810160405280929190818152602001828054610ba790614ba9565b8015610bf45780601f10610bc957610100808354040283529160200191610bf4565b820191906000526020600020905b815481529060010190602001808311610bd757829003601f168201915b5050505050905090565b610c066122bd565b610c377f65ed49cf024b70ea8dcfe9ae13e522103c17d83f251c42b88528392b06a87a1e610c32612303565b6116ef565b80610c6f5750610c6e7ffa82654b3741fbd62191c4203954d4738ea263889addcb00737382a182502a81610c69612303565b6116ef565b5b610cae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ca590614ed3565b60405180910390fd5b610d4b85858580806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050848480806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505060405180602001604052806000815250612312565b610d53612398565b5050505050565b6060600b600083815260200190815260200160002060009054906101000a900460ff16610dbc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610db390614f65565b60405180910390fd5b6000600a8054610dcb90614ba9565b905011610e7357600e60008381526020019081526020016000208054610df090614ba9565b80601f0160208091040260200160405190810160405280929190818152602001828054610e1c90614ba9565b8015610e695780601f10610e3e57610100808354040283529160200191610e69565b820191906000526020600020905b815481529060010190602001808311610e4c57829003601f168201915b5050505050610e9f565b600a610e7e836123a2565b604051602001610e8f929190615044565b6040516020818303038152906040525b9050919050565b606060006009805490508410610ebd576000610ecf565b83600980549050610ece9190615097565b5b9050600083821115610ee15783610ee3565b815b905060008167ffffffffffffffff811115610f0157610f00613cff565b5b604051908082528060200260200182016040528015610f3457816020015b6060815260200190600190039081610f1f5790505b50905060005b82811015611056576000600267ffffffffffffffff811115610f5f57610f5e613cff565b5b604051908082528060200260200182016040528015610f8d5781602001602082028036833780820191505090505b50905060098289610f9e91906150cb565b81548110610faf57610fae614e58565b5b906000526020600020015481600081518110610fce57610fcd614e58565b5b602002602001018181525050600c600082600081518110610ff257610ff1614e58565b5b60200260200101518152602001908152602001600020548160018151811061101d5761101c614e58565b5b6020026020010181815250508083838151811061103d5761103c614e58565b5b6020026020010181905250508080600101915050610f3a565b5080935050505092915050565b600c6020528060005260406000206000915090505481565b600060046000838152602001908152602001600020600101549050919050565b60006110a5612303565b90508073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16141580156110ea57506110e88682611db7565b155b1561112e5780866040517fe237d9220000000000000000000000000000000000000000000000000000000081526004016111259291906150ff565b60405180910390fd5b61113b8686868686612470565b505050505050565b60006111596000801b611154612303565b6116ef565b9050600061118e7f65ed49cf024b70ea8dcfe9ae13e522103c17d83f251c42b88528392b06a87a1e611189612303565b6116ef565b905081806111995750805b6111d8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111cf9061519a565b60405180910390fd5b6000801b84148061120857507f65ed49cf024b70ea8dcfe9ae13e522103c17d83f251c42b88528392b06a87a1e84145b1561124e578161124d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016112449061522c565b60405180910390fd5b5b6112588484612568565b5050505050565b611267612303565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146112cb576040517f6697b23200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112d5828261265a565b505050565b6112e261274d565b6112eb81611fb6565b6112f86000801b82612568565b5061130d6000801b611308612303565b61265a565b5050565b6000600980549050905090565b6113266122bd565b8461132f612303565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16148061137557506113748161136f612303565b611db7565b5b6113b4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113ab90615298565b60405180910390fd5b61144186868680806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050858580806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050506127d4565b5061144a612398565b5050505050565b6060815183511461149d57815183516040517f5b0599910000000000000000000000000000000000000000000000000000000081526004016114949291906152b8565b60405180910390fd5b6000835167ffffffffffffffff8111156114ba576114b9613cff565b5b6040519080825280602002602001820160405280156114e85781602001602082028036833780820191505090505b50905060005b845181101561154f5761152561150d828761286890919063ffffffff16565b611520838761287c90919063ffffffff16565b6108c5565b82828151811061153857611537614e58565b5b6020026020010181815250508060010190506114ee565b508091505092915050565b6000600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b600d6020528060005260406000206000915090505481565b6115d461274d565b6115de6000612890565b565b7f65ed49cf024b70ea8dcfe9ae13e522103c17d83f251c42b88528392b06a87a1e61160a8161222b565b81600d600085815260200190815260200160002081905550505050565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600b6020528060005260406000206000915054906101000a900460ff1681565b606060098054806020026020016040519081016040528092919081815260200182805480156116bb57602002820191906000526020600020905b8154815260200190600101908083116116a7575b5050505050905090565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60006004600084815260200190815260200160002060000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b606060006009805490508410611771576000611783565b836009805490506117829190615097565b5b90506000838211156117955783611797565b815b905060008167ffffffffffffffff8111156117b5576117b4613cff565b5b6040519080825280602002602001820160405280156117e35781602001602082028036833780820191505090505b50905060005b8281101561184757600981886117ff91906150cb565b815481106118105761180f614e58565b5b906000526020600020015482828151811061182e5761182d614e58565b5b60200260200101818152505080806001019150506117e9565b5080935050505092915050565b60606008805461186390614ba9565b80601f016020809104026020016040519081016040528092919081815260200182805461188f90614ba9565b80156118dc5780601f106118b1576101008083540402835291602001916118dc565b820191906000526020600020905b8154815290600101906020018083116118bf57829003601f168201915b5050505050905090565b6000801b81565b6118ff6118f8612303565b8383612956565b5050565b80600a90816119129190614d86565b5050565b7f65ed49cf024b70ea8dcfe9ae13e522103c17d83f251c42b88528392b06a87a1e6119408161222b565b61194982612ac6565b5050565b600042600d600084815260200190815260200160002054109050919050565b6119746122bd565b60005b86869050811015611a5457611a478888888481811061199957611998614e58565b5b90506020020160208101906119ae919061452b565b878780806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050868680806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f820116905080830192505050505050506040518060200160405280600081525061109b565b8080600101915050611977565b50611a5d612398565b50505050505050565b60098181548110611a7657600080fd5b906000526020600020016000915090505481565b611a926122bd565b82611a9b612303565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161480611ae15750611ae081611adb612303565b611db7565b5b611b20576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b1790615298565b60405180910390fd5b611b2b848484612b0a565b50611b34612398565b505050565b600a8054611b4690614ba9565b80601f0160208091040260200160405190810160405280929190818152602001828054611b7290614ba9565b8015611bbf5780601f10611b9457610100808354040283529160200191611bbf565b820191906000526020600020905b815481529060010190602001808311611ba257829003601f168201915b505050505081565b611bd08261107b565b611bd98161222b565b611be3838361265a565b50505050565b606060006009805490508410611c00576000611c12565b83600980549050611c119190615097565b5b9050600083821115611c245783611c26565b815b905060008167ffffffffffffffff811115611c4457611c43613cff565b5b604051908082528060200260200182016040528015611c7757816020015b6060815260200190600190039081611c625790505b50905060005b82811015611ce257611cb760098289611c9691906150cb565b81548110611ca757611ca6614e58565b5b9060005260206000200154610d5a565b828281518110611cca57611cc9614e58565b5b60200260200101819052508080600101915050611c7d565b5080935050505092915050565b611d207f65ed49cf024b70ea8dcfe9ae13e522103c17d83f251c42b88528392b06a87a1e611d1b612303565b6116ef565b80611d585750611d577ffa82654b3741fbd62191c4203954d4738ea263889addcb00737382a182502a81611d52612303565b6116ef565b5b611d97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d8e90614ed3565b60405180910390fd5b611db283838360405180602001604052806000815250612bb1565b505050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b6060600060098054905067ffffffffffffffff811115611e6e57611e6d613cff565b5b604051908082528060200260200182016040528015611ea157816020015b6060815260200190600190039081611e8c5790505b50905060005b600980549050811015611f0657611edb60098281548110611ecb57611eca614e58565b5b9060005260206000200154610d5a565b828281518110611eee57611eed614e58565b5b60200260200101819052508080600101915050611ea7565b508091505090565b6000611f18612303565b90508073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff1614158015611f5d5750611f5b8682611db7565b155b15611fa15780866040517fe237d922000000000000000000000000000000000000000000000000000000008152600401611f989291906150ff565b60405180910390fd5b611fae8686868686612c4a565b505050505050565b611fbe61274d565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036120305760006040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081526004016120279190614733565b60405180910390fd5b61203981612890565b50565b6060600060098054905067ffffffffffffffff81111561205f5761205e613cff565b5b60405190808252806020026020018201604052801561209257816020015b606081526020019060019003908161207d5790505b50905060005b6009805490508110156121a7576000600267ffffffffffffffff8111156120c2576120c1613cff565b5b6040519080825280602002602001820160405280156120f05781602001602082028036833780820191505090505b5090506009828154811061210757612106614e58565b5b90600052602060002001548160008151811061212657612125614e58565b5b60200260200101818152505061215a856009848154811061214a57612149614e58565b5b90600052602060002001546108c5565b8160018151811061216e5761216d614e58565b5b6020026020010181815250508083838151811061218e5761218d614e58565b5b6020026020010181905250508080600101915050612098565b5080915050919050565b60007f7965db0b000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480612224575061222382612d55565b5b9050919050565b61223c81612237612303565b612e37565b50565b600b600082815260200190815260200160002060009054906101000a900460ff166122ba5760098190806001815401808255809150506001900390600052602060002001600090919091909150556001600b600083815260200190815260200160002060006101000a81548160ff0219169083151502179055505b50565b6002600654036122f9576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6002600681905550565b600061230d612e88565b905090565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036123845760006040517f57f447ce00000000000000000000000000000000000000000000000000000000815260040161237b9190614733565b60405180910390fd5b612392600085858585612eba565b50505050565b6001600681905550565b6060600060016123b184612f6c565b01905060008167ffffffffffffffff8111156123d0576123cf613cff565b5b6040519080825280601f01601f1916602001820160405280156124025781602001600182028036833780820191505090505b509050600082602001820190505b600115612465578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8581612459576124586152e1565b5b04945060008503612410575b819350505050919050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036124e25760006040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016124d99190614733565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff16036125545760006040517f01a8351400000000000000000000000000000000000000000000000000000000815260040161254b9190614733565b60405180910390fd5b6125618585858585612eba565b5050505050565b600061257483836116ef565b61264f5760016004600085815260200190815260200160002060000160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506125ec612303565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a460019050612654565b600090505b92915050565b600061266683836116ef565b156127425760006004600085815260200190815260200160002060000160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506126df612303565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16847ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a460019050612747565b600090505b92915050565b612755612303565b73ffffffffffffffffffffffffffffffffffffffff166127736116c5565b73ffffffffffffffffffffffffffffffffffffffff16146127d257612796612303565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526004016127c99190614733565b60405180910390fd5b565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16036128465760006040517f01a8351400000000000000000000000000000000000000000000000000000000815260040161283d9190614733565b60405180910390fd5b612863836000848460405180602001604052806000815250612eba565b505050565b600060208202602084010151905092915050565b600060208202602084010151905092915050565b6000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905081600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036129c85760006040517fced3e1000000000000000000000000000000000000000000000000000000000081526004016129bf9190614733565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3183604051612ab99190613cc9565b60405180910390a3505050565b80600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1603612b7c5760006040517f01a83514000000000000000000000000000000000000000000000000000000008152600401612b739190614733565b60405180910390fd5b600080612b8984846130bf565b91509150612baa856000848460405180602001604052806000815250612eba565b5050505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603612c235760006040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401612c1a9190614733565b60405180910390fd5b600080612c3085856130bf565b91509150612c42600087848487612eba565b505050505050565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1603612cbc5760006040517f57f447ce000000000000000000000000000000000000000000000000000000008152600401612cb39190614733565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1603612d2e5760006040517f01a83514000000000000000000000000000000000000000000000000000000008152600401612d259190614733565b60405180910390fd5b600080612d3b85856130bf565b91509150612d4c8787848487612eba565b50505050505050565b60007fd9b67a26000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480612e2057507f0e89341c000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916145b80612e305750612e2f826130ef565b5b9050919050565b612e4182826116ef565b612e845780826040517fe2517d3f000000000000000000000000000000000000000000000000000000008152600401612e7b929190615310565b60405180910390fd5b5050565b6000612e933361155a565b15612ea757601436033560601c9050612eb6565b612eaf613159565b9050612eb7565b5b90565b612ec685858585613161565b600073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614612f65576000612f04612303565b90506001845103612f54576000612f2560008661287c90919063ffffffff16565b90506000612f3d60008661287c90919063ffffffff16565b9050612f4d838989858589613407565b5050612f63565b612f628187878787876135bb565b5b505b5050505050565b600080600090507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310612fca577a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008381612fc057612fbf6152e1565b5b0492506040810190505b6d04ee2d6d415b85acef81000000008310613007576d04ee2d6d415b85acef81000000008381612ffd57612ffc6152e1565b5b0492506020810190505b662386f26fc10000831061303657662386f26fc10000838161302c5761302b6152e1565b5b0492506010810190505b6305f5e100831061305f576305f5e1008381613055576130546152e1565b5b0492506008810190505b612710831061308457612710838161307a576130796152e1565b5b0492506004810190505b606483106130a7576064838161309d5761309c6152e1565b5b0492506002810190505b600a83106130b6576001810190505b80915050919050565b60608060405191506001825283602083015260408201905060018152826020820152604081016040529250929050565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b600033905090565b61316d8484848461376f565b60005b825181101561340057600083828151811061318e5761318d614e58565b5b6020026020010151905060008383815181106131ad576131ac614e58565b5b602002602001015190506131c08261194d565b806131f75750600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16145b8061322857506132277f65ed49cf024b70ea8dcfe9ae13e522103c17d83f251c42b88528392b06a87a1e886116ef565b5b8061325957506132587ffa82654b3741fbd62191c4203954d4738ea263889addcb00737382a182502a81886116ef565b5b806132905750600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16145b6132cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016132c6906153ab565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff160361333b5761330c8261223f565b80600c6000848152602001908152602001600020600082825461332f91906150cb565b925050819055506133f1565b600073ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff16036133f05780600c60008481526020019081526020016000205410156133c5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016133bc9061543d565b60405180910390fd5b80600c600084815260200190815260200160002060008282546133e89190615097565b925050819055505b5b50508080600101915050613170565b5050505050565b60008473ffffffffffffffffffffffffffffffffffffffff163b11156135b3578373ffffffffffffffffffffffffffffffffffffffff1663f23a6e6187878686866040518663ffffffff1660e01b81526004016134689594939291906154b2565b6020604051808303816000875af19250505080156134a457506040513d601f19601f820116820180604052508101906134a19190615521565b60015b613528573d80600081146134d4576040519150601f19603f3d011682016040523d82523d6000602084013e6134d9565b606091505b50600081510361352057846040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016135179190614733565b60405180910390fd5b805181602001fd5b63f23a6e6160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916146135b157846040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016135a89190614733565b60405180910390fd5b505b505050505050565b60008473ffffffffffffffffffffffffffffffffffffffff163b1115613767578373ffffffffffffffffffffffffffffffffffffffff1663bc197c8187878686866040518663ffffffff1660e01b815260040161361c95949392919061554e565b6020604051808303816000875af192505050801561365857506040513d601f19601f820116820180604052508101906136559190615521565b60015b6136dc573d8060008114613688576040519150601f19603f3d011682016040523d82523d6000602084013e61368d565b606091505b5060008151036136d457846040517f57f447ce0000000000000000000000000000000000000000000000000000000081526004016136cb9190614733565b60405180910390fd5b805181602001fd5b63bc197c8160e01b7bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916817bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161461376557846040517f57f447ce00000000000000000000000000000000000000000000000000000000815260040161375c9190614733565b60405180910390fd5b505b505050505050565b80518251146137b957815181516040517f5b0599910000000000000000000000000000000000000000000000000000000081526004016137b09291906152b8565b60405180910390fd5b60006137c3612303565b905060005b83518110156139d25760006137e6828661287c90919063ffffffff16565b905060006137fd838661287c90919063ffffffff16565b9050600073ffffffffffffffffffffffffffffffffffffffff168873ffffffffffffffffffffffffffffffffffffffff161461392a57600080600084815260200190815260200160002060008a73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050818110156138d257888183856040517f03dee4c50000000000000000000000000000000000000000000000000000000081526004016138c994939291906155b6565b60405180910390fd5b81810360008085815260200190815260200160002060008b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550505b600073ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff16146139c5578060008084815260200190815260200160002060008973ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546139bd91906150cb565b925050819055505b50508060010190506137c8565b506001835103613a915760006139f260008561287c90919063ffffffff16565b90506000613a0a60008561287c90919063ffffffff16565b90508573ffffffffffffffffffffffffffffffffffffffff168773ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628585604051613a829291906152b8565b60405180910390a45050613b10565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051613b079291906155fb565b60405180910390a45b5050505050565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000613b5682613b2b565b9050919050565b613b6681613b4b565b8114613b7157600080fd5b50565b600081359050613b8381613b5d565b92915050565b6000819050919050565b613b9c81613b89565b8114613ba757600080fd5b50565b600081359050613bb981613b93565b92915050565b60008060408385031215613bd657613bd5613b21565b5b6000613be485828601613b74565b9250506020613bf585828601613baa565b9150509250929050565b613c0881613b89565b82525050565b6000602082019050613c236000830184613bff565b92915050565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613c5e81613c29565b8114613c6957600080fd5b50565b600081359050613c7b81613c55565b92915050565b600060208284031215613c9757613c96613b21565b5b6000613ca584828501613c6c565b91505092915050565b60008115159050919050565b613cc381613cae565b82525050565b6000602082019050613cde6000830184613cba565b92915050565b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b613d3782613cee565b810181811067ffffffffffffffff82111715613d5657613d55613cff565b5b80604052505050565b6000613d69613b17565b9050613d758282613d2e565b919050565b600067ffffffffffffffff821115613d9557613d94613cff565b5b613d9e82613cee565b9050602081019050919050565b82818337600083830152505050565b6000613dcd613dc884613d7a565b613d5f565b905082815260208101848484011115613de957613de8613ce9565b5b613df4848285613dab565b509392505050565b600082601f830112613e1157613e10613ce4565b5b8135613e21848260208601613dba565b91505092915050565b60008060408385031215613e4157613e40613b21565b5b6000613e4f85828601613baa565b925050602083013567ffffffffffffffff811115613e7057613e6f613b26565b5b613e7c85828601613dfc565b9150509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b613ee781613b89565b82525050565b6000613ef98383613ede565b60208301905092915050565b6000602082019050919050565b6000613f1d82613eb2565b613f278185613ebd565b9350613f3283613ece565b8060005b83811015613f63578151613f4a8882613eed565b9750613f5583613f05565b925050600181019050613f36565b5085935050505092915050565b6000613f7c8383613f12565b905092915050565b6000602082019050919050565b6000613f9c82613e86565b613fa68185613e91565b935083602082028501613fb885613ea2565b8060005b85811015613ff45784840389528151613fd58582613f70565b9450613fe083613f84565b925060208a01995050600181019050613fbc565b50829750879550505050505092915050565b600060208201905081810360008301526140208184613f91565b905092915050565b600081519050919050565b600082825260208201905092915050565b60005b83811015614062578082015181840152602081019050614047565b60008484015250505050565b600061407982614028565b6140838185614033565b9350614093818560208601614044565b61409c81613cee565b840191505092915050565b600060208201905081810360008301526140c1818461406e565b905092915050565b600080fd5b600080fd5b60008083601f8401126140e9576140e8613ce4565b5b8235905067ffffffffffffffff811115614106576141056140c9565b5b602083019150836020820283011115614122576141216140ce565b5b9250929050565b60008060008060006060868803121561414557614144613b21565b5b600061415388828901613b74565b955050602086013567ffffffffffffffff81111561417457614173613b26565b5b614180888289016140d3565b9450945050604086013567ffffffffffffffff8111156141a3576141a2613b26565b5b6141af888289016140d3565b92509250509295509295909350565b6000602082840312156141d4576141d3613b21565b5b60006141e284828501613baa565b91505092915050565b6000806040838503121561420257614201613b21565b5b600061421085828601613baa565b925050602061422185828601613baa565b9150509250929050565b6000819050919050565b61423e8161422b565b811461424957600080fd5b50565b60008135905061425b81614235565b92915050565b60006020828403121561427757614276613b21565b5b60006142858482850161424c565b91505092915050565b6142978161422b565b82525050565b60006020820190506142b2600083018461428e565b92915050565b600067ffffffffffffffff8211156142d3576142d2613cff565b5b602082029050602081019050919050565b60006142f76142f2846142b8565b613d5f565b9050808382526020820190506020840283018581111561431a576143196140ce565b5b835b81811015614343578061432f8882613baa565b84526020840193505060208101905061431c565b5050509392505050565b600082601f83011261436257614361613ce4565b5b81356143728482602086016142e4565b91505092915050565b600067ffffffffffffffff82111561439657614395613cff565b5b61439f82613cee565b9050602081019050919050565b60006143bf6143ba8461437b565b613d5f565b9050828152602081018484840111156143db576143da613ce9565b5b6143e6848285613dab565b509392505050565b600082601f83011261440357614402613ce4565b5b81356144138482602086016143ac565b91505092915050565b600080600080600060a0868803121561443857614437613b21565b5b600061444688828901613b74565b955050602061445788828901613b74565b945050604086013567ffffffffffffffff81111561447857614477613b26565b5b6144848882890161434d565b935050606086013567ffffffffffffffff8111156144a5576144a4613b26565b5b6144b18882890161434d565b925050608086013567ffffffffffffffff8111156144d2576144d1613b26565b5b6144de888289016143ee565b9150509295509295909350565b6000806040838503121561450257614501613b21565b5b60006145108582860161424c565b925050602061452185828601613b74565b9150509250929050565b60006020828403121561454157614540613b21565b5b600061454f84828501613b74565b91505092915050565b600067ffffffffffffffff82111561457357614572613cff565b5b602082029050602081019050919050565b600061459761459284614558565b613d5f565b905080838252602082019050602084028301858111156145ba576145b96140ce565b5b835b818110156145e357806145cf8882613b74565b8452602084019350506020810190506145bc565b5050509392505050565b600082601f83011261460257614601613ce4565b5b8135614612848260208601614584565b91505092915050565b6000806040838503121561463257614631613b21565b5b600083013567ffffffffffffffff8111156146505761464f613b26565b5b61465c858286016145ed565b925050602083013567ffffffffffffffff81111561467d5761467c613b26565b5b6146898582860161434d565b9150509250929050565b600082825260208201905092915050565b60006146af82613eb2565b6146b98185614693565b93506146c483613ece565b8060005b838110156146f55781516146dc8882613eed565b97506146e783613f05565b9250506001810190506146c8565b5085935050505092915050565b6000602082019050818103600083015261471c81846146a4565b905092915050565b61472d81613b4b565b82525050565b60006020820190506147486000830184614724565b92915050565b61475781613cae565b811461476257600080fd5b50565b6000813590506147748161474e565b92915050565b6000806040838503121561479157614790613b21565b5b600061479f85828601613b74565b92505060206147b085828601614765565b9150509250929050565b6000602082840312156147d0576147cf613b21565b5b600082013567ffffffffffffffff8111156147ee576147ed613b26565b5b6147fa84828501613dfc565b91505092915050565b60008083601f84011261481957614818613ce4565b5b8235905067ffffffffffffffff811115614836576148356140c9565b5b602083019150836020820283011115614852576148516140ce565b5b9250929050565b60008060008060008060006080888a03121561487857614877613b21565b5b60006148868a828b01613b74565b975050602088013567ffffffffffffffff8111156148a7576148a6613b26565b5b6148b38a828b01614803565b9650965050604088013567ffffffffffffffff8111156148d6576148d5613b26565b5b6148e28a828b016140d3565b9450945050606088013567ffffffffffffffff81111561490557614904613b26565b5b6149118a828b016140d3565b925092505092959891949750929550565b60008060006060848603121561493b5761493a613b21565b5b600061494986828701613b74565b935050602061495a86828701613baa565b925050604061496b86828701613baa565b9150509250925092565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b600082825260208201905092915050565b60006149bd82614028565b6149c781856149a1565b93506149d7818560208601614044565b6149e081613cee565b840191505092915050565b60006149f783836149b2565b905092915050565b6000602082019050919050565b6000614a1782614975565b614a218185614980565b935083602082028501614a3385614991565b8060005b85811015614a6f5784840389528151614a5085826149eb565b9450614a5b836149ff565b925060208a01995050600181019050614a37565b50829750879550505050505092915050565b60006020820190508181036000830152614a9b8184614a0c565b905092915050565b60008060408385031215614aba57614ab9613b21565b5b6000614ac885828601613b74565b9250506020614ad985828601613b74565b9150509250929050565b600080600080600060a08688031215614aff57614afe613b21565b5b6000614b0d88828901613b74565b9550506020614b1e88828901613b74565b9450506040614b2f88828901613baa565b9350506060614b4088828901613baa565b925050608086013567ffffffffffffffff811115614b6157614b60613b26565b5b614b6d888289016143ee565b9150509295509295909350565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b60006002820490506001821680614bc157607f821691505b602082108103614bd457614bd3614b7a565b5b50919050565b60008190508160005260206000209050919050565b60006020601f8301049050919050565b600082821b905092915050565b600060088302614c3c7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82614bff565b614c468683614bff565b95508019841693508086168417925050509392505050565b6000819050919050565b6000614c83614c7e614c7984613b89565b614c5e565b613b89565b9050919050565b6000819050919050565b614c9d83614c68565b614cb1614ca982614c8a565b848454614c0c565b825550505050565b600090565b614cc6614cb9565b614cd1818484614c94565b505050565b5b81811015614cf557614cea600082614cbe565b600181019050614cd7565b5050565b601f821115614d3a57614d0b81614bda565b614d1484614bef565b81016020851015614d23578190505b614d37614d2f85614bef565b830182614cd6565b50505b505050565b600082821c905092915050565b6000614d5d60001984600802614d3f565b1980831691505092915050565b6000614d768383614d4c565b9150826002028217905092915050565b614d8f82614028565b67ffffffffffffffff811115614da857614da7613cff565b5b614db28254614ba9565b614dbd828285614cf9565b600060209050601f831160018114614df05760008415614dde578287015190505b614de88582614d6a565b865550614e50565b601f198416614dfe86614bda565b60005b82811015614e2657848901518255600182019150602085019450602081019050614e01565b86831015614e435784890151614e3f601f891682614d4c565b8355505b6001600288020188555050505b505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e6f7420617574686f72697a656420746f206d696e742e000000000000000000600082015250565b6000614ebd601783614033565b9150614ec882614e87565b602082019050919050565b60006020820190508181036000830152614eec81614eb0565b9050919050565b7f555249207265717565737420666f72206e6f6e206578697374656e742069746560008201527f6d49640000000000000000000000000000000000000000000000000000000000602082015250565b6000614f4f602383614033565b9150614f5a82614ef3565b604082019050919050565b60006020820190508181036000830152614f7e81614f42565b9050919050565b600081905092915050565b60008154614f9d81614ba9565b614fa78186614f85565b94506001821660008114614fc25760018114614fd75761500a565b60ff198316865281151582028601935061500a565b614fe085614bda565b60005b8381101561500257815481890152600182019150602081019050614fe3565b838801955050505b50505092915050565b600061501e82614028565b6150288185614f85565b9350615038818560208601614044565b80840191505092915050565b60006150508285614f90565b915061505c8284615013565b91508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006150a282613b89565b91506150ad83613b89565b92508282039050818111156150c5576150c4615068565b5b92915050565b60006150d682613b89565b91506150e183613b89565b92508282019050808211156150f9576150f8615068565b5b92915050565b60006040820190506151146000830185614724565b6151216020830184614724565b9392505050565b7f526f6c65206772616e74696e672072657175697265732061646d696e206f722060008201527f6d616e6167657220726f6c652e00000000000000000000000000000000000000602082015250565b6000615184602d83614033565b915061518f82615128565b604082019050919050565b600060208201905081810360008301526151b381615177565b9050919050565b7f4f6e6c792061646d696e2063616e206772616e742061646d696e206f72206d6160008201527f6e6167657220726f6c652e000000000000000000000000000000000000000000602082015250565b6000615216602b83614033565b9150615221826151ba565b604082019050919050565b6000602082019050818103600083015261524581615209565b9050919050565b7f4e6f7420617070726f76656420746f206275726e2e0000000000000000000000600082015250565b6000615282601583614033565b915061528d8261524c565b602082019050919050565b600060208201905081810360008301526152b181615275565b9050919050565b60006040820190506152cd6000830185613bff565b6152da6020830184613bff565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60006040820190506153256000830185614724565b615332602083018461428e565b9392505050565b7f4974656d206973206e6f742063757272656e746c79207472616e73666572616260008201527f6c652e0000000000000000000000000000000000000000000000000000000000602082015250565b6000615395602383614033565b91506153a082615339565b604082019050919050565b600060208201905081810360008301526153c481615388565b9050919050565b7f455243313135353a206275726e20616d6f756e7420657863656564732069746560008201527f6d537570706c7900000000000000000000000000000000000000000000000000602082015250565b6000615427602783614033565b9150615432826153cb565b604082019050919050565b600060208201905081810360008301526154568161541a565b9050919050565b600081519050919050565b600082825260208201905092915050565b60006154848261545d565b61548e8185615468565b935061549e818560208601614044565b6154a781613cee565b840191505092915050565b600060a0820190506154c76000830188614724565b6154d46020830187614724565b6154e16040830186613bff565b6154ee6060830185613bff565b81810360808301526155008184615479565b90509695505050505050565b60008151905061551b81613c55565b92915050565b60006020828403121561553757615536613b21565b5b60006155458482850161550c565b91505092915050565b600060a0820190506155636000830188614724565b6155706020830187614724565b818103604083015261558281866146a4565b9050818103606083015261559681856146a4565b905081810360808301526155aa8184615479565b90509695505050505050565b60006080820190506155cb6000830187614724565b6155d86020830186613bff565b6155e56040830185613bff565b6155f26060830184613bff565b95945050505050565b6000604082019050818103600083015261561581856146a4565b9050818103602083015261562981846146a4565b9050939250505056fea2646970667358221220c2a84ee49c89b6ede380bbe7428a5e01b3565d282b21267a2cc410108df2354564736f6c63430008180033
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.