ERC-1155
NFT
Overview
Max Total Supply
22,846 MONSKIN
Holders
1,800
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
DefimonsSkins
Compiler Version
v0.8.15+commit.e14f2714
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import { IAccessControl } from "@openzeppelin/contracts/access/IAccessControl.sol"; import { AccessControl } from "@openzeppelin/contracts/access/AccessControl.sol"; import { IONFT1155 } from "../Omnichain/token/onft/IONFT1155.sol"; import { ONFT1155 } from "../Omnichain/token/onft/ONFT1155.sol"; contract DefimonsSkins is AccessControl, ONFT1155 { // // Events // event SkinMinterSet(address skinMinterAddress); event SkinMinterRevoked(address revokedAddress); event URISet(string newURI); // // Constants // bytes32 public constant SKIN_MINTER_ROLE = keccak256("SKIN_MINTER_ROLE"); // // State // // Immutable string private _name; string private _symbol; // Total supply of tokens with given ID mapping(uint256 => uint256) public totalSupply; // // Constructor // /** * @param name_ Name for this collection. * @param symbol_ Symbol for this collection. * @param uri_ Initial uri to be set for this collection. * @param lzEndpoint_ Adddress of the LayerZero endpoint contract. * @param adminAddress_ Address to be granted the DEFAULT_ADMIN_ROLE to. */ constructor( string memory name_, string memory symbol_, string memory uri_, address lzEndpoint_, address adminAddress_ ) ONFT1155(uri_, lzEndpoint_) { require(lzEndpoint_ != address(0), "Layer Zero endpoint can't be zero address"); require(adminAddress_ != address(0), "Admin address can't be zero address"); _name = name_; _symbol = symbol_; _grantRole(DEFAULT_ADMIN_ROLE, adminAddress_); emit URISet(uri_); } // // Admin API // /** * @dev Grants SKIN_MINTER_ROLE to minterAddress_. * Required to call mint() and mintBatch() functions. */ function setSkinMinterRole(address minterAddress_) public onlyRole(DEFAULT_ADMIN_ROLE) { _grantRole(SKIN_MINTER_ROLE, minterAddress_); emit SkinMinterSet(minterAddress_); } /** * @dev Revokes SKIN_MINTER_ROLE from minterAddres_. */ function revokeSkinMinterRole(address minterAddress_) public onlyRole(DEFAULT_ADMIN_ROLE) { _revokeRole(SKIN_MINTER_ROLE, minterAddress_); emit SkinMinterRevoked(minterAddress_); } /** * @dev Sets the URI for *ALL* tokens. * See {ERC1155 - uri} */ function setURI(string memory newURI_) public onlyRole(DEFAULT_ADMIN_ROLE) { _setURI(newURI_); emit URISet(newURI_); } // // Skin Minter API // /** * @dev Exposes the _mint() function. * Can only be called by an address with SKIN_MINTER_ROLE. * @param to_ The address to mint the tokens to. * @param tokenId_ The tokenId of the tokens to be minted. * @param amount_ The amount of token to be minted. * @param data_ Arbitrary data to be sent to _mint() function. */ function mint( address to_, uint256 tokenId_, uint256 amount_, bytes memory data_ ) external onlyRole(SKIN_MINTER_ROLE) { _mint(to_, tokenId_, amount_, data_); } /** * @notice Mints a batch of Skins to each address present in the list. * @dev This function calls the '_mintBatch()' function inside a recursive loop. Beware of gas spending! * @param addrs_ The list of addresses to mint to. * @param ids_ The IDs of the Skins to mint per address. * @param amounts_ The amount of each token ID to mint per address. */ function mintBatch( address[] memory addrs_, uint256[][] memory ids_, uint256[][] memory amounts_ ) external onlyRole(SKIN_MINTER_ROLE) { for (uint256 i = 0; i < addrs_.length; ) { _mintBatch(addrs_[i], ids_[i], amounts_[i], ""); unchecked { ++i; } } } // // Public Read API // /** * @dev Getter for this collection's name */ function name() public view returns (string memory) { return _name; } /** * @dev Getter for this collection's symbol */ function symbol() public view returns (string memory) { return _symbol; } // // ERC1155 // function _beforeTokenTransfer( // solhint-disable-next-line no-unused-vars address, address from, address to, uint256[] memory ids, uint256[] memory amounts, // solhint-disable-next-line no-unused-vars bytes memory ) internal virtual override { if (from == address(0)) { for (uint256 i = 0; i < ids.length; ) { totalSupply[ids[i]] += amounts[i]; unchecked { ++i; } } } if (to == address(0)) { for (uint256 i = 0; i < ids.length; ) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 supply = totalSupply[id]; require(supply >= amount, "ERC1155: Burn amount exceeds totalSupply"); unchecked { totalSupply[id] = supply - amount; } unchecked { ++i; } } } } // // ERC165 // function supportsInterface(bytes4 interfaceId) public view virtual override(AccessControl, ONFT1155) returns (bool) { return interfaceId == type(IAccessControl).interfaceId || interfaceId == type(IONFT1155).interfaceId || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../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: * * ``` * 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}: * * ``` * 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. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ 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 override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @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 override 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 override 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 override 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 `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @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 Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @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. * * _Available since v3.1._ */ 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 `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.0; import "./IERC1155.sol"; import "./IERC1155Receiver.sol"; import "./extensions/IERC1155MetadataURI.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 * * _Available since v3.1._ */ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { using Address for address; // Mapping from token ID to account balances mapping(uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor(string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) public view virtual override returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1155: address zero is not a valid owner"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not token owner or approved" ); _safeTransferFrom(from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not token owner or approved" ); _safeBatchTransferFrom(from, to, ids, amounts, data); } /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, to, ids, amounts, data); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; emit TransferSingle(operator, from, to, id, amount); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; } emit TransferBatch(operator, from, to, ids, amounts); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); _balances[id][to] += amount; emit TransferSingle(operator, address(0), to, id, amount); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint256 i = 0; i < ids.length; i++) { _balances[ids[i]][to] += amounts[i]; } emit TransferBatch(operator, address(0), to, ids, amounts); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `amount` tokens of token type `id`. */ function _burn( address from, uint256 id, uint256 amount ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } emit TransferSingle(operator, from, address(0), id, amount); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch( address from, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } } emit TransferBatch(operator, from, address(0), ids, amounts); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC1155: setting approval status for self"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `ids` and `amounts` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} /** * @dev Hook that is called after any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non-ERC1155Receiver implementer"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non-ERC1155Receiver implementer"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^0.8.0; import "../IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. * * _Available since v3.1._ */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "./ILayerZeroUserApplicationConfig.sol"; interface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig { // @notice send a LayerZero message to the specified address at a LayerZero endpoint. // @param _dstChainId - the destination chain identifier // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains // @param _payload - a custom bytes payload to send to the destination contract // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination function send(uint16 _dstChainId, bytes calldata _destination, bytes calldata _payload, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable; // @notice used by the messaging library to publish verified payload // @param _srcChainId - the source chain identifier // @param _srcAddress - the source contract (as bytes) at the source chain // @param _dstAddress - the address on destination chain // @param _nonce - the unbound message ordering nonce // @param _gasLimit - the gas limit for external contract execution // @param _payload - verified payload to send to the destination contract function receivePayload(uint16 _srcChainId, bytes calldata _srcAddress, address _dstAddress, uint64 _nonce, uint _gasLimit, bytes calldata _payload) external; // @notice get the inboundNonce of a lzApp from a source chain which could be EVM or non-EVM chain // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64); // @notice get the outboundNonce from this source chain which, consequently, is always an EVM // @param _srcAddress - the source chain contract address function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64); // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery // @param _dstChainId - the destination chain identifier // @param _userApplication - the user app address on this EVM chain // @param _payload - the custom message to send over LayerZero // @param _payInZRO - if false, user app pays the protocol fee in native token // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain function estimateFees(uint16 _dstChainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam) external view returns (uint nativeFee, uint zroFee); // @notice get this Endpoint's immutable source identifier function getChainId() external view returns (uint16); // @notice the interface to retry failed message on this Endpoint destination // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address // @param _payload - the payload to be retried function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external; // @notice query if any STORED payload (message blocking) at the endpoint. // @param _srcChainId - the source chain identifier // @param _srcAddress - the source chain contract address function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool); // @notice query if the _libraryAddress is valid for sending msgs. // @param _userApplication - the user app address on this EVM chain function getSendLibraryAddress(address _userApplication) external view returns (address); // @notice query if the _libraryAddress is valid for receiving msgs. // @param _userApplication - the user app address on this EVM chain function getReceiveLibraryAddress(address _userApplication) external view returns (address); // @notice query if the non-reentrancy guard for send() is on // @return true if the guard is on. false otherwise function isSendingPayload() external view returns (bool); // @notice query if the non-reentrancy guard for receive() is on // @return true if the guard is on. false otherwise function isReceivingPayload() external view returns (bool); // @notice get the configuration of the LayerZero messaging library of the specified version // @param _version - messaging library version // @param _chainId - the chainId for the pending config change // @param _userApplication - the contract address of the user application // @param _configType - type of configuration. every messaging library has its own convention. function getConfig(uint16 _version, uint16 _chainId, address _userApplication, uint _configType) external view returns (bytes memory); // @notice get the send() LayerZero messaging library version // @param _userApplication - the contract address of the user application function getSendVersion(address _userApplication) external view returns (uint16); // @notice get the lzReceive() LayerZero messaging library version // @param _userApplication - the contract address of the user application function getReceiveVersion(address _userApplication) external view returns (uint16); }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface ILayerZeroReceiver { // @notice LayerZero endpoint will invoke this function to deliver the message on the destination // @param _srcChainId - the source endpoint identifier // @param _srcAddress - the source sending contract address from the source chain // @param _nonce - the ordered message nonce // @param _payload - the signed payload is the UA bytes has encoded to be sent function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; interface ILayerZeroUserApplicationConfig { // @notice set the configuration of the LayerZero messaging library of the specified version // @param _version - messaging library version // @param _chainId - the chainId for the pending config change // @param _configType - type of configuration. every messaging library has its own convention. // @param _config - configuration in the bytes. can encode arbitrary content. function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external; // @notice set the send() LayerZero messaging library version to _version // @param _version - new messaging library version function setSendVersion(uint16 _version) external; // @notice set the lzReceive() LayerZero messaging library version to _version // @param _version - new messaging library version function setReceiveVersion(uint16 _version) external; // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload // @param _srcChainId - the chainId of the source chain // @param _srcAddress - the contract address of the source contract at the source chain function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "../interfaces/ILayerZeroReceiver.sol"; import "../interfaces/ILayerZeroUserApplicationConfig.sol"; import "../interfaces/ILayerZeroEndpoint.sol"; import "../util/BytesLib.sol"; /* * a generic LzReceiver implementation */ abstract contract LzApp is Ownable, ILayerZeroReceiver, ILayerZeroUserApplicationConfig { using BytesLib for bytes; ILayerZeroEndpoint public immutable lzEndpoint; mapping(uint16 => bytes) public trustedRemoteLookup; mapping(uint16 => mapping(uint16 => uint)) public minDstGasLookup; address public precrime; event SetPrecrime(address precrime); event SetTrustedRemote(uint16 _remoteChainId, bytes _path); event SetTrustedRemoteAddress(uint16 _remoteChainId, bytes _remoteAddress); event SetMinDstGas(uint16 _dstChainId, uint16 _type, uint _minDstGas); constructor(address _endpoint) { lzEndpoint = ILayerZeroEndpoint(_endpoint); } function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual override { // lzReceive must be called by the endpoint for security require(_msgSender() == address(lzEndpoint), "LzApp: invalid endpoint caller"); bytes memory trustedRemote = trustedRemoteLookup[_srcChainId]; // if will still block the message pathway from (srcChainId, srcAddress). should not receive message from untrusted remote. require(_srcAddress.length == trustedRemote.length && trustedRemote.length > 0 && keccak256(_srcAddress) == keccak256(trustedRemote), "LzApp: invalid source sending contract"); _blockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); } // abstract function - the default behaviour of LayerZero is blocking. See: NonblockingLzApp if you dont need to enforce ordered messaging function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual; function _lzSend(uint16 _dstChainId, bytes memory _payload, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams, uint _nativeFee) internal virtual { bytes memory trustedRemote = trustedRemoteLookup[_dstChainId]; require(trustedRemote.length != 0, "LzApp: destination chain is not a trusted source"); lzEndpoint.send{value: _nativeFee}(_dstChainId, trustedRemote, _payload, _refundAddress, _zroPaymentAddress, _adapterParams); } function _checkGasLimit(uint16 _dstChainId, uint16 _type, bytes memory _adapterParams, uint _extraGas) internal view virtual { uint providedGasLimit = _getGasLimit(_adapterParams); uint minGasLimit = minDstGasLookup[_dstChainId][_type] + _extraGas; require(minGasLimit > 0, "LzApp: minGasLimit not set"); require(providedGasLimit >= minGasLimit, "LzApp: gas limit is too low"); } function _getGasLimit(bytes memory _adapterParams) internal pure virtual returns (uint gasLimit) { require(_adapterParams.length >= 34, "LzApp: invalid adapterParams"); assembly { gasLimit := mload(add(_adapterParams, 34)) } } //---------------------------UserApplication config---------------------------------------- function getConfig(uint16 _version, uint16 _chainId, address, uint _configType) external view returns (bytes memory) { return lzEndpoint.getConfig(_version, _chainId, address(this), _configType); } // generic config for LayerZero user Application function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external override onlyOwner { lzEndpoint.setConfig(_version, _chainId, _configType, _config); } function setSendVersion(uint16 _version) external override onlyOwner { lzEndpoint.setSendVersion(_version); } function setReceiveVersion(uint16 _version) external override onlyOwner { lzEndpoint.setReceiveVersion(_version); } function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external override onlyOwner { lzEndpoint.forceResumeReceive(_srcChainId, _srcAddress); } // _path = abi.encodePacked(remoteAddress, localAddress) // this function set the trusted path for the cross-chain communication function setTrustedRemote(uint16 _srcChainId, bytes calldata _path) external onlyOwner { trustedRemoteLookup[_srcChainId] = _path; emit SetTrustedRemote(_srcChainId, _path); } function setTrustedRemoteAddress(uint16 _remoteChainId, bytes calldata _remoteAddress) external onlyOwner { trustedRemoteLookup[_remoteChainId] = abi.encodePacked(_remoteAddress, address(this)); emit SetTrustedRemoteAddress(_remoteChainId, _remoteAddress); } function getTrustedRemoteAddress(uint16 _remoteChainId) external view returns (bytes memory) { bytes memory path = trustedRemoteLookup[_remoteChainId]; require(path.length != 0, "LzApp: no trusted path record"); return path.slice(0, path.length - 20); // the last 20 bytes should be address(this) } function setPrecrime(address _precrime) external onlyOwner { precrime = _precrime; emit SetPrecrime(_precrime); } function setMinDstGas(uint16 _dstChainId, uint16 _packetType, uint _minGas) external onlyOwner { require(_minGas > 0, "LzApp: invalid minGas"); minDstGasLookup[_dstChainId][_packetType] = _minGas; emit SetMinDstGas(_dstChainId, _packetType, _minGas); } //--------------------------- VIEW FUNCTION ---------------------------------------- function isTrustedRemote(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool) { bytes memory trustedSource = trustedRemoteLookup[_srcChainId]; return keccak256(trustedSource) == keccak256(_srcAddress); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./LzApp.sol"; import "../util/ExcessivelySafeCall.sol"; /* * the default LayerZero messaging behaviour is blocking, i.e. any failed message will block the channel * this abstract class try-catch all fail messages and store locally for future retry. hence, non-blocking * NOTE: if the srcAddress is not configured properly, it will still block the message pathway from (srcChainId, srcAddress) */ abstract contract NonblockingLzApp is LzApp { using ExcessivelySafeCall for address; constructor(address _endpoint) LzApp(_endpoint) {} mapping(uint16 => mapping(bytes => mapping(uint64 => bytes32))) public failedMessages; event MessageFailed(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes _payload, bytes _reason); event RetryMessageSuccess(uint16 _srcChainId, bytes _srcAddress, uint64 _nonce, bytes32 _payloadHash); // overriding the virtual function in LzReceiver function _blockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual override { (bool success, bytes memory reason) = address(this).excessivelySafeCall(gasleft(), 150, abi.encodeWithSelector(this.nonblockingLzReceive.selector, _srcChainId, _srcAddress, _nonce, _payload)); // try-catch all errors/exceptions if (!success) { failedMessages[_srcChainId][_srcAddress][_nonce] = keccak256(_payload); emit MessageFailed(_srcChainId, _srcAddress, _nonce, _payload, reason); } } function nonblockingLzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public virtual { // only internal transaction require(_msgSender() == address(this), "NonblockingLzApp: caller must be LzApp"); _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); } //@notice override this function function _nonblockingLzReceive(uint16 _srcChainId, bytes memory _srcAddress, uint64 _nonce, bytes memory _payload) internal virtual; function retryMessage(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) public payable virtual { // assert there is message to retry bytes32 payloadHash = failedMessages[_srcChainId][_srcAddress][_nonce]; require(payloadHash != bytes32(0), "NonblockingLzApp: no stored message"); require(keccak256(_payload) == payloadHash, "NonblockingLzApp: invalid payload"); // clear the stored message failedMessages[_srcChainId][_srcAddress][_nonce] = bytes32(0); // execute the message. revert if it fails again _nonblockingLzReceive(_srcChainId, _srcAddress, _nonce, _payload); emit RetryMessageSuccess(_srcChainId, _srcAddress, _nonce, payloadHash); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "./IONFT1155Core.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; /** * @dev Interface of the ONFT standard */ interface IONFT1155 is IONFT1155Core, IERC1155 { }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * @dev Interface of the ONFT Core standard */ interface IONFT1155Core is IERC165 { event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint _tokenId, uint _amount); event SendBatchToChain(uint16 indexed _dstChainId, address indexed _from, bytes indexed _toAddress, uint[] _tokenIds, uint[] _amounts); event ReceiveFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint _tokenId, uint _amount); event ReceiveBatchFromChain(uint16 indexed _srcChainId, bytes indexed _srcAddress, address indexed _toAddress, uint[] _tokenIds, uint[] _amounts); // _from - address where tokens should be deducted from on behalf of // _dstChainId - L0 defined chain id to send tokens too // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain // _tokenId - token Id to transfer // _amount - amount of the tokens to transfer // _refundAddress - address on src that will receive refund for any overpayment of L0 fees // _zroPaymentAddress - if paying in zro, pass the address to use. using 0x0 indicates not paying fees in zro // _adapterParams - flexible bytes array to indicate messaging adapter services in L0 function sendFrom(address _from, uint16 _dstChainId, bytes calldata _toAddress, uint _tokenId, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable; // _from - address where tokens should be deducted from on behalf of // _dstChainId - L0 defined chain id to send tokens too // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain // _tokenIds - token Ids to transfer // _amounts - amounts of the tokens to transfer // _refundAddress - address on src that will receive refund for any overpayment of L0 fees // _zroPaymentAddress - if paying in zro, pass the address to use. using 0x0 indicates not paying fees in zro // _adapterParams - flexible bytes array to indicate messaging adapter services in L0 function sendBatchFrom(address _from, uint16 _dstChainId, bytes calldata _toAddress, uint[] calldata _tokenIds, uint[] calldata _amounts, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable; // _dstChainId - L0 defined chain id to send tokens too // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain // _tokenId - token Id to transfer // _amount - amount of the tokens to transfer // _useZro - indicates to use zro to pay L0 fees // _adapterParams - flexible bytes array to indicate messaging adapter services in L0 function estimateSendFee(uint16 _dstChainId, bytes calldata _toAddress, uint _tokenId, uint _amount, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee); // _dstChainId - L0 defined chain id to send tokens too // _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain // _tokenIds - tokens Id to transfer // _amounts - amounts of the tokens to transfer // _useZro - indicates to use zro to pay L0 fees // _adapterParams - flexible bytes array to indicate messaging adapter services in L0 function estimateSendBatchFee(uint16 _dstChainId, bytes calldata _toAddress, uint[] calldata _tokenIds, uint[] calldata _amounts, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IONFT1155.sol"; import "./ONFT1155Core.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; // NOTE: this ONFT contract has no public minting logic. // must implement your own minting logic in child classes contract ONFT1155 is ONFT1155Core, ERC1155, IONFT1155 { constructor(string memory _uri, address _lzEndpoint) ERC1155(_uri) ONFT1155Core(_lzEndpoint) {} function supportsInterface(bytes4 interfaceId) public view virtual override(ONFT1155Core, ERC1155, IERC165) returns (bool) { return interfaceId == type(IONFT1155).interfaceId || super.supportsInterface(interfaceId); } function _debitFrom(address _from, uint16, bytes memory, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual override { address spender = _msgSender(); require(spender == _from || isApprovedForAll(_from, spender), "ONFT1155: send caller is not owner nor approved"); _burnBatch(_from, _tokenIds, _amounts); } function _creditTo(uint16, address _toAddress, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual override { _mintBatch(_toAddress, _tokenIds, _amounts, ""); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IONFT1155Core.sol"; import "../../lzApp/NonblockingLzApp.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; abstract contract ONFT1155Core is NonblockingLzApp, ERC165, IONFT1155Core { uint public constant NO_EXTRA_GAS = 0; uint16 public constant FUNCTION_TYPE_SEND = 1; uint16 public constant FUNCTION_TYPE_SEND_BATCH = 2; bool public useCustomAdapterParams; event SetUseCustomAdapterParams(bool _useCustomAdapterParams); constructor(address _lzEndpoint) NonblockingLzApp(_lzEndpoint) {} function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IONFT1155Core).interfaceId || super.supportsInterface(interfaceId); } function estimateSendFee(uint16 _dstChainId, bytes memory _toAddress, uint _tokenId, uint _amount, bool _useZro, bytes memory _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) { return estimateSendBatchFee(_dstChainId, _toAddress, _toSingletonArray(_tokenId), _toSingletonArray(_amount), _useZro, _adapterParams); } function estimateSendBatchFee(uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, uint[] memory _amounts, bool _useZro, bytes memory _adapterParams) public view virtual override returns (uint nativeFee, uint zroFee) { bytes memory payload = abi.encode(_toAddress, _tokenIds, _amounts); return lzEndpoint.estimateFees(_dstChainId, address(this), payload, _useZro, _adapterParams); } function sendFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint _tokenId, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) public payable virtual override { _sendBatch(_from, _dstChainId, _toAddress, _toSingletonArray(_tokenId), _toSingletonArray(_amount), _refundAddress, _zroPaymentAddress, _adapterParams); } function sendBatchFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, uint[] memory _amounts, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) public payable virtual override { _sendBatch(_from, _dstChainId, _toAddress, _tokenIds, _amounts, _refundAddress, _zroPaymentAddress, _adapterParams); } function _sendBatch(address _from, uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, uint[] memory _amounts, address payable _refundAddress, address _zroPaymentAddress, bytes memory _adapterParams) internal virtual { _debitFrom(_from, _dstChainId, _toAddress, _tokenIds, _amounts); bytes memory payload = abi.encode(_toAddress, _tokenIds, _amounts); if (_tokenIds.length == 1) { if (useCustomAdapterParams) { _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND, _adapterParams, NO_EXTRA_GAS); } else { require(_adapterParams.length == 0, "LzApp: _adapterParams must be empty."); } _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value); emit SendToChain(_dstChainId, _from, _toAddress, _tokenIds[0], _amounts[0]); } else if (_tokenIds.length > 1) { if (useCustomAdapterParams) { _checkGasLimit(_dstChainId, FUNCTION_TYPE_SEND_BATCH, _adapterParams, NO_EXTRA_GAS); } else { require(_adapterParams.length == 0, "LzApp: _adapterParams must be empty."); } _lzSend(_dstChainId, payload, _refundAddress, _zroPaymentAddress, _adapterParams, msg.value); emit SendBatchToChain(_dstChainId, _from, _toAddress, _tokenIds, _amounts); } } function _nonblockingLzReceive( uint16 _srcChainId, bytes memory _srcAddress, uint64, /*_nonce*/ bytes memory _payload ) internal virtual override { // decode and load the toAddress (bytes memory toAddressBytes, uint[] memory tokenIds, uint[] memory amounts) = abi.decode(_payload, (bytes, uint[], uint[])); address toAddress; assembly { toAddress := mload(add(toAddressBytes, 20)) } _creditTo(_srcChainId, toAddress, tokenIds, amounts); if (tokenIds.length == 1) { emit ReceiveFromChain(_srcChainId, _srcAddress, toAddress, tokenIds[0], amounts[0]); } else if (tokenIds.length > 1) { emit ReceiveBatchFromChain(_srcChainId, _srcAddress, toAddress, tokenIds, amounts); } } function setUseCustomAdapterParams(bool _useCustomAdapterParams) external onlyOwner { useCustomAdapterParams = _useCustomAdapterParams; emit SetUseCustomAdapterParams(_useCustomAdapterParams); } function _debitFrom(address _from, uint16 _dstChainId, bytes memory _toAddress, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual; function _creditTo(uint16 _srcChainId, address _toAddress, uint[] memory _tokenIds, uint[] memory _amounts) internal virtual; function _toSingletonArray(uint element) internal pure returns (uint[] memory) { uint[] memory array = new uint[](1); array[0] = element; return array; } }
// SPDX-License-Identifier: Unlicense /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity >=0.8.0 <0.9.0; library BytesLib { function concat( bytes memory _preBytes, bytes memory _postBytes ) internal pure returns (bytes memory) { bytes memory tempBytes; assembly { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // Store the length of the first bytes array at the beginning of // the memory for tempBytes. let length := mload(_preBytes) mstore(tempBytes, length) // Maintain a memory counter for the current write location in the // temp bytes array by adding the 32 bytes for the array length to // the starting location. let mc := add(tempBytes, 0x20) // Stop copying when the memory counter reaches the length of the // first bytes array. let end := add(mc, length) for { // Initialize a copy counter to the start of the _preBytes data, // 32 bytes into its memory. let cc := add(_preBytes, 0x20) } lt(mc, end) { // Increase both counters by 32 bytes each iteration. mc := add(mc, 0x20) cc := add(cc, 0x20) } { // Write the _preBytes data into the tempBytes memory 32 bytes // at a time. mstore(mc, mload(cc)) } // Add the length of _postBytes to the current length of tempBytes // and store it as the new length in the first 32 bytes of the // tempBytes memory. length := mload(_postBytes) mstore(tempBytes, add(length, mload(tempBytes))) // Move the memory counter back from a multiple of 0x20 to the // actual end of the _preBytes data. mc := end // Stop copying when the memory counter reaches the new combined // length of the arrays. end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } // Update the free-memory pointer by padding our last write location // to 32 bytes: add 31 bytes to the end of tempBytes to move to the // next 32 byte block, then round down to the nearest multiple of // 32. If the sum of the length of the two arrays is zero then add // one before rounding down to leave a blank 32 bytes (the length block with 0). mstore(0x40, and( add(add(end, iszero(add(length, mload(_preBytes)))), 31), not(31) // Round down to the nearest 32 bytes. )) } return tempBytes; } function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal { assembly { // Read the first 32 bytes of _preBytes storage, which is the length // of the array. (We don't need to use the offset into the slot // because arrays use the entire slot.) let fslot := sload(_preBytes.slot) // Arrays of 31 bytes or less have an even value in their slot, // while longer arrays have an odd value. The actual length is // the slot divided by two for odd values, and the lowest order // byte divided by two for even values. // If the slot is even, bitwise and the slot with 255 and divide by // two to get the length. If the slot is odd, bitwise and the slot // with -1 and divide by two. let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) let newlength := add(slength, mlength) // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage switch add(lt(slength, 32), lt(newlength, 32)) case 2 { // Since the new array still fits in the slot, we just need to // update the contents of the slot. // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length sstore( _preBytes.slot, // all the modifications to the slot are inside this // next block add( // we can just add to the slot contents because the // bytes we want to change are the LSBs fslot, add( mul( div( // load the bytes from memory mload(add(_postBytes, 0x20)), // zero all bytes to the right exp(0x100, sub(32, mlength)) ), // and now shift left the number of bytes to // leave space for the length in the slot exp(0x100, sub(32, newlength)) ), // increase length by the double of the memory // bytes length mul(mlength, 2) ) ) ) } case 1 { // The stored value fits in the slot, but the combined value // will exceed it. // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // The contents of the _postBytes array start 32 bytes into // the structure. Our first read should obtain the `submod` // bytes that can fit into the unused space in the last word // of the stored array. To get this, we read 32 bytes starting // from `submod`, so the data we read overlaps with the array // contents by `submod` bytes. Masking the lowest-order // `submod` bytes allows us to add that value directly to the // stored value. let submod := sub(32, slength) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore( sc, add( and( fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00 ), and(mload(mc), mask) ) ) for { mc := add(mc, 0x20) sc := add(sc, 1) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } default { // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) // Start copying to the last used word of the stored array. let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // Copy over the first `submod` bytes of the new data as in // case 1 above. let slengthmod := mod(slength, 32) let mlengthmod := mod(mlength, 32) let submod := sub(32, slengthmod) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore(sc, add(sload(sc), and(mload(mc), mask))) for { sc := add(sc, 1) mc := add(mc, 0x20) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } } } function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { require(_length + 31 >= _length, "slice_overflow"); require(_bytes.length >= _start + _length, "slice_outOfBounds"); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_bytes.length >= _start + 20, "toAddress_outOfBounds"); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) { require(_bytes.length >= _start + 1 , "toUint8_outOfBounds"); uint8 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x1), _start)) } return tempUint; } function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) { require(_bytes.length >= _start + 2, "toUint16_outOfBounds"); uint16 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x2), _start)) } return tempUint; } function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) { require(_bytes.length >= _start + 4, "toUint32_outOfBounds"); uint32 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x4), _start)) } return tempUint; } function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) { require(_bytes.length >= _start + 8, "toUint64_outOfBounds"); uint64 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x8), _start)) } return tempUint; } function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) { require(_bytes.length >= _start + 12, "toUint96_outOfBounds"); uint96 tempUint; assembly { tempUint := mload(add(add(_bytes, 0xc), _start)) } return tempUint; } function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) { require(_bytes.length >= _start + 16, "toUint128_outOfBounds"); uint128 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x10), _start)) } return tempUint; } function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) { require(_bytes.length >= _start + 32, "toUint256_outOfBounds"); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) { require(_bytes.length >= _start + 32, "toBytes32_outOfBounds"); bytes32 tempBytes32; assembly { tempBytes32 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes32; } function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) { bool success = true; assembly { let length := mload(_preBytes) // if lengths don't match the arrays are not equal switch eq(length, mload(_postBytes)) case 1 { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 let mc := add(_preBytes, 0x20) let end := add(mc, length) for { let cc := add(_postBytes, 0x20) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) } eq(add(lt(mc, end), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { // if any of these checks fails then arrays are not equal if iszero(eq(mload(mc), mload(cc))) { // unsuccess: success := 0 cb := 0 } } } default { // unsuccess: success := 0 } } return success; } function equalStorage( bytes storage _preBytes, bytes memory _postBytes ) internal view returns (bool) { bool success = true; assembly { // we know _preBytes_offset is 0 let fslot := sload(_preBytes.slot) // Decode the length of the stored array like in concatStorage(). let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) // if lengths don't match the arrays are not equal switch eq(slength, mlength) case 1 { // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage if iszero(iszero(slength)) { switch lt(slength, 32) case 1 { // blank the last byte which is the length fslot := mul(div(fslot, 0x100), 0x100) if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) { // unsuccess: success := 0 } } default { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := keccak256(0x0, 0x20) let mc := add(_postBytes, 0x20) let end := add(mc, mlength) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) for {} eq(add(lt(mc, end), cb), 2) { sc := add(sc, 1) mc := add(mc, 0x20) } { if iszero(eq(sload(sc), mload(mc))) { // unsuccess: success := 0 cb := 0 } } } } } default { // unsuccess: success := 0 } } return success; } }
// SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity >=0.7.6; library ExcessivelySafeCall { uint256 constant LOW_28_MASK = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff; /// @notice Use when you _really_ really _really_ don't trust the called /// contract. This prevents the called contract from causing reversion of /// the caller in as many ways as we can. /// @dev The main difference between this and a solidity low-level call is /// that we limit the number of bytes that the callee can cause to be /// copied to caller memory. This prevents stupid things like malicious /// contracts returning 10,000,000 bytes causing a local OOG when copying /// to memory. /// @param _target The address to call /// @param _gas The amount of gas to forward to the remote contract /// @param _maxCopy The maximum number of bytes of returndata to copy /// to memory. /// @param _calldata The data to send to the remote contract /// @return success and returndata, as `.call()`. Returndata is capped to /// `_maxCopy` bytes. function excessivelySafeCall( address _target, uint256 _gas, uint16 _maxCopy, bytes memory _calldata ) internal returns (bool, bytes memory) { // set up for assembly call uint256 _toCopy; bool _success; bytes memory _returnData = new bytes(_maxCopy); // dispatch message to recipient // by assembly calling "handle" function // we call via assembly to avoid memcopying a very large returndata // returned by a malicious contract assembly { _success := call( _gas, // gas _target, // recipient 0, // ether value add(_calldata, 0x20), // inloc mload(_calldata), // inlen 0, // outloc 0 // outlen ) // limit our copy to 256 bytes _toCopy := returndatasize() if gt(_toCopy, _maxCopy) { _toCopy := _maxCopy } // Store the length of the copied bytes mstore(_returnData, _toCopy) // copy the bytes from returndata[0:_toCopy] returndatacopy(add(_returnData, 0x20), 0, _toCopy) } return (_success, _returnData); } /// @notice Use when you _really_ really _really_ don't trust the called /// contract. This prevents the called contract from causing reversion of /// the caller in as many ways as we can. /// @dev The main difference between this and a solidity low-level call is /// that we limit the number of bytes that the callee can cause to be /// copied to caller memory. This prevents stupid things like malicious /// contracts returning 10,000,000 bytes causing a local OOG when copying /// to memory. /// @param _target The address to call /// @param _gas The amount of gas to forward to the remote contract /// @param _maxCopy The maximum number of bytes of returndata to copy /// to memory. /// @param _calldata The data to send to the remote contract /// @return success and returndata, as `.call()`. Returndata is capped to /// `_maxCopy` bytes. function excessivelySafeStaticCall( address _target, uint256 _gas, uint16 _maxCopy, bytes memory _calldata ) internal view returns (bool, bytes memory) { // set up for assembly call uint256 _toCopy; bool _success; bytes memory _returnData = new bytes(_maxCopy); // dispatch message to recipient // by assembly calling "handle" function // we call via assembly to avoid memcopying a very large returndata // returned by a malicious contract assembly { _success := staticcall( _gas, // gas _target, // recipient add(_calldata, 0x20), // inloc mload(_calldata), // inlen 0, // outloc 0 // outlen ) // limit our copy to 256 bytes _toCopy := returndatasize() if gt(_toCopy, _maxCopy) { _toCopy := _maxCopy } // Store the length of the copied bytes mstore(_returnData, _toCopy) // copy the bytes from returndata[0:_toCopy] returndatacopy(add(_returnData, 0x20), 0, _toCopy) } return (_success, _returnData); } /** * @notice Swaps function selectors in encoded contract calls * @dev Allows reuse of encoded calldata for functions with identical * argument types but different names. It simply swaps out the first 4 bytes * for the new selector. This function modifies memory in place, and should * only be used with caution. * @param _newSelector The new 4-byte selector * @param _buf The encoded contract args */ function swapSelector(bytes4 _newSelector, bytes memory _buf) internal pure { require(_buf.length >= 4); uint256 _mask = LOW_28_MASK; assembly { // load the first word of let _word := mload(add(_buf, 0x20)) // mask out the top 4 bytes // /x _word := and(_word, _mask) _word := or(_newSelector, _word) mstore(add(_buf, 0x20), _word) } } }
{ "remappings": [ "@openzeppelin/=lib/openzeppelin-contracts/", "@threesigma/=lib/threesigma-contracts/", "ds-test/=lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/contracts/", "threesigma-contracts/=lib/threesigma-contracts/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"name_","type":"string"},{"internalType":"string","name":"symbol_","type":"string"},{"internalType":"string","name":"uri_","type":"string"},{"internalType":"address","name":"lzEndpoint_","type":"address"},{"internalType":"address","name":"adminAddress_","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"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":false,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"},{"indexed":false,"internalType":"bytes","name":"_payload","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"_reason","type":"bytes"}],"name":"MessageFailed","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":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":true,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":true,"internalType":"address","name":"_toAddress","type":"address"},{"indexed":false,"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"ReceiveBatchFromChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":true,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":true,"internalType":"address","name":"_toAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"ReceiveFromChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"indexed":false,"internalType":"uint64","name":"_nonce","type":"uint64"},{"indexed":false,"internalType":"bytes32","name":"_payloadHash","type":"bytes32"}],"name":"RetryMessageSuccess","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":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"bytes","name":"_toAddress","type":"bytes"},{"indexed":false,"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"_amounts","type":"uint256[]"}],"name":"SendBatchToChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"bytes","name":"_toAddress","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"SendToChain","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"indexed":false,"internalType":"uint16","name":"_type","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"_minDstGas","type":"uint256"}],"name":"SetMinDstGas","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"precrime","type":"address"}],"name":"SetPrecrime","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_path","type":"bytes"}],"name":"SetTrustedRemote","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"indexed":false,"internalType":"bytes","name":"_remoteAddress","type":"bytes"}],"name":"SetTrustedRemoteAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"_useCustomAdapterParams","type":"bool"}],"name":"SetUseCustomAdapterParams","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"revokedAddress","type":"address"}],"name":"SkinMinterRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"skinMinterAddress","type":"address"}],"name":"SkinMinterSet","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"newURI","type":"string"}],"name":"URISet","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FUNCTION_TYPE_SEND","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FUNCTION_TYPE_SEND_BATCH","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"NO_EXTRA_GAS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SKIN_MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":"accounts","type":"address[]"},{"internalType":"uint256[]","name":"ids","type":"uint256[]"}],"name":"balanceOfBatch","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"bool","name":"_useZro","type":"bool"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"estimateSendBatchFee","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_useZro","type":"bool"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"estimateSendFee","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"uint64","name":"","type":"uint64"}],"name":"failedMessages","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"forceResumeReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"_configType","type":"uint256"}],"name":"getConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"}],"name":"getTrustedRemoteAddress","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"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":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"}],"name":"isTrustedRemote","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lzEndpoint","outputs":[{"internalType":"contract ILayerZeroEndpoint","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"lzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"},{"internalType":"uint16","name":"","type":"uint16"}],"name":"minDstGasLookup","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to_","type":"address"},{"internalType":"uint256","name":"tokenId_","type":"uint256"},{"internalType":"uint256","name":"amount_","type":"uint256"},{"internalType":"bytes","name":"data_","type":"bytes"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addrs_","type":"address[]"},{"internalType":"uint256[][]","name":"ids_","type":"uint256[][]"},{"internalType":"uint256[][]","name":"amounts_","type":"uint256[][]"}],"name":"mintBatch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"nonblockingLzReceive","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"precrime","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_srcAddress","type":"bytes"},{"internalType":"uint64","name":"_nonce","type":"uint64"},{"internalType":"bytes","name":"_payload","type":"bytes"}],"name":"retryMessage","outputs":[],"stateMutability":"payable","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":"minterAddress_","type":"address"}],"name":"revokeSkinMinterRole","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":"amounts","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":"amount","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256[]","name":"_tokenIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_amounts","type":"uint256[]"},{"internalType":"address payable","name":"_refundAddress","type":"address"},{"internalType":"address","name":"_zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"sendBatchFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"address payable","name":"_refundAddress","type":"address"},{"internalType":"address","name":"_zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"}],"name":"sendFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"},{"internalType":"uint16","name":"_chainId","type":"uint16"},{"internalType":"uint256","name":"_configType","type":"uint256"},{"internalType":"bytes","name":"_config","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"uint16","name":"_packetType","type":"uint16"},{"internalType":"uint256","name":"_minGas","type":"uint256"}],"name":"setMinDstGas","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_precrime","type":"address"}],"name":"setPrecrime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setReceiveVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_version","type":"uint16"}],"name":"setSendVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"minterAddress_","type":"address"}],"name":"setSkinMinterRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_srcChainId","type":"uint16"},{"internalType":"bytes","name":"_path","type":"bytes"}],"name":"setTrustedRemote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_remoteChainId","type":"uint16"},{"internalType":"bytes","name":"_remoteAddress","type":"bytes"}],"name":"setTrustedRemoteAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newURI_","type":"string"}],"name":"setURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_useCustomAdapterParams","type":"bool"}],"name":"setUseCustomAdapterParams","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":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalSupply","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":"uint16","name":"","type":"uint16"}],"name":"trustedRemoteLookup","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"uri","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"useCustomAdapterParams","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a06040523480156200001157600080fd5b50604051620056f6380380620056f68339810160408190526200003491620003a0565b8282818180806200004533620001a3565b6001600160a01b0316608052506200005f905081620001f3565b5050506001600160a01b038216620000d05760405162461bcd60e51b815260206004820152602960248201527f4c61796572205a65726f20656e64706f696e742063616e2774206265207a65726044820152686f206164647265737360b81b60648201526084015b60405180910390fd5b6001600160a01b038116620001345760405162461bcd60e51b815260206004820152602360248201527f41646d696e20616464726573732063616e2774206265207a65726f206164647260448201526265737360e81b6064820152608401620000c7565b600a620001428682620004e6565b50600b620001518582620004e6565b506200015f60008262000205565b7fde63cc2d19581e57e158d078c2df83f9ab70addd6257f7f12bfecb21c06c912883604051620001909190620005b2565b60405180910390a15050505050620005e7565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6009620002018282620004e6565b5050565b60008281526005602090815260408083206001600160a01b038516845290915290205460ff16620002015760008281526005602090815260408083206001600160a01b03851684529091529020805460ff19166001179055620002653390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620002dc578181015183820152602001620002c2565b83811115620002ec576000848401525b50505050565b600082601f8301126200030457600080fd5b81516001600160401b0380821115620003215762000321620002a9565b604051601f8301601f19908116603f011681019082821181831017156200034c576200034c620002a9565b816040528381528660208588010111156200036657600080fd5b62000379846020830160208901620002bf565b9695505050505050565b80516001600160a01b03811681146200039b57600080fd5b919050565b600080600080600060a08688031215620003b957600080fd5b85516001600160401b0380821115620003d157600080fd5b620003df89838a01620002f2565b96506020880151915080821115620003f657600080fd5b6200040489838a01620002f2565b955060408801519150808211156200041b57600080fd5b506200042a88828901620002f2565b9350506200043b6060870162000383565b91506200044b6080870162000383565b90509295509295909350565b600181811c908216806200046c57607f821691505b6020821081036200048d57634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620004e157600081815260208120601f850160051c81016020861015620004bc5750805b601f850160051c820191505b81811015620004dd57828155600101620004c8565b5050505b505050565b81516001600160401b03811115620005025762000502620002a9565b6200051a8162000513845462000457565b8462000493565b602080601f831160018114620005525760008415620005395750858301515b600019600386901b1c1916600185901b178555620004dd565b600085815260208120601f198616915b82811015620005835788860151825594840194600190910190840162000562565b5085821015620005a25787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6020815260008251806020840152620005d3816040850160208701620002bf565b601f01601f19169190910160400192915050565b6080516150bb6200063b6000396000818161088001528181610a8801528181610e8901528181610fa6015281816112a3015281816118700152818161197901528181611e6e015261330c01526150bb6000f3fe6080604052600436106103335760003560e01c806388c88dac116101ab578063baf3292d116100f7578063eab45d9c11610095578063f242432a1161006f578063f242432a14610a05578063f2fde38b14610a25578063f5ecbdbc14610a45578063fde5ff6114610a6557600080fd5b8063eab45d9c146109ab578063eb8d72b7146109cb578063ed629c5c146109eb57600080fd5b8063d1deba1f116100d1578063d1deba1f1461090f578063d547741f14610922578063df2a5b3b14610942578063e985e9c51461096257600080fd5b8063baf3292d146108a2578063bd85b039146108c2578063cbed8b9c146108ef57600080fd5b80639f38369a11610164578063a6c3d1651161013e578063a6c3d16514610819578063af3fb21c14610839578063b25356631461084e578063b353aaa71461086e57600080fd5b80639f38369a146107d9578063a217fddf14610597578063a22cb465146107f957600080fd5b806388c88dac146106f85780638cfd8f5c1461071a5780638da5cb5b1461075257806391d1485414610784578063950c8a74146107a457806395d89b41146107c457600080fd5b80632f2ff15d116102855780634e1273f411610223578063715018a6116101fd578063715018a61461066e578063731133e9146106835780637533d788146106a35780638608e5f8146106c357600080fd5b80634e1273f4146105d25780635b8c41e6146105ff57806366ad5c8a1461064e57600080fd5b806342d65a8d1161025f57806342d65a8d1461057757806344770515146105975780634ab4e687146105ac5780634db8226a146105bf57600080fd5b80632f2ff15d1461051757806336568abe146105375780633d8b38f61461055757600080fd5b80630e89341c116102f2578063149e3e1f116102cc578063149e3e1f1461047f578063248a9ca3146104a75780632c4d7213146104d75780632eb2c2d6146104f757600080fd5b80630e89341c1461041f57806310ddb1371461043f578063122ed6791461045f57600080fd5b80621d356714610338578062fdd58e1461035a57806301ffc9a71461038d57806302fe5305146103bd57806306fdde03146103dd57806307e0db17146103ff575b600080fd5b34801561034457600080fd5b50610358610353366004613954565b610a85565b005b34801561036657600080fd5b5061037a610375366004613a07565b610cb6565b6040519081526020015b60405180910390f35b34801561039957600080fd5b506103ad6103a8366004613a49565b610d49565b6040519015158152602001610384565b3480156103c957600080fd5b506103586103d8366004613b15565b610d87565b3480156103e957600080fd5b506103f2610dd6565b6040516103849190613bbd565b34801561040b57600080fd5b5061035861041a366004613bd0565b610e68565b34801561042b57600080fd5b506103f261043a366004613beb565b610ef1565b34801561044b57600080fd5b5061035861045a366004613bd0565b610f85565b34801561046b57600080fd5b5061035861047a366004613d91565b610fdd565b34801561048b57600080fd5b50610494600281565b60405161ffff9091168152602001610384565b3480156104b357600080fd5b5061037a6104c2366004613beb565b60009081526005602052604090206001015490565b3480156104e357600080fd5b506103586104f2366004613e18565b61106f565b34801561050357600080fd5b50610358610512366004613e55565b6110cb565b34801561052357600080fd5b50610358610532366004613f02565b611110565b34801561054357600080fd5b50610358610552366004613f02565b61113a565b34801561056357600080fd5b506103ad610572366004613f32565b6111b8565b34801561058357600080fd5b50610358610592366004613f32565b611284565b3480156105a357600080fd5b5061037a600081565b6103586105ba366004613f84565b61130a565b6103586105cd366004614073565b611324565b3480156105de57600080fd5b506105f26105ed366004614119565b611344565b60405161038491906141b7565b34801561060b57600080fd5b5061037a61061a3660046141ca565b6004602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b34801561065a57600080fd5b50610358610669366004613954565b61146d565b34801561067a57600080fd5b50610358611549565b34801561068f57600080fd5b5061035861069e366004614227565b61155d565b3480156106af57600080fd5b506103f26106be366004613bd0565b611581565b3480156106cf57600080fd5b506106e36106de366004614299565b61161b565b60408051928352602083019190915201610384565b34801561070457600080fd5b5061037a60008051602061506683398151915281565b34801561072657600080fd5b5061037a61073536600461432f565b600260209081526000928352604080842090915290825290205481565b34801561075e57600080fd5b506000546001600160a01b03165b6040516001600160a01b039091168152602001610384565b34801561079057600080fd5b506103ad61079f366004613f02565b61164b565b3480156107b057600080fd5b5060035461076c906001600160a01b031681565b3480156107d057600080fd5b506103f2611676565b3480156107e557600080fd5b506103f26107f4366004613bd0565b611685565b34801561080557600080fd5b50610358610814366004614362565b61179b565b34801561082557600080fd5b50610358610834366004613f32565b6117a6565b34801561084557600080fd5b50610494600181565b34801561085a57600080fd5b506106e361086936600461438e565b61182f565b34801561087a57600080fd5b5061076c7f000000000000000000000000000000000000000000000000000000000000000081565b3480156108ae57600080fd5b506103586108bd366004613e18565b6118fd565b3480156108ce57600080fd5b5061037a6108dd366004613beb565b600c6020526000908152604090205481565b3480156108fb57600080fd5b5061035861090a36600461442a565b61195a565b61035861091d366004613954565b6119ef565b34801561092e57600080fd5b5061035861093d366004613f02565b611c05565b34801561094e57600080fd5b5061035861095d366004614498565b611c2a565b34801561096e57600080fd5b506103ad61097d3660046144d4565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b3480156109b757600080fd5b506103586109c6366004614502565b611cdc565b3480156109d757600080fd5b506103586109e6366004613f32565b611d25565b3480156109f757600080fd5b506006546103ad9060ff1681565b348015610a1157600080fd5b50610358610a2036600461451d565b611d7f565b348015610a3157600080fd5b50610358610a40366004613e18565b611dc4565b348015610a5157600080fd5b506103f2610a60366004614585565b611e3d565b348015610a7157600080fd5b50610358610a80366004613e18565b611eee565b337f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031614610b025760405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c6572000060448201526064015b60405180910390fd5b61ffff861660009081526001602052604081208054610b20906145d2565b80601f0160208091040260200160405190810160405280929190818152602001828054610b4c906145d2565b8015610b995780601f10610b6e57610100808354040283529160200191610b99565b820191906000526020600020905b815481529060010190602001808311610b7c57829003601f168201915b50505050509050805186869050148015610bb4575060008151115b8015610bdc575080516020820120604051610bd2908890889061460c565b6040518091039020145b610c375760405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f6044820152651b9d1c9858dd60d21b6064820152608401610af9565b610cad8787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881528a935091508890889081908401838280828437600092019190915250611f4a92505050565b50505050505050565b60006001600160a01b038316610d215760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b6064820152608401610af9565b5060009081526007602090815260408083206001600160a01b03949094168352929052205490565b60006001600160e01b03198216637965db0b60e01b1480610d7257506001600160e01b03198216155b80610d815750610d8182612054565b92915050565b6000610d9281612071565b610d9b8261207b565b7fde63cc2d19581e57e158d078c2df83f9ab70addd6257f7f12bfecb21c06c912882604051610dca9190613bbd565b60405180910390a15050565b6060600a8054610de5906145d2565b80601f0160208091040260200160405190810160405280929190818152602001828054610e11906145d2565b8015610e5e5780601f10610e3357610100808354040283529160200191610e5e565b820191906000526020600020905b815481529060010190602001808311610e4157829003601f168201915b5050505050905090565b610e70612087565b6040516307e0db1760e01b815261ffff821660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906307e0db17906024015b600060405180830381600087803b158015610ed657600080fd5b505af1158015610eea573d6000803e3d6000fd5b5050505050565b606060098054610f00906145d2565b80601f0160208091040260200160405190810160405280929190818152602001828054610f2c906145d2565b8015610f795780601f10610f4e57610100808354040283529160200191610f79565b820191906000526020600020905b815481529060010190602001808311610f5c57829003601f168201915b50505050509050919050565b610f8d612087565b6040516310ddb13760e01b815261ffff821660048201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906310ddb13790602401610ebc565b600080516020615066833981519152610ff581612071565b60005b8451811015610eea576110678582815181106110165761101661461c565b60200260200101518583815181106110305761103061461c565b602002602001015185848151811061104a5761104a61461c565b6020026020010151604051806020016040528060008152506120e1565b600101610ff8565b600061107a81612071565b6110926000805160206150668339815191528361223c565b6040516001600160a01b03831681527fba13ef2b97189c5212bdce88bbe506f56215cbd2baa5b90034a7b25e615f151f90602001610dca565b6001600160a01b0385163314806110e757506110e7853361097d565b6111035760405162461bcd60e51b8152600401610af990614632565b610eea85858585856122c2565b60008281526005602052604090206001015461112b81612071565b611135838361223c565b505050565b6001600160a01b03811633146111aa5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610af9565b6111b48282612467565b5050565b61ffff8316600090815260016020526040812080548291906111d9906145d2565b80601f0160208091040260200160405190810160405280929190818152602001828054611205906145d2565b80156112525780601f1061122757610100808354040283529160200191611252565b820191906000526020600020905b81548152906001019060200180831161123557829003601f168201915b50505050509050838360405161126992919061460c565b60405180910390208180519060200120149150509392505050565b61128c612087565b6040516342d65a8d60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906342d65a8d906112dc908690869086906004016146a9565b600060405180830381600087803b1580156112f657600080fd5b505af1158015610cad573d6000803e3d6000fd5b61131a88888888888888886124ce565b5050505050505050565b61131a888888611333896126b5565b61133c896126b5565b8888886124ce565b606081518351146113a95760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152608401610af9565b600083516001600160401b038111156113c4576113c4613a66565b6040519080825280602002602001820160405280156113ed578160200160208202803683370190505b50905060005b8451811015611465576114388582815181106114115761141161461c565b602002602001015185838151811061142b5761142b61461c565b6020026020010151610cb6565b82828151811061144a5761144a61461c565b602090810291909101015261145e816146dd565b90506113f3565b509392505050565b3330146114cb5760405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d7573742062656044820152650204c7a4170760d41b6064820152608401610af9565b6115418686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f89018190048102820181019092528781528993509150879087908190840183828082843760009201919091525061270092505050565b505050505050565b611551612087565b61155b600061284d565b565b60008051602061506683398151915261157581612071565b610eea8585858561289d565b6001602052600090815260409020805461159a906145d2565b80601f01602080910402602001604051908101604052809291908181526020018280546115c6906145d2565b80156116135780601f106115e857610100808354040283529160200191611613565b820191906000526020600020905b8154815290600101906020018083116115f657829003601f168201915b505050505081565b60008061163c888861162c896126b5565b611635896126b5565b888861182f565b91509150965096945050505050565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060600b8054610de5906145d2565b61ffff81166000908152600160205260408120805460609291906116a8906145d2565b80601f01602080910402602001604051908101604052809291908181526020018280546116d4906145d2565b80156117215780601f106116f657610100808354040283529160200191611721565b820191906000526020600020905b81548152906001019060200180831161170457829003601f168201915b5050505050905080516000036117795760405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f72640000006044820152606401610af9565b61179460006014835161178c91906146f6565b83919061297f565b9392505050565b6111b4338383612a8c565b6117ae612087565b8181306040516020016117c39392919061470d565b60408051601f1981840301815291815261ffff85166000908152600160205220906117ee9082614779565b507f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce838383604051611822939291906146a9565b60405180910390a1505050565b600080600087878760405160200161184993929190614838565b60408051601f198184030181529082905263040a7bb160e41b825291506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906340a7bb10906118ad908c90309086908b908b9060040161487b565b6040805180830381865afa1580156118c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ed91906148cf565b9250925050965096945050505050565b611905612087565b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b906020015b60405180910390a150565b611962612087565b6040516332fb62e760e21b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063cbed8b9c906119b690889088908890889088906004016148f3565b600060405180830381600087803b1580156119d057600080fd5b505af11580156119e4573d6000803e3d6000fd5b505050505050505050565b61ffff86166000908152600460205260408082209051611a12908890889061460c565b90815260408051602092819003830190206001600160401b03871660009081529252902054905080611a925760405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201526261676560e81b6064820152608401610af9565b808383604051611aa392919061460c565b604051809103902014611b025760405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f616044820152601960fa1b6064820152608401610af9565b61ffff87166000908152600460205260408082209051611b25908990899061460c565b90815260408051602092819003830181206001600160401b038916600090815290845282902093909355601f88018290048202830182019052868252611bbd918991899089908190840183828082843760009201919091525050604080516020601f8a018190048102820181019092528881528a93509150889088908190840183828082843760009201919091525061270092505050565b7fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e58787878785604051611bf495949392919061492c565b60405180910390a150505050505050565b600082815260056020526040902060010154611c2081612071565b6111358383612467565b611c32612087565b60008111611c7a5760405162461bcd60e51b81526020600482015260156024820152744c7a4170703a20696e76616c6964206d696e47617360581b6044820152606401610af9565b61ffff83811660008181526002602090815260408083209487168084529482529182902085905581519283528201929092529081018290527f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac090606001611822565b611ce4612087565b6006805460ff19168215159081179091556040519081527f1584ad594a70cbe1e6515592e1272a987d922b097ead875069cebe8b40c004a49060200161194f565b611d2d612087565b61ffff83166000908152600160205260409020611d4b828483614967565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab838383604051611822939291906146a9565b6001600160a01b038516331480611d9b5750611d9b853361097d565b611db75760405162461bcd60e51b8152600401610af990614632565b610eea8585858585612b6c565b611dcc612087565b6001600160a01b038116611e315760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610af9565b611e3a8161284d565b50565b604051633d7b2f6f60e21b815261ffff808616600483015284166024820152306044820152606481018290526060907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f5ecbdbc90608401600060405180830381865afa158015611ebd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611ee59190810190614a75565b95945050505050565b6000611ef981612071565b611f1160008051602061506683398151915283612467565b6040516001600160a01b03831681527f8435d9e9ea350ea5e5d2a951878b703697500d9a5a79dd222bf0463b6ccf7ade90602001610dca565b600080611fad5a60966366ad5c8a60e01b89898989604051602401611f729493929190614aa9565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915230929190612c9d565b9150915081611541578280519060200120600460008861ffff1661ffff16815260200190815260200160002086604051611fe79190614ae7565b9081526040805191829003602090810183206001600160401b0389166000908152915220919091557fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c906120449088908890889088908790614b03565b60405180910390a1505050505050565b60006001600160e01b031982161580610d815750610d8182612d27565b611e3a8133612d67565b60096111b48282614779565b6000546001600160a01b0316331461155b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af9565b6001600160a01b0384166121075760405162461bcd60e51b8152600401610af990614b55565b81518351146121285760405162461bcd60e51b8152600401610af990614b96565b3361213881600087878787612dc0565b60005b84518110156121d4578381815181106121565761215661461c565b6020026020010151600760008784815181106121745761217461461c565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b0316815260200190815260200160002060008282546121bc9190614bde565b909155508190506121cc816146dd565b91505061213b565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051612225929190614bf6565b60405180910390a4610eea81600087878787612f28565b612246828261164b565b6111b45760008281526005602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561227e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b81518351146122e35760405162461bcd60e51b8152600401610af990614b96565b6001600160a01b0384166123095760405162461bcd60e51b8152600401610af990614c1b565b33612318818787878787612dc0565b60005b84518110156124015760008582815181106123385761233861461c565b6020026020010151905060008583815181106123565761235661461c565b60209081029190910181015160008481526007835260408082206001600160a01b038e1683529093529190912054909150818110156123a75760405162461bcd60e51b8152600401610af990614c60565b60008381526007602090815260408083206001600160a01b038e8116855292528083208585039055908b168252812080548492906123e6908490614bde565b92505081905550505050806123fa906146dd565b905061231b565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051612451929190614bf6565b60405180910390a4611541818787878787612f28565b612471828261164b565b156111b45760008281526005602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6124db8888888888613083565b60008686866040516020016124f293929190614838565b604051602081830303815290604052905085516001036125f75760065460ff161561252a5761252588600184600061310f565b612549565b8151156125495760405162461bcd60e51b8152600401610af990614caa565b6125578882868686346131ee565b866040516125659190614ae7565b6040518091039020896001600160a01b03168961ffff167f968b0d61ebcf43e5d76ed87bd2c4ee2f22b4969b9f4ca49e3373c025eddd5eeb896000815181106125b0576125b061461c565b6020026020010151896000815181106125cb576125cb61461c565b60200260200101516040516125ea929190918252602082015260400190565b60405180910390a46119e4565b6001865111156119e45760065460ff161561261f5761261a88600284600061310f565b61263e565b81511561263e5760405162461bcd60e51b8152600401610af990614caa565b61264c8882868686346131ee565b8660405161265a9190614ae7565b6040518091039020896001600160a01b03168961ffff167fddd15f7cfbd674ac2096d598f1650367f8a8bd72b4e3abd85591099ea3b57e3389896040516126a2929190614bf6565b60405180910390a4505050505050505050565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106126ef576126ef61461c565b602090810291909101015292915050565b6000806000838060200190518101906127199190614d54565b6014830151929550909350915061273288828585613388565b82516001036127db57806001600160a01b0316876040516127539190614ae7565b60405180910390208961ffff167f1bf64e58d19fc43de4c44b3d1bb1fae313979af831a7a39f3297564294329f0f866000815181106127945761279461461c565b6020026020010151866000815181106127af576127af61461c565b60200260200101516040516127ce929190918252602082015260400190565b60405180910390a461131a565b60018351111561131a57806001600160a01b0316876040516127fd9190614ae7565b60405180910390208961ffff167f1ae08edbbcd7baa8d064835de8593ce16b313414525ac89534e349f4da7926e4868660405161283b929190614bf6565b60405180910390a45050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0384166128c35760405162461bcd60e51b8152600401610af990614b55565b3360006128cf856126b5565b905060006128dc856126b5565b90506128ed83600089858589612dc0565b60008681526007602090815260408083206001600160a01b038b1684529091528120805487929061291f908490614bde565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4610cad836000898989896133a9565b60608161298d81601f614bde565b10156129cc5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610af9565b6129d68284614bde565b84511015612a1a5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610af9565b606082158015612a395760405191506000825260208201604052612a83565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015612a72578051835260209283019201612a5a565b5050858452601f01601f1916604052505b50949350505050565b816001600160a01b0316836001600160a01b031603612aff5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608401610af9565b6001600160a01b03838116600081815260086020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b038416612b925760405162461bcd60e51b8152600401610af990614c1b565b336000612b9e856126b5565b90506000612bab856126b5565b9050612bbb838989858589612dc0565b60008681526007602090815260408083206001600160a01b038c16845290915290205485811015612bfe5760405162461bcd60e51b8152600401610af990614c60565b60008781526007602090815260408083206001600160a01b038d8116855292528083208985039055908a16825281208054889290612c3d908490614bde565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46119e4848a8a8a8a8a6133a9565b6000606060008060008661ffff166001600160401b03811115612cc257612cc2613a66565b6040519080825280601f01601f191660200182016040528015612cec576020820181803683370190505b50905060008087516020890160008d8df191503d925086831115612d0e578692505b828152826000602083013e909890975095505050505050565b60006001600160e01b03198216636cdb3d1360e11b1480612d5857506001600160e01b031982166303a24d0760e21b145b80610d815750610d8182613464565b612d71828261164b565b6111b457612d7e81613489565b612d8983602061349b565b604051602001612d9a929190614dd1565b60408051601f198184030181529082905262461bcd60e51b8252610af991600401613bbd565b6001600160a01b038516612e3e5760005b8351811015612e3c57828181518110612dec57612dec61461c565b6020026020010151600c6000868481518110612e0a57612e0a61461c565b602002602001015181526020019081526020016000206000828254612e2f9190614bde565b9091555050600101612dd1565b505b6001600160a01b0384166115415760005b8351811015610cad576000848281518110612e6c57612e6c61461c565b602002602001015190506000848381518110612e8a57612e8a61461c565b602002602001015190506000600c600084815260200190815260200160002054905081811015612f0d5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204275726e20616d6f756e74206578636565647320746f74604482015267616c537570706c7960c01b6064820152608401610af9565b6000928352600c602052604090922091039055600101612e4f565b6001600160a01b0384163b156115415760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190612f6c9089908990889088908890600401614e46565b6020604051808303816000875af1925050508015612fa7575060408051601f3d908101601f19168201909252612fa491810190614e84565b60015b61305357612fb3614ea1565b806308c379a003612fec5750612fc7614ebd565b80612fd25750612fee565b8060405162461bcd60e51b8152600401610af99190613bbd565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b6064820152608401610af9565b6001600160e01b0319811663bc197c8160e01b14610cad5760405162461bcd60e51b8152600401610af990614f46565b336001600160a01b0386168114806130a057506130a0868261097d565b6131045760405162461bcd60e51b815260206004820152602f60248201527f4f4e4654313135353a2073656e642063616c6c6572206973206e6f74206f776e60448201526e195c881b9bdc88185c1c1c9bdd9959608a1b6064820152608401610af9565b611541868484613636565b600061311a8361384d565b61ffff80871660009081526002602090815260408083209389168352929052908120549192509061314c908490614bde565b90506000811161319e5760405162461bcd60e51b815260206004820152601a60248201527f4c7a4170703a206d696e4761734c696d6974206e6f74207365740000000000006044820152606401610af9565b808210156115415760405162461bcd60e51b815260206004820152601b60248201527f4c7a4170703a20676173206c696d697420697320746f6f206c6f7700000000006044820152606401610af9565b61ffff86166000908152600160205260408120805461320c906145d2565b80601f0160208091040260200160405190810160405280929190818152602001828054613238906145d2565b80156132855780601f1061325a57610100808354040283529160200191613285565b820191906000526020600020905b81548152906001019060200180831161326857829003601f168201915b5050505050905080516000036132f65760405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201526f61207472757374656420736f7572636560801b6064820152608401610af9565b60405162c5803160e81b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063c580310090849061334d908b9086908c908c908c908c90600401614f8e565b6000604051808303818588803b15801561336657600080fd5b505af115801561337a573d6000803e3d6000fd5b505050505050505050505050565b6133a3838383604051806020016040528060008152506120e1565b50505050565b6001600160a01b0384163b156115415760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906133ed9089908990889088908890600401614ff5565b6020604051808303816000875af1925050508015613428575060408051601f3d908101601f1916820190925261342591810190614e84565b60015b61343457612fb3614ea1565b6001600160e01b0319811663f23a6e6160e01b14610cad5760405162461bcd60e51b8152600401610af990614f46565b60006001600160e01b031982166319abbbbb60e11b1480610d815750610d81826138a9565b6060610d816001600160a01b03831660145b606060006134aa83600261502f565b6134b5906002614bde565b6001600160401b038111156134cc576134cc613a66565b6040519080825280601f01601f1916602001820160405280156134f6576020820181803683370190505b509050600360fc1b816000815181106135115761351161461c565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106135405761354061461c565b60200101906001600160f81b031916908160001a905350600061356484600261502f565b61356f906001614bde565b90505b60018111156135e7576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106135a3576135a361461c565b1a60f81b8282815181106135b9576135b961461c565b60200101906001600160f81b031916908160001a90535060049490941c936135e08161504e565b9050613572565b5083156117945760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610af9565b6001600160a01b0383166136985760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b6064820152608401610af9565b80518251146136b95760405162461bcd60e51b8152600401610af990614b96565b60003390506136dc81856000868660405180602001604052806000815250612dc0565b60005b83518110156137e05760008482815181106136fc576136fc61461c565b60200260200101519050600084838151811061371a5761371a61461c565b60209081029190910181015160008481526007835260408082206001600160a01b038c1683529093529190912054909150818110156137a75760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b6064820152608401610af9565b60009283526007602090815260408085206001600160a01b038b16865290915290922091039055806137d8816146dd565b9150506136df565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051613831929190614bf6565b60405180910390a46040805160208101909152600090526133a3565b60006022825110156138a15760405162461bcd60e51b815260206004820152601c60248201527f4c7a4170703a20696e76616c69642061646170746572506172616d73000000006044820152606401610af9565b506022015190565b60006001600160e01b03198216637965db0b60e01b1480610d8157506301ffc9a760e01b6001600160e01b0319831614610d81565b803561ffff811681146138f057600080fd5b919050565b60008083601f84011261390757600080fd5b5081356001600160401b0381111561391e57600080fd5b60208301915083602082850101111561393657600080fd5b9250929050565b80356001600160401b03811681146138f057600080fd5b6000806000806000806080878903121561396d57600080fd5b613976876138de565b955060208701356001600160401b038082111561399257600080fd5b61399e8a838b016138f5565b90975095508591506139b260408a0161393d565b945060608901359150808211156139c857600080fd5b506139d589828a016138f5565b979a9699509497509295939492505050565b6001600160a01b0381168114611e3a57600080fd5b80356138f0816139e7565b60008060408385031215613a1a57600080fd5b8235613a25816139e7565b946020939093013593505050565b6001600160e01b031981168114611e3a57600080fd5b600060208284031215613a5b57600080fd5b813561179481613a33565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b0381118282101715613aa157613aa1613a66565b6040525050565b60006001600160401b03821115613ac157613ac1613a66565b50601f01601f191660200190565b6000613ada83613aa8565b604051613ae78282613a7c565b809250848152858585011115613afc57600080fd5b8484602083013760006020868301015250509392505050565b600060208284031215613b2757600080fd5b81356001600160401b03811115613b3d57600080fd5b8201601f81018413613b4e57600080fd5b613b5d84823560208401613acf565b949350505050565b60005b83811015613b80578181015183820152602001613b68565b838111156133a35750506000910152565b60008151808452613ba9816020860160208601613b65565b601f01601f19169290920160200192915050565b6020815260006117946020830184613b91565b600060208284031215613be257600080fd5b611794826138de565b600060208284031215613bfd57600080fd5b5035919050565b60006001600160401b03821115613c1d57613c1d613a66565b5060051b60200190565b600082601f830112613c3857600080fd5b81356020613c4582613c04565b604051613c528282613a7c565b83815260059390931b8501820192828101915086841115613c7257600080fd5b8286015b84811015613c96578035613c89816139e7565b8352918301918301613c76565b509695505050505050565b600082601f830112613cb257600080fd5b81356020613cbf82613c04565b604051613ccc8282613a7c565b83815260059390931b8501820192828101915086841115613cec57600080fd5b8286015b84811015613c965780358352918301918301613cf0565b600082601f830112613d1857600080fd5b81356020613d2582613c04565b604051613d328282613a7c565b83815260059390931b8501820192828101915086841115613d5257600080fd5b8286015b84811015613c965780356001600160401b03811115613d755760008081fd5b613d838986838b0101613ca1565b845250918301918301613d56565b600080600060608486031215613da657600080fd5b83356001600160401b0380821115613dbd57600080fd5b613dc987838801613c27565b94506020860135915080821115613ddf57600080fd5b613deb87838801613d07565b93506040860135915080821115613e0157600080fd5b50613e0e86828701613d07565b9150509250925092565b600060208284031215613e2a57600080fd5b8135611794816139e7565b600082601f830112613e4657600080fd5b61179483833560208501613acf565b600080600080600060a08688031215613e6d57600080fd5b8535613e78816139e7565b94506020860135613e88816139e7565b935060408601356001600160401b0380821115613ea457600080fd5b613eb089838a01613ca1565b94506060880135915080821115613ec657600080fd5b613ed289838a01613ca1565b93506080880135915080821115613ee857600080fd5b50613ef588828901613e35565b9150509295509295909350565b60008060408385031215613f1557600080fd5b823591506020830135613f27816139e7565b809150509250929050565b600080600060408486031215613f4757600080fd5b613f50846138de565b925060208401356001600160401b03811115613f6b57600080fd5b613f77868287016138f5565b9497909650939450505050565b600080600080600080600080610100898b031215613fa157600080fd5b613faa896139fc565b9750613fb860208a016138de565b965060408901356001600160401b0380821115613fd457600080fd5b613fe08c838d01613e35565b975060608b0135915080821115613ff657600080fd5b6140028c838d01613ca1565b965060808b013591508082111561401857600080fd5b6140248c838d01613ca1565b955061403260a08c016139fc565b945061404060c08c016139fc565b935060e08b013591508082111561405657600080fd5b506140638b828c01613e35565b9150509295985092959890939650565b600080600080600080600080610100898b03121561409057600080fd5b883561409b816139e7565b97506140a960208a016138de565b965060408901356001600160401b03808211156140c557600080fd5b6140d18c838d01613e35565b975060608b0135965060808b0135955060a08b013591506140f1826139e7565b90935060c08a013590614103826139e7565b90925060e08a0135908082111561405657600080fd5b6000806040838503121561412c57600080fd5b82356001600160401b038082111561414357600080fd5b61414f86838701613c27565b9350602085013591508082111561416557600080fd5b5061417285828601613ca1565b9150509250929050565b600081518084526020808501945080840160005b838110156141ac57815187529582019590820190600101614190565b509495945050505050565b602081526000611794602083018461417c565b6000806000606084860312156141df57600080fd5b6141e8846138de565b925060208401356001600160401b0381111561420357600080fd5b61420f86828701613e35565b92505061421e6040850161393d565b90509250925092565b6000806000806080858703121561423d57600080fd5b8435614248816139e7565b9350602085013592506040850135915060608501356001600160401b0381111561427157600080fd5b61427d87828801613e35565b91505092959194509250565b803580151581146138f057600080fd5b60008060008060008060c087890312156142b257600080fd5b6142bb876138de565b955060208701356001600160401b03808211156142d757600080fd5b6142e38a838b01613e35565b965060408901359550606089013594506142ff60808a01614289565b935060a089013591508082111561431557600080fd5b5061432289828a01613e35565b9150509295509295509295565b6000806040838503121561434257600080fd5b61434b836138de565b9150614359602084016138de565b90509250929050565b6000806040838503121561437557600080fd5b8235614380816139e7565b915061435960208401614289565b60008060008060008060c087890312156143a757600080fd5b6143b0876138de565b955060208701356001600160401b03808211156143cc57600080fd5b6143d88a838b01613e35565b965060408901359150808211156143ee57600080fd5b6143fa8a838b01613ca1565b9550606089013591508082111561441057600080fd5b61441c8a838b01613ca1565b94506142ff60808a01614289565b60008060008060006080868803121561444257600080fd5b61444b866138de565b9450614459602087016138de565b93506040860135925060608601356001600160401b0381111561447b57600080fd5b614487888289016138f5565b969995985093965092949392505050565b6000806000606084860312156144ad57600080fd5b6144b6846138de565b92506144c4602085016138de565b9150604084013590509250925092565b600080604083850312156144e757600080fd5b82356144f2816139e7565b91506020830135613f27816139e7565b60006020828403121561451457600080fd5b61179482614289565b600080600080600060a0868803121561453557600080fd5b8535614540816139e7565b94506020860135614550816139e7565b9350604086013592506060860135915060808601356001600160401b0381111561457957600080fd5b613ef588828901613e35565b6000806000806080858703121561459b57600080fd5b6145a4856138de565b93506145b2602086016138de565b925060408501356145c2816139e7565b9396929550929360600135925050565b600181811c908216806145e657607f821691505b60208210810361460657634e487b7160e01b600052602260045260246000fd5b50919050565b8183823760009101908152919050565b634e487b7160e01b600052603260045260246000fd5b6020808252602e908201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60408201526d195c881bdc88185c1c1c9bdd995960921b606082015260800190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff84168152604060208201526000611ee5604083018486614680565b634e487b7160e01b600052601160045260246000fd5b6000600182016146ef576146ef6146c7565b5060010190565b600082821015614708576147086146c7565b500390565b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b601f82111561113557600081815260208120601f850160051c8101602086101561475a5750805b601f850160051c820191505b8181101561154157828155600101614766565b81516001600160401b0381111561479257614792613a66565b6147a6816147a084546145d2565b84614733565b602080601f8311600181146147db57600084156147c35750858301515b600019600386901b1c1916600185901b178555611541565b600085815260208120601f198616915b8281101561480a578886015182559484019460019091019084016147eb565b50858210156148285787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60608152600061484b6060830186613b91565b828103602084015261485d818661417c565b90508281036040840152614871818561417c565b9695505050505050565b61ffff861681526001600160a01b038516602082015260a0604082018190526000906148a990830186613b91565b841515606084015282810360808401526148c38185613b91565b98975050505050505050565b600080604083850312156148e257600080fd5b505080516020909101519092909150565b600061ffff808816835280871660208401525084604083015260806060830152614921608083018486614680565b979650505050505050565b61ffff8616815260806020820152600061494a608083018688614680565b6001600160401b0394909416604083015250606001529392505050565b6001600160401b0383111561497e5761497e613a66565b6149928361498c83546145d2565b83614733565b6000601f8411600181146149c657600085156149ae5750838201355b600019600387901b1c1916600186901b178355610eea565b600083815260209020601f19861690835b828110156149f757868501358255602094850194600190920191016149d7565b5086821015614a145760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b600082601f830112614a3757600080fd5b8151614a4281613aa8565b604051614a4f8282613a7c565b828152856020848701011115614a6457600080fd5b611ee5836020830160208801613b65565b600060208284031215614a8757600080fd5b81516001600160401b03811115614a9d57600080fd5b613b5d84828501614a26565b61ffff85168152608060208201526000614ac66080830186613b91565b6001600160401b038516604084015282810360608401526149218185613b91565b60008251614af9818460208701613b65565b9190910192915050565b61ffff8616815260a060208201526000614b2060a0830187613b91565b6001600160401b03861660408401528281036060840152614b418186613b91565b905082810360808401526148c38185613b91565b60208082526021908201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206040820152670dad2e6dac2e8c6d60c31b606082015260800190565b60008219821115614bf157614bf16146c7565b500190565b604081526000614c09604083018561417c565b8281036020840152611ee5818561417c565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b60208082526024908201527f4c7a4170703a205f61646170746572506172616d73206d75737420626520656d604082015263383a3c9760e11b606082015260800190565b600082601f830112614cff57600080fd5b81516020614d0c82613c04565b604051614d198282613a7c565b83815260059390931b8501820192828101915086841115614d3957600080fd5b8286015b84811015613c965780518352918301918301614d3d565b600080600060608486031215614d6957600080fd5b83516001600160401b0380821115614d8057600080fd5b614d8c87838801614a26565b94506020860151915080821115614da257600080fd5b614dae87838801614cee565b93506040860151915080821115614dc457600080fd5b50613e0e86828701614cee565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614e09816017850160208801613b65565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614e3a816028840160208801613b65565b01602801949350505050565b6001600160a01b0386811682528516602082015260a060408201819052600090614e729083018661417c565b8281036060840152614b41818661417c565b600060208284031215614e9657600080fd5b815161179481613a33565b600060033d1115614eba5760046000803e5060005160e01c5b90565b600060443d1015614ecb5790565b6040516003193d81016004833e81513d6001600160401b038160248401118184111715614efa57505050505090565b8285019150815181811115614f125750505050505090565b843d8701016020828501011115614f2c5750505050505090565b614f3b60208286010187613a7c565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b61ffff8716815260c060208201526000614fab60c0830188613b91565b8281036040840152614fbd8188613b91565b6001600160a01b0387811660608601528616608085015283810360a08501529050614fe88185613b91565b9998505050505050505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061492190830184613b91565b6000816000190483118215151615615049576150496146c7565b500290565b60008161505d5761505d6146c7565b50600019019056fe0b16f85926f1264b62da5a65aba7bd7afe2c6182293e09518c96a88343aeab84a2646970667358221220895a27b57d5cc688addce3ad98e769e3317845d5499f1338261ea3cf551b02b464736f6c634300080f003300000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6750000000000000000000000007382bcf0bda75e8cfdf5d5d7515c6aa59d480a040000000000000000000000000000000000000000000000000000000000000013446566696d6f6e7320436861726163746572730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000074d4f4e534b494e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003168747470733a2f2f6170692e646566696d6f6e732e636f6d2f6d657461646174612f636861726163746572732f7b69647d000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106103335760003560e01c806388c88dac116101ab578063baf3292d116100f7578063eab45d9c11610095578063f242432a1161006f578063f242432a14610a05578063f2fde38b14610a25578063f5ecbdbc14610a45578063fde5ff6114610a6557600080fd5b8063eab45d9c146109ab578063eb8d72b7146109cb578063ed629c5c146109eb57600080fd5b8063d1deba1f116100d1578063d1deba1f1461090f578063d547741f14610922578063df2a5b3b14610942578063e985e9c51461096257600080fd5b8063baf3292d146108a2578063bd85b039146108c2578063cbed8b9c146108ef57600080fd5b80639f38369a11610164578063a6c3d1651161013e578063a6c3d16514610819578063af3fb21c14610839578063b25356631461084e578063b353aaa71461086e57600080fd5b80639f38369a146107d9578063a217fddf14610597578063a22cb465146107f957600080fd5b806388c88dac146106f85780638cfd8f5c1461071a5780638da5cb5b1461075257806391d1485414610784578063950c8a74146107a457806395d89b41146107c457600080fd5b80632f2ff15d116102855780634e1273f411610223578063715018a6116101fd578063715018a61461066e578063731133e9146106835780637533d788146106a35780638608e5f8146106c357600080fd5b80634e1273f4146105d25780635b8c41e6146105ff57806366ad5c8a1461064e57600080fd5b806342d65a8d1161025f57806342d65a8d1461057757806344770515146105975780634ab4e687146105ac5780634db8226a146105bf57600080fd5b80632f2ff15d1461051757806336568abe146105375780633d8b38f61461055757600080fd5b80630e89341c116102f2578063149e3e1f116102cc578063149e3e1f1461047f578063248a9ca3146104a75780632c4d7213146104d75780632eb2c2d6146104f757600080fd5b80630e89341c1461041f57806310ddb1371461043f578063122ed6791461045f57600080fd5b80621d356714610338578062fdd58e1461035a57806301ffc9a71461038d57806302fe5305146103bd57806306fdde03146103dd57806307e0db17146103ff575b600080fd5b34801561034457600080fd5b50610358610353366004613954565b610a85565b005b34801561036657600080fd5b5061037a610375366004613a07565b610cb6565b6040519081526020015b60405180910390f35b34801561039957600080fd5b506103ad6103a8366004613a49565b610d49565b6040519015158152602001610384565b3480156103c957600080fd5b506103586103d8366004613b15565b610d87565b3480156103e957600080fd5b506103f2610dd6565b6040516103849190613bbd565b34801561040b57600080fd5b5061035861041a366004613bd0565b610e68565b34801561042b57600080fd5b506103f261043a366004613beb565b610ef1565b34801561044b57600080fd5b5061035861045a366004613bd0565b610f85565b34801561046b57600080fd5b5061035861047a366004613d91565b610fdd565b34801561048b57600080fd5b50610494600281565b60405161ffff9091168152602001610384565b3480156104b357600080fd5b5061037a6104c2366004613beb565b60009081526005602052604090206001015490565b3480156104e357600080fd5b506103586104f2366004613e18565b61106f565b34801561050357600080fd5b50610358610512366004613e55565b6110cb565b34801561052357600080fd5b50610358610532366004613f02565b611110565b34801561054357600080fd5b50610358610552366004613f02565b61113a565b34801561056357600080fd5b506103ad610572366004613f32565b6111b8565b34801561058357600080fd5b50610358610592366004613f32565b611284565b3480156105a357600080fd5b5061037a600081565b6103586105ba366004613f84565b61130a565b6103586105cd366004614073565b611324565b3480156105de57600080fd5b506105f26105ed366004614119565b611344565b60405161038491906141b7565b34801561060b57600080fd5b5061037a61061a3660046141ca565b6004602090815260009384526040808520845180860184018051928152908401958401959095209452929052825290205481565b34801561065a57600080fd5b50610358610669366004613954565b61146d565b34801561067a57600080fd5b50610358611549565b34801561068f57600080fd5b5061035861069e366004614227565b61155d565b3480156106af57600080fd5b506103f26106be366004613bd0565b611581565b3480156106cf57600080fd5b506106e36106de366004614299565b61161b565b60408051928352602083019190915201610384565b34801561070457600080fd5b5061037a60008051602061506683398151915281565b34801561072657600080fd5b5061037a61073536600461432f565b600260209081526000928352604080842090915290825290205481565b34801561075e57600080fd5b506000546001600160a01b03165b6040516001600160a01b039091168152602001610384565b34801561079057600080fd5b506103ad61079f366004613f02565b61164b565b3480156107b057600080fd5b5060035461076c906001600160a01b031681565b3480156107d057600080fd5b506103f2611676565b3480156107e557600080fd5b506103f26107f4366004613bd0565b611685565b34801561080557600080fd5b50610358610814366004614362565b61179b565b34801561082557600080fd5b50610358610834366004613f32565b6117a6565b34801561084557600080fd5b50610494600181565b34801561085a57600080fd5b506106e361086936600461438e565b61182f565b34801561087a57600080fd5b5061076c7f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67581565b3480156108ae57600080fd5b506103586108bd366004613e18565b6118fd565b3480156108ce57600080fd5b5061037a6108dd366004613beb565b600c6020526000908152604090205481565b3480156108fb57600080fd5b5061035861090a36600461442a565b61195a565b61035861091d366004613954565b6119ef565b34801561092e57600080fd5b5061035861093d366004613f02565b611c05565b34801561094e57600080fd5b5061035861095d366004614498565b611c2a565b34801561096e57600080fd5b506103ad61097d3660046144d4565b6001600160a01b03918216600090815260086020908152604080832093909416825291909152205460ff1690565b3480156109b757600080fd5b506103586109c6366004614502565b611cdc565b3480156109d757600080fd5b506103586109e6366004613f32565b611d25565b3480156109f757600080fd5b506006546103ad9060ff1681565b348015610a1157600080fd5b50610358610a2036600461451d565b611d7f565b348015610a3157600080fd5b50610358610a40366004613e18565b611dc4565b348015610a5157600080fd5b506103f2610a60366004614585565b611e3d565b348015610a7157600080fd5b50610358610a80366004613e18565b611eee565b337f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756001600160a01b031614610b025760405162461bcd60e51b815260206004820152601e60248201527f4c7a4170703a20696e76616c696420656e64706f696e742063616c6c6572000060448201526064015b60405180910390fd5b61ffff861660009081526001602052604081208054610b20906145d2565b80601f0160208091040260200160405190810160405280929190818152602001828054610b4c906145d2565b8015610b995780601f10610b6e57610100808354040283529160200191610b99565b820191906000526020600020905b815481529060010190602001808311610b7c57829003601f168201915b50505050509050805186869050148015610bb4575060008151115b8015610bdc575080516020820120604051610bd2908890889061460c565b6040518091039020145b610c375760405162461bcd60e51b815260206004820152602660248201527f4c7a4170703a20696e76616c696420736f757263652073656e64696e6720636f6044820152651b9d1c9858dd60d21b6064820152608401610af9565b610cad8787878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8a018190048102820181019092528881528a935091508890889081908401838280828437600092019190915250611f4a92505050565b50505050505050565b60006001600160a01b038316610d215760405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b6064820152608401610af9565b5060009081526007602090815260408083206001600160a01b03949094168352929052205490565b60006001600160e01b03198216637965db0b60e01b1480610d7257506001600160e01b03198216155b80610d815750610d8182612054565b92915050565b6000610d9281612071565b610d9b8261207b565b7fde63cc2d19581e57e158d078c2df83f9ab70addd6257f7f12bfecb21c06c912882604051610dca9190613bbd565b60405180910390a15050565b6060600a8054610de5906145d2565b80601f0160208091040260200160405190810160405280929190818152602001828054610e11906145d2565b8015610e5e5780601f10610e3357610100808354040283529160200191610e5e565b820191906000526020600020905b815481529060010190602001808311610e4157829003601f168201915b5050505050905090565b610e70612087565b6040516307e0db1760e01b815261ffff821660048201527f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756001600160a01b0316906307e0db17906024015b600060405180830381600087803b158015610ed657600080fd5b505af1158015610eea573d6000803e3d6000fd5b5050505050565b606060098054610f00906145d2565b80601f0160208091040260200160405190810160405280929190818152602001828054610f2c906145d2565b8015610f795780601f10610f4e57610100808354040283529160200191610f79565b820191906000526020600020905b815481529060010190602001808311610f5c57829003601f168201915b50505050509050919050565b610f8d612087565b6040516310ddb13760e01b815261ffff821660048201527f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756001600160a01b0316906310ddb13790602401610ebc565b600080516020615066833981519152610ff581612071565b60005b8451811015610eea576110678582815181106110165761101661461c565b60200260200101518583815181106110305761103061461c565b602002602001015185848151811061104a5761104a61461c565b6020026020010151604051806020016040528060008152506120e1565b600101610ff8565b600061107a81612071565b6110926000805160206150668339815191528361223c565b6040516001600160a01b03831681527fba13ef2b97189c5212bdce88bbe506f56215cbd2baa5b90034a7b25e615f151f90602001610dca565b6001600160a01b0385163314806110e757506110e7853361097d565b6111035760405162461bcd60e51b8152600401610af990614632565b610eea85858585856122c2565b60008281526005602052604090206001015461112b81612071565b611135838361223c565b505050565b6001600160a01b03811633146111aa5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610af9565b6111b48282612467565b5050565b61ffff8316600090815260016020526040812080548291906111d9906145d2565b80601f0160208091040260200160405190810160405280929190818152602001828054611205906145d2565b80156112525780601f1061122757610100808354040283529160200191611252565b820191906000526020600020905b81548152906001019060200180831161123557829003601f168201915b50505050509050838360405161126992919061460c565b60405180910390208180519060200120149150509392505050565b61128c612087565b6040516342d65a8d60e01b81526001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67516906342d65a8d906112dc908690869086906004016146a9565b600060405180830381600087803b1580156112f657600080fd5b505af1158015610cad573d6000803e3d6000fd5b61131a88888888888888886124ce565b5050505050505050565b61131a888888611333896126b5565b61133c896126b5565b8888886124ce565b606081518351146113a95760405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152608401610af9565b600083516001600160401b038111156113c4576113c4613a66565b6040519080825280602002602001820160405280156113ed578160200160208202803683370190505b50905060005b8451811015611465576114388582815181106114115761141161461c565b602002602001015185838151811061142b5761142b61461c565b6020026020010151610cb6565b82828151811061144a5761144a61461c565b602090810291909101015261145e816146dd565b90506113f3565b509392505050565b3330146114cb5760405162461bcd60e51b815260206004820152602660248201527f4e6f6e626c6f636b696e674c7a4170703a2063616c6c6572206d7573742062656044820152650204c7a4170760d41b6064820152608401610af9565b6115418686868080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f89018190048102820181019092528781528993509150879087908190840183828082843760009201919091525061270092505050565b505050505050565b611551612087565b61155b600061284d565b565b60008051602061506683398151915261157581612071565b610eea8585858561289d565b6001602052600090815260409020805461159a906145d2565b80601f01602080910402602001604051908101604052809291908181526020018280546115c6906145d2565b80156116135780601f106115e857610100808354040283529160200191611613565b820191906000526020600020905b8154815290600101906020018083116115f657829003601f168201915b505050505081565b60008061163c888861162c896126b5565b611635896126b5565b888861182f565b91509150965096945050505050565b60009182526005602090815260408084206001600160a01b0393909316845291905290205460ff1690565b6060600b8054610de5906145d2565b61ffff81166000908152600160205260408120805460609291906116a8906145d2565b80601f01602080910402602001604051908101604052809291908181526020018280546116d4906145d2565b80156117215780601f106116f657610100808354040283529160200191611721565b820191906000526020600020905b81548152906001019060200180831161170457829003601f168201915b5050505050905080516000036117795760405162461bcd60e51b815260206004820152601d60248201527f4c7a4170703a206e6f20747275737465642070617468207265636f72640000006044820152606401610af9565b61179460006014835161178c91906146f6565b83919061297f565b9392505050565b6111b4338383612a8c565b6117ae612087565b8181306040516020016117c39392919061470d565b60408051601f1981840301815291815261ffff85166000908152600160205220906117ee9082614779565b507f8c0400cfe2d1199b1a725c78960bcc2a344d869b80590d0f2bd005db15a572ce838383604051611822939291906146a9565b60405180910390a1505050565b600080600087878760405160200161184993929190614838565b60408051601f198184030181529082905263040a7bb160e41b825291506001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67516906340a7bb10906118ad908c90309086908b908b9060040161487b565b6040805180830381865afa1580156118c9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ed91906148cf565b9250925050965096945050505050565b611905612087565b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527f5db758e995a17ec1ad84bdef7e8c3293a0bd6179bcce400dff5d4c3d87db726b906020015b60405180910390a150565b611962612087565b6040516332fb62e760e21b81526001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd675169063cbed8b9c906119b690889088908890889088906004016148f3565b600060405180830381600087803b1580156119d057600080fd5b505af11580156119e4573d6000803e3d6000fd5b505050505050505050565b61ffff86166000908152600460205260408082209051611a12908890889061460c565b90815260408051602092819003830190206001600160401b03871660009081529252902054905080611a925760405162461bcd60e51b815260206004820152602360248201527f4e6f6e626c6f636b696e674c7a4170703a206e6f2073746f726564206d65737360448201526261676560e81b6064820152608401610af9565b808383604051611aa392919061460c565b604051809103902014611b025760405162461bcd60e51b815260206004820152602160248201527f4e6f6e626c6f636b696e674c7a4170703a20696e76616c6964207061796c6f616044820152601960fa1b6064820152608401610af9565b61ffff87166000908152600460205260408082209051611b25908990899061460c565b90815260408051602092819003830181206001600160401b038916600090815290845282902093909355601f88018290048202830182019052868252611bbd918991899089908190840183828082843760009201919091525050604080516020601f8a018190048102820181019092528881528a93509150889088908190840183828082843760009201919091525061270092505050565b7fc264d91f3adc5588250e1551f547752ca0cfa8f6b530d243b9f9f4cab10ea8e58787878785604051611bf495949392919061492c565b60405180910390a150505050505050565b600082815260056020526040902060010154611c2081612071565b6111358383612467565b611c32612087565b60008111611c7a5760405162461bcd60e51b81526020600482015260156024820152744c7a4170703a20696e76616c6964206d696e47617360581b6044820152606401610af9565b61ffff83811660008181526002602090815260408083209487168084529482529182902085905581519283528201929092529081018290527f9d5c7c0b934da8fefa9c7760c98383778a12dfbfc0c3b3106518f43fb9508ac090606001611822565b611ce4612087565b6006805460ff19168215159081179091556040519081527f1584ad594a70cbe1e6515592e1272a987d922b097ead875069cebe8b40c004a49060200161194f565b611d2d612087565b61ffff83166000908152600160205260409020611d4b828483614967565b507ffa41487ad5d6728f0b19276fa1eddc16558578f5109fc39d2dc33c3230470dab838383604051611822939291906146a9565b6001600160a01b038516331480611d9b5750611d9b853361097d565b611db75760405162461bcd60e51b8152600401610af990614632565b610eea8585858585612b6c565b611dcc612087565b6001600160a01b038116611e315760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610af9565b611e3a8161284d565b50565b604051633d7b2f6f60e21b815261ffff808616600483015284166024820152306044820152606481018290526060907f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6756001600160a01b03169063f5ecbdbc90608401600060405180830381865afa158015611ebd573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611ee59190810190614a75565b95945050505050565b6000611ef981612071565b611f1160008051602061506683398151915283612467565b6040516001600160a01b03831681527f8435d9e9ea350ea5e5d2a951878b703697500d9a5a79dd222bf0463b6ccf7ade90602001610dca565b600080611fad5a60966366ad5c8a60e01b89898989604051602401611f729493929190614aa9565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915230929190612c9d565b9150915081611541578280519060200120600460008861ffff1661ffff16815260200190815260200160002086604051611fe79190614ae7565b9081526040805191829003602090810183206001600160401b0389166000908152915220919091557fe183f33de2837795525b4792ca4cd60535bd77c53b7e7030060bfcf5734d6b0c906120449088908890889088908790614b03565b60405180910390a1505050505050565b60006001600160e01b031982161580610d815750610d8182612d27565b611e3a8133612d67565b60096111b48282614779565b6000546001600160a01b0316331461155b5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610af9565b6001600160a01b0384166121075760405162461bcd60e51b8152600401610af990614b55565b81518351146121285760405162461bcd60e51b8152600401610af990614b96565b3361213881600087878787612dc0565b60005b84518110156121d4578381815181106121565761215661461c565b6020026020010151600760008784815181106121745761217461461c565b602002602001015181526020019081526020016000206000886001600160a01b03166001600160a01b0316815260200190815260200160002060008282546121bc9190614bde565b909155508190506121cc816146dd565b91505061213b565b50846001600160a01b031660006001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051612225929190614bf6565b60405180910390a4610eea81600087878787612f28565b612246828261164b565b6111b45760008281526005602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561227e3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b81518351146122e35760405162461bcd60e51b8152600401610af990614b96565b6001600160a01b0384166123095760405162461bcd60e51b8152600401610af990614c1b565b33612318818787878787612dc0565b60005b84518110156124015760008582815181106123385761233861461c565b6020026020010151905060008583815181106123565761235661461c565b60209081029190910181015160008481526007835260408082206001600160a01b038e1683529093529190912054909150818110156123a75760405162461bcd60e51b8152600401610af990614c60565b60008381526007602090815260408083206001600160a01b038e8116855292528083208585039055908b168252812080548492906123e6908490614bde565b92505081905550505050806123fa906146dd565b905061231b565b50846001600160a01b0316866001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8787604051612451929190614bf6565b60405180910390a4611541818787878787612f28565b612471828261164b565b156111b45760008281526005602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6124db8888888888613083565b60008686866040516020016124f293929190614838565b604051602081830303815290604052905085516001036125f75760065460ff161561252a5761252588600184600061310f565b612549565b8151156125495760405162461bcd60e51b8152600401610af990614caa565b6125578882868686346131ee565b866040516125659190614ae7565b6040518091039020896001600160a01b03168961ffff167f968b0d61ebcf43e5d76ed87bd2c4ee2f22b4969b9f4ca49e3373c025eddd5eeb896000815181106125b0576125b061461c565b6020026020010151896000815181106125cb576125cb61461c565b60200260200101516040516125ea929190918252602082015260400190565b60405180910390a46119e4565b6001865111156119e45760065460ff161561261f5761261a88600284600061310f565b61263e565b81511561263e5760405162461bcd60e51b8152600401610af990614caa565b61264c8882868686346131ee565b8660405161265a9190614ae7565b6040518091039020896001600160a01b03168961ffff167fddd15f7cfbd674ac2096d598f1650367f8a8bd72b4e3abd85591099ea3b57e3389896040516126a2929190614bf6565b60405180910390a4505050505050505050565b604080516001808252818301909252606091600091906020808301908036833701905050905082816000815181106126ef576126ef61461c565b602090810291909101015292915050565b6000806000838060200190518101906127199190614d54565b6014830151929550909350915061273288828585613388565b82516001036127db57806001600160a01b0316876040516127539190614ae7565b60405180910390208961ffff167f1bf64e58d19fc43de4c44b3d1bb1fae313979af831a7a39f3297564294329f0f866000815181106127945761279461461c565b6020026020010151866000815181106127af576127af61461c565b60200260200101516040516127ce929190918252602082015260400190565b60405180910390a461131a565b60018351111561131a57806001600160a01b0316876040516127fd9190614ae7565b60405180910390208961ffff167f1ae08edbbcd7baa8d064835de8593ce16b313414525ac89534e349f4da7926e4868660405161283b929190614bf6565b60405180910390a45050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b0384166128c35760405162461bcd60e51b8152600401610af990614b55565b3360006128cf856126b5565b905060006128dc856126b5565b90506128ed83600089858589612dc0565b60008681526007602090815260408083206001600160a01b038b1684529091528120805487929061291f908490614bde565b909155505060408051878152602081018790526001600160a01b03808a1692600092918716917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a4610cad836000898989896133a9565b60608161298d81601f614bde565b10156129cc5760405162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b6044820152606401610af9565b6129d68284614bde565b84511015612a1a5760405162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b6044820152606401610af9565b606082158015612a395760405191506000825260208201604052612a83565b6040519150601f8416801560200281840101858101878315602002848b0101015b81831015612a72578051835260209283019201612a5a565b5050858452601f01601f1916604052505b50949350505050565b816001600160a01b0316836001600160a01b031603612aff5760405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608401610af9565b6001600160a01b03838116600081815260086020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b038416612b925760405162461bcd60e51b8152600401610af990614c1b565b336000612b9e856126b5565b90506000612bab856126b5565b9050612bbb838989858589612dc0565b60008681526007602090815260408083206001600160a01b038c16845290915290205485811015612bfe5760405162461bcd60e51b8152600401610af990614c60565b60008781526007602090815260408083206001600160a01b038d8116855292528083208985039055908a16825281208054889290612c3d908490614bde565b909155505060408051888152602081018890526001600160a01b03808b16928c821692918816917fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62910160405180910390a46119e4848a8a8a8a8a6133a9565b6000606060008060008661ffff166001600160401b03811115612cc257612cc2613a66565b6040519080825280601f01601f191660200182016040528015612cec576020820181803683370190505b50905060008087516020890160008d8df191503d925086831115612d0e578692505b828152826000602083013e909890975095505050505050565b60006001600160e01b03198216636cdb3d1360e11b1480612d5857506001600160e01b031982166303a24d0760e21b145b80610d815750610d8182613464565b612d71828261164b565b6111b457612d7e81613489565b612d8983602061349b565b604051602001612d9a929190614dd1565b60408051601f198184030181529082905262461bcd60e51b8252610af991600401613bbd565b6001600160a01b038516612e3e5760005b8351811015612e3c57828181518110612dec57612dec61461c565b6020026020010151600c6000868481518110612e0a57612e0a61461c565b602002602001015181526020019081526020016000206000828254612e2f9190614bde565b9091555050600101612dd1565b505b6001600160a01b0384166115415760005b8351811015610cad576000848281518110612e6c57612e6c61461c565b602002602001015190506000848381518110612e8a57612e8a61461c565b602002602001015190506000600c600084815260200190815260200160002054905081811015612f0d5760405162461bcd60e51b815260206004820152602860248201527f455243313135353a204275726e20616d6f756e74206578636565647320746f74604482015267616c537570706c7960c01b6064820152608401610af9565b6000928352600c602052604090922091039055600101612e4f565b6001600160a01b0384163b156115415760405163bc197c8160e01b81526001600160a01b0385169063bc197c8190612f6c9089908990889088908890600401614e46565b6020604051808303816000875af1925050508015612fa7575060408051601f3d908101601f19168201909252612fa491810190614e84565b60015b61305357612fb3614ea1565b806308c379a003612fec5750612fc7614ebd565b80612fd25750612fee565b8060405162461bcd60e51b8152600401610af99190613bbd565b505b60405162461bcd60e51b815260206004820152603460248201527f455243313135353a207472616e7366657220746f206e6f6e2d455243313135356044820152732932b1b2b4bb32b91034b6b83632b6b2b73a32b960611b6064820152608401610af9565b6001600160e01b0319811663bc197c8160e01b14610cad5760405162461bcd60e51b8152600401610af990614f46565b336001600160a01b0386168114806130a057506130a0868261097d565b6131045760405162461bcd60e51b815260206004820152602f60248201527f4f4e4654313135353a2073656e642063616c6c6572206973206e6f74206f776e60448201526e195c881b9bdc88185c1c1c9bdd9959608a1b6064820152608401610af9565b611541868484613636565b600061311a8361384d565b61ffff80871660009081526002602090815260408083209389168352929052908120549192509061314c908490614bde565b90506000811161319e5760405162461bcd60e51b815260206004820152601a60248201527f4c7a4170703a206d696e4761734c696d6974206e6f74207365740000000000006044820152606401610af9565b808210156115415760405162461bcd60e51b815260206004820152601b60248201527f4c7a4170703a20676173206c696d697420697320746f6f206c6f7700000000006044820152606401610af9565b61ffff86166000908152600160205260408120805461320c906145d2565b80601f0160208091040260200160405190810160405280929190818152602001828054613238906145d2565b80156132855780601f1061325a57610100808354040283529160200191613285565b820191906000526020600020905b81548152906001019060200180831161326857829003601f168201915b5050505050905080516000036132f65760405162461bcd60e51b815260206004820152603060248201527f4c7a4170703a2064657374696e6174696f6e20636861696e206973206e6f742060448201526f61207472757374656420736f7572636560801b6064820152608401610af9565b60405162c5803160e81b81526001600160a01b037f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd675169063c580310090849061334d908b9086908c908c908c908c90600401614f8e565b6000604051808303818588803b15801561336657600080fd5b505af115801561337a573d6000803e3d6000fd5b505050505050505050505050565b6133a3838383604051806020016040528060008152506120e1565b50505050565b6001600160a01b0384163b156115415760405163f23a6e6160e01b81526001600160a01b0385169063f23a6e61906133ed9089908990889088908890600401614ff5565b6020604051808303816000875af1925050508015613428575060408051601f3d908101601f1916820190925261342591810190614e84565b60015b61343457612fb3614ea1565b6001600160e01b0319811663f23a6e6160e01b14610cad5760405162461bcd60e51b8152600401610af990614f46565b60006001600160e01b031982166319abbbbb60e11b1480610d815750610d81826138a9565b6060610d816001600160a01b03831660145b606060006134aa83600261502f565b6134b5906002614bde565b6001600160401b038111156134cc576134cc613a66565b6040519080825280601f01601f1916602001820160405280156134f6576020820181803683370190505b509050600360fc1b816000815181106135115761351161461c565b60200101906001600160f81b031916908160001a905350600f60fb1b816001815181106135405761354061461c565b60200101906001600160f81b031916908160001a905350600061356484600261502f565b61356f906001614bde565b90505b60018111156135e7576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106135a3576135a361461c565b1a60f81b8282815181106135b9576135b961461c565b60200101906001600160f81b031916908160001a90535060049490941c936135e08161504e565b9050613572565b5083156117945760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610af9565b6001600160a01b0383166136985760405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b6064820152608401610af9565b80518251146136b95760405162461bcd60e51b8152600401610af990614b96565b60003390506136dc81856000868660405180602001604052806000815250612dc0565b60005b83518110156137e05760008482815181106136fc576136fc61461c565b60200260200101519050600084838151811061371a5761371a61461c565b60209081029190910181015160008481526007835260408082206001600160a01b038c1683529093529190912054909150818110156137a75760405162461bcd60e51b8152602060048201526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b6064820152608401610af9565b60009283526007602090815260408085206001600160a01b038b16865290915290922091039055806137d8816146dd565b9150506136df565b5060006001600160a01b0316846001600160a01b0316826001600160a01b03167f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb8686604051613831929190614bf6565b60405180910390a46040805160208101909152600090526133a3565b60006022825110156138a15760405162461bcd60e51b815260206004820152601c60248201527f4c7a4170703a20696e76616c69642061646170746572506172616d73000000006044820152606401610af9565b506022015190565b60006001600160e01b03198216637965db0b60e01b1480610d8157506301ffc9a760e01b6001600160e01b0319831614610d81565b803561ffff811681146138f057600080fd5b919050565b60008083601f84011261390757600080fd5b5081356001600160401b0381111561391e57600080fd5b60208301915083602082850101111561393657600080fd5b9250929050565b80356001600160401b03811681146138f057600080fd5b6000806000806000806080878903121561396d57600080fd5b613976876138de565b955060208701356001600160401b038082111561399257600080fd5b61399e8a838b016138f5565b90975095508591506139b260408a0161393d565b945060608901359150808211156139c857600080fd5b506139d589828a016138f5565b979a9699509497509295939492505050565b6001600160a01b0381168114611e3a57600080fd5b80356138f0816139e7565b60008060408385031215613a1a57600080fd5b8235613a25816139e7565b946020939093013593505050565b6001600160e01b031981168114611e3a57600080fd5b600060208284031215613a5b57600080fd5b813561179481613a33565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b0381118282101715613aa157613aa1613a66565b6040525050565b60006001600160401b03821115613ac157613ac1613a66565b50601f01601f191660200190565b6000613ada83613aa8565b604051613ae78282613a7c565b809250848152858585011115613afc57600080fd5b8484602083013760006020868301015250509392505050565b600060208284031215613b2757600080fd5b81356001600160401b03811115613b3d57600080fd5b8201601f81018413613b4e57600080fd5b613b5d84823560208401613acf565b949350505050565b60005b83811015613b80578181015183820152602001613b68565b838111156133a35750506000910152565b60008151808452613ba9816020860160208601613b65565b601f01601f19169290920160200192915050565b6020815260006117946020830184613b91565b600060208284031215613be257600080fd5b611794826138de565b600060208284031215613bfd57600080fd5b5035919050565b60006001600160401b03821115613c1d57613c1d613a66565b5060051b60200190565b600082601f830112613c3857600080fd5b81356020613c4582613c04565b604051613c528282613a7c565b83815260059390931b8501820192828101915086841115613c7257600080fd5b8286015b84811015613c96578035613c89816139e7565b8352918301918301613c76565b509695505050505050565b600082601f830112613cb257600080fd5b81356020613cbf82613c04565b604051613ccc8282613a7c565b83815260059390931b8501820192828101915086841115613cec57600080fd5b8286015b84811015613c965780358352918301918301613cf0565b600082601f830112613d1857600080fd5b81356020613d2582613c04565b604051613d328282613a7c565b83815260059390931b8501820192828101915086841115613d5257600080fd5b8286015b84811015613c965780356001600160401b03811115613d755760008081fd5b613d838986838b0101613ca1565b845250918301918301613d56565b600080600060608486031215613da657600080fd5b83356001600160401b0380821115613dbd57600080fd5b613dc987838801613c27565b94506020860135915080821115613ddf57600080fd5b613deb87838801613d07565b93506040860135915080821115613e0157600080fd5b50613e0e86828701613d07565b9150509250925092565b600060208284031215613e2a57600080fd5b8135611794816139e7565b600082601f830112613e4657600080fd5b61179483833560208501613acf565b600080600080600060a08688031215613e6d57600080fd5b8535613e78816139e7565b94506020860135613e88816139e7565b935060408601356001600160401b0380821115613ea457600080fd5b613eb089838a01613ca1565b94506060880135915080821115613ec657600080fd5b613ed289838a01613ca1565b93506080880135915080821115613ee857600080fd5b50613ef588828901613e35565b9150509295509295909350565b60008060408385031215613f1557600080fd5b823591506020830135613f27816139e7565b809150509250929050565b600080600060408486031215613f4757600080fd5b613f50846138de565b925060208401356001600160401b03811115613f6b57600080fd5b613f77868287016138f5565b9497909650939450505050565b600080600080600080600080610100898b031215613fa157600080fd5b613faa896139fc565b9750613fb860208a016138de565b965060408901356001600160401b0380821115613fd457600080fd5b613fe08c838d01613e35565b975060608b0135915080821115613ff657600080fd5b6140028c838d01613ca1565b965060808b013591508082111561401857600080fd5b6140248c838d01613ca1565b955061403260a08c016139fc565b945061404060c08c016139fc565b935060e08b013591508082111561405657600080fd5b506140638b828c01613e35565b9150509295985092959890939650565b600080600080600080600080610100898b03121561409057600080fd5b883561409b816139e7565b97506140a960208a016138de565b965060408901356001600160401b03808211156140c557600080fd5b6140d18c838d01613e35565b975060608b0135965060808b0135955060a08b013591506140f1826139e7565b90935060c08a013590614103826139e7565b90925060e08a0135908082111561405657600080fd5b6000806040838503121561412c57600080fd5b82356001600160401b038082111561414357600080fd5b61414f86838701613c27565b9350602085013591508082111561416557600080fd5b5061417285828601613ca1565b9150509250929050565b600081518084526020808501945080840160005b838110156141ac57815187529582019590820190600101614190565b509495945050505050565b602081526000611794602083018461417c565b6000806000606084860312156141df57600080fd5b6141e8846138de565b925060208401356001600160401b0381111561420357600080fd5b61420f86828701613e35565b92505061421e6040850161393d565b90509250925092565b6000806000806080858703121561423d57600080fd5b8435614248816139e7565b9350602085013592506040850135915060608501356001600160401b0381111561427157600080fd5b61427d87828801613e35565b91505092959194509250565b803580151581146138f057600080fd5b60008060008060008060c087890312156142b257600080fd5b6142bb876138de565b955060208701356001600160401b03808211156142d757600080fd5b6142e38a838b01613e35565b965060408901359550606089013594506142ff60808a01614289565b935060a089013591508082111561431557600080fd5b5061432289828a01613e35565b9150509295509295509295565b6000806040838503121561434257600080fd5b61434b836138de565b9150614359602084016138de565b90509250929050565b6000806040838503121561437557600080fd5b8235614380816139e7565b915061435960208401614289565b60008060008060008060c087890312156143a757600080fd5b6143b0876138de565b955060208701356001600160401b03808211156143cc57600080fd5b6143d88a838b01613e35565b965060408901359150808211156143ee57600080fd5b6143fa8a838b01613ca1565b9550606089013591508082111561441057600080fd5b61441c8a838b01613ca1565b94506142ff60808a01614289565b60008060008060006080868803121561444257600080fd5b61444b866138de565b9450614459602087016138de565b93506040860135925060608601356001600160401b0381111561447b57600080fd5b614487888289016138f5565b969995985093965092949392505050565b6000806000606084860312156144ad57600080fd5b6144b6846138de565b92506144c4602085016138de565b9150604084013590509250925092565b600080604083850312156144e757600080fd5b82356144f2816139e7565b91506020830135613f27816139e7565b60006020828403121561451457600080fd5b61179482614289565b600080600080600060a0868803121561453557600080fd5b8535614540816139e7565b94506020860135614550816139e7565b9350604086013592506060860135915060808601356001600160401b0381111561457957600080fd5b613ef588828901613e35565b6000806000806080858703121561459b57600080fd5b6145a4856138de565b93506145b2602086016138de565b925060408501356145c2816139e7565b9396929550929360600135925050565b600181811c908216806145e657607f821691505b60208210810361460657634e487b7160e01b600052602260045260246000fd5b50919050565b8183823760009101908152919050565b634e487b7160e01b600052603260045260246000fd5b6020808252602e908201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60408201526d195c881bdc88185c1c1c9bdd995960921b606082015260800190565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b61ffff84168152604060208201526000611ee5604083018486614680565b634e487b7160e01b600052601160045260246000fd5b6000600182016146ef576146ef6146c7565b5060010190565b600082821015614708576147086146c7565b500390565b8284823760609190911b6bffffffffffffffffffffffff19169101908152601401919050565b601f82111561113557600081815260208120601f850160051c8101602086101561475a5750805b601f850160051c820191505b8181101561154157828155600101614766565b81516001600160401b0381111561479257614792613a66565b6147a6816147a084546145d2565b84614733565b602080601f8311600181146147db57600084156147c35750858301515b600019600386901b1c1916600185901b178555611541565b600085815260208120601f198616915b8281101561480a578886015182559484019460019091019084016147eb565b50858210156148285787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60608152600061484b6060830186613b91565b828103602084015261485d818661417c565b90508281036040840152614871818561417c565b9695505050505050565b61ffff861681526001600160a01b038516602082015260a0604082018190526000906148a990830186613b91565b841515606084015282810360808401526148c38185613b91565b98975050505050505050565b600080604083850312156148e257600080fd5b505080516020909101519092909150565b600061ffff808816835280871660208401525084604083015260806060830152614921608083018486614680565b979650505050505050565b61ffff8616815260806020820152600061494a608083018688614680565b6001600160401b0394909416604083015250606001529392505050565b6001600160401b0383111561497e5761497e613a66565b6149928361498c83546145d2565b83614733565b6000601f8411600181146149c657600085156149ae5750838201355b600019600387901b1c1916600186901b178355610eea565b600083815260209020601f19861690835b828110156149f757868501358255602094850194600190920191016149d7565b5086821015614a145760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b600082601f830112614a3757600080fd5b8151614a4281613aa8565b604051614a4f8282613a7c565b828152856020848701011115614a6457600080fd5b611ee5836020830160208801613b65565b600060208284031215614a8757600080fd5b81516001600160401b03811115614a9d57600080fd5b613b5d84828501614a26565b61ffff85168152608060208201526000614ac66080830186613b91565b6001600160401b038516604084015282810360608401526149218185613b91565b60008251614af9818460208701613b65565b9190910192915050565b61ffff8616815260a060208201526000614b2060a0830187613b91565b6001600160401b03861660408401528281036060840152614b418186613b91565b905082810360808401526148c38185613b91565b60208082526021908201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736040820152607360f81b606082015260800190565b60208082526028908201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206040820152670dad2e6dac2e8c6d60c31b606082015260800190565b60008219821115614bf157614bf16146c7565b500190565b604081526000614c09604083018561417c565b8281036020840152611ee5818561417c565b60208082526025908201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604082015264647265737360d81b606082015260800190565b6020808252602a908201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60408201526939103a3930b739b332b960b11b606082015260800190565b60208082526024908201527f4c7a4170703a205f61646170746572506172616d73206d75737420626520656d604082015263383a3c9760e11b606082015260800190565b600082601f830112614cff57600080fd5b81516020614d0c82613c04565b604051614d198282613a7c565b83815260059390931b8501820192828101915086841115614d3957600080fd5b8286015b84811015613c965780518352918301918301614d3d565b600080600060608486031215614d6957600080fd5b83516001600160401b0380821115614d8057600080fd5b614d8c87838801614a26565b94506020860151915080821115614da257600080fd5b614dae87838801614cee565b93506040860151915080821115614dc457600080fd5b50613e0e86828701614cee565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614e09816017850160208801613b65565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614e3a816028840160208801613b65565b01602801949350505050565b6001600160a01b0386811682528516602082015260a060408201819052600090614e729083018661417c565b8281036060840152614b41818661417c565b600060208284031215614e9657600080fd5b815161179481613a33565b600060033d1115614eba5760046000803e5060005160e01c5b90565b600060443d1015614ecb5790565b6040516003193d81016004833e81513d6001600160401b038160248401118184111715614efa57505050505090565b8285019150815181811115614f125750505050505090565b843d8701016020828501011115614f2c5750505050505090565b614f3b60208286010187613a7c565b509095945050505050565b60208082526028908201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b606082015260800190565b61ffff8716815260c060208201526000614fab60c0830188613b91565b8281036040840152614fbd8188613b91565b6001600160a01b0387811660608601528616608085015283810360a08501529050614fe88185613b91565b9998505050505050505050565b6001600160a01b03868116825285166020820152604081018490526060810183905260a06080820181905260009061492190830184613b91565b6000816000190483118215151615615049576150496146c7565b500290565b60008161505d5761505d6146c7565b50600019019056fe0b16f85926f1264b62da5a65aba7bd7afe2c6182293e09518c96a88343aeab84a2646970667358221220895a27b57d5cc688addce3ad98e769e3317845d5499f1338261ea3cf551b02b464736f6c634300080f0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000012000000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6750000000000000000000000007382bcf0bda75e8cfdf5d5d7515c6aa59d480a040000000000000000000000000000000000000000000000000000000000000013446566696d6f6e7320436861726163746572730000000000000000000000000000000000000000000000000000000000000000000000000000000000000000074d4f4e534b494e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003168747470733a2f2f6170692e646566696d6f6e732e636f6d2f6d657461646174612f636861726163746572732f7b69647d000000000000000000000000000000
-----Decoded View---------------
Arg [0] : name_ (string): Defimons Characters
Arg [1] : symbol_ (string): MONSKIN
Arg [2] : uri_ (string): https://api.defimons.com/metadata/characters/{id}
Arg [3] : lzEndpoint_ (address): 0x66A71Dcef29A0fFBDBE3c6a460a3B5BC225Cd675
Arg [4] : adminAddress_ (address): 0x7382BCf0BDa75E8CfDf5D5D7515C6aA59D480a04
-----Encoded View---------------
12 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [1] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [3] : 00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd675
Arg [4] : 0000000000000000000000007382bcf0bda75e8cfdf5d5d7515c6aa59d480a04
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000013
Arg [6] : 446566696d6f6e73204368617261637465727300000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [8] : 4d4f4e534b494e00000000000000000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000031
Arg [10] : 68747470733a2f2f6170692e646566696d6f6e732e636f6d2f6d657461646174
Arg [11] : 612f636861726163746572732f7b69647d000000000000000000000000000000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.