Overview
CRO Balance
CRO Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
TradeShip
Compiler Version
v0.8.4+commit.c7e474f2
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.4; import "@openzeppelin/contracts-upgradeable/utils/cryptography/SignatureCheckerUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "../utils/Introspection.sol"; import "../utils/SafePct.sol"; import "./IPort.sol"; import "./TradeshipCrates.sol"; import { UPGRADER_ROLE, SIG_ROLE, PORT_SCALE, STAFF_ROLE, SERVER_ROLE } from "../utils/Constants.sol"; contract TradeShip is ReentrancyGuardUpgradeable, AccessControlUpgradeable, UUPSUpgradeable, TradeshipCrates { using SafePct for uint256; using Introspection for address; using SignatureCheckerUpgradeable for address; using AddressUpgradeable for address payable; event OrderFilled(bytes32 indexed orderHash, address filler, uint royaltyAmount); event OrderCancelled(bytes32 indexed orderHash); event RoyaltyPaid(address collection, uint id, address ipholder, uint amount, address paymentToken); event StakerFee(uint amount); error UnsupportedOrderType(OrderType); error InvalidConsiderationsAmount(); error UnsupportedItemType(ItemType); error OrderInvalid(bytes32); IPort public portContract; address payable public stakerAddress; mapping(bytes32 => bool) public executed; function initialize(address payable _port, address payable _stakerAddress) public initializer { portContract = IPort(_port); stakerAddress = _stakerAddress; __AccessControl_init(); __UUPSUpgradeable_init(); __ReentrancyGuard_init(); __TradeshipCrates_init(); _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); _grantRole(UPGRADER_ROLE, _msgSender()); } function _authorizeUpgrade(address newImplementation) internal onlyRole(UPGRADER_ROLE) override {} function fillOrders(Order[] memory _orders, Approval memory _approval, bytes memory _serverSig) payable external nonReentrant{ _validateApproval(_approval, _serverSig); _processOrders(_orders, _approval); } function cancelOrders(Order[] memory _orders) external { uint len = _orders.length; for(uint i = 0; i < len; i++){ _cancelOrder(_orders[i]); } } function _validateApproval(Approval memory _approval, bytes memory _serverSig) view private { require(block.timestamp < _approval.expire, "window expired"); bytes32 digest = _hashApproval(_approval); address signer = ECDSAUpgradeable.recover(digest, _serverSig); require(hasRole(SIG_ROLE, signer), "not signer"); } function _processOrders(Order[] memory _orders, Approval memory _approval) private { uint len = _orders.length; require(len > 0, "invalid length"); require(len == _approval.sigs.length, "not correct lengths"); uint totalNativePrice; for(uint i = 0; i < len; i++){ if(_orders[i].orderType == OrderType.SELL_NFT_NATIVE){ totalNativePrice += _getNativePayable(_orders[i]); } } require(msg.value >= (totalNativePrice + _approval.feeAmount), "not enough value"); _payFee(_approval.feeAmount); for(uint i = 0; i < len; i++){ bytes32 digest = _validateOrder(_orders[i], _approval.sigs[i]); ConduitTransfer[] memory tradesForOrder = _createTrades(_orders[i], _approval.filler); uint royalty =_processNativePayments(_orders[i], _msgSender()); if(!_isLegacy(_orders[i])){ emit OrderFilled(digest, _approval.filler, royalty); } portContract.executeTradesServer(tradesForOrder); } } function _payFee(uint _fee) private { if(_fee > 0){ uint256 stakerFee = _fee.mulDiv(1,2); emit StakerFee(stakerFee); (payable(address(portContract))).sendValue(_fee); } } function reportStakerFee(uint _fee) external onlyRole(SERVER_ROLE){ emit StakerFee(_fee); } //pays royalty holder and seller native token function _processNativePayments(Order memory _order, address _filler) private returns (uint royaltyTotal){ if(_order.orderType == OrderType.TOKEN_TRADES || _order.orderType == OrderType.SELL_NFT_TOKEN || _order.orderType == OrderType.OFFER) return 0; if(_order.orderType == OrderType.SELL_NFT_NATIVE){ uint price = _getNativePayable(_order); if(_isLegacy(_order)){ try portContract.makeLegacyPurchase{value : price}(_getLegacyId(_order), _filler) { }catch { revert("fail legacy"); } } else { uint256 amountSeller = price; uint len = _order.offerings.length; for(uint i = 0; i < len; i++){ OfferItem memory offering = _order.offerings[i]; uint royalty = portContract.calculateRoyalty(offering.token, offering.identifierOrCriteria, price/len); amountSeller -= royalty; royaltyTotal += royalty; if(royalty > 0){ try portContract.payRoyaltyServer{value: royalty}(offering.token, offering.identifierOrCriteria, price/len){} catch{ revert("royalty fail"); } } } if(portContract.useEscrow(_order.offerer)){ portContract.addToEscrow{value : amountSeller}(_order.offerer); } else { (payable(_order.offerer)).sendValue(amountSeller); } } } else { revert UnsupportedOrderType(_order.orderType); } } function _cancelOrder(Order memory _order) internal { require(!_isLegacy(_order), "cancel invalid"); bytes32 digest = _hashOrder(_order); if(executed[digest]){ revert OrderInvalid(digest); } require(block.timestamp < _order.endAt, "order expired"); require(_order.offerer == _msgSender() || hasRole(STAFF_ROLE, _msgSender()), "not seller"); executed[digest] = true; emit OrderCancelled(digest); } function _validateOrder(Order memory _order, bytes memory _sig) internal returns (bytes32) { if(!_isLegacy(_order)){ bytes32 digest = _hashOrder(_order); if(executed[digest]){ revert OrderInvalid(digest); } executed[digest] = true; require(block.timestamp < _order.endAt, "order expired"); require(_order.offerer.isValidSignatureNow(digest, _sig), "Invalid signer"); return digest; } else { return bytes32(0); } } function _createTrades(Order memory _order, address _filler) private returns (ConduitTransfer[] memory){ ConduitTransfer[] memory transferInformations; if (_order.orderType == OrderType.SELL_NFT_NATIVE) { if (!_isLegacy(_order)) { transferInformations = new ConduitTransfer[](_order.offerings.length); for (uint i = 0; i < _order.offerings.length; i++) { OfferItem memory item = _order.offerings[i]; transferInformations[i] = _createConduitItem(item, _order.offerer, _filler); } } } else if (_order.orderType == OrderType.TOKEN_TRADES) { uint256 size = _order.offerings.length + _order.considerations.length; transferInformations = new ConduitTransfer[](size); for (uint i = 0; i < _order.offerings.length; i++) { OfferItem memory item = _order.offerings[i]; transferInformations[i] = _createConduitItem(item, _order.offerer, _filler); } for (uint i = 0; i < _order.considerations.length; i++) { OfferItem memory item = _order.considerations[i]; transferInformations[i + _order.offerings.length] = _createConduitItem(item, _filler, _order.offerer); } } else if(_order.orderType == OrderType.SELL_NFT_TOKEN) { require(_order.considerations.length == 1, "invalid considerations"); require(_order.considerations[0].itemType == ItemType.ERC20, "invalid considerations"); uint256 royaltyPayments = 0; uint len = _order.offerings.length; for (uint i = 0; i < len; i++) { (,uint royalty) = portContract.getStandardNFTRoyalty(_order.offerings[i].token, _order.offerings[i].identifierOrCriteria, _order.considerations[0].endAmount/_order.offerings.length); if (royalty > 0) royaltyPayments++; } transferInformations = new ConduitTransfer[](1 + len + royaltyPayments); uint256 idx = 0; OfferItem memory consieration = _order.considerations[0]; uint payout = consieration.endAmount; for (uint i = 0; i < len; i++) { OfferItem memory offering = _order.offerings[i]; transferInformations[idx] = _createConduitItem(offering, _order.offerer, _filler); (address ipholder, uint royalty) = portContract.getStandardNFTRoyalty(offering.token, offering.identifierOrCriteria, consieration.endAmount/len); if(royalty > 0){ transferInformations[idx + 1] = _createERC20Transfer(consieration.token, _filler, ipholder, royalty); idx++; payout -= royalty; emit RoyaltyPaid(offering.token, offering.identifierOrCriteria, ipholder, royalty, consieration.token); } idx++; } transferInformations[idx] = _createERC20Transfer(consieration.token, _filler, _order.offerer, payout); } else if(_order.orderType == OrderType.OFFER){ require(_order.offerings.length == 1, "invalid offerings"); OfferItem memory offering = _order.offerings[0]; uint payout = offering.endAmount; require(offering.itemType == ItemType.ERC20 || offering.itemType == ItemType.POOL, "invalid offerings"); uint256 royaltyPayments = 0; uint len = _order.considerations.length; for (uint i = 0; i < len; i++) { (,uint royalty) = portContract.getStandardNFTRoyalty(_order.considerations[i].token, _order.considerations[i].identifierOrCriteria, payout/len); if (royalty > 0) royaltyPayments++; } transferInformations = new ConduitTransfer[](1+ len + royaltyPayments); uint256 idx = 0; for(uint i = 0; i < len; i++){ transferInformations[idx] = _createConduitItem(_order.considerations[i], _filler, _order.offerer); (address ipholder, uint royalty) = portContract.getStandardNFTRoyalty(_order.considerations[i].token, _order.considerations[i].identifierOrCriteria, offering.endAmount/len); if(royalty > 0){ transferInformations[idx + 1] = offering.itemType == ItemType.POOL ? _createPoolTransfer(_order.offerer, ipholder, royalty) : _createERC20Transfer(offering.token, _order.offerer, ipholder, royalty); idx++; payout -= royalty; emit RoyaltyPaid(offering.token, offering.identifierOrCriteria, ipholder, royalty, offering.token); } idx++; } transferInformations[idx] = offering.itemType == ItemType.POOL ? _createPoolTransfer(_order.offerer, _filler, payout) : _createERC20Transfer(offering.token, _order.offerer, _filler, payout); }else { revert UnsupportedOrderType(_order.orderType); } return transferInformations; } function _createConduitItem(OfferItem memory item, address from, address to) private view returns (ConduitTransfer memory) { ConduitItemType tokenType; if (item.itemType == ItemType.ERC721) { tokenType = ConduitItemType.ERC721; } else if (item.itemType == ItemType.ERC1155) { tokenType = ConduitItemType.ERC1155; } else if (item.itemType == ItemType.ERC20) { tokenType = ConduitItemType.ERC20; } else if(item.itemType == ItemType.POOL){ tokenType = ConduitItemType.POOL; if(portContract.useEscrow(to)){ item.identifierOrCriteria = 1; } item.token = portContract.pool(); } else { revert UnsupportedItemType(item.itemType); } ConduitTransfer memory transferInformation; transferInformation.itemType = tokenType; transferInformation.token = item.token; transferInformation.from = from; transferInformation.to = to; transferInformation.identifier = item.identifierOrCriteria; transferInformation.amount = item.endAmount; return transferInformation; } function _createPoolTransfer(address _from, address _to, uint256 amount) private view returns (ConduitTransfer memory){ ConduitTransfer memory transferInformation; transferInformation.itemType = ConduitItemType.POOL; transferInformation.token = portContract.pool(); transferInformation.from = _from; transferInformation.to = _to; transferInformation.amount = amount; if(portContract.useEscrow(_to)){ transferInformation.identifier = 1; } return transferInformation; } function _createERC20Transfer(address _token, address _from, address _to, uint256 _amount) private pure returns (ConduitTransfer memory) { ConduitTransfer memory transferInformation; transferInformation.itemType = ConduitItemType.ERC20; transferInformation.token = _token; transferInformation.from = _from; transferInformation.to = _to; transferInformation.amount = _amount; return transferInformation; } function _isLegacy(Order memory _order) private pure returns (bool){ return _order.orderType == OrderType.SELL_NFT_NATIVE && _order.offerings[0].itemType == ItemType.LEGACY_LISTING; } function _getLegacyId(Order memory _order) private pure returns (uint){ require(_isLegacy(_order), 'not legacy'); return _order.offerings[0].identifierOrCriteria; } function _getNativePayable(Order memory _order) private view returns (uint){ if(_order.orderType == OrderType.SELL_NFT_NATIVE){ if(_isLegacy(_order)){ try portContract.priceLookup(_order.offerings[0].identifierOrCriteria) returns (uint256 priceLookup){ return priceLookup; }catch Error(string memory reason){ revert(reason); } } else { if(_order.considerations.length != 1 && _order.considerations[0].endAmount > 0) revert InvalidConsiderationsAmount(); if(_order.considerations[0].itemType != ItemType.NATIVE) revert UnsupportedItemType(_order.considerations[0].itemType); return _order.considerations[0].endAmount; } }else if(_order.orderType == OrderType.TOKEN_TRADES || _order.orderType == OrderType.SELL_NFT_TOKEN){ return 0; } else { revert UnsupportedOrderType(_order.orderType); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.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 AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal onlyInitializing { } function __AccessControl_init_unchained() internal onlyInitializing { } 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(IAccessControlUpgradeable).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 ", StringsUpgradeable.toHexString(account), " is missing role ", StringsUpgradeable.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()); } } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// 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 IAccessControlUpgradeable { /** * @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.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822ProxiableUpgradeable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1271.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC1271 standard signature validation method for * contracts as defined in https://eips.ethereum.org/EIPS/eip-1271[ERC-1271]. * * _Available since v4.1._ */ interface IERC1271Upgradeable { /** * @dev Should return whether the signature provided is valid for the provided data * @param hash Hash of the data to be signed * @param signature Signature byte array associated with _data */ function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967UpgradeUpgradeable is Initializable { function __ERC1967Upgrade_init() internal onlyInitializing { } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @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) private returns (bytes memory) { require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Internal function that returns the initialized version. Returns `_initialized` */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Internal function that returns the initialized version. Returns `_initializing` */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate the implementation's compatibility when performing an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// 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 AddressUpgradeable { /** * @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://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return 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 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; import "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../StringsUpgradeable.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSAUpgradeable { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", StringsUpgradeable.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.0; import "./ECDSAUpgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ * * @custom:storage-size 52 */ abstract contract EIP712Upgradeable is Initializable { /* solhint-disable var-name-mixedcase */ bytes32 private _HASHED_NAME; bytes32 private _HASHED_VERSION; bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ function __EIP712_init(string memory name, string memory version) internal onlyInitializing { __EIP712_init_unchained(name, version); } function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash()); } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev The hash of the name parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712NameHash() internal virtual view returns (bytes32) { return _HASHED_NAME; } /** * @dev The hash of the version parameter for the EIP712 domain. * * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs * are a concern. */ function _EIP712VersionHash() internal virtual view returns (bytes32) { return _HASHED_VERSION; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/SignatureChecker.sol) pragma solidity ^0.8.0; import "./ECDSAUpgradeable.sol"; import "../AddressUpgradeable.sol"; import "../../interfaces/IERC1271Upgradeable.sol"; /** * @dev Signature verification helper that can be used instead of `ECDSA.recover` to seamlessly support both ECDSA * signatures from externally owned accounts (EOAs) as well as ERC1271 signatures from smart contract wallets like * Argent and Gnosis Safe. * * _Available since v4.1._ */ library SignatureCheckerUpgradeable { /** * @dev Checks if a signature is valid for a given signer and data hash. If the signer is a smart contract, the * signature is validated against that smart contract using ERC1271, otherwise it's validated using `ECDSA.recover`. * * NOTE: Unlike ECDSA signatures, contract signatures are revocable, and the outcome of this function can thus * change through time. It could return true at block N and false at block N+1 (or the opposite). */ function isValidSignatureNow( address signer, bytes32 hash, bytes memory signature ) internal view returns (bool) { (address recovered, ECDSAUpgradeable.RecoverError error) = ECDSAUpgradeable.tryRecover(hash, signature); if (error == ECDSAUpgradeable.RecoverError.NoError && recovered == signer) { return true; } (bool success, bytes memory result) = signer.staticcall( abi.encodeWithSelector(IERC1271Upgradeable.isValidSignature.selector, hash, signature) ); return (success && result.length == 32 && abi.decode(result, (bytes32)) == bytes32(IERC1271Upgradeable.isValidSignature.selector)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.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 ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// 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 IERC165Upgradeable { /** * @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 MathUpgradeable { 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 * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/MathUpgradeable.sol"; /** * @dev String operations. */ library StringsUpgradeable { 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 = MathUpgradeable.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, MathUpgradeable.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 (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
// 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.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/introspection/ERC165Checker.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Library used to query support of an interface declared via {IERC165}. * * Note that these functions return the actual result of the query: they do not * `revert` if an interface is not supported. It is up to the caller to decide * what to do in these cases. */ library ERC165Checker { // As per the EIP-165 spec, no interface should ever match 0xffffffff bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff; /** * @dev Returns true if `account` supports the {IERC165} interface. */ function supportsERC165(address account) internal view returns (bool) { // Any contract that implements ERC165 must explicitly indicate support of // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid return supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) && !supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID); } /** * @dev Returns true if `account` supports the interface defined by * `interfaceId`. Support for {IERC165} itself is queried automatically. * * See {IERC165-supportsInterface}. */ function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) { // query support of both ERC165 as per the spec and support of _interfaceId return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId); } /** * @dev Returns a boolean array where each value corresponds to the * interfaces passed in and whether they're supported or not. This allows * you to batch check interfaces for a contract where your expectation * is that some interfaces may not be supported. * * See {IERC165-supportsInterface}. * * _Available since v3.4._ */ function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool[] memory) { // an array of booleans corresponding to interfaceIds and whether they're supported or not bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length); // query support of ERC165 itself if (supportsERC165(account)) { // query support of each interface in interfaceIds for (uint256 i = 0; i < interfaceIds.length; i++) { interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]); } } return interfaceIdsSupported; } /** * @dev Returns true if `account` supports all the interfaces defined in * `interfaceIds`. Support for {IERC165} itself is queried automatically. * * Batch-querying can lead to gas savings by skipping repeated checks for * {IERC165} support. * * See {IERC165-supportsInterface}. */ function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) { // query support of ERC165 itself if (!supportsERC165(account)) { return false; } // query support of each interface in interfaceIds for (uint256 i = 0; i < interfaceIds.length; i++) { if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) { return false; } } // all interfaces supported return true; } /** * @notice Query if a contract implements an interface, does not check ERC165 support * @param account The address of the contract to query for support of an interface * @param interfaceId The interface identifier, as specified in ERC-165 * @return true if the contract at account indicates support of the interface with * identifier interfaceId, false otherwise * @dev Assumes that account contains a contract that supports ERC165, otherwise * the behavior of this method is undefined. This precondition can be checked * with {supportsERC165}. * Interface identification is specified in ERC-165. */ function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) { // prepare call bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId); // perform static call bool success; uint256 returnSize; uint256 returnValue; assembly { success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20) returnSize := returndatasize() returnValue := mload(0x00) } return success && returnSize >= 0x20 && returnValue > 0; } }
// 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 pragma solidity ^0.8.4; enum ConduitItemType { NATIVE, // unused ERC20, ERC721, ERC1155, POOL } uint256 constant USE_ESCROW_YES = 1; uint256 constant USE_ESCROW_NO = 0; struct ConduitTransfer { ConduitItemType itemType; address token; address from; address to; uint256 identifier; uint256 amount; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; interface IBundle2 { event BundleCreated(uint indexed id, address[] contracts, uint[] ids, string name, string desc); event BundleDestroyed(uint indexed id) ; function wrap(address[] calldata _tokens, uint256[] calldata _ids, string calldata _name, string calldata desc) external; function contents(uint256 _id) external view returns (address[] memory, uint[] memory); function unwrap(uint _id) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "../conduit/ConduitLib.sol"; interface IPort { //Returns fee as a percent in 10k scale (ie 300 = 3%) function fee(address user) external view returns (uint16 userFee); function addToEscrow(address _address) external payable; function cancelActive(address _nft, uint256 _id, address _seller) external; function executeTradesServer(ConduitTransfer[] calldata transferInformation) external; function getStandardNFTRoyalty(address _contract, uint256 _id, uint256 _price) external view returns (address ipHolder, uint256 royaltyAmount); function calculateRoyalty(address _contract, uint256 _id, uint256 _price) external view returns (uint256 royaltyAmount); function payRoyalty(address _contract, uint256 _id, uint256 _price) external payable; function makeLegacyPurchase(uint256 _id, address _buyer) external payable; function payRoyaltyServer(address _contract, uint256 _id, uint256 _price) external payable; function priceLookup(uint256 _id) external view returns (uint256); function useEscrow(address user) external view returns(bool); function pool() external view returns(address); //depreciated use executeTradeServer function transferToken( ConduitItemType _type, address _tokenAddress, address _from, address _to, uint256 _identifier, uint256 _amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts-upgradeable/utils/cryptography/EIP712Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; abstract contract TradeshipCrates is Initializable, EIP712Upgradeable { constructor() {} function __TradeshipCrates_init() internal onlyInitializing { __EIP712_init("EB TradeShip", "1.0"); } function __TradeshipCrates_init_unchained() internal onlyInitializing { } function domainSeparator() external view returns (bytes32){ return _domainSeparatorV4(); } enum ItemType { // 0: CRO on mainnet, MATIC on polygon, etc. NATIVE, // 1: ERC721 items ERC721, // 2: ERC1155 items ERC1155, // 3: ERC20 items (ERC777 and ERC20 analogues could also technically work) ERC20, // 4: ERC721 items where a number of tokenIds are supported ERC721_WITH_CRITERIA, // 5: ERC1155 items where a number of ids are supported ERC1155_WITH_CRITERIA, // 6: Legacy Listing from OG bay contract LEGACY_LISTING, // 7: Ebisu's Pool POOL } enum OrderType { //0: NFTS -> NATIVE SELL_NFT_NATIVE, //1: ERC20, ERC721, ERC1155 -> ERC20, ERC721, ERC1155 TOKEN_TRADES, //2: NFT -> ERC20 SELL_NFT_TOKEN, //3: POOL|ERC20 -> [ERC721 | ERC1155] OFFER } /** * @dev An offer item has five components: an item type (ETH or other native * tokens, ERC20, ERC721, and ERC1155, as well as criteria-based ERC721 and * ERC1155), a token address, a dual-purpose "identifierOrCriteria" * component that will either represent a tokenId or a merkle root * depending on the item type, and a start and end amount that support * increasing or decreasing amounts over the duration of the respective * order. */ struct OfferItem { ItemType itemType; address token; uint256 identifierOrCriteria; uint256 startAmount; uint256 endAmount; } bytes private constant offerItemString = abi.encodePacked( "OfferItem(", "uint8 itemType,", "address token,", "uint256 identifierOrCriteria,", "uint256 startAmount,", "uint256 endAmount", ")" ); struct Order { address offerer; OfferItem[] offerings; OfferItem[] considerations; OrderType orderType; uint256 startAt; uint256 endAt; uint256 salt; } bytes private constant orderString = abi.encodePacked( "Order(", "address offerer,", "OfferItem[] offerings,", "OfferItem[] considerations,", "uint8 orderType,", "uint256 startAt,", "uint256 endAt,", "uint256 salt", ")" ); bytes32 private constant _TYPE_ORDER = keccak256( abi.encodePacked( orderString, offerItemString ) ); function _hashOfferItem(OfferItem memory _offer) private pure returns(bytes32){ return keccak256(abi.encode( keccak256(offerItemString), _offer.itemType, _offer.token, _offer.identifierOrCriteria, _offer.startAmount, _offer.endAmount )); } function _hashOrder(Order memory _order) public view returns (bytes32){ bytes32[] memory _offerHashes = new bytes32[](_order.offerings.length); for(uint i = 0; i < _offerHashes.length; i++){ _offerHashes[i] = _hashOfferItem(_order.offerings[i]); } bytes32[] memory _considerationHashes = new bytes32[](_order.considerations.length); for(uint i = 0; i < _considerationHashes.length; i++){ _considerationHashes[i] = _hashOfferItem(_order.considerations[i]); } return _hashTypedDataV4(keccak256(abi.encode( _TYPE_ORDER, _order.offerer, keccak256(abi.encodePacked(_offerHashes)), keccak256((abi.encodePacked(_considerationHashes))), _order.orderType, _order.startAt, _order.endAt, _order.salt ))); } struct Approval { uint256 expire; uint256 feeAmount; address feeToken; address filler; bytes[] sigs; } bytes private constant approvalTypeString = abi.encodePacked( "Approval(", "uint256 expire,", "uint256 feeAmount,", "address feeToken,", "address filler,", "bytes[] sigs", ")" ); bytes32 private constant _TYPE_APPROVAL = keccak256(abi.encodePacked( approvalTypeString )); function _hashApproval(Approval memory _approval) public view returns (bytes32){ bytes32[] memory _hashes = new bytes32[](_approval.sigs.length); for(uint i = 0; i < _hashes.length; i++){ _hashes[i] = keccak256(_approval.sigs[i]); } bytes32 structHash = keccak256(abi.encode( _TYPE_APPROVAL, _approval.expire, _approval.feeAmount, _approval.feeToken, _approval.filler, keccak256(abi.encodePacked(_hashes)) )); return _hashTypedDataV4(structHash); } uint256[50] __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; //Roles bytes32 constant UPGRADER_ROLE = keccak256("UPGRADER_ROLE"); bytes32 constant SIG_ROLE = keccak256("SIG_ROLE"); bytes32 constant STAFF_ROLE = keccak256("STAFF_ROLE"); bytes32 constant SERVER_ROLE = keccak256("SERVER_ROLE"); //Scale to be used with SafePct uint16 constant PORT_SCALE = 10_000;
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; import "../market/IBundle2.sol"; library Introspection { function is721(address _contract) internal view returns(bool){ return ERC165Checker.supportsInterface(_contract, type(IERC721).interfaceId); } function is1155(address _contract) internal view returns(bool){ return ERC165Checker.supportsInterface(_contract, type(IERC1155).interfaceId); } function is20(address _contract) internal view returns (bool){ return ERC165Checker.supportsInterface(_contract, type(IERC20).interfaceId); } function isNft(address _contract) internal view returns (bool){ return is721(_contract) || is1155(_contract); } function isRoyaltyStandard(address _contract) internal view returns (bool){ return ERC165Checker.supportsInterface(_contract, type(IERC2981).interfaceId); } function isBundleContract(address _contract) internal view returns (bool) { return ERC165Checker.supportsInterface(_contract, type(IBundle2).interfaceId); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; library SafeMathLite{ /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.4; /** * @dev Compute percentages safely without phantom overflows. * * Intermediate operations can overflow even when the result will always * fit into computed type. Developers usually * assume that overflows raise errors. `SafePct` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ import "./SafeMathLite.sol"; library SafePct { using SafeMathLite for uint256; /** * Requirements: * * - intermediate operations must revert on overflow */ function mulDiv(uint256 x, uint256 y, uint256 z) internal pure returns (uint256) { require(z > 0, "Division by zero"); require(y <= z, "Invalid multiplier"); if (x == 0) return 0; uint256 xy = x * y; if (xy / x == y) { // no overflow happened - same as in SafeMath mul return xy / z; } //slither-disable-next-line divide-before-multiply uint256 a = x / z; uint256 b = x % z; // x = a * z + b //slither-disable-next-line divide-before-multiply uint256 c = y / z; uint256 d = y % z; // y = c * z + d return (a.mul(c).mul(z)).add(a.mul(d)).add(b.mul(c)).add(b.mul(d).div(z)); } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[],"name":"InvalidConsiderationsAmount","type":"error"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"OrderInvalid","type":"error"},{"inputs":[{"internalType":"enum TradeshipCrates.ItemType","name":"","type":"uint8"}],"name":"UnsupportedItemType","type":"error"},{"inputs":[{"internalType":"enum TradeshipCrates.OrderType","name":"","type":"uint8"}],"name":"UnsupportedOrderType","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"orderHash","type":"bytes32"}],"name":"OrderCancelled","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"orderHash","type":"bytes32"},{"indexed":false,"internalType":"address","name":"filler","type":"address"},{"indexed":false,"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"name":"OrderFilled","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":false,"internalType":"address","name":"collection","type":"address"},{"indexed":false,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"ipholder","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"paymentToken","type":"address"}],"name":"RoyaltyPaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"StakerFee","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"expire","type":"uint256"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"address","name":"feeToken","type":"address"},{"internalType":"address","name":"filler","type":"address"},{"internalType":"bytes[]","name":"sigs","type":"bytes[]"}],"internalType":"struct TradeshipCrates.Approval","name":"_approval","type":"tuple"}],"name":"_hashApproval","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"offerer","type":"address"},{"components":[{"internalType":"enum TradeshipCrates.ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifierOrCriteria","type":"uint256"},{"internalType":"uint256","name":"startAmount","type":"uint256"},{"internalType":"uint256","name":"endAmount","type":"uint256"}],"internalType":"struct TradeshipCrates.OfferItem[]","name":"offerings","type":"tuple[]"},{"components":[{"internalType":"enum TradeshipCrates.ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifierOrCriteria","type":"uint256"},{"internalType":"uint256","name":"startAmount","type":"uint256"},{"internalType":"uint256","name":"endAmount","type":"uint256"}],"internalType":"struct TradeshipCrates.OfferItem[]","name":"considerations","type":"tuple[]"},{"internalType":"enum TradeshipCrates.OrderType","name":"orderType","type":"uint8"},{"internalType":"uint256","name":"startAt","type":"uint256"},{"internalType":"uint256","name":"endAt","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"}],"internalType":"struct TradeshipCrates.Order","name":"_order","type":"tuple"}],"name":"_hashOrder","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"offerer","type":"address"},{"components":[{"internalType":"enum TradeshipCrates.ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifierOrCriteria","type":"uint256"},{"internalType":"uint256","name":"startAmount","type":"uint256"},{"internalType":"uint256","name":"endAmount","type":"uint256"}],"internalType":"struct TradeshipCrates.OfferItem[]","name":"offerings","type":"tuple[]"},{"components":[{"internalType":"enum TradeshipCrates.ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifierOrCriteria","type":"uint256"},{"internalType":"uint256","name":"startAmount","type":"uint256"},{"internalType":"uint256","name":"endAmount","type":"uint256"}],"internalType":"struct TradeshipCrates.OfferItem[]","name":"considerations","type":"tuple[]"},{"internalType":"enum TradeshipCrates.OrderType","name":"orderType","type":"uint8"},{"internalType":"uint256","name":"startAt","type":"uint256"},{"internalType":"uint256","name":"endAt","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"}],"internalType":"struct TradeshipCrates.Order[]","name":"_orders","type":"tuple[]"}],"name":"cancelOrders","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"domainSeparator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"executed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"offerer","type":"address"},{"components":[{"internalType":"enum TradeshipCrates.ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifierOrCriteria","type":"uint256"},{"internalType":"uint256","name":"startAmount","type":"uint256"},{"internalType":"uint256","name":"endAmount","type":"uint256"}],"internalType":"struct TradeshipCrates.OfferItem[]","name":"offerings","type":"tuple[]"},{"components":[{"internalType":"enum TradeshipCrates.ItemType","name":"itemType","type":"uint8"},{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"identifierOrCriteria","type":"uint256"},{"internalType":"uint256","name":"startAmount","type":"uint256"},{"internalType":"uint256","name":"endAmount","type":"uint256"}],"internalType":"struct TradeshipCrates.OfferItem[]","name":"considerations","type":"tuple[]"},{"internalType":"enum TradeshipCrates.OrderType","name":"orderType","type":"uint8"},{"internalType":"uint256","name":"startAt","type":"uint256"},{"internalType":"uint256","name":"endAt","type":"uint256"},{"internalType":"uint256","name":"salt","type":"uint256"}],"internalType":"struct TradeshipCrates.Order[]","name":"_orders","type":"tuple[]"},{"components":[{"internalType":"uint256","name":"expire","type":"uint256"},{"internalType":"uint256","name":"feeAmount","type":"uint256"},{"internalType":"address","name":"feeToken","type":"address"},{"internalType":"address","name":"filler","type":"address"},{"internalType":"bytes[]","name":"sigs","type":"bytes[]"}],"internalType":"struct TradeshipCrates.Approval","name":"_approval","type":"tuple"},{"internalType":"bytes","name":"_serverSig","type":"bytes"}],"name":"fillOrders","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address payable","name":"_port","type":"address"},{"internalType":"address payable","name":"_stakerAddress","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"portContract","outputs":[{"internalType":"contract IPort","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_fee","type":"uint256"}],"name":"reportStakerFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stakerAddress","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
60a06040523060601b60805234801561001757600080fd5b5060805160601c6150946100526000396000818161052c0152818161056c0152818161079d015281816107dd015261086c01526150946000f3fe60806040526004361061011f5760003560e01c806359eaef0b116100a0578063a9fcfb3311610064578063a9fcfb3314610322578063d470316b14610353578063d547741f14610374578063e7d6e22914610394578063f698da25146103b457600080fd5b806359eaef0b146102745780638a91c5581461029457806391d14854146102b457806395a03360146102d4578063a217fddf1461030d57600080fd5b806336568abe116100e757806336568abe146101ec5780633659cfe61461020c578063485cc9551461022c5780634f1ef2861461024c57806352d1902d1461025f57600080fd5b806301ffc9a7146101245780630338ed9d14610159578063212c18951461016e578063248a9ca31461018e5780632f2ff15d146101cc575b600080fd5b34801561013057600080fd5b5061014461013f3660046148a6565b6103c9565b60405190151581526020015b60405180910390f35b61016c6101673660046147af565b610400565b005b34801561017a57600080fd5b5061016c61018936600461477d565b61042a565b34801561019a57600080fd5b506101be6101a9366004614852565b60009081526097602052604090206001015490565b604051908152602001610150565b3480156101d857600080fd5b5061016c6101e7366004614882565b610479565b3480156101f857600080fd5b5061016c610207366004614882565b61049e565b34801561021857600080fd5b5061016c610227366004614693565b610521565b34801561023857600080fd5b5061016c6102473660046146cb565b610601565b61016c61025a366004614703565b610792565b34801561026b57600080fd5b506101be61085f565b34801561028057600080fd5b506101be61028f3660046148ce565b610913565b3480156102a057600080fd5b5061016c6102af366004614852565b610b58565b3480156102c057600080fd5b506101446102cf366004614882565b610bb9565b3480156102e057600080fd5b50610193546102f5906001600160a01b031681565b6040516001600160a01b039091168152602001610150565b34801561031957600080fd5b506101be600081565b34801561032e57600080fd5b5061014461033d366004614852565b6101956020526000908152604090205460ff1681565b34801561035f57600080fd5b50610194546102f5906001600160a01b031681565b34801561038057600080fd5b5061016c61038f366004614882565b610be4565b3480156103a057600080fd5b506101be6103af366004614900565b610c09565b3480156103c057600080fd5b506101be610f75565b60006001600160e01b03198216637965db0b60e01b14806103fa57506301ffc9a760e01b6001600160e01b03198316145b92915050565b610408610f84565b6104128282610fde565b61041c83836110a3565b61042560018055565b505050565b805160005b818110156104255761046783828151811061045a57634e487b7160e01b600052603260045260246000fd5b602002602001015161141e565b8061047181614edb565b91505061042f565b600082815260976020526040902060010154610494816115a5565b61042583836115af565b6001600160a01b03811633146105135760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b61051d8282611635565b5050565b306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016141561056a5760405162461bcd60e51b815260040161050a90614cb7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166105b3600080516020615018833981519152546001600160a01b031690565b6001600160a01b0316146105d95760405162461bcd60e51b815260040161050a90614d03565b6105e28161169c565b604080516000808252602082019092526105fe918391906116c6565b50565b600054610100900460ff16158080156106215750600054600160ff909116105b8061063b5750303b15801561063b575060005460ff166001145b61069e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161050a565b6000805460ff1916600117905580156106c1576000805461ff0019166101001790555b61019380546001600160a01b038086166001600160a01b0319928316179092556101948054928516929091169190911790556106fb611840565b610703611840565b61070b611869565b610713611898565b61071e6000336115af565b6107487f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e3336115af565b8015610425576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156107db5760405162461bcd60e51b815260040161050a90614cb7565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316610824600080516020615018833981519152546001600160a01b031690565b6001600160a01b03161461084a5760405162461bcd60e51b815260040161050a90614d03565b6108538261169c565b61051d828260016116c6565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146108ff5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161050a565b506000805160206150188339815191525b90565b6000808260800151516001600160401b0381111561094157634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561096a578160200160208202803683370190505b50905060005b81518110156109e9578360800151818151811061099d57634e487b7160e01b600052603260045260246000fd5b6020026020010151805190602001208282815181106109cc57634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806109e181614edb565b915050610970565b5060405168082e0e0e4deecc2d8560bb1b60208201526e1d5a5b9d0c8d4d88195e1c1a5c994b608a1b6029820152711d5a5b9d0c8d4d88199959505b5bdd5b9d0b60721b6038820152701859191c995cdcc8199959551bdad95b8b607a1b604a8201526e1859191c995cdcc8199a5b1b195c8b608a1b605b8201526b62797465735b5d207369677360a01b606a820152602960f81b607682015260009060770160408051601f1981840301815290829052610aa6916020016149b8565b60405160208183030381529060405280519060200120846000015185602001518660400151876060015186604051602001610ae19190614982565b60408051601f1981840301815282825280516020918201209083019790975281019490945260608401929092526001600160a01b0390811660808401521660a082015260c081019190915260e001604051602081830303815290604052805190602001209050610b5081611908565b949350505050565b7fa8a7bc421f721cb936ea99efdad79237e6ee0b871a2a08cf648691f9584cdc77610b82816115a5565b6040518281527ff4ffe908c22fd1a4d04ba8ccb3a51ee6bd407993518f8f3e96aa8c7755d6e5cf9060200160405180910390a15050565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600082815260976020526040902060010154610bff816115a5565b6104258383611635565b6000808260200151516001600160401b03811115610c3757634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610c60578160200160208202803683370190505b50905060005b8151811015610ce057610ca384602001518281518110610c9657634e487b7160e01b600052603260045260246000fd5b6020026020010151611956565b828281518110610cc357634e487b7160e01b600052603260045260246000fd5b602090810291909101015280610cd881614edb565b915050610c66565b5060008360400151516001600160401b03811115610d0e57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610d37578160200160208202803683370190505b50905060005b8151811015610daa57610d6d85604001518281518110610c9657634e487b7160e01b600052603260045260246000fd5b828281518110610d8d57634e487b7160e01b600052603260045260246000fd5b602090810291909101015280610da281614edb565b915050610d3d565b506040516509ee4c8cae4560d31b60208201526f1859191c995cdcc81bd999995c995c8b60821b60268201527513d999995c925d195b56d7481bd999995c9a5b99dccb60521b60368201527f4f666665724974656d5b5d20636f6e73696465726174696f6e732c0000000000604c8201526f1d5a5b9d0e081bdc99195c951e5c194b60821b60678201526f1d5a5b9d0c8d4d881cdd185c9d105d0b60821b60778201526d1d5a5b9d0c8d4d88195b99105d0b60921b60878201526b1d5a5b9d0c8d4d881cd85b1d60a21b6095820152602960f81b60a1820152610b509060a201604051602081830303815290604052604051602001610ea890614a03565b60408051601f1981840301815290829052610ec692916020016149d4565b60405160208183030381529060405280519060200120856000015184604051602001610ef29190614982565b6040516020818303038152906040528051906020012084604051602001610f199190614982565b60405160208183030381529060405280519060200120886060015189608001518a60a001518b60c00151604051602001610f5a989796959493929190614bdd565b60405160208183030381529060405280519060200120611908565b6000610f7f6119c8565b905090565b60026001541415610fd75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161050a565b6002600155565b8151421061101f5760405162461bcd60e51b815260206004820152600e60248201526d1dda5b991bddc8195e1c1a5c995960921b604482015260640161050a565b600061102a83610913565b905060006110388284611a45565b90506110647fce80e833f1c3f0c050749e11fed407dc3dacd109611ea11097e9f5eb6abd9aad82610bb9565b61109d5760405162461bcd60e51b815260206004820152600a6024820152693737ba1039b4b3b732b960b11b604482015260640161050a565b50505050565b8151806110e35760405162461bcd60e51b815260206004820152600e60248201526d0d2dcecc2d8d2c840d8cadccee8d60931b604482015260640161050a565b816080015151811461112d5760405162461bcd60e51b81526020600482015260136024820152726e6f7420636f7272656374206c656e6774687360681b604482015260640161050a565b6000805b828110156111db57600085828151811061115b57634e487b7160e01b600052603260045260246000fd5b602002602001015160600151600381111561118657634e487b7160e01b600052602160045260246000fd5b14156111c9576111bc8582815181106111af57634e487b7160e01b600052603260045260246000fd5b6020026020010151611a69565b6111c69083614de5565b91505b806111d381614edb565b915050611131565b5060208301516111eb9082614de5565b34101561122d5760405162461bcd60e51b815260206004820152601060248201526f6e6f7420656e6f7567682076616c756560801b604482015260640161050a565b61123a8360200151611d67565b60005b828110156114115760006112a386838151811061126a57634e487b7160e01b600052603260045260246000fd5b60200260200101518660800151848151811061129657634e487b7160e01b600052603260045260246000fd5b6020026020010151611dce565b905060006112dc8784815181106112ca57634e487b7160e01b600052603260045260246000fd5b60200260200101518760600151611ede565b9050600061131788858151811061130357634e487b7160e01b600052603260045260246000fd5b60200260200101516113123390565b612da4565b905061134988858151811061133c57634e487b7160e01b600052603260045260246000fd5b6020026020010151613221565b611398576060870151604080516001600160a01b0390921682526020820183905284917f091df57229697c69000d4036c8c123d47d4b61cbb946bdbeaa454f31a560a044910160405180910390a25b61019354604051633153ff2d60e01b81526001600160a01b0390911690633153ff2d906113c9908590600401614b45565b600060405180830381600087803b1580156113e357600080fd5b505af11580156113f7573d6000803e3d6000fd5b50505050505050808061140990614edb565b91505061123d565b5050505050565b60018055565b61142781613221565b156114655760405162461bcd60e51b815260206004820152600e60248201526d18d85b98d95b081a5b9d985b1a5960921b604482015260640161050a565b600061147082610c09565b6000818152610195602052604090205490915060ff16156114a757604051635056f0c960e01b81526004810182905260240161050a565b8160a0015142106114ea5760405162461bcd60e51b815260206004820152600d60248201526c1bdc99195c88195e1c1a5c9959609a1b604482015260640161050a565b81516001600160a01b031633148061152757506115277f5620a1113a72b02a617976b3f6b15600dd7a8b3a916a9ca01e23119d989a054333610bb9565b6115605760405162461bcd60e51b815260206004820152600a6024820152693737ba1039b2b63632b960b11b604482015260640161050a565b60008181526101956020526040808220805460ff191660011790555182917f5152abf959f6564662358c2e52b702259b78bac5ee7842a0f01937e670efcc7d91a25050565b6105fe81336132a9565b6115b98282610bb9565b61051d5760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556115f13390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61163f8282610bb9565b1561051d5760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e361051d816115a5565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156116f95761042583613302565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561173257600080fd5b505afa925050508015611762575060408051601f3d908101601f1916820190925261175f9181019061486a565b60015b6117c55760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161050a565b60008051602061501883398151915281146118345760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161050a565b5061042583838361339e565b600054610100900460ff166118675760405162461bcd60e51b815260040161050a90614d4f565b565b600054610100900460ff166118905760405162461bcd60e51b815260040161050a90614d4f565b6118676133c3565b600054610100900460ff166118bf5760405162461bcd60e51b815260040161050a90614d4f565b6118676040518060400160405280600c81526020016b04542205472616465536869760a41b815250604051806040016040528060038152602001620312e360ec1b8152506133ea565b60006103fa6119156119c8565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b600060405160200161196790614a03565b60405160208183030381529060405280519060200120826000015183602001518460400151856060015186608001516040516020016119ab96959493929190614c47565b604051602081830303815290604052805190602001209050919050565b6000610f7f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6119f861012d5490565b61012e546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b6000806000611a54858561341b565b91509150611a6181613461565b509392505050565b60008082606001516003811115611a9057634e487b7160e01b600052602160045260246000fd5b1415611ce157611a9f82613221565b15611ba35761019354602083015180516001600160a01b0390921691631fa8bc149190600090611adf57634e487b7160e01b600052603260045260246000fd5b6020026020010151604001516040518263ffffffff1660e01b8152600401611b0991815260200190565b60206040518083038186803b158015611b2157600080fd5b505afa925050508015611b51575060408051601f3d908101601f19168201909252611b4e9181019061486a565b60015b6103fa57611b5d614f62565b806308c379a01415611b975750611b72614f79565b80611b7d5750611b99565b8060405162461bcd60e51b815260040161050a9190614ca4565b505b3d6000803e3d6000fd5b816040015151600114158015611be9575060008260400151600081518110611bdb57634e487b7160e01b600052603260045260246000fd5b602002602001015160800151115b15611c0757604051636bdba9d160e11b815260040160405180910390fd5b60008260400151600081518110611c2e57634e487b7160e01b600052603260045260246000fd5b6020026020010151600001516007811115611c5957634e487b7160e01b600052602160045260246000fd5b14611ca9578160400151600081518110611c8357634e487b7160e01b600052603260045260246000fd5b6020026020010151600001516040516355b020d560e11b815260040161050a9190614c88565b8160400151600081518110611cce57634e487b7160e01b600052603260045260246000fd5b6020026020010151608001519050919050565b600182606001516003811115611d0757634e487b7160e01b600052602160045260246000fd5b1480611d365750600282606001516003811115611d3457634e487b7160e01b600052602160045260246000fd5b145b15611d4357506000919050565b81606001516040516387d9aef360e01b815260040161050a9190614c96565b919050565b80156105fe576000611d7c82600160026135e7565b90507ff4ffe908c22fd1a4d04ba8ccb3a51ee6bd407993518f8f3e96aa8c7755d6e5cf81604051611daf91815260200190565b60405180910390a16101935461051d906001600160a01b03168361373e565b6000611dd983613221565b611ed6576000611de884610c09565b6000818152610195602052604090205490915060ff1615611e1f57604051635056f0c960e01b81526004810182905260240161050a565b600081815261019560205260409020805460ff1916600117905560a08401514210611e7c5760405162461bcd60e51b815260206004820152600d60248201526c1bdc99195c88195e1c1a5c9959609a1b604482015260640161050a565b8351611e92906001600160a01b03168285613857565b611ecf5760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21039b4b3b732b960911b604482015260640161050a565b90506103fa565b5060006103fa565b606080600084606001516003811115611f0757634e487b7160e01b600052602160045260246000fd5b141561201657611f1684613221565b612011578360200151516001600160401b03811115611f4557634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611f7e57816020015b611f6b6142bb565b815260200190600190039081611f635790505b50905060005b84602001515181101561200f57600085602001518281518110611fb757634e487b7160e01b600052603260045260246000fd5b60200260200101519050611fd0818760000151876139a7565b838381518110611ff057634e487b7160e01b600052603260045260246000fd5b602002602001018190525050808061200790614edb565b915050611f84565b505b612d9d565b60018460600151600381111561203c57634e487b7160e01b600052602160045260246000fd5b14156121f257600084604001515185602001515161205a9190614de5565b9050806001600160401b0381111561208257634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156120bb57816020015b6120a86142bb565b8152602001906001900390816120a05790505b50915060005b85602001515181101561214c576000866020015182815181106120f457634e487b7160e01b600052603260045260246000fd5b6020026020010151905061210d818860000151886139a7565b84838151811061212d57634e487b7160e01b600052603260045260246000fd5b602002602001018190525050808061214490614edb565b9150506120c1565b5060005b8560400151518110156121eb5760008660400151828151811061218357634e487b7160e01b600052603260045260246000fd5b6020026020010151905061219c818789600001516139a7565b84886020015151846121ae9190614de5565b815181106121cc57634e487b7160e01b600052603260045260246000fd5b60200260200101819052505080806121e390614edb565b915050612150565b5050612d9d565b60028460600151600381111561221857634e487b7160e01b600052602160045260246000fd5b14156127825783604001515160011461226c5760405162461bcd60e51b8152602060048201526016602482015275696e76616c696420636f6e73696465726174696f6e7360501b604482015260640161050a565b6003846040015160008151811061229357634e487b7160e01b600052603260045260246000fd5b60200260200101516000015160078111156122be57634e487b7160e01b600052602160045260246000fd5b146123045760405162461bcd60e51b8152602060048201526016602482015275696e76616c696420636f6e73696465726174696f6e7360501b604482015260640161050a565b602084015151600090815b818110156124675761019354602088015180516000926001600160a01b031691638ad6ff1e918590811061235357634e487b7160e01b600052603260045260246000fd5b6020026020010151602001518a60200151858151811061238357634e487b7160e01b600052603260045260246000fd5b6020026020010151604001518b60200151518c604001516000815181106123ba57634e487b7160e01b600052603260045260246000fd5b6020026020010151608001516123d09190614dfd565b6040518463ffffffff1660e01b81526004016123ee93929190614b24565b604080518083038186803b15801561240557600080fd5b505afa158015612419573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061243d9190614750565b9150508015612454578361245081614edb565b9450505b508061245f81614edb565b91505061230f565b5081612474826001614de5565b61247e9190614de5565b6001600160401b038111156124a357634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156124dc57816020015b6124c96142bb565b8152602001906001900390816124c15790505b509250600080876040015160008151811061250757634e487b7160e01b600052603260045260246000fd5b6020026020010151905060008160800151905060005b848110156127385760008a60200151828151811061254b57634e487b7160e01b600052603260045260246000fd5b60200260200101519050612564818c600001518c6139a7565b88868151811061258457634e487b7160e01b600052603260045260246000fd5b602002602001018190525060008061019360009054906101000a90046001600160a01b03166001600160a01b0316638ad6ff1e846020015185604001518b8a608001516125d19190614dfd565b6040518463ffffffff1660e01b81526004016125ef93929190614b24565b604080518083038186803b15801561260657600080fd5b505afa15801561261a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061263e9190614750565b909250905080156127155761265986602001518d8484613c46565b8a612665896001614de5565b8151811061268357634e487b7160e01b600052603260045260246000fd5b6020026020010181905250868061269990614edb565b97506126a790508186614e30565b6020808501516040808701518a84015182516001600160a01b0394851681529485019190915282871691840191909152606083018590521660808201529095507f984c9c2a7606f832d0b6917b420cdc05d944830576daec3c9d8c7e7a95e641b49060a00160405180910390a15b8661271f81614edb565b975050505050808061273090614edb565b91505061251d565b5061274d8260200151898b6000015184613c46565b86848151811061276d57634e487b7160e01b600052603260045260246000fd5b60200260200101819052505050505050612d9d565b6003846060015160038111156127a857634e487b7160e01b600052602160045260246000fd5b1415612d7e578360200151516001146127f75760405162461bcd60e51b8152602060048201526011602482015270696e76616c6964206f66666572696e677360781b604482015260640161050a565b6000846020015160008151811061281e57634e487b7160e01b600052603260045260246000fd5b6020908102919091010151608081015190915060038251600781111561285457634e487b7160e01b600052602160045260246000fd5b1480612880575060078251600781111561287e57634e487b7160e01b600052602160045260246000fd5b145b6128c05760405162461bcd60e51b8152602060048201526011602482015270696e76616c6964206f66666572696e677360781b604482015260640161050a565b604086015151600090815b818110156129ee576101935460408a015180516000926001600160a01b031691638ad6ff1e918590811061290f57634e487b7160e01b600052603260045260246000fd5b6020026020010151602001518c60400151858151811061293f57634e487b7160e01b600052603260045260246000fd5b60200260200101516040015186896129579190614dfd565b6040518463ffffffff1660e01b815260040161297593929190614b24565b604080518083038186803b15801561298c57600080fd5b505afa1580156129a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129c49190614750565b91505080156129db57836129d781614edb565b9450505b50806129e681614edb565b9150506128cb565b50816129fb826001614de5565b612a059190614de5565b6001600160401b03811115612a2a57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015612a6357816020015b612a506142bb565b815260200190600190039081612a485790505b5094506000805b82811015612d0f57612aac8a604001518281518110612a9957634e487b7160e01b600052603260045260246000fd5b60200260200101518a8c600001516139a7565b878381518110612acc57634e487b7160e01b600052603260045260246000fd5b602002602001018190525060008061019360009054906101000a90046001600160a01b03166001600160a01b0316638ad6ff1e8d604001518581518110612b2357634e487b7160e01b600052603260045260246000fd5b6020026020010151602001518e604001518681518110612b5357634e487b7160e01b600052603260045260246000fd5b602002602001015160400151888c60800151612b6f9190614dfd565b6040518463ffffffff1660e01b8152600401612b8d93929190614b24565b604080518083038186803b158015612ba457600080fd5b505afa158015612bb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bdc9190614750565b90925090508015612ced57600788516007811115612c0a57634e487b7160e01b600052602160045260246000fd5b14612c2857612c2388602001518d600001518484613c46565b612c35565b8b51612c35908383613c85565b89612c41866001614de5565b81518110612c5f57634e487b7160e01b600052603260045260246000fd5b60200260200101819052508380612c7590614edb565b9450612c8390508188614e30565b6020808a01516040808c015181516001600160a01b0393841680825294810191909152918616908201526060810184905260808101919091529097507f984c9c2a7606f832d0b6917b420cdc05d944830576daec3c9d8c7e7a95e641b49060a00160405180910390a15b83612cf781614edb565b94505050508080612d0790614edb565b915050612a6a565b50600785516007811115612d3357634e487b7160e01b600052602160045260246000fd5b14612d5157612d4c85602001518a600001518a87613c46565b612d5e565b8851612d5e908986613c85565b86828151811061276d57634e487b7160e01b600052603260045260246000fd5b83606001516040516387d9aef360e01b815260040161050a9190614c96565b9392505050565b6000600183606001516003811115612dcc57634e487b7160e01b600052602160045260246000fd5b1480612dfb5750600283606001516003811115612df957634e487b7160e01b600052602160045260246000fd5b145b80612e295750600383606001516003811115612e2757634e487b7160e01b600052602160045260246000fd5b145b15612e36575060006103fa565b600083606001516003811115612e5c57634e487b7160e01b600052602160045260246000fd5b1415613202576000612e6d84611a69565b9050612e7884613221565b15612f3157610193546001600160a01b031663698f5cc882612e9987613dc9565b6040516001600160e01b031960e085901b16815260048101919091526001600160a01b03871660248201526044016000604051808303818588803b158015612ee057600080fd5b505af193505050508015612ef2575060015b612f2c5760405162461bcd60e51b815260206004820152600b60248201526a6661696c206c656761637960a81b604482015260640161050a565b6131fc565b602084015151819060005b818110156130f757600087602001518281518110612f6a57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151610193549181015160408201519193506000926001600160a01b03169163a68928e29190612fa4888b614dfd565b6040518463ffffffff1660e01b8152600401612fc293929190614b24565b60206040518083038186803b158015612fda57600080fd5b505afa158015612fee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613012919061486a565b905061301e8186614e30565b945061302a8188614de5565b965080156130e25761019354602083015160408401516001600160a01b03909216916384cbfe0891849161305e898c614dfd565b6040518563ffffffff1660e01b815260040161307c93929190614b24565b6000604051808303818588803b15801561309557600080fd5b505af1935050505080156130a7575060015b6130e25760405162461bcd60e51b815260206004820152600c60248201526b1c9bde585b1d1e4819985a5b60a21b604482015260640161050a565b505080806130ef90614edb565b915050612f3c565b5061019354865160405163018c032f60e21b81526001600160a01b0391821660048201529116906306300cbc9060240160206040518083038186803b15801561313f57600080fd5b505afa158015613153573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131779190614832565b156131e457610193548651604051634065da6360e01b81526001600160a01b039182166004820152911690634065da639084906024016000604051808303818588803b1580156131c657600080fd5b505af11580156131da573d6000803e3d6000fd5b50505050506131f9565b85516131f9906001600160a01b03168361373e565b50505b506103fa565b82606001516040516387d9aef360e01b815260040161050a9190614c96565b6000808260600151600381111561324857634e487b7160e01b600052602160045260246000fd5b1480156103fa57506006826020015160008151811061327757634e487b7160e01b600052603260045260246000fd5b60200260200101516000015160078111156132a257634e487b7160e01b600052602160045260246000fd5b1492915050565b6132b38282610bb9565b61051d576132c081613e45565b6132cb836020613e57565b6040516020016132dc929190614aaf565b60408051601f198184030181529082905262461bcd60e51b825261050a91600401614ca4565b6001600160a01b0381163b61336f5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161050a565b60008051602061501883398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6133a783614038565b6000825111806133b45750805b156104255761109d8383614078565b600054610100900460ff166114185760405162461bcd60e51b815260040161050a90614d4f565b600054610100900460ff166134115760405162461bcd60e51b815260040161050a90614d4f565b61051d828261416c565b6000808251604114156134525760208301516040840151606085015160001a613446878285856141af565b9450945050505061345a565b506000905060025b9250929050565b600081600481111561348357634e487b7160e01b600052602160045260246000fd5b141561348c5750565b60018160048111156134ae57634e487b7160e01b600052602160045260246000fd5b14156134fc5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161050a565b600281600481111561351e57634e487b7160e01b600052602160045260246000fd5b141561356c5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161050a565b600381600481111561358e57634e487b7160e01b600052602160045260246000fd5b14156105fe5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161050a565b600080821161362b5760405162461bcd60e51b815260206004820152601060248201526f4469766973696f6e206279207a65726f60801b604482015260640161050a565b818311156136705760405162461bcd60e51b815260206004820152601260248201527124b73b30b634b21036bab63a34b83634b2b960711b604482015260640161050a565b8361367d57506000612d9d565b60006136898486614e11565b9050836136968683614dfd565b14156136ae576136a68382614dfd565b915050612d9d565b60006136ba8487614dfd565b905060006136c88588614ef6565b905060006136d68688614dfd565b905060006136e48789614ef6565b90506137316136fd886136f78685614273565b9061427f565b61372b61370a8686614273565b61372b6137178987614273565b61372b8d6137258c8b614273565b90614273565b9061428b565b9998505050505050505050565b8047101561378e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161050a565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146137db576040519150601f19603f3d011682016040523d82523d6000602084013e6137e0565b606091505b50509050806104255760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161050a565b6000806000613866858561341b565b9092509050600081600481111561388d57634e487b7160e01b600052602160045260246000fd5b1480156138ab5750856001600160a01b0316826001600160a01b0316145b156138bb57600192505050612d9d565b600080876001600160a01b0316631626ba7e60e01b88886040516024016138e3929190614c2e565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161392191906149b8565b600060405180830381855afa9150503d806000811461395c576040519150601f19603f3d011682016040523d82523d6000602084013e613961565b606091505b5091509150818015613974575080516020145b801561399b57508051630b135d3f60e11b90613999908301602090810190840161486a565b145b98975050505050505050565b6139af6142bb565b60006001855160078111156139d457634e487b7160e01b600052602160045260246000fd5b14156139e257506002613bb2565b600285516007811115613a0557634e487b7160e01b600052602160045260246000fd5b1415613a1357506003613bb2565b600385516007811115613a3657634e487b7160e01b600052602160045260246000fd5b1415613a4457506001613bb2565b600785516007811115613a6757634e487b7160e01b600052602160045260246000fd5b1415613b9657506101935460405163018c032f60e21b81526001600160a01b038481166004808401919091529216906306300cbc9060240160206040518083038186803b158015613ab757600080fd5b505afa158015613acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613aef9190614832565b15613afc57600160408601525b61019360009054906101000a90046001600160a01b03166001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b158015613b4b57600080fd5b505afa158015613b5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b8391906146af565b6001600160a01b03166020860152613bb2565b84516040516355b020d560e11b815261050a9190600401614c88565b613bba6142bb565b80826004811115613bdb57634e487b7160e01b600052602160045260246000fd5b90816004811115613bfc57634e487b7160e01b600052602160045260246000fd5b9052506020868101516001600160a01b039081169183019190915294851660408083019190915293909416606085015250508201516080808301919091529091015160a082015290565b613c4e6142bb565b613c566142bb565b600181526001600160a01b0395861660208201529385166040850152509216606082015260a081019190915290565b613c8d6142bb565b613c956142bb565b600480825261019354604080516316f0115b60e01b815290516001600160a01b03909216926316f0115b928282019260209290829003018186803b158015613cdc57600080fd5b505afa158015613cf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d1491906146af565b6001600160a01b0390811660208301528581166040808401919091528582166060840181905260a0840186905261019354915163018c032f60e21b815260048101919091529116906306300cbc9060240160206040518083038186803b158015613d7d57600080fd5b505afa158015613d91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613db59190614832565b15610b505760016080820152949350505050565b6000613dd482613221565b613e0d5760405162461bcd60e51b815260206004820152600a6024820152696e6f74206c656761637960b01b604482015260640161050a565b8160200151600081518110613e3257634e487b7160e01b600052603260045260246000fd5b6020026020010151604001519050919050565b60606103fa6001600160a01b03831660145b60606000613e66836002614e11565b613e71906002614de5565b6001600160401b03811115613e9657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613ec0576020820181803683370190505b509050600360fc1b81600081518110613ee957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613f2657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000613f4a846002614e11565b613f55906001614de5565b90505b6001811115613fe9576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613f9757634e487b7160e01b600052603260045260246000fd5b1a60f81b828281518110613fbb57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c93613fe281614e73565b9050613f58565b508315612d9d5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161050a565b61404181613302565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6140e05760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161050a565b600080846001600160a01b0316846040516140fb91906149b8565b600060405180830381855af49150503d8060008114614136576040519150601f19603f3d011682016040523d82523d6000602084013e61413b565b606091505b5091509150614163828260405180606001604052806027815260200161503860279139614297565b95945050505050565b600054610100900460ff166141935760405162461bcd60e51b815260040161050a90614d4f565b81516020928301208151919092012061012d9190915561012e55565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156141e6575060009050600361426a565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561423a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166142635760006001925092505061426a565b9150600090505b94509492505050565b6000612d9d8284614e11565b6000612d9d8284614dfd565b6000612d9d8284614de5565b606083156142a6575081612d9d565b612d9d8383815115611b7d5781518083602001fd5b6040805160c08101909152806000815260006020820181905260408201819052606082018190526080820181905260a09091015290565b8035611d6281615002565b600082601f83011261430d578081fd5b8135602061431a82614dc2565b604080516143288382614eaf565b848152838101925086840160a0808702890186018a1015614347578788fd5b875b878110156143b95781838c03121561435f578889fd5b845161436a81614e8a565b833560088110614378578a8bfd5b81528388013561438781615002565b818901528386013586820152606080850135908201526080808501359082015286529486019491810191600101614349565b50919998505050505050505050565b600082601f8301126143d8578081fd5b813560206143e582614dc2565b6040516143f28282614eaf565b8381528281019150858301600585901b87018401881015614411578586fd5b855b858110156144515781356001600160401b03811115614430578788fd5b61443e8a87838c01016145e6565b8552509284019290840190600101614413565b5090979650505050505050565b600082601f83011261446e578081fd5b81356001600160401b0381111561448757614487614f4c565b60405161449e601f8301601f191660200182614eaf565b8181528460208386010111156144b2578283fd5b816020850160208301379081016020019190915292915050565b803560048110611d6257600080fd5b600060a082840312156144ec578081fd5b6040516144f881614e8a565b8091508235815260208084013581830152604084013561451781615002565b6040830152606084013561452a81615002565b606083015260808401356001600160401b038082111561454957600080fd5b818601915086601f83011261455d57600080fd5b813561456881614dc2565b6040516145758282614eaf565b8281528581019150848601600584901b860187018b101561459557600080fd5b6000805b858110156145d0578235878111156145af578283fd5b6145bd8e8b838c010161445e565b8652509388019391880191600101614599565b5050508060808801525050505050505092915050565b600060e082840312156145f7578081fd5b6145ff614d9a565b905061460a826142f2565b815260208201356001600160401b038082111561462657600080fd5b614632858386016142fd565b6020840152604084013591508082111561464b57600080fd5b50614658848285016142fd565b60408301525061466a606083016144cc565b60608201526080820135608082015260a082013560a082015260c082013560c082015292915050565b6000602082840312156146a4578081fd5b8135612d9d81615002565b6000602082840312156146c0578081fd5b8151612d9d81615002565b600080604083850312156146dd578081fd5b82356146e881615002565b915060208301356146f881615002565b809150509250929050565b60008060408385031215614715578182fd5b823561472081615002565b915060208301356001600160401b0381111561473a578182fd5b6147468582860161445e565b9150509250929050565b60008060408385031215614762578182fd5b825161476d81615002565b6020939093015192949293505050565b60006020828403121561478e578081fd5b81356001600160401b038111156147a3578182fd5b610b50848285016143c8565b6000806000606084860312156147c3578081fd5b83356001600160401b03808211156147d9578283fd5b6147e5878388016143c8565b945060208601359150808211156147fa578283fd5b614806878388016144db565b9350604086013591508082111561481b578283fd5b506148288682870161445e565b9150509250925092565b600060208284031215614843578081fd5b81518015158114612d9d578182fd5b600060208284031215614863578081fd5b5035919050565b60006020828403121561487b578081fd5b5051919050565b60008060408385031215614894578182fd5b8235915060208301356146f881615002565b6000602082840312156148b7578081fd5b81356001600160e01b031981168114612d9d578182fd5b6000602082840312156148df578081fd5b81356001600160401b038111156148f4578182fd5b610b50848285016144db565b600060208284031215614911578081fd5b81356001600160401b03811115614926578182fd5b610b50848285016145e6565b6000815180845261494a816020860160208601614e47565b601f01601f19169290920160200192915050565b6008811061496e5761496e614f36565b9052565b6004811061496e5761496e614f36565b815160009082906020808601845b838110156149ac57815185529382019390820190600101614990565b50929695505050505050565b600082516149ca818460208701614e47565b9190910192915050565b600083516149e6818460208801614e47565b8351908301906149fa818360208801614e47565b01949350505050565b6909ecccccae492e8cada560b31b81526e1d5a5b9d0e081a5d195b551e5c194b608a1b600a8201526d1859191c995cdcc81d1bdad95b8b60921b60198201527f75696e74323536206964656e7469666965724f7243726974657269612c0000006027820152731d5a5b9d0c8d4d881cdd185c9d105b5bdd5b9d0b60621b6044820152701d5a5b9d0c8d4d88195b99105b5bdd5b9d607a1b6058820152602960f81b6069820152606a0190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614ae7816017850160208801614e47565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614b18816028840160208801614e47565b01602801949350505050565b6001600160a01b039390931683526020830191909152604082015260600190565b602080825282518282018190526000919060409081850190868401855b82811015614bd0578151805160058110614b7e57614b7e614f36565b8552808701516001600160a01b039081168887015286820151811687870152606080830151909116908601526080808201519086015260a0908101519085015260c09093019290850190600101614b62565b5091979650505050505050565b8881526001600160a01b038816602082015260408101879052606081018690526101008101614c0f6080830187614972565b8460a08301528360c08301528260e08301529998505050505050505050565b828152604060208201526000610b506040830184614932565b86815260c08101614c5b602083018861495e565b6001600160a01b039590951660408201526060810193909352608083019190915260a09091015292915050565b602081016103fa828461495e565b602081016103fa8284614972565b602081526000612d9d6020830184614932565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60405160e081016001600160401b0381118282101715614dbc57614dbc614f4c565b60405290565b60006001600160401b03821115614ddb57614ddb614f4c565b5060051b60200190565b60008219821115614df857614df8614f0a565b500190565b600082614e0c57614e0c614f20565b500490565b6000816000190483118215151615614e2b57614e2b614f0a565b500290565b600082821015614e4257614e42614f0a565b500390565b60005b83811015614e62578181015183820152602001614e4a565b8381111561109d5750506000910152565b600081614e8257614e82614f0a565b506000190190565b60a081018181106001600160401b0382111715614ea957614ea9614f4c565b60405250565b601f8201601f191681016001600160401b0381118282101715614ed457614ed4614f4c565b6040525050565b6000600019821415614eef57614eef614f0a565b5060010190565b600082614f0557614f05614f20565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600060033d111561091057600481823e5160e01c90565b600060443d1015614f875790565b6040516003193d81016004833e81513d6001600160401b038160248401118184111715614fb657505050505090565b8285019150815181811115614fce5750505050505090565b843d8701016020828501011115614fe85750505050505090565b614ff760208286010187614eaf565b509095945050505050565b6001600160a01b03811681146105fe57600080fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220aea36f72a7cf1b77796eea2982a526a53802821cec081d733796a37f32da838964736f6c63430008040033
Deployed Bytecode
0x60806040526004361061011f5760003560e01c806359eaef0b116100a0578063a9fcfb3311610064578063a9fcfb3314610322578063d470316b14610353578063d547741f14610374578063e7d6e22914610394578063f698da25146103b457600080fd5b806359eaef0b146102745780638a91c5581461029457806391d14854146102b457806395a03360146102d4578063a217fddf1461030d57600080fd5b806336568abe116100e757806336568abe146101ec5780633659cfe61461020c578063485cc9551461022c5780634f1ef2861461024c57806352d1902d1461025f57600080fd5b806301ffc9a7146101245780630338ed9d14610159578063212c18951461016e578063248a9ca31461018e5780632f2ff15d146101cc575b600080fd5b34801561013057600080fd5b5061014461013f3660046148a6565b6103c9565b60405190151581526020015b60405180910390f35b61016c6101673660046147af565b610400565b005b34801561017a57600080fd5b5061016c61018936600461477d565b61042a565b34801561019a57600080fd5b506101be6101a9366004614852565b60009081526097602052604090206001015490565b604051908152602001610150565b3480156101d857600080fd5b5061016c6101e7366004614882565b610479565b3480156101f857600080fd5b5061016c610207366004614882565b61049e565b34801561021857600080fd5b5061016c610227366004614693565b610521565b34801561023857600080fd5b5061016c6102473660046146cb565b610601565b61016c61025a366004614703565b610792565b34801561026b57600080fd5b506101be61085f565b34801561028057600080fd5b506101be61028f3660046148ce565b610913565b3480156102a057600080fd5b5061016c6102af366004614852565b610b58565b3480156102c057600080fd5b506101446102cf366004614882565b610bb9565b3480156102e057600080fd5b50610193546102f5906001600160a01b031681565b6040516001600160a01b039091168152602001610150565b34801561031957600080fd5b506101be600081565b34801561032e57600080fd5b5061014461033d366004614852565b6101956020526000908152604090205460ff1681565b34801561035f57600080fd5b50610194546102f5906001600160a01b031681565b34801561038057600080fd5b5061016c61038f366004614882565b610be4565b3480156103a057600080fd5b506101be6103af366004614900565b610c09565b3480156103c057600080fd5b506101be610f75565b60006001600160e01b03198216637965db0b60e01b14806103fa57506301ffc9a760e01b6001600160e01b03198316145b92915050565b610408610f84565b6104128282610fde565b61041c83836110a3565b61042560018055565b505050565b805160005b818110156104255761046783828151811061045a57634e487b7160e01b600052603260045260246000fd5b602002602001015161141e565b8061047181614edb565b91505061042f565b600082815260976020526040902060010154610494816115a5565b61042583836115af565b6001600160a01b03811633146105135760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b60648201526084015b60405180910390fd5b61051d8282611635565b5050565b306001600160a01b037f000000000000000000000000a57f310c78f0ce3ba6bb1b58dd4062d9d0663d6e16141561056a5760405162461bcd60e51b815260040161050a90614cb7565b7f000000000000000000000000a57f310c78f0ce3ba6bb1b58dd4062d9d0663d6e6001600160a01b03166105b3600080516020615018833981519152546001600160a01b031690565b6001600160a01b0316146105d95760405162461bcd60e51b815260040161050a90614d03565b6105e28161169c565b604080516000808252602082019092526105fe918391906116c6565b50565b600054610100900460ff16158080156106215750600054600160ff909116105b8061063b5750303b15801561063b575060005460ff166001145b61069e5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161050a565b6000805460ff1916600117905580156106c1576000805461ff0019166101001790555b61019380546001600160a01b038086166001600160a01b0319928316179092556101948054928516929091169190911790556106fb611840565b610703611840565b61070b611869565b610713611898565b61071e6000336115af565b6107487f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e3336115af565b8015610425576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b306001600160a01b037f000000000000000000000000a57f310c78f0ce3ba6bb1b58dd4062d9d0663d6e1614156107db5760405162461bcd60e51b815260040161050a90614cb7565b7f000000000000000000000000a57f310c78f0ce3ba6bb1b58dd4062d9d0663d6e6001600160a01b0316610824600080516020615018833981519152546001600160a01b031690565b6001600160a01b03161461084a5760405162461bcd60e51b815260040161050a90614d03565b6108538261169c565b61051d828260016116c6565b6000306001600160a01b037f000000000000000000000000a57f310c78f0ce3ba6bb1b58dd4062d9d0663d6e16146108ff5760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c0000000000000000606482015260840161050a565b506000805160206150188339815191525b90565b6000808260800151516001600160401b0381111561094157634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561096a578160200160208202803683370190505b50905060005b81518110156109e9578360800151818151811061099d57634e487b7160e01b600052603260045260246000fd5b6020026020010151805190602001208282815181106109cc57634e487b7160e01b600052603260045260246000fd5b6020908102919091010152806109e181614edb565b915050610970565b5060405168082e0e0e4deecc2d8560bb1b60208201526e1d5a5b9d0c8d4d88195e1c1a5c994b608a1b6029820152711d5a5b9d0c8d4d88199959505b5bdd5b9d0b60721b6038820152701859191c995cdcc8199959551bdad95b8b607a1b604a8201526e1859191c995cdcc8199a5b1b195c8b608a1b605b8201526b62797465735b5d207369677360a01b606a820152602960f81b607682015260009060770160408051601f1981840301815290829052610aa6916020016149b8565b60405160208183030381529060405280519060200120846000015185602001518660400151876060015186604051602001610ae19190614982565b60408051601f1981840301815282825280516020918201209083019790975281019490945260608401929092526001600160a01b0390811660808401521660a082015260c081019190915260e001604051602081830303815290604052805190602001209050610b5081611908565b949350505050565b7fa8a7bc421f721cb936ea99efdad79237e6ee0b871a2a08cf648691f9584cdc77610b82816115a5565b6040518281527ff4ffe908c22fd1a4d04ba8ccb3a51ee6bd407993518f8f3e96aa8c7755d6e5cf9060200160405180910390a15050565b60009182526097602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600082815260976020526040902060010154610bff816115a5565b6104258383611635565b6000808260200151516001600160401b03811115610c3757634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610c60578160200160208202803683370190505b50905060005b8151811015610ce057610ca384602001518281518110610c9657634e487b7160e01b600052603260045260246000fd5b6020026020010151611956565b828281518110610cc357634e487b7160e01b600052603260045260246000fd5b602090810291909101015280610cd881614edb565b915050610c66565b5060008360400151516001600160401b03811115610d0e57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015610d37578160200160208202803683370190505b50905060005b8151811015610daa57610d6d85604001518281518110610c9657634e487b7160e01b600052603260045260246000fd5b828281518110610d8d57634e487b7160e01b600052603260045260246000fd5b602090810291909101015280610da281614edb565b915050610d3d565b506040516509ee4c8cae4560d31b60208201526f1859191c995cdcc81bd999995c995c8b60821b60268201527513d999995c925d195b56d7481bd999995c9a5b99dccb60521b60368201527f4f666665724974656d5b5d20636f6e73696465726174696f6e732c0000000000604c8201526f1d5a5b9d0e081bdc99195c951e5c194b60821b60678201526f1d5a5b9d0c8d4d881cdd185c9d105d0b60821b60778201526d1d5a5b9d0c8d4d88195b99105d0b60921b60878201526b1d5a5b9d0c8d4d881cd85b1d60a21b6095820152602960f81b60a1820152610b509060a201604051602081830303815290604052604051602001610ea890614a03565b60408051601f1981840301815290829052610ec692916020016149d4565b60405160208183030381529060405280519060200120856000015184604051602001610ef29190614982565b6040516020818303038152906040528051906020012084604051602001610f199190614982565b60405160208183030381529060405280519060200120886060015189608001518a60a001518b60c00151604051602001610f5a989796959493929190614bdd565b60405160208183030381529060405280519060200120611908565b6000610f7f6119c8565b905090565b60026001541415610fd75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161050a565b6002600155565b8151421061101f5760405162461bcd60e51b815260206004820152600e60248201526d1dda5b991bddc8195e1c1a5c995960921b604482015260640161050a565b600061102a83610913565b905060006110388284611a45565b90506110647fce80e833f1c3f0c050749e11fed407dc3dacd109611ea11097e9f5eb6abd9aad82610bb9565b61109d5760405162461bcd60e51b815260206004820152600a6024820152693737ba1039b4b3b732b960b11b604482015260640161050a565b50505050565b8151806110e35760405162461bcd60e51b815260206004820152600e60248201526d0d2dcecc2d8d2c840d8cadccee8d60931b604482015260640161050a565b816080015151811461112d5760405162461bcd60e51b81526020600482015260136024820152726e6f7420636f7272656374206c656e6774687360681b604482015260640161050a565b6000805b828110156111db57600085828151811061115b57634e487b7160e01b600052603260045260246000fd5b602002602001015160600151600381111561118657634e487b7160e01b600052602160045260246000fd5b14156111c9576111bc8582815181106111af57634e487b7160e01b600052603260045260246000fd5b6020026020010151611a69565b6111c69083614de5565b91505b806111d381614edb565b915050611131565b5060208301516111eb9082614de5565b34101561122d5760405162461bcd60e51b815260206004820152601060248201526f6e6f7420656e6f7567682076616c756560801b604482015260640161050a565b61123a8360200151611d67565b60005b828110156114115760006112a386838151811061126a57634e487b7160e01b600052603260045260246000fd5b60200260200101518660800151848151811061129657634e487b7160e01b600052603260045260246000fd5b6020026020010151611dce565b905060006112dc8784815181106112ca57634e487b7160e01b600052603260045260246000fd5b60200260200101518760600151611ede565b9050600061131788858151811061130357634e487b7160e01b600052603260045260246000fd5b60200260200101516113123390565b612da4565b905061134988858151811061133c57634e487b7160e01b600052603260045260246000fd5b6020026020010151613221565b611398576060870151604080516001600160a01b0390921682526020820183905284917f091df57229697c69000d4036c8c123d47d4b61cbb946bdbeaa454f31a560a044910160405180910390a25b61019354604051633153ff2d60e01b81526001600160a01b0390911690633153ff2d906113c9908590600401614b45565b600060405180830381600087803b1580156113e357600080fd5b505af11580156113f7573d6000803e3d6000fd5b50505050505050808061140990614edb565b91505061123d565b5050505050565b60018055565b61142781613221565b156114655760405162461bcd60e51b815260206004820152600e60248201526d18d85b98d95b081a5b9d985b1a5960921b604482015260640161050a565b600061147082610c09565b6000818152610195602052604090205490915060ff16156114a757604051635056f0c960e01b81526004810182905260240161050a565b8160a0015142106114ea5760405162461bcd60e51b815260206004820152600d60248201526c1bdc99195c88195e1c1a5c9959609a1b604482015260640161050a565b81516001600160a01b031633148061152757506115277f5620a1113a72b02a617976b3f6b15600dd7a8b3a916a9ca01e23119d989a054333610bb9565b6115605760405162461bcd60e51b815260206004820152600a6024820152693737ba1039b2b63632b960b11b604482015260640161050a565b60008181526101956020526040808220805460ff191660011790555182917f5152abf959f6564662358c2e52b702259b78bac5ee7842a0f01937e670efcc7d91a25050565b6105fe81336132a9565b6115b98282610bb9565b61051d5760008281526097602090815260408083206001600160a01b03851684529091529020805460ff191660011790556115f13390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b61163f8282610bb9565b1561051d5760008281526097602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b7f189ab7a9244df0848122154315af71fe140f3db0fe014031783b0946b8c9d2e361051d816115a5565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff16156116f95761042583613302565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b815260040160206040518083038186803b15801561173257600080fd5b505afa925050508015611762575060408051601f3d908101601f1916820190925261175f9181019061486a565b60015b6117c55760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b606482015260840161050a565b60008051602061501883398151915281146118345760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b606482015260840161050a565b5061042583838361339e565b600054610100900460ff166118675760405162461bcd60e51b815260040161050a90614d4f565b565b600054610100900460ff166118905760405162461bcd60e51b815260040161050a90614d4f565b6118676133c3565b600054610100900460ff166118bf5760405162461bcd60e51b815260040161050a90614d4f565b6118676040518060400160405280600c81526020016b04542205472616465536869760a41b815250604051806040016040528060038152602001620312e360ec1b8152506133ea565b60006103fa6119156119c8565b8360405161190160f01b6020820152602281018390526042810182905260009060620160405160208183030381529060405280519060200120905092915050565b600060405160200161196790614a03565b60405160208183030381529060405280519060200120826000015183602001518460400151856060015186608001516040516020016119ab96959493929190614c47565b604051602081830303815290604052805190602001209050919050565b6000610f7f7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f6119f861012d5490565b61012e546040805160208101859052908101839052606081018290524660808201523060a082015260009060c0016040516020818303038152906040528051906020012090509392505050565b6000806000611a54858561341b565b91509150611a6181613461565b509392505050565b60008082606001516003811115611a9057634e487b7160e01b600052602160045260246000fd5b1415611ce157611a9f82613221565b15611ba35761019354602083015180516001600160a01b0390921691631fa8bc149190600090611adf57634e487b7160e01b600052603260045260246000fd5b6020026020010151604001516040518263ffffffff1660e01b8152600401611b0991815260200190565b60206040518083038186803b158015611b2157600080fd5b505afa925050508015611b51575060408051601f3d908101601f19168201909252611b4e9181019061486a565b60015b6103fa57611b5d614f62565b806308c379a01415611b975750611b72614f79565b80611b7d5750611b99565b8060405162461bcd60e51b815260040161050a9190614ca4565b505b3d6000803e3d6000fd5b816040015151600114158015611be9575060008260400151600081518110611bdb57634e487b7160e01b600052603260045260246000fd5b602002602001015160800151115b15611c0757604051636bdba9d160e11b815260040160405180910390fd5b60008260400151600081518110611c2e57634e487b7160e01b600052603260045260246000fd5b6020026020010151600001516007811115611c5957634e487b7160e01b600052602160045260246000fd5b14611ca9578160400151600081518110611c8357634e487b7160e01b600052603260045260246000fd5b6020026020010151600001516040516355b020d560e11b815260040161050a9190614c88565b8160400151600081518110611cce57634e487b7160e01b600052603260045260246000fd5b6020026020010151608001519050919050565b600182606001516003811115611d0757634e487b7160e01b600052602160045260246000fd5b1480611d365750600282606001516003811115611d3457634e487b7160e01b600052602160045260246000fd5b145b15611d4357506000919050565b81606001516040516387d9aef360e01b815260040161050a9190614c96565b919050565b80156105fe576000611d7c82600160026135e7565b90507ff4ffe908c22fd1a4d04ba8ccb3a51ee6bd407993518f8f3e96aa8c7755d6e5cf81604051611daf91815260200190565b60405180910390a16101935461051d906001600160a01b03168361373e565b6000611dd983613221565b611ed6576000611de884610c09565b6000818152610195602052604090205490915060ff1615611e1f57604051635056f0c960e01b81526004810182905260240161050a565b600081815261019560205260409020805460ff1916600117905560a08401514210611e7c5760405162461bcd60e51b815260206004820152600d60248201526c1bdc99195c88195e1c1a5c9959609a1b604482015260640161050a565b8351611e92906001600160a01b03168285613857565b611ecf5760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b21039b4b3b732b960911b604482015260640161050a565b90506103fa565b5060006103fa565b606080600084606001516003811115611f0757634e487b7160e01b600052602160045260246000fd5b141561201657611f1684613221565b612011578360200151516001600160401b03811115611f4557634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015611f7e57816020015b611f6b6142bb565b815260200190600190039081611f635790505b50905060005b84602001515181101561200f57600085602001518281518110611fb757634e487b7160e01b600052603260045260246000fd5b60200260200101519050611fd0818760000151876139a7565b838381518110611ff057634e487b7160e01b600052603260045260246000fd5b602002602001018190525050808061200790614edb565b915050611f84565b505b612d9d565b60018460600151600381111561203c57634e487b7160e01b600052602160045260246000fd5b14156121f257600084604001515185602001515161205a9190614de5565b9050806001600160401b0381111561208257634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156120bb57816020015b6120a86142bb565b8152602001906001900390816120a05790505b50915060005b85602001515181101561214c576000866020015182815181106120f457634e487b7160e01b600052603260045260246000fd5b6020026020010151905061210d818860000151886139a7565b84838151811061212d57634e487b7160e01b600052603260045260246000fd5b602002602001018190525050808061214490614edb565b9150506120c1565b5060005b8560400151518110156121eb5760008660400151828151811061218357634e487b7160e01b600052603260045260246000fd5b6020026020010151905061219c818789600001516139a7565b84886020015151846121ae9190614de5565b815181106121cc57634e487b7160e01b600052603260045260246000fd5b60200260200101819052505080806121e390614edb565b915050612150565b5050612d9d565b60028460600151600381111561221857634e487b7160e01b600052602160045260246000fd5b14156127825783604001515160011461226c5760405162461bcd60e51b8152602060048201526016602482015275696e76616c696420636f6e73696465726174696f6e7360501b604482015260640161050a565b6003846040015160008151811061229357634e487b7160e01b600052603260045260246000fd5b60200260200101516000015160078111156122be57634e487b7160e01b600052602160045260246000fd5b146123045760405162461bcd60e51b8152602060048201526016602482015275696e76616c696420636f6e73696465726174696f6e7360501b604482015260640161050a565b602084015151600090815b818110156124675761019354602088015180516000926001600160a01b031691638ad6ff1e918590811061235357634e487b7160e01b600052603260045260246000fd5b6020026020010151602001518a60200151858151811061238357634e487b7160e01b600052603260045260246000fd5b6020026020010151604001518b60200151518c604001516000815181106123ba57634e487b7160e01b600052603260045260246000fd5b6020026020010151608001516123d09190614dfd565b6040518463ffffffff1660e01b81526004016123ee93929190614b24565b604080518083038186803b15801561240557600080fd5b505afa158015612419573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061243d9190614750565b9150508015612454578361245081614edb565b9450505b508061245f81614edb565b91505061230f565b5081612474826001614de5565b61247e9190614de5565b6001600160401b038111156124a357634e487b7160e01b600052604160045260246000fd5b6040519080825280602002602001820160405280156124dc57816020015b6124c96142bb565b8152602001906001900390816124c15790505b509250600080876040015160008151811061250757634e487b7160e01b600052603260045260246000fd5b6020026020010151905060008160800151905060005b848110156127385760008a60200151828151811061254b57634e487b7160e01b600052603260045260246000fd5b60200260200101519050612564818c600001518c6139a7565b88868151811061258457634e487b7160e01b600052603260045260246000fd5b602002602001018190525060008061019360009054906101000a90046001600160a01b03166001600160a01b0316638ad6ff1e846020015185604001518b8a608001516125d19190614dfd565b6040518463ffffffff1660e01b81526004016125ef93929190614b24565b604080518083038186803b15801561260657600080fd5b505afa15801561261a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061263e9190614750565b909250905080156127155761265986602001518d8484613c46565b8a612665896001614de5565b8151811061268357634e487b7160e01b600052603260045260246000fd5b6020026020010181905250868061269990614edb565b97506126a790508186614e30565b6020808501516040808701518a84015182516001600160a01b0394851681529485019190915282871691840191909152606083018590521660808201529095507f984c9c2a7606f832d0b6917b420cdc05d944830576daec3c9d8c7e7a95e641b49060a00160405180910390a15b8661271f81614edb565b975050505050808061273090614edb565b91505061251d565b5061274d8260200151898b6000015184613c46565b86848151811061276d57634e487b7160e01b600052603260045260246000fd5b60200260200101819052505050505050612d9d565b6003846060015160038111156127a857634e487b7160e01b600052602160045260246000fd5b1415612d7e578360200151516001146127f75760405162461bcd60e51b8152602060048201526011602482015270696e76616c6964206f66666572696e677360781b604482015260640161050a565b6000846020015160008151811061281e57634e487b7160e01b600052603260045260246000fd5b6020908102919091010151608081015190915060038251600781111561285457634e487b7160e01b600052602160045260246000fd5b1480612880575060078251600781111561287e57634e487b7160e01b600052602160045260246000fd5b145b6128c05760405162461bcd60e51b8152602060048201526011602482015270696e76616c6964206f66666572696e677360781b604482015260640161050a565b604086015151600090815b818110156129ee576101935460408a015180516000926001600160a01b031691638ad6ff1e918590811061290f57634e487b7160e01b600052603260045260246000fd5b6020026020010151602001518c60400151858151811061293f57634e487b7160e01b600052603260045260246000fd5b60200260200101516040015186896129579190614dfd565b6040518463ffffffff1660e01b815260040161297593929190614b24565b604080518083038186803b15801561298c57600080fd5b505afa1580156129a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129c49190614750565b91505080156129db57836129d781614edb565b9450505b50806129e681614edb565b9150506128cb565b50816129fb826001614de5565b612a059190614de5565b6001600160401b03811115612a2a57634e487b7160e01b600052604160045260246000fd5b604051908082528060200260200182016040528015612a6357816020015b612a506142bb565b815260200190600190039081612a485790505b5094506000805b82811015612d0f57612aac8a604001518281518110612a9957634e487b7160e01b600052603260045260246000fd5b60200260200101518a8c600001516139a7565b878381518110612acc57634e487b7160e01b600052603260045260246000fd5b602002602001018190525060008061019360009054906101000a90046001600160a01b03166001600160a01b0316638ad6ff1e8d604001518581518110612b2357634e487b7160e01b600052603260045260246000fd5b6020026020010151602001518e604001518681518110612b5357634e487b7160e01b600052603260045260246000fd5b602002602001015160400151888c60800151612b6f9190614dfd565b6040518463ffffffff1660e01b8152600401612b8d93929190614b24565b604080518083038186803b158015612ba457600080fd5b505afa158015612bb8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bdc9190614750565b90925090508015612ced57600788516007811115612c0a57634e487b7160e01b600052602160045260246000fd5b14612c2857612c2388602001518d600001518484613c46565b612c35565b8b51612c35908383613c85565b89612c41866001614de5565b81518110612c5f57634e487b7160e01b600052603260045260246000fd5b60200260200101819052508380612c7590614edb565b9450612c8390508188614e30565b6020808a01516040808c015181516001600160a01b0393841680825294810191909152918616908201526060810184905260808101919091529097507f984c9c2a7606f832d0b6917b420cdc05d944830576daec3c9d8c7e7a95e641b49060a00160405180910390a15b83612cf781614edb565b94505050508080612d0790614edb565b915050612a6a565b50600785516007811115612d3357634e487b7160e01b600052602160045260246000fd5b14612d5157612d4c85602001518a600001518a87613c46565b612d5e565b8851612d5e908986613c85565b86828151811061276d57634e487b7160e01b600052603260045260246000fd5b83606001516040516387d9aef360e01b815260040161050a9190614c96565b9392505050565b6000600183606001516003811115612dcc57634e487b7160e01b600052602160045260246000fd5b1480612dfb5750600283606001516003811115612df957634e487b7160e01b600052602160045260246000fd5b145b80612e295750600383606001516003811115612e2757634e487b7160e01b600052602160045260246000fd5b145b15612e36575060006103fa565b600083606001516003811115612e5c57634e487b7160e01b600052602160045260246000fd5b1415613202576000612e6d84611a69565b9050612e7884613221565b15612f3157610193546001600160a01b031663698f5cc882612e9987613dc9565b6040516001600160e01b031960e085901b16815260048101919091526001600160a01b03871660248201526044016000604051808303818588803b158015612ee057600080fd5b505af193505050508015612ef2575060015b612f2c5760405162461bcd60e51b815260206004820152600b60248201526a6661696c206c656761637960a81b604482015260640161050a565b6131fc565b602084015151819060005b818110156130f757600087602001518281518110612f6a57634e487b7160e01b600052603260045260246000fd5b602090810291909101810151610193549181015160408201519193506000926001600160a01b03169163a68928e29190612fa4888b614dfd565b6040518463ffffffff1660e01b8152600401612fc293929190614b24565b60206040518083038186803b158015612fda57600080fd5b505afa158015612fee573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613012919061486a565b905061301e8186614e30565b945061302a8188614de5565b965080156130e25761019354602083015160408401516001600160a01b03909216916384cbfe0891849161305e898c614dfd565b6040518563ffffffff1660e01b815260040161307c93929190614b24565b6000604051808303818588803b15801561309557600080fd5b505af1935050505080156130a7575060015b6130e25760405162461bcd60e51b815260206004820152600c60248201526b1c9bde585b1d1e4819985a5b60a21b604482015260640161050a565b505080806130ef90614edb565b915050612f3c565b5061019354865160405163018c032f60e21b81526001600160a01b0391821660048201529116906306300cbc9060240160206040518083038186803b15801561313f57600080fd5b505afa158015613153573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131779190614832565b156131e457610193548651604051634065da6360e01b81526001600160a01b039182166004820152911690634065da639084906024016000604051808303818588803b1580156131c657600080fd5b505af11580156131da573d6000803e3d6000fd5b50505050506131f9565b85516131f9906001600160a01b03168361373e565b50505b506103fa565b82606001516040516387d9aef360e01b815260040161050a9190614c96565b6000808260600151600381111561324857634e487b7160e01b600052602160045260246000fd5b1480156103fa57506006826020015160008151811061327757634e487b7160e01b600052603260045260246000fd5b60200260200101516000015160078111156132a257634e487b7160e01b600052602160045260246000fd5b1492915050565b6132b38282610bb9565b61051d576132c081613e45565b6132cb836020613e57565b6040516020016132dc929190614aaf565b60408051601f198184030181529082905262461bcd60e51b825261050a91600401614ca4565b6001600160a01b0381163b61336f5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840161050a565b60008051602061501883398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b6133a783614038565b6000825111806133b45750805b156104255761109d8383614078565b600054610100900460ff166114185760405162461bcd60e51b815260040161050a90614d4f565b600054610100900460ff166134115760405162461bcd60e51b815260040161050a90614d4f565b61051d828261416c565b6000808251604114156134525760208301516040840151606085015160001a613446878285856141af565b9450945050505061345a565b506000905060025b9250929050565b600081600481111561348357634e487b7160e01b600052602160045260246000fd5b141561348c5750565b60018160048111156134ae57634e487b7160e01b600052602160045260246000fd5b14156134fc5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e61747572650000000000000000604482015260640161050a565b600281600481111561351e57634e487b7160e01b600052602160045260246000fd5b141561356c5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e67746800604482015260640161050a565b600381600481111561358e57634e487b7160e01b600052602160045260246000fd5b14156105fe5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b606482015260840161050a565b600080821161362b5760405162461bcd60e51b815260206004820152601060248201526f4469766973696f6e206279207a65726f60801b604482015260640161050a565b818311156136705760405162461bcd60e51b815260206004820152601260248201527124b73b30b634b21036bab63a34b83634b2b960711b604482015260640161050a565b8361367d57506000612d9d565b60006136898486614e11565b9050836136968683614dfd565b14156136ae576136a68382614dfd565b915050612d9d565b60006136ba8487614dfd565b905060006136c88588614ef6565b905060006136d68688614dfd565b905060006136e48789614ef6565b90506137316136fd886136f78685614273565b9061427f565b61372b61370a8686614273565b61372b6137178987614273565b61372b8d6137258c8b614273565b90614273565b9061428b565b9998505050505050505050565b8047101561378e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161050a565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146137db576040519150601f19603f3d011682016040523d82523d6000602084013e6137e0565b606091505b50509050806104255760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d61792068617665207265766572746564000000000000606482015260840161050a565b6000806000613866858561341b565b9092509050600081600481111561388d57634e487b7160e01b600052602160045260246000fd5b1480156138ab5750856001600160a01b0316826001600160a01b0316145b156138bb57600192505050612d9d565b600080876001600160a01b0316631626ba7e60e01b88886040516024016138e3929190614c2e565b60408051601f198184030181529181526020820180516001600160e01b03166001600160e01b031990941693909317909252905161392191906149b8565b600060405180830381855afa9150503d806000811461395c576040519150601f19603f3d011682016040523d82523d6000602084013e613961565b606091505b5091509150818015613974575080516020145b801561399b57508051630b135d3f60e11b90613999908301602090810190840161486a565b145b98975050505050505050565b6139af6142bb565b60006001855160078111156139d457634e487b7160e01b600052602160045260246000fd5b14156139e257506002613bb2565b600285516007811115613a0557634e487b7160e01b600052602160045260246000fd5b1415613a1357506003613bb2565b600385516007811115613a3657634e487b7160e01b600052602160045260246000fd5b1415613a4457506001613bb2565b600785516007811115613a6757634e487b7160e01b600052602160045260246000fd5b1415613b9657506101935460405163018c032f60e21b81526001600160a01b038481166004808401919091529216906306300cbc9060240160206040518083038186803b158015613ab757600080fd5b505afa158015613acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613aef9190614832565b15613afc57600160408601525b61019360009054906101000a90046001600160a01b03166001600160a01b03166316f0115b6040518163ffffffff1660e01b815260040160206040518083038186803b158015613b4b57600080fd5b505afa158015613b5f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613b8391906146af565b6001600160a01b03166020860152613bb2565b84516040516355b020d560e11b815261050a9190600401614c88565b613bba6142bb565b80826004811115613bdb57634e487b7160e01b600052602160045260246000fd5b90816004811115613bfc57634e487b7160e01b600052602160045260246000fd5b9052506020868101516001600160a01b039081169183019190915294851660408083019190915293909416606085015250508201516080808301919091529091015160a082015290565b613c4e6142bb565b613c566142bb565b600181526001600160a01b0395861660208201529385166040850152509216606082015260a081019190915290565b613c8d6142bb565b613c956142bb565b600480825261019354604080516316f0115b60e01b815290516001600160a01b03909216926316f0115b928282019260209290829003018186803b158015613cdc57600080fd5b505afa158015613cf0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613d1491906146af565b6001600160a01b0390811660208301528581166040808401919091528582166060840181905260a0840186905261019354915163018c032f60e21b815260048101919091529116906306300cbc9060240160206040518083038186803b158015613d7d57600080fd5b505afa158015613d91573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613db59190614832565b15610b505760016080820152949350505050565b6000613dd482613221565b613e0d5760405162461bcd60e51b815260206004820152600a6024820152696e6f74206c656761637960b01b604482015260640161050a565b8160200151600081518110613e3257634e487b7160e01b600052603260045260246000fd5b6020026020010151604001519050919050565b60606103fa6001600160a01b03831660145b60606000613e66836002614e11565b613e71906002614de5565b6001600160401b03811115613e9657634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015613ec0576020820181803683370190505b509050600360fc1b81600081518110613ee957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110613f2657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053506000613f4a846002614e11565b613f55906001614de5565b90505b6001811115613fe9576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110613f9757634e487b7160e01b600052603260045260246000fd5b1a60f81b828281518110613fbb57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c93613fe281614e73565b9050613f58565b508315612d9d5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161050a565b61404181613302565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6140e05760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840161050a565b600080846001600160a01b0316846040516140fb91906149b8565b600060405180830381855af49150503d8060008114614136576040519150601f19603f3d011682016040523d82523d6000602084013e61413b565b606091505b5091509150614163828260405180606001604052806027815260200161503860279139614297565b95945050505050565b600054610100900460ff166141935760405162461bcd60e51b815260040161050a90614d4f565b81516020928301208151919092012061012d9190915561012e55565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156141e6575060009050600361426a565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa15801561423a573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166142635760006001925092505061426a565b9150600090505b94509492505050565b6000612d9d8284614e11565b6000612d9d8284614dfd565b6000612d9d8284614de5565b606083156142a6575081612d9d565b612d9d8383815115611b7d5781518083602001fd5b6040805160c08101909152806000815260006020820181905260408201819052606082018190526080820181905260a09091015290565b8035611d6281615002565b600082601f83011261430d578081fd5b8135602061431a82614dc2565b604080516143288382614eaf565b848152838101925086840160a0808702890186018a1015614347578788fd5b875b878110156143b95781838c03121561435f578889fd5b845161436a81614e8a565b833560088110614378578a8bfd5b81528388013561438781615002565b818901528386013586820152606080850135908201526080808501359082015286529486019491810191600101614349565b50919998505050505050505050565b600082601f8301126143d8578081fd5b813560206143e582614dc2565b6040516143f28282614eaf565b8381528281019150858301600585901b87018401881015614411578586fd5b855b858110156144515781356001600160401b03811115614430578788fd5b61443e8a87838c01016145e6565b8552509284019290840190600101614413565b5090979650505050505050565b600082601f83011261446e578081fd5b81356001600160401b0381111561448757614487614f4c565b60405161449e601f8301601f191660200182614eaf565b8181528460208386010111156144b2578283fd5b816020850160208301379081016020019190915292915050565b803560048110611d6257600080fd5b600060a082840312156144ec578081fd5b6040516144f881614e8a565b8091508235815260208084013581830152604084013561451781615002565b6040830152606084013561452a81615002565b606083015260808401356001600160401b038082111561454957600080fd5b818601915086601f83011261455d57600080fd5b813561456881614dc2565b6040516145758282614eaf565b8281528581019150848601600584901b860187018b101561459557600080fd5b6000805b858110156145d0578235878111156145af578283fd5b6145bd8e8b838c010161445e565b8652509388019391880191600101614599565b5050508060808801525050505050505092915050565b600060e082840312156145f7578081fd5b6145ff614d9a565b905061460a826142f2565b815260208201356001600160401b038082111561462657600080fd5b614632858386016142fd565b6020840152604084013591508082111561464b57600080fd5b50614658848285016142fd565b60408301525061466a606083016144cc565b60608201526080820135608082015260a082013560a082015260c082013560c082015292915050565b6000602082840312156146a4578081fd5b8135612d9d81615002565b6000602082840312156146c0578081fd5b8151612d9d81615002565b600080604083850312156146dd578081fd5b82356146e881615002565b915060208301356146f881615002565b809150509250929050565b60008060408385031215614715578182fd5b823561472081615002565b915060208301356001600160401b0381111561473a578182fd5b6147468582860161445e565b9150509250929050565b60008060408385031215614762578182fd5b825161476d81615002565b6020939093015192949293505050565b60006020828403121561478e578081fd5b81356001600160401b038111156147a3578182fd5b610b50848285016143c8565b6000806000606084860312156147c3578081fd5b83356001600160401b03808211156147d9578283fd5b6147e5878388016143c8565b945060208601359150808211156147fa578283fd5b614806878388016144db565b9350604086013591508082111561481b578283fd5b506148288682870161445e565b9150509250925092565b600060208284031215614843578081fd5b81518015158114612d9d578182fd5b600060208284031215614863578081fd5b5035919050565b60006020828403121561487b578081fd5b5051919050565b60008060408385031215614894578182fd5b8235915060208301356146f881615002565b6000602082840312156148b7578081fd5b81356001600160e01b031981168114612d9d578182fd5b6000602082840312156148df578081fd5b81356001600160401b038111156148f4578182fd5b610b50848285016144db565b600060208284031215614911578081fd5b81356001600160401b03811115614926578182fd5b610b50848285016145e6565b6000815180845261494a816020860160208601614e47565b601f01601f19169290920160200192915050565b6008811061496e5761496e614f36565b9052565b6004811061496e5761496e614f36565b815160009082906020808601845b838110156149ac57815185529382019390820190600101614990565b50929695505050505050565b600082516149ca818460208701614e47565b9190910192915050565b600083516149e6818460208801614e47565b8351908301906149fa818360208801614e47565b01949350505050565b6909ecccccae492e8cada560b31b81526e1d5a5b9d0e081a5d195b551e5c194b608a1b600a8201526d1859191c995cdcc81d1bdad95b8b60921b60198201527f75696e74323536206964656e7469666965724f7243726974657269612c0000006027820152731d5a5b9d0c8d4d881cdd185c9d105b5bdd5b9d0b60621b6044820152701d5a5b9d0c8d4d88195b99105b5bdd5b9d607a1b6058820152602960f81b6069820152606a0190565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614ae7816017850160208801614e47565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614b18816028840160208801614e47565b01602801949350505050565b6001600160a01b039390931683526020830191909152604082015260600190565b602080825282518282018190526000919060409081850190868401855b82811015614bd0578151805160058110614b7e57614b7e614f36565b8552808701516001600160a01b039081168887015286820151811687870152606080830151909116908601526080808201519086015260a0908101519085015260c09093019290850190600101614b62565b5091979650505050505050565b8881526001600160a01b038816602082015260408101879052606081018690526101008101614c0f6080830187614972565b8460a08301528360c08301528260e08301529998505050505050505050565b828152604060208201526000610b506040830184614932565b86815260c08101614c5b602083018861495e565b6001600160a01b039590951660408201526060810193909352608083019190915260a09091015292915050565b602081016103fa828461495e565b602081016103fa8284614972565b602081526000612d9d6020830184614932565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60405160e081016001600160401b0381118282101715614dbc57614dbc614f4c565b60405290565b60006001600160401b03821115614ddb57614ddb614f4c565b5060051b60200190565b60008219821115614df857614df8614f0a565b500190565b600082614e0c57614e0c614f20565b500490565b6000816000190483118215151615614e2b57614e2b614f0a565b500290565b600082821015614e4257614e42614f0a565b500390565b60005b83811015614e62578181015183820152602001614e4a565b8381111561109d5750506000910152565b600081614e8257614e82614f0a565b506000190190565b60a081018181106001600160401b0382111715614ea957614ea9614f4c565b60405250565b601f8201601f191681016001600160401b0381118282101715614ed457614ed4614f4c565b6040525050565b6000600019821415614eef57614eef614f0a565b5060010190565b600082614f0557614f05614f20565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600060033d111561091057600481823e5160e01c90565b600060443d1015614f875790565b6040516003193d81016004833e81513d6001600160401b038160248401118184111715614fb657505050505090565b8285019150815181811115614fce5750505050505090565b843d8701016020828501011115614fe85750505050505090565b614ff760208286010187614eaf565b509095945050505050565b6001600160a01b03811681146105fe57600080fdfe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220aea36f72a7cf1b77796eea2982a526a53802821cec081d733796a37f32da838964736f6c63430008040033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
Loading...
Loading
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.