Address Details
contract
0x49d9421864D462fc5aCF1FeeF94EF00a0E692B13
- Contract Name
- NFTStoreFrontV2
- Creator
- 0x4c45c6–9e9f2c at 0xe63543–dfca44
- Balance
- 0 CELO ( )
- Locked CELO Balance
- 0.00 CELO
- Voting CELO Balance
- 0.00 CELO
- Pending Unlocked Gold
- 0.00 CELO
- Tokens
-
Fetching tokens...
- Transactions
- 1 Transactions
- Transfers
- 0 Transfers
- Gas Used
- 29,045
- Last Balance Update
- 15962145
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- NFTStoreFrontV2
- Optimization enabled
- false
- Compiler version
- v0.8.9+commit.e5eed63a
- EVM Version
- london
- Verified at
- 2022-11-03T12:31:44.007243Z
contracts/NFTStoreFrontV2.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/interfaces/IERC721.sol"; import "@openzeppelin/contracts/interfaces/IERC1155.sol"; import "@openzeppelin/contracts/interfaces/IERC2981.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import "./Utils.sol"; import "./PlastikRRGV1.sol"; import "./PlastikNFTV1.sol"; import "./PlastikERC1155V1.sol"; // import "hardhat/console.sol"; contract NFTStoreFrontV2 is Ownable, IERC721Receiver, EIP712 { using SafeMath for uint256; using SafeMath for uint96; event PlatformFee(uint96 platformFee); event BuyAsset( address indexed assetOwner, uint256 indexed tokenId, uint256 quantity, address indexed buyer ); event ExecuteBid( address indexed assetOwner, uint256 indexed tokenId, uint256 quantity, address indexed buyer ); uint96 private platformFeePct; struct Fee { uint256 platformFee; uint256 ngoFee; uint256 assetFee; uint256 royaltyFee; address tokenCreator; } struct PurchaseSignatures { bytes artSellSignature; bytes artVoucherSignature; bytes[] rrgSellSignatures; bytes[] rrgSignatures; PlastikSellPrice sellPrice; bytes signaturePrice; } struct SellRequest { address tokenAddress; uint256 tokenId; uint256 price; address erc20Address; uint96 ngoFeePct; address sellerAddress; } struct BidRequest { address tokenAddress; uint256 tokenId; address erc20Address; address sellerAddress; address bidderAddress; uint256 biddingPrice; PlastikSellPrice sellPrice; bytes signaturePrice; } struct PlastikSellPrice { address buyer; uint256 ratio; uint256 decimals; uint96 currency; uint256 timestamp; address tokenAddress; } address platformWalletAddress; address ngoWalletAddress; address priceValidator; constructor( address _platformWalletAddress, address _ngoWalletAddress, uint96 _platformFeePct, address _priceSigner ) Ownable() EIP712("NFTSTOREFRONT", "1.0") { platformWalletAddress = _platformWalletAddress; ngoWalletAddress = _ngoWalletAddress; platformFeePct = _platformFeePct; priceValidator = _priceSigner; } function mixLazyMintedArtAndRRGs( PurchaseSignatures calldata purchase, SellRequest calldata artSellRequest, NFTVoucher calldata artVoucher, SellRequest[] calldata rrgSellRequests, NFTVoucher[] calldata rrgVouchers ) public { // console.logBytes(purchase.signaturePrice); _verifyPriceSignature(purchase.sellPrice, purchase.signaturePrice, artSellRequest.erc20Address); // verify and transfer art address artSeller = _verifySellerSign( artSellRequest, purchase.artSellSignature ); _verifySellerSellRequest( artSeller, artSellRequest, artVoucher.tokenAddress, artVoucher.tokenId ); PlastikNFTV1(artVoucher.tokenAddress).safeLazyMint( _msgSender(), artVoucher, purchase.artVoucherSignature ); Fee memory artFee = getFees( _convertCurrencyToPlastik(artSellRequest.price, purchase.sellPrice), 1, artSellRequest.ngoFeePct, artSellRequest.tokenAddress, artSellRequest.tokenId ); // console.log("FEES ART mixLazyMintedArtAndRRGs"); // console.log("platformFee ", artFee.platformFee); // console.log("ngoFee", artFee.ngoFee); // console.log("assetFee" , artFee.assetFee); // console.log("royaltyFee", artFee.royaltyFee); // console.log(artFee.tokenCreator); // IERC20 erc20Address = IERC20(artSellRequest.erc20Address); // console.log("INIT BALANCE",erc20Address.balanceOf(_msgSender())); _distributeFee( _msgSender(), artSellRequest.sellerAddress, artSellRequest.erc20Address, artFee ); // console.log("Balance after ART",erc20Address.balanceOf(_msgSender())); for (uint8 i = 0; i < rrgVouchers.length; i++) { uint256 tokenId = PlastikRRGV1(rrgVouchers[i].tokenAddress) .safeLazyMint( _msgSender(), rrgVouchers[i], purchase.rrgSignatures[i] ); // PlastikRRGV1(rrgVouchers[i].tokenAddress).useRRG(tokenId); PlastikRRGV1(rrgVouchers[i].tokenAddress).attachRRGToArt( _msgSender(), tokenId, artVoucher.tokenAddress, artVoucher.tokenId ); Fee memory fee = getFees( _convertCurrencyToPlastik(rrgSellRequests[i].price, purchase.sellPrice), 1, rrgSellRequests[i].ngoFeePct, rrgSellRequests[i].tokenAddress, rrgSellRequests[i].tokenId ); // console.log("FEES PRG mixLazyMintedArtAndRRGs"); // console.log("platformFee ", fee.platformFee); // console.log("ngoFee", fee.ngoFee); // console.log("assetFee" , fee.assetFee); // console.log("royaltyFee", fee.royaltyFee); // console.log(fee.tokenCreator); _distributeFee( _msgSender(), rrgSellRequests[i].sellerAddress, rrgSellRequests[i].erc20Address, fee ); // console.log("Balance after PRG",erc20Address.balanceOf(_msgSender())); } } function mixExistingArtWithLazyMintedRRGs( PurchaseSignatures calldata purchase, SellRequest calldata artSellRequest, SellRequest[] calldata rrgSellRequests, NFTVoucher[] calldata rrgVouchers ) public { require( ERC165Checker.supportsInterface( artSellRequest.tokenAddress, type(IERC721).interfaceId ), "Only allowed ERC721 tokens" ); _verifyPriceSignature(purchase.sellPrice, purchase.signaturePrice, artSellRequest.erc20Address); // verify and transfer art address artSeller = _verifySellerSign( artSellRequest, purchase.artSellSignature ); _verifySellerSellRequest( artSeller, artSellRequest, artSellRequest.tokenAddress, artSellRequest.tokenId ); // the art we are assuming that it was approved to transfer already IERC721(artSellRequest.tokenAddress).safeTransferFrom( artSellRequest.sellerAddress, _msgSender(), artSellRequest.tokenId ); Fee memory artFee = getFees( _convertCurrencyToPlastik(artSellRequest.price, purchase.sellPrice), 1, artSellRequest.ngoFeePct, artSellRequest.tokenAddress, artSellRequest.tokenId ); // console.log("FEES ART mixExistingArtWithLazyMintedRRGs"); // console.log("platformFee ", artFee.platformFee); // console.log("ngoFee", artFee.ngoFee); // console.log("assetFee" , artFee.assetFee); // console.log("royaltyFee", artFee.royaltyFee); // console.log(artFee.tokenCreator); _distributeFee( _msgSender(), artSellRequest.sellerAddress, artSellRequest.erc20Address, artFee ); // mint and transfer lazyminted RRG for (uint8 i = 0; i < rrgVouchers.length; i++) { address rrgSeller = _verifySellerSign( rrgSellRequests[i], purchase.rrgSellSignatures[i] ); //verify the message against the lazy mint vourcher _verifySellerSellRequest( rrgSeller, rrgSellRequests[i], rrgVouchers[i].tokenAddress, rrgVouchers[i].tokenId ); uint256 tokenId = PlastikRRGV1(rrgVouchers[i].tokenAddress) .safeLazyMint( _msgSender(), rrgVouchers[i], purchase.rrgSignatures[i] ); // PlastikRRGV1(rrgVouchers[i].tokenAddress).useRRG(tokenId); PlastikRRGV1(rrgVouchers[i].tokenAddress).attachRRGToArt( _msgSender(), tokenId, artSellRequest.tokenAddress, artSellRequest.tokenId ); Fee memory fee = getFees( _convertCurrencyToPlastik(rrgSellRequests[i].price, purchase.sellPrice), 1, rrgSellRequests[i].ngoFeePct, rrgSellRequests[i].tokenAddress, rrgSellRequests[i].tokenId ); // console.log("FEES PRG mixExistingArtWithLazyMintedRRGs"); // console.log("platformFee ", fee.platformFee); // console.log("ngoFee", fee.ngoFee); // console.log("assetFee" , fee.assetFee); // console.log("royaltyFee", fee.royaltyFee); // console.log(fee.tokenCreator); _distributeFee( _msgSender(), rrgSellRequests[i].sellerAddress, rrgSellRequests[i].erc20Address, fee ); } } function buyLazyMintedRRG( SellRequest calldata sellRequest, bytes calldata sellSignature, NFTVoucher calldata voucher, bytes calldata signature, PlastikSellPrice calldata sellPrice, bytes calldata signaturePrice ) public { _verifyPriceSignature(sellPrice, signaturePrice, sellRequest.erc20Address); address seller = _verifySellerSign(sellRequest, sellSignature); //verify the message against the lazy mint vourcher _verifySellerSellRequest( seller, sellRequest, voucher.tokenAddress, voucher.tokenId ); //mint and transfer PlastikRRGV1(voucher.tokenAddress).safeLazyMint( _msgSender(), voucher, signature ); Fee memory fee = getFees( _convertCurrencyToPlastik(sellRequest.price, sellPrice), 1, sellRequest.ngoFeePct, sellRequest.tokenAddress, sellRequest.tokenId ); _distributeFee( _msgSender(), sellRequest.sellerAddress, sellRequest.erc20Address, fee ); } function buyRRG( SellRequest calldata sellRequest, bytes calldata sellSignature, PlastikSellPrice calldata sellPrice, bytes calldata signaturePrice ) public { _verifyPriceSignature(sellPrice, signaturePrice, sellRequest.erc20Address); address seller = _verifySellerSign(sellRequest, sellSignature); require(seller == sellRequest.sellerAddress, "Invalid seller address"); IERC721(sellRequest.tokenAddress).safeTransferFrom( sellRequest.sellerAddress, _msgSender(), sellRequest.tokenId ); emit BuyAsset(seller, sellRequest.tokenId, 1, _msgSender()); Fee memory fee = getFees( _convertCurrencyToPlastik(sellRequest.price, sellPrice), 1, sellRequest.ngoFeePct, sellRequest.tokenAddress, sellRequest.tokenId ); _distributeFee( _msgSender(), sellRequest.sellerAddress, sellRequest.erc20Address, fee ); } function _verifySellerSellRequest( address seller, SellRequest calldata sellRequest, address tokenAddress, uint256 tokenId ) private pure { require(seller == sellRequest.sellerAddress, "Invalid seller address"); require( sellRequest.tokenAddress == tokenAddress, "Invalid token address" ); require(sellRequest.tokenId == tokenId, "Invalid token id"); } function _verifyBidderBidRequest( address bidder, BidRequest calldata bidRequest, SellRequest calldata sellRequest, address tokenAddress, uint256 tokenId ) private pure { require(bidder == bidRequest.bidderAddress, "Invalid bidder address"); require( bidRequest.sellerAddress == sellRequest.sellerAddress, "Invalid seller address" ); require( bidRequest.erc20Address == sellRequest.erc20Address, "Invalid payment token address" ); require( bidRequest.tokenAddress == tokenAddress, "Invalid token address" ); require(bidRequest.tokenId == tokenId, "Invalid token id"); } function _verifySellerSign( SellRequest calldata item, bytes calldata signature ) private view returns (address) { bytes32 digest = _hashTypedDataV4( keccak256( abi.encode( Constants.SELLREQUEST_TYPEHASH, item.tokenAddress, item.tokenId, item.price, item.erc20Address, item.ngoFeePct, item.sellerAddress ) ) ); return ECDSA.recover(digest, signature); } function _verifyPriceSignature( PlastikSellPrice calldata item, bytes calldata signature, address ercToken ) private view returns (address) { bytes32 digest = _hashTypedDataV4( keccak256( abi.encode( Constants.PLASTIKSELLPRICEREQUEST_TYPEHASH, item.buyer, item.ratio, item.decimals, item.currency, item.timestamp, item.tokenAddress ) ) ); address sig = ECDSA.recover(digest, signature); require(sig == priceValidator, "Price validator invalid"); require(_msgSender() == item.buyer, "Buyer sign price invalid"); require(ercToken == item.tokenAddress, "ercToken invalid"); require( block.timestamp < item.timestamp + 10 minutes, "Price is expired" ); return sig; } function _convertCurrencyToPlastik(uint256 price, PlastikSellPrice calldata sellPrice) private view returns (uint256) { // console.log("_convertCurrencyToPlastik"); // console.log(price); // console.log(sellPrice.currency); // console.log(sellPrice.decimals); // console.log(sellPrice.ratio); // uint256 result = 0; if(sellPrice.currency == 0) { // 0 - PLASTIK, 1 - USD // result = price; return price; } else if(sellPrice.currency == 1) { // result = (price * 10 ** sellPrice.decimals)/sellPrice.ratio; return (price * 10 ** sellPrice.decimals)/sellPrice.ratio; } revert("Currency invalid for price conversion"); // console.log("RESULT"); // console.log(result); // return result; } function _verifyBidderSign( BidRequest calldata item, bytes calldata signature ) private view returns (address) { bytes32 digest = _hashTypedDataV4( keccak256( abi.encode( Constants.BIDREQUEST_TYPEHASH, item.tokenAddress, item.tokenId, item.erc20Address, item.sellerAddress, item.bidderAddress, item.biddingPrice ) ) ); return ECDSA.recover(digest, signature); } function _distributeFee( address _buyer, address _seller, address _erc20Address, Fee memory _fee ) private { IERC20 erc20Address = IERC20(_erc20Address); if (_fee.platformFee > 0) { require( erc20Address.transferFrom( _buyer, platformWalletAddress, _fee.platformFee ), "failure while transferring" ); // console.log("Transfering platformFee ", _fee.platformFee); } if (_fee.ngoFee > 0) { require( erc20Address.transferFrom( _buyer, ngoWalletAddress, _fee.ngoFee ), "failure while transferring" ); // console.log("Transfering ngoFee ", _fee.ngoFee); } if (_fee.royaltyFee > 0) { require( erc20Address.transferFrom( _buyer, _fee.tokenCreator, _fee.royaltyFee ), "failure while transferring" ); // console.log("Transfering royaltyFee ", _fee.royaltyFee); } require( erc20Address.transferFrom(_buyer, _seller, _fee.assetFee), "failure while transferring" ); // console.log("Transfering assetFee ", _fee.assetFee); // console.log("SUM", _fee.assetFee+_fee.royaltyFee+_fee.ngoFee+_fee.platformFee); } function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external override returns (bytes4) { msg.sender.call(data); return bytes4( keccak256("onERC721Received(address,address,uint256,bytes)") ); } function platformServiceFee() public view virtual returns (uint96) { return platformFeePct; } function setPlatformServiceFee(uint96 _platformFee) public onlyOwner returns (bool) { platformFeePct = _platformFee; emit PlatformFee(platformFeePct); return true; } function getFees( uint256 price, uint256 qty, uint96 ngoFeePct, address buyingAssetAddress, uint256 tokenId ) internal view returns (Fee memory) { require( ngoFeePct.add(platformFeePct) <= 10000, "Invalid platform fee or NGO fee" ); // console.log("PRICE FINAL"); // console.log(price); uint256 assetFee; address creator; uint256 royaltyFee; uint256 paymentAmt = price * qty; uint256 platformFee = paymentAmt.mul(platformFeePct).div(10000); uint256 ngoFee = paymentAmt.mul(ngoFeePct).div(10000); uint256 amount = paymentAmt.sub(platformFee).sub(ngoFee); if ( ERC165Checker.supportsInterface( buyingAssetAddress, type(IERC2981).interfaceId ) ) { (creator, royaltyFee) = ( (IERC2981(buyingAssetAddress).royaltyInfo(tokenId, amount)) ); } assetFee = amount.sub(royaltyFee); return Fee(platformFee, ngoFee, assetFee, royaltyFee, creator); } function executeBid( BidRequest calldata bid, bytes calldata bidSignature, SellRequest calldata sellRequest, bytes calldata sellSignature ) public returns (bool) { _verifyPriceSignature(bid.sellPrice, bid.signaturePrice, sellRequest.erc20Address); address bidder = _verifyBidderSign(bid, bidSignature); _verifyBidderBidRequest( bidder, bid, sellRequest, sellRequest.tokenAddress, sellRequest.tokenId ); IERC721(bid.tokenAddress).safeTransferFrom( bid.sellerAddress, bid.bidderAddress, bid.tokenId ); Fee memory fee = getFees( _convertCurrencyToPlastik(bid.biddingPrice, bid.sellPrice), 1, sellRequest.ngoFeePct, bid.tokenAddress, bid.tokenId ); _distributeFee( bid.bidderAddress, bid.sellerAddress, sellRequest.erc20Address, fee ); emit ExecuteBid(bid.sellerAddress, bid.tokenId, 1, bid.bidderAddress); return true; } function executeBidLazyMintingRRG( BidRequest calldata bid, bytes calldata bidSignature, SellRequest calldata sellRequest, bytes calldata sellSignature, NFTVoucher calldata voucher, bytes calldata signature ) public returns (bool) { _verifyPriceSignature(bid.sellPrice, bid.signaturePrice, sellRequest.erc20Address); address bidder = _verifyBidderSign(bid, bidSignature); _verifyBidderBidRequest( bidder, bid, sellRequest, voucher.tokenAddress, voucher.tokenId ); address seller = _verifySellerSign(sellRequest, sellSignature); _verifySellerSellRequest( seller, sellRequest, bid.tokenAddress, bid.tokenId ); PlastikRRGV1(voucher.tokenAddress).safeLazyMint( bidder, voucher, signature ); Fee memory fee = getFees( _convertCurrencyToPlastik(bid.biddingPrice, bid.sellPrice), 1, sellRequest.ngoFeePct, sellRequest.tokenAddress, sellRequest.tokenId ); _distributeFee( bid.bidderAddress, seller, sellRequest.erc20Address, fee ); emit ExecuteBid(bid.sellerAddress, bid.tokenId, 1, bid.bidderAddress); return true; } function setPriceValidator(address newValidator) public onlyOwner returns (bool) { priceValidator = newValidator; return true; } }
/_openzeppelin/contracts/access/AccessControl.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
/_openzeppelin/contracts/access/AccessControlEnumerable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerable.sol"; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
/_openzeppelin/contracts/access/IAccessControl.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
/_openzeppelin/contracts/access/IAccessControlEnumerable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
/_openzeppelin/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
/_openzeppelin/contracts/interfaces/IERC1155.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1155.sol) pragma solidity ^0.8.0; import "../token/ERC1155/IERC1155.sol";
/_openzeppelin/contracts/interfaces/IERC2981.sol
// 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); }
/_openzeppelin/contracts/interfaces/IERC721.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol) pragma solidity ^0.8.0; import "../token/ERC721/IERC721.sol";
/_openzeppelin/contracts/security/Pausable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
/_openzeppelin/contracts/token/ERC1155/ERC1155.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.0; import "./IERC1155.sol"; import "./IERC1155Receiver.sol"; import "./extensions/IERC1155MetadataURI.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 * * _Available since v3.1._ */ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { using Address for address; // Mapping from token ID to account balances mapping(uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor(string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) public view virtual override returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1155: address zero is not a valid owner"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not token owner nor approved" ); _safeTransferFrom(from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not token owner nor approved" ); _safeBatchTransferFrom(from, to, ids, amounts, data); } /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, to, ids, amounts, data); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; emit TransferSingle(operator, from, to, id, amount); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; } emit TransferBatch(operator, from, to, ids, amounts); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); _balances[id][to] += amount; emit TransferSingle(operator, address(0), to, id, amount); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint256 i = 0; i < ids.length; i++) { _balances[ids[i]][to] += amounts[i]; } emit TransferBatch(operator, address(0), to, ids, amounts); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `amount` tokens of token type `id`. */ function _burn( address from, uint256 id, uint256 amount ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } emit TransferSingle(operator, from, address(0), id, amount); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch( address from, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } } emit TransferBatch(operator, from, address(0), ids, amounts); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC1155: setting approval status for self"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `ids` and `amounts` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} /** * @dev Hook that is called after any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } }
/_openzeppelin/contracts/token/ERC1155/IERC1155.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.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; }
/_openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
/_openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/extensions/ERC1155Burnable.sol) pragma solidity ^0.8.0; import "../ERC1155.sol"; /** * @dev Extension of {ERC1155} that allows token holders to destroy both their * own tokens and those that they have been approved to use. * * _Available since v3.1._ */ abstract contract ERC1155Burnable is ERC1155 { function burn( address account, uint256 id, uint256 value ) public virtual { require( account == _msgSender() || isApprovedForAll(account, _msgSender()), "ERC1155: caller is not token owner nor approved" ); _burn(account, id, value); } function burnBatch( address account, uint256[] memory ids, uint256[] memory values ) public virtual { require( account == _msgSender() || isApprovedForAll(account, _msgSender()), "ERC1155: caller is not token owner nor approved" ); _burnBatch(account, ids, values); } }
/_openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol) pragma solidity ^0.8.0; import "../ERC1155.sol"; /** * @dev Extension of ERC1155 that adds tracking of total supply per id. * * Useful for scenarios where Fungible and Non-fungible tokens have to be * clearly identified. Note: While a totalSupply of 1 might mean the * corresponding is an NFT, there is no guarantees that no other token with the * same id are not going to be minted. */ abstract contract ERC1155Supply is ERC1155 { mapping(uint256 => uint256) private _totalSupply; /** * @dev Total amount of tokens in with a given id. */ function totalSupply(uint256 id) public view virtual returns (uint256) { return _totalSupply[id]; } /** * @dev Indicates whether any token exist with a given id, or not. */ function exists(uint256 id) public view virtual returns (bool) { return ERC1155Supply.totalSupply(id) > 0; } /** * @dev See {ERC1155-_beforeTokenTransfer}. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual override { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); if (from == address(0)) { for (uint256 i = 0; i < ids.length; ++i) { _totalSupply[ids[i]] += amounts[i]; } } if (to == address(0)) { for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 supply = _totalSupply[id]; require(supply >= amount, "ERC1155: burn amount exceeds totalSupply"); unchecked { _totalSupply[id] = supply - amount; } } } } }
/_openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/extensions/IERC1155MetadataURI.sol) pragma solidity ^0.8.0; import "../IERC1155.sol"; /** * @dev Interface of the optional ERC1155MetadataExtension interface, as defined * in the https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[EIP]. * * _Available since v3.1._ */ interface IERC1155MetadataURI is IERC1155 { /** * @dev Returns the URI for token type `id`. * * If the `\{id\}` substring is present in the URI, it must be replaced by * clients with the actual token type ID. */ function uri(uint256 id) external view returns (string memory); }
/_openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.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); }
/_openzeppelin/contracts/token/ERC721/ERC721.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: address zero is not a valid owner"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: invalid token ID"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not token owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); _safeTransfer(from, to, tokenId, data); } /** * @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. * * `data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { address owner = ERC721.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
/_openzeppelin/contracts/token/ERC721/IERC721.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.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: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * 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); }
/_openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
/_openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721Burnable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "../../../utils/Context.sol"; /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be burned (destroyed). */ abstract contract ERC721Burnable is Context, ERC721 { /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); _burn(tokenId); } }
/_openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } }
/_openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721URIStorage.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; /** * @dev ERC721 token with storage based token URI management. */ abstract contract ERC721URIStorage is ERC721 { using Strings for uint256; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = _baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } return super.tokenURI(tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev See {ERC721-_burn}. This override additionally checks to see if a * token-specific URI was set for the token, and if so, it deletes the token URI from * the storage mapping. */ function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } }
/_openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
/_openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
/_openzeppelin/contracts/token/common/ERC2981.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
/_openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://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 functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/_openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
/_openzeppelin/contracts/utils/Strings.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_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) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @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] = _HEX_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); } }
/_openzeppelin/contracts/utils/cryptography/ECDSA.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.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 ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } 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"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' 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) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ 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 if (signature.length == 64) { bytes32 r; bytes32 vs; // 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)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } 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 (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // 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", Strings.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)); } }
/_openzeppelin/contracts/utils/cryptography/draft-EIP712.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.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._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* 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]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } 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 ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
/_openzeppelin/contracts/utils/introspection/ERC165.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
/_openzeppelin/contracts/utils/introspection/ERC165Checker.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 _supportsERC165Interface(account, type(IERC165).interfaceId) && !_supportsERC165Interface(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) && _supportsERC165Interface(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] = _supportsERC165Interface(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 (!_supportsERC165Interface(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 _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) { bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId); (bool success, bytes memory result) = account.staticcall{gas: 30000}(encodedParams); if (result.length < 32) return false; return success && abi.decode(result, (bool)); } }
/_openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
/_openzeppelin/contracts/utils/math/SafeMath.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the 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; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
/_openzeppelin/contracts/utils/structs/EnumerableSet.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
/contracts/PlastikBaseERC721V1.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import "./PlastikCrypto.sol"; import "./PlastikRole.sol"; import "./Utils.sol"; import "./PlastikRoyaltyCal.sol"; /// @custom:security-contact daniel@nozama.green abstract contract PlastikBaseERC721V1 is Ownable, ERC721, ERC721Enumerable, ERC721URIStorage, ERC721Burnable, IERC2981 { string internal __baseURI; IPlastikRoyaltyCal internal royaltyCal; PlastikCrypto internal plastikCrypto; PlastikRole internal plastikRole; constructor( IPlastikRoyaltyCal _royaltyCal, PlastikCrypto _plastikCrypto, PlastikRole _plastikRole, string memory name, string memory symbol ) ERC721(name, symbol) { __baseURI = Constants.BASE_URI; royaltyCal = _royaltyCal; plastikCrypto = _plastikCrypto; plastikRole = _plastikRole; } function _baseURI() internal view override returns (string memory) { return __baseURI; } function setBaseURI(string memory baseURI_) public onlyOwner { __baseURI = baseURI_; } modifier onlyMinterRole() { plastikRole.verifyMinterRole(_msgSender()); _; } function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view virtual override returns (address, uint256) { return royaltyCal.royaltyInfo(_tokenId, _salePrice); } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal override(ERC721, ERC721Enumerable) { super._beforeTokenTransfer(from, to, tokenId); } function _burn(uint256 tokenId) internal virtual override(ERC721, ERC721URIStorage) { super._burn(tokenId); royaltyCal.resetTokenRoyalty(tokenId); } function transferToBuyer( address signer, address buyer, uint256 tokenId ) internal { // transfer to the buyer if (_msgSender() == signer) { transferFrom(signer, buyer, tokenId); } else { this.transferFrom(signer, buyer, tokenId); } } function tokenURI(uint256 tokenId) public view virtual override(ERC721, ERC721URIStorage) returns (string memory) { return super.tokenURI(tokenId); } function supportsInterface(bytes4 interfaceId) public view override(ERC721, IERC165, ERC721Enumerable) returns (bool) { return interfaceId == type(IERC721Metadata).interfaceId || interfaceId == type(IERC721Enumerable).interfaceId || interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } }
/contracts/PlastikCrypto.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import "./Utils.sol"; contract PlastikCrypto is EIP712 { constructor() EIP712("PLASTIK", "1.0") {} /// @notice Verifies the signature for a given NFTVoucher, returning the address of the signer. /// @dev Will revert if the signature is invalid. Does not verify that the signer is authorized to mint NFTs. /// @param voucher An NFTVoucher describing an unminted NFT. function verify(NFTVoucher calldata voucher, bytes memory signature) public view returns (address) { bytes32 digest = _hashTypedDataV4( keccak256( abi.encode( Constants.NFTVOUCHER_TYPEHASH, voucher.tokenAddress, voucher.tokenId, keccak256(bytes(voucher.tokenURI)), voucher.creatorAddress, voucher.royalty ) ) ); return ECDSA.recover(digest, signature); } }
/contracts/PlastikERC1155V1.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC1155/ERC1155.sol"; import "@openzeppelin/contracts/token/common/ERC2981.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol"; /// @custom:security-contact daniel@nozama.green contract PlastikERC1155V1 is Ownable, ERC1155, ERC2981, AccessControl, Pausable, ERC1155Burnable, ERC1155Supply { bytes32 public constant URI_SETTER_ROLE = keccak256("URI_SETTER_ROLE"); bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); struct Sign { uint8 v; bytes32 r; bytes32 s; } constructor() ERC1155("https://plastiks.io") { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(URI_SETTER_ROLE, msg.sender); _grantRole(PAUSER_ROLE, msg.sender); _grantRole(MINTER_ROLE, msg.sender); } function verifySign(string memory tokenURI, Sign memory sign) internal view { bytes32 hash = keccak256(abi.encodePacked(this,tokenURI)); require(owner() == ecrecover(keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)), sign.v, sign.r, sign.s), "Owner sign verification failed"); } function setURI(string memory newuri) public onlyRole(URI_SETTER_ROLE) { _setURI(newuri); } function pause() public onlyRole(PAUSER_ROLE) { _pause(); } function unpause() public onlyRole(PAUSER_ROLE) { _unpause(); } function mint( address account, string memory uri, uint256 id, uint256 amount, uint96 fee, Sign memory sign, bytes memory data ) public onlyRole(MINTER_ROLE) { verifySign(uri, sign); _mint(account, id, amount, data); _setTokenRoyalty(id, account, fee); } //TODO add fee and royalty function mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public onlyRole(MINTER_ROLE) { _mintBatch(to, ids, amounts, data); } function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal override(ERC1155, ERC1155Supply) whenNotPaused { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); } // The following functions are overrides required by Solidity. function supportsInterface(bytes4 interfaceId) public view override(ERC1155, ERC2981, AccessControl) returns (bool) { return super.supportsInterface(interfaceId); } }
/contracts/PlastikNFTV1.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./Utils.sol"; import "./PlastikBaseERC721V1.sol"; /// @custom:security-contact daniel@nozama.green contract PlastikNFTV1 is PlastikBaseERC721V1, IPlastikArtLazyMint { event PlastikNFTMinted(address mintTo, uint256 tokenId); constructor( IPlastikRoyaltyCal _royaltyCal, PlastikCrypto _plastikCrypto, PlastikRole _plastikRole ) PlastikBaseERC721V1( _royaltyCal, _plastikCrypto, _plastikRole, "PlastikNFTV1", "PLASTIKART" ) {} function safeLazyMint( address buyer, NFTVoucher calldata voucher, bytes calldata signature ) external payable onlyMinterRole returns (uint256) { require(voucher.tokenAddress == address(this), "The voucher must be for this contract"); // must be compatible with eth_signTypedDataV4 in MetaMask address signer = plastikCrypto.verify(voucher, signature); require( signer == voucher.creatorAddress, "Creator Address does not match" ); // mint to signer first to establish on-chain history _safeMint(signer, voucher.tokenId); _setTokenURI(voucher.tokenId, voucher.tokenURI); emit PlastikNFTMinted(signer, voucher.tokenId); royaltyCal.setTokenRoyalty(voucher.tokenId, signer, voucher.royalty); // transfer to the buyer transferToBuyer(signer, buyer, voucher.tokenId); return voucher.tokenId; } }
/contracts/PlastikRRGV1.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./Utils.sol"; import "./PlastikBaseERC721V1.sol"; import "./VerifiedAccounts.sol"; /// @custom:security-contact daniel@nozama.green contract PlastikRRGV1 is PlastikBaseERC721V1, IPlastikRRGLazyMint { mapping(uint256 => address) private _attachedRRGToArtAddresss; mapping(uint256 => uint256) private _attachedRRGToArtIds; mapping(uint256 => bool) private _usedRRG; event UseRRG( uint256 indexed _tokenId, address indexed _owner, uint256 indexed _timestamp ); event RRGNFTMinted(address indexed mintTo, uint256 tokenId); event TheArtOfRecycling( address indexed sustainableUser, uint256 tokenId, address indexed artAddress, uint256 indexed artTokenId ); VerifiedAccounts verifiedAccounts; constructor( address _addressVerification, PlastikRoyaltyCal _royaltyCal, PlastikCrypto _plastikCrypto, PlastikRole _plastikRole ) PlastikBaseERC721V1( _royaltyCal, _plastikCrypto, _plastikRole, "PlastikRRGV1", "PLASTIK" ) { verifiedAccounts = VerifiedAccounts(_addressVerification); } function setVerification(address _verifiedAddress) public onlyOwner returns (bool) { verifiedAccounts = VerifiedAccounts(_verifiedAddress); return true; } function mintRRG( uint256 tokenId, string memory tokenURI, uint96 royalty ) external onlyMinterRole returns (uint256) { // mint to signer first to establish on-chain history _safeMint(_msgSender(), tokenId); _setTokenURI(tokenId, tokenURI); emit RRGNFTMinted(_msgSender(), tokenId); royaltyCal.setTokenRoyalty(tokenId, _msgSender(), royalty); return tokenId; } function safeLazyMint( address buyer, NFTVoucher calldata voucher, bytes memory signature ) external payable onlyMinterRole returns (uint256) { require( voucher.tokenAddress == address(this), "The voucher must be for this contract" ); // must be compatible with eth_signTypedDataV4 in MetaMask address signer = plastikCrypto.verify(voucher, signature); require( signer == voucher.creatorAddress, "Creator Address does not match" ); //verify if the creator is a verified recycler require( verifiedAccounts.isVerified(voucher.creatorAddress), "Creator is not a verified recycler" ); // mint to signer first to establish on-chain history _safeMint(signer, voucher.tokenId); _setTokenURI(voucher.tokenId, voucher.tokenURI); emit RRGNFTMinted(signer, voucher.tokenId); royaltyCal.setTokenRoyalty(voucher.tokenId, buyer, voucher.royalty); // transfer to the buyer transferToBuyer(signer, buyer, voucher.tokenId); return voucher.tokenId; } function attachRRGToArt( address sustainableUser, uint256 tokenId, address artTokenAddress, uint256 artTokenId ) public onlyMinterRole { require(_attachedRRGToArtIds[tokenId] == 0, "RRG is already attached"); _attachedRRGToArtAddresss[tokenId] = artTokenAddress; _attachedRRGToArtIds[tokenId] = artTokenId; emit TheArtOfRecycling( sustainableUser, tokenId, artTokenAddress, artTokenId ); } function isRRGUsed(uint256 _tokenId) public view returns (bool) { return _usedRRG[_tokenId]; } function useRRG(uint256 _tokenId) public returns (bool) { require(msg.sender == ownerOf(_tokenId), "Only the owner can use"); require(!_usedRRG[_tokenId], "RRG is already used"); _usedRRG[_tokenId] = true; emit UseRRG(_tokenId, msg.sender, block.timestamp); return true; } }
/contracts/PlastikRole.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/AccessControl.sol"; import "./Utils.sol"; contract PlastikRole is AccessControl { constructor() { _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); _grantRole(Constants.MINTER_ROLE, _msgSender()); } function grantMinterRole(address account) public { grantRole(Constants.MINTER_ROLE, account); } function verifyMinterRole(address account) public view { if (!hasRole(Constants.MINTER_ROLE, account)) { revert("Only minter role can mint"); } } }
/contracts/PlastikRoyaltyCal.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/token/common/ERC2981.sol"; interface IPlastikRoyaltyCal is IERC2981 { function setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) external; function resetTokenRoyalty(uint256 _tokenId) external; } contract PlastikRoyaltyCal is ERC2981, IPlastikRoyaltyCal { event TokenRoyaltySet(uint256 tokenId, address receiver, uint96 fee); event TokenRoyaltyReset(uint256 tokenId); function setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) public { super._setTokenRoyalty(tokenId, receiver, feeNumerator); emit TokenRoyaltySet(tokenId, receiver, feeNumerator); } function resetTokenRoyalty(uint256 tokenId) public { super._resetTokenRoyalty(tokenId); emit TokenRoyaltyReset(tokenId); } }
/contracts/Utils.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; library Constants { bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 constant NFTVOUCHER_TYPEHASH = keccak256( "NFTVoucher(address tokenAddress,uint256 tokenId,string tokenURI,address creatorAddress,uint96 royalty)" ); bytes32 constant SELLREQUEST_TYPEHASH = keccak256( "SellRequest(address tokenAddress,uint256 tokenId,uint256 price,address erc20Address,uint96 ngoFeePct,address sellerAddress)" ); bytes32 constant PLASTIKSELLPRICEREQUEST_TYPEHASH = keccak256( "PlastikSellPrice(address buyer,uint256 ratio,uint256 decimals,uint96 currency,uint256 timestamp,address tokenAddress)" ); bytes32 constant BIDREQUEST_TYPEHASH = keccak256( "BidRequest(address tokenAddress,uint256 tokenId,address erc20Address,address sellerAddress,address bidderAddress,uint256 biddingPrice)" ); string public constant BASE_URI = "https://plastiks.io/ipfs/"; } /// @notice Represents an un-minted NFT, which has not yet been recorded into the blockchain. A signed voucher can be redeemed for a real NFT using the redeem function. struct NFTVoucher { /// @notice The address of the ERC721 or ERC1155 address tokenAddress; /// @notice The id of the token to be redeemed. Must be unique - if another token with this ID already exists, the redeem function will revert. uint256 tokenId; /// @notice The metadata URI to associate with this token. string tokenURI; /// @notice The address of the original signer of this lazy minting address creatorAddress; /// @notice The royalty percentage for the original creator (offset 2 digits) uint96 royalty; } interface IPlastikLazyMint { struct ExternalArt { uint256 tokenId; address tokenAddress; address ownerAddress; } } interface IPlastikArtLazyMint is IPlastikLazyMint { function safeLazyMint( address buyer, NFTVoucher calldata voucher, bytes calldata signature ) external payable returns (uint256); } interface IPlastikRRGLazyMint is IPlastikLazyMint { function safeLazyMint( address buyer, NFTVoucher calldata voucher, bytes calldata signature ) external payable returns (uint256); }
/contracts/VerifiedAccounts.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; contract VerifiedAccounts is Ownable, AccessControlEnumerable { bytes32 public constant VALIDATOR_ROLE = keccak256("VALIDATOR_ROLE"); mapping(address => bool) verifyAddresses; event Verified(address indexed _address); event Unverified(address indexed _address); constructor() Ownable() { _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(VALIDATOR_ROLE, _msgSender()); verifyAddresses[_msgSender()] = true; } function addVerifyAddress(address _address, bool value) public { require(hasRole(VALIDATOR_ROLE, msg.sender), "Only validators can verify"); verifyAddresses[_address] = value; if (value) { emit Verified(_address); } else { emit Unverified(_address); } } function isVerified(address _address) public view returns (bool) { return verifyAddresses[_address]; } }
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_platformWalletAddress","internalType":"address"},{"type":"address","name":"_ngoWalletAddress","internalType":"address"},{"type":"uint96","name":"_platformFeePct","internalType":"uint96"},{"type":"address","name":"_priceSigner","internalType":"address"}]},{"type":"event","name":"BuyAsset","inputs":[{"type":"address","name":"assetOwner","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true},{"type":"uint256","name":"quantity","internalType":"uint256","indexed":false},{"type":"address","name":"buyer","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"ExecuteBid","inputs":[{"type":"address","name":"assetOwner","internalType":"address","indexed":true},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":true},{"type":"uint256","name":"quantity","internalType":"uint256","indexed":false},{"type":"address","name":"buyer","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"PlatformFee","inputs":[{"type":"uint96","name":"platformFee","internalType":"uint96","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"buyLazyMintedRRG","inputs":[{"type":"tuple","name":"sellRequest","internalType":"struct NFTStoreFrontV2.SellRequest","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"address","name":"erc20Address","internalType":"address"},{"type":"uint96","name":"ngoFeePct","internalType":"uint96"},{"type":"address","name":"sellerAddress","internalType":"address"}]},{"type":"bytes","name":"sellSignature","internalType":"bytes"},{"type":"tuple","name":"voucher","internalType":"struct NFTVoucher","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"string","name":"tokenURI","internalType":"string"},{"type":"address","name":"creatorAddress","internalType":"address"},{"type":"uint96","name":"royalty","internalType":"uint96"}]},{"type":"bytes","name":"signature","internalType":"bytes"},{"type":"tuple","name":"sellPrice","internalType":"struct NFTStoreFrontV2.PlastikSellPrice","components":[{"type":"address","name":"buyer","internalType":"address"},{"type":"uint256","name":"ratio","internalType":"uint256"},{"type":"uint256","name":"decimals","internalType":"uint256"},{"type":"uint96","name":"currency","internalType":"uint96"},{"type":"uint256","name":"timestamp","internalType":"uint256"},{"type":"address","name":"tokenAddress","internalType":"address"}]},{"type":"bytes","name":"signaturePrice","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"buyRRG","inputs":[{"type":"tuple","name":"sellRequest","internalType":"struct NFTStoreFrontV2.SellRequest","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"address","name":"erc20Address","internalType":"address"},{"type":"uint96","name":"ngoFeePct","internalType":"uint96"},{"type":"address","name":"sellerAddress","internalType":"address"}]},{"type":"bytes","name":"sellSignature","internalType":"bytes"},{"type":"tuple","name":"sellPrice","internalType":"struct NFTStoreFrontV2.PlastikSellPrice","components":[{"type":"address","name":"buyer","internalType":"address"},{"type":"uint256","name":"ratio","internalType":"uint256"},{"type":"uint256","name":"decimals","internalType":"uint256"},{"type":"uint96","name":"currency","internalType":"uint96"},{"type":"uint256","name":"timestamp","internalType":"uint256"},{"type":"address","name":"tokenAddress","internalType":"address"}]},{"type":"bytes","name":"signaturePrice","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"executeBid","inputs":[{"type":"tuple","name":"bid","internalType":"struct NFTStoreFrontV2.BidRequest","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"address","name":"erc20Address","internalType":"address"},{"type":"address","name":"sellerAddress","internalType":"address"},{"type":"address","name":"bidderAddress","internalType":"address"},{"type":"uint256","name":"biddingPrice","internalType":"uint256"},{"type":"tuple","name":"sellPrice","internalType":"struct NFTStoreFrontV2.PlastikSellPrice","components":[{"type":"address","name":"buyer","internalType":"address"},{"type":"uint256","name":"ratio","internalType":"uint256"},{"type":"uint256","name":"decimals","internalType":"uint256"},{"type":"uint96","name":"currency","internalType":"uint96"},{"type":"uint256","name":"timestamp","internalType":"uint256"},{"type":"address","name":"tokenAddress","internalType":"address"}]},{"type":"bytes","name":"signaturePrice","internalType":"bytes"}]},{"type":"bytes","name":"bidSignature","internalType":"bytes"},{"type":"tuple","name":"sellRequest","internalType":"struct NFTStoreFrontV2.SellRequest","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"address","name":"erc20Address","internalType":"address"},{"type":"uint96","name":"ngoFeePct","internalType":"uint96"},{"type":"address","name":"sellerAddress","internalType":"address"}]},{"type":"bytes","name":"sellSignature","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"executeBidLazyMintingRRG","inputs":[{"type":"tuple","name":"bid","internalType":"struct NFTStoreFrontV2.BidRequest","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"address","name":"erc20Address","internalType":"address"},{"type":"address","name":"sellerAddress","internalType":"address"},{"type":"address","name":"bidderAddress","internalType":"address"},{"type":"uint256","name":"biddingPrice","internalType":"uint256"},{"type":"tuple","name":"sellPrice","internalType":"struct NFTStoreFrontV2.PlastikSellPrice","components":[{"type":"address","name":"buyer","internalType":"address"},{"type":"uint256","name":"ratio","internalType":"uint256"},{"type":"uint256","name":"decimals","internalType":"uint256"},{"type":"uint96","name":"currency","internalType":"uint96"},{"type":"uint256","name":"timestamp","internalType":"uint256"},{"type":"address","name":"tokenAddress","internalType":"address"}]},{"type":"bytes","name":"signaturePrice","internalType":"bytes"}]},{"type":"bytes","name":"bidSignature","internalType":"bytes"},{"type":"tuple","name":"sellRequest","internalType":"struct NFTStoreFrontV2.SellRequest","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"address","name":"erc20Address","internalType":"address"},{"type":"uint96","name":"ngoFeePct","internalType":"uint96"},{"type":"address","name":"sellerAddress","internalType":"address"}]},{"type":"bytes","name":"sellSignature","internalType":"bytes"},{"type":"tuple","name":"voucher","internalType":"struct NFTVoucher","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"string","name":"tokenURI","internalType":"string"},{"type":"address","name":"creatorAddress","internalType":"address"},{"type":"uint96","name":"royalty","internalType":"uint96"}]},{"type":"bytes","name":"signature","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mixExistingArtWithLazyMintedRRGs","inputs":[{"type":"tuple","name":"purchase","internalType":"struct NFTStoreFrontV2.PurchaseSignatures","components":[{"type":"bytes","name":"artSellSignature","internalType":"bytes"},{"type":"bytes","name":"artVoucherSignature","internalType":"bytes"},{"type":"bytes[]","name":"rrgSellSignatures","internalType":"bytes[]"},{"type":"bytes[]","name":"rrgSignatures","internalType":"bytes[]"},{"type":"tuple","name":"sellPrice","internalType":"struct NFTStoreFrontV2.PlastikSellPrice","components":[{"type":"address","name":"buyer","internalType":"address"},{"type":"uint256","name":"ratio","internalType":"uint256"},{"type":"uint256","name":"decimals","internalType":"uint256"},{"type":"uint96","name":"currency","internalType":"uint96"},{"type":"uint256","name":"timestamp","internalType":"uint256"},{"type":"address","name":"tokenAddress","internalType":"address"}]},{"type":"bytes","name":"signaturePrice","internalType":"bytes"}]},{"type":"tuple","name":"artSellRequest","internalType":"struct NFTStoreFrontV2.SellRequest","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"address","name":"erc20Address","internalType":"address"},{"type":"uint96","name":"ngoFeePct","internalType":"uint96"},{"type":"address","name":"sellerAddress","internalType":"address"}]},{"type":"tuple[]","name":"rrgSellRequests","internalType":"struct NFTStoreFrontV2.SellRequest[]","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"address","name":"erc20Address","internalType":"address"},{"type":"uint96","name":"ngoFeePct","internalType":"uint96"},{"type":"address","name":"sellerAddress","internalType":"address"}]},{"type":"tuple[]","name":"rrgVouchers","internalType":"struct NFTVoucher[]","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"string","name":"tokenURI","internalType":"string"},{"type":"address","name":"creatorAddress","internalType":"address"},{"type":"uint96","name":"royalty","internalType":"uint96"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mixLazyMintedArtAndRRGs","inputs":[{"type":"tuple","name":"purchase","internalType":"struct NFTStoreFrontV2.PurchaseSignatures","components":[{"type":"bytes","name":"artSellSignature","internalType":"bytes"},{"type":"bytes","name":"artVoucherSignature","internalType":"bytes"},{"type":"bytes[]","name":"rrgSellSignatures","internalType":"bytes[]"},{"type":"bytes[]","name":"rrgSignatures","internalType":"bytes[]"},{"type":"tuple","name":"sellPrice","internalType":"struct NFTStoreFrontV2.PlastikSellPrice","components":[{"type":"address","name":"buyer","internalType":"address"},{"type":"uint256","name":"ratio","internalType":"uint256"},{"type":"uint256","name":"decimals","internalType":"uint256"},{"type":"uint96","name":"currency","internalType":"uint96"},{"type":"uint256","name":"timestamp","internalType":"uint256"},{"type":"address","name":"tokenAddress","internalType":"address"}]},{"type":"bytes","name":"signaturePrice","internalType":"bytes"}]},{"type":"tuple","name":"artSellRequest","internalType":"struct NFTStoreFrontV2.SellRequest","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"address","name":"erc20Address","internalType":"address"},{"type":"uint96","name":"ngoFeePct","internalType":"uint96"},{"type":"address","name":"sellerAddress","internalType":"address"}]},{"type":"tuple","name":"artVoucher","internalType":"struct NFTVoucher","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"string","name":"tokenURI","internalType":"string"},{"type":"address","name":"creatorAddress","internalType":"address"},{"type":"uint96","name":"royalty","internalType":"uint96"}]},{"type":"tuple[]","name":"rrgSellRequests","internalType":"struct NFTStoreFrontV2.SellRequest[]","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"address","name":"erc20Address","internalType":"address"},{"type":"uint96","name":"ngoFeePct","internalType":"uint96"},{"type":"address","name":"sellerAddress","internalType":"address"}]},{"type":"tuple[]","name":"rrgVouchers","internalType":"struct NFTVoucher[]","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"string","name":"tokenURI","internalType":"string"},{"type":"address","name":"creatorAddress","internalType":"address"},{"type":"uint96","name":"royalty","internalType":"uint96"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bytes4","name":"","internalType":"bytes4"}],"name":"onERC721Received","inputs":[{"type":"address","name":"operator","internalType":"address"},{"type":"address","name":"from","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"bytes","name":"data","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint96","name":"","internalType":"uint96"}],"name":"platformServiceFee","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"setPlatformServiceFee","inputs":[{"type":"uint96","name":"_platformFee","internalType":"uint96"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"setPriceValidator","inputs":[{"type":"address","name":"newValidator","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
Contract Creation Code
0x6101406040523480156200001257600080fd5b50604051620056183803806200561883398181016040528101906200003891906200042f565b6040518060400160405280600d81526020017f4e465453544f524546524f4e54000000000000000000000000000000000000008152506040518060400160405280600381526020017f312e300000000000000000000000000000000000000000000000000000000000815250620000c4620000b86200027460201b60201c565b6200027c60201b60201c565b60008280519060200120905060008280519060200120905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f90508260e081815250508161010081815250504660a081815250506200012d8184846200034060201b60201c565b608081815250503073ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff1681525050806101208181525050505050505083600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600060146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555080600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505062000545565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600083838346306040516020016200035d959493929190620004e8565b6040516020818303038152906040528051906020012090509392505050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620003ae8262000381565b9050919050565b620003c081620003a1565b8114620003cc57600080fd5b50565b600081519050620003e081620003b5565b92915050565b60006bffffffffffffffffffffffff82169050919050565b6200040981620003e6565b81146200041557600080fd5b50565b6000815190506200042981620003fe565b92915050565b600080600080608085870312156200044c576200044b6200037c565b5b60006200045c87828801620003cf565b94505060206200046f87828801620003cf565b9350506040620004828782880162000418565b92505060606200049587828801620003cf565b91505092959194509250565b6000819050919050565b620004b681620004a1565b82525050565b6000819050919050565b620004d181620004bc565b82525050565b620004e281620003a1565b82525050565b600060a082019050620004ff6000830188620004ab565b6200050e6020830187620004ab565b6200051d6040830186620004ab565b6200052c6060830185620004c6565b6200053b6080830184620004d7565b9695505050505050565b60805160a05160c05160e0516101005161012051615083620005956000396000612c8a01526000612ccc01526000612cab01526000612be001526000612c3601526000612c5f01526150836000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063715018a61161008c578063da04a09511610066578063da04a095146101fe578063e1c3b1401461021a578063f2fde38b1461024a578063fae5a83f14610266576100cf565b8063715018a6146101a65780638da5cb5b146101b0578063d027b928146101ce576100cf565b8063140baf99146100d4578063150b7a02146101045780632dec66b0146101345780634cd9b1df146101525780635e5641c51461016e5780636336db3c1461018a575b600080fd5b6100ee60048036038101906100e9919061323e565b610296565b6040516100fb9190613384565b60405180910390f35b61011e60048036038101906101199190613433565b6104ed565b60405161012b91906134f6565b60405180910390f35b61013c610587565b6040516101499190613538565b60405180910390f35b61016c6004803603810190610167919061361f565b6105a8565b005b61018860048036038101906101839190613703565b610be7565b005b6101a4600480360381019061019f91906137ac565b610e2d565b005b6101ae611323565b005b6101b8611337565b6040516101c591906138b2565b60405180910390f35b6101e860048036038101906101e391906138cd565b611360565b6040516101f59190613384565b60405180910390f35b61021860048036038101906102139190613992565b611599565b005b610234600480360381019061022f9190613acd565b61171f565b6040516102419190613384565b60405180910390f35b610264600480360381019061025f9190613afa565b6117b4565b005b610280600480360381019061027b9190613afa565b611838565b60405161028d9190613384565b60405180910390f35b60006102c88a60c0018b8061018001906102b09190613b36565b8a60600160208101906102c39190613afa565b61188c565b5060006102d68b8b8b611b77565b90506102fb818c8a8860000160208101906102f19190613afa565b8960200135611c7f565b6000610308898989611ef0565b905061032c818a8e60000160208101906103229190613afa565b8f60200135611ff8565b85600001602081019061033f9190613afa565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb7838888886040518563ffffffff1660e01b815260040161037d9493929190613db9565b602060405180830381600087803b15801561039757600080fd5b505af11580156103ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103cf9190613e15565b5060006104186103e68e60a001358f60c001612144565b60018c60800160208101906103fb9190613acd565b8d600001602081019061040e9190613afa565b8e60200135612212565b905061044a8d60800160208101906104309190613afa565b838c60600160208101906104449190613afa565b84612496565b8c608001602081019061045d9190613afa565b73ffffffffffffffffffffffffffffffffffffffff168d602001358e606001602081019061048b9190613afa565b73ffffffffffffffffffffffffffffffffffffffff167fec34853c156da04e4792f1c735112ae54e5ed52bac58db5014b26746f306a36260016040516104d19190613e87565b60405180910390a4600193505050509998505050505050505050565b60003373ffffffffffffffffffffffffffffffffffffffff168383604051610516929190613ed2565b6000604051808303816000865af19150503d8060008114610553576040519150601f19603f3d011682016040523d82523d6000602084013e610558565b606091505b5050507f150b7a023d4804d13e8c85fb27262cb750cf6ba9f9dd3bb30d90f482ceeb4b1f905095945050505050565b60008060149054906101000a90046bffffffffffffffffffffffff16905090565b6105e48560000160208101906105be9190613afa565b7f80ac58cd0000000000000000000000000000000000000000000000000000000061285c565b610623576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161061a90613f48565b60405180910390fd5b610653866080018780610140019061063b9190613b36565b88606001602081019061064e9190613afa565b61188c565b50600061066f8688806000019061066a9190613b36565b611ef0565b905061069381878860000160208101906106899190613afa565b8960200135611ff8565b8560000160208101906106a69190613afa565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e8760a00160208101906106d49190613afa565b6106dc612881565b89602001356040518463ffffffff1660e01b81526004016106ff93929190613f77565b600060405180830381600087803b15801561071957600080fd5b505af115801561072d573d6000803e3d6000fd5b50505050600061077961074788604001358a608001612144565b600189608001602081019061075c9190613acd565b8a600001602081019061076f9190613afa565b8b60200135612212565b90506107b2610786612881565b8860a00160208101906107999190613afa565b8960600160208101906107ac9190613afa565b84612496565b60005b848490508160ff161015610bdc57600061081f88888460ff168181106107de576107dd613fae565b5b905060c002018b80604001906107f49190613fdd565b8560ff1681811061080857610807613fae565b5b905060200281019061081a9190613b36565b611ef0565b90506108ac8189898560ff1681811061083b5761083a613fae565b5b905060c0020188888660ff1681811061085757610856613fae565b5b90506020028101906108699190614040565b600001602081019061087b9190613afa565b89898760ff1681811061089157610890613fae565b5b90506020028101906108a39190614040565b60200135611ff8565b600086868460ff168181106108c4576108c3613fae565b5b90506020028101906108d69190614040565b60000160208101906108e89190613afa565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb761090b612881565b89898760ff1681811061092157610920613fae565b5b90506020028101906109339190614040565b8e80606001906109439190613fdd565b8860ff1681811061095757610956613fae565b5b90506020028101906109699190613b36565b6040518563ffffffff1660e01b81526004016109889493929190613db9565b602060405180830381600087803b1580156109a257600080fd5b505af11580156109b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109da9190613e15565b905086868460ff168181106109f2576109f1613fae565b5b9050602002810190610a049190614040565b6000016020810190610a169190613afa565b73ffffffffffffffffffffffffffffffffffffffff1663e2ece3ff610a39612881565b838d6000016020810190610a4d9190613afa565b8e602001356040518563ffffffff1660e01b8152600401610a719493929190614068565b600060405180830381600087803b158015610a8b57600080fd5b505af1158015610a9f573d6000803e3d6000fd5b505050506000610b57610ad48b8b8760ff16818110610ac157610ac0613fae565b5b905060c00201604001358e608001612144565b60018c8c8860ff16818110610aec57610aeb613fae565b5b905060c002016080016020810190610b049190613acd565b8d8d8960ff16818110610b1a57610b19613fae565b5b905060c002016000016020810190610b329190613afa565b8e8e8a60ff16818110610b4857610b47613fae565b5b905060c0020160200135612212565b9050610bc6610b64612881565b8b8b8760ff16818110610b7a57610b79613fae565b5b905060c0020160a0016020810190610b929190613afa565b8c8c8860ff16818110610ba857610ba7613fae565b5b905060c002016060016020810190610bc09190613afa565b84612496565b5050508080610bd4906140e9565b9150506107b5565b505050505050505050565b610c05838383896060016020810190610c009190613afa565b61188c565b506000610c13878787611ef0565b90508660a0016020810190610c289190613afa565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8c9061415f565b60405180910390fd5b866000016020810190610ca89190613afa565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e8860a0016020810190610cd69190613afa565b610cde612881565b8a602001356040518463ffffffff1660e01b8152600401610d0193929190613f77565b600060405180830381600087803b158015610d1b57600080fd5b505af1158015610d2f573d6000803e3d6000fd5b50505050610d3b612881565b73ffffffffffffffffffffffffffffffffffffffff1687602001358273ffffffffffffffffffffffffffffffffffffffff167fb10197cef009fd301a90b892d25451c22c3701eb18ee2df1250d31e514fff3946001604051610d9d9190613e87565b60405180910390a46000610dea610db8896040013587612144565b60018a6080016020810190610dcd9190613acd565b8b6000016020810190610de09190613afa565b8c60200135612212565b9050610e23610df7612881565b8960a0016020810190610e0a9190613afa565b8a6060016020810190610e1d9190613afa565b84612496565b5050505050505050565b610e5d8760800188806101400190610e459190613b36565b896060016020810190610e589190613afa565b61188c565b506000610e7987898060000190610e749190613b36565b611ef0565b9050610e9d8188886000016020810190610e939190613afa565b8960200135611ff8565b856000016020810190610eb09190613afa565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb7610ed3612881565b888b8060200190610ee49190613b36565b6040518563ffffffff1660e01b8152600401610f039493929190613db9565b602060405180830381600087803b158015610f1d57600080fd5b505af1158015610f31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f559190613e15565b506000610f9e610f6c89604001358b608001612144565b60018a6080016020810190610f819190613acd565b8b6000016020810190610f949190613afa565b8c60200135612212565b9050610fd7610fab612881565b8960a0016020810190610fbe9190613afa565b8a6060016020810190610fd19190613afa565b84612496565b60005b848490508160ff16101561131757600085858360ff1681811061100057610fff613fae565b5b90506020028101906110129190614040565b60000160208101906110249190613afa565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb7611047612881565b88888660ff1681811061105d5761105c613fae565b5b905060200281019061106f9190614040565b8e806060019061107f9190613fdd565b8760ff1681811061109357611092613fae565b5b90506020028101906110a59190613b36565b6040518563ffffffff1660e01b81526004016110c49493929190613db9565b602060405180830381600087803b1580156110de57600080fd5b505af11580156110f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111169190613e15565b905085858360ff1681811061112e5761112d613fae565b5b90506020028101906111409190614040565b60000160208101906111529190613afa565b73ffffffffffffffffffffffffffffffffffffffff1663e2ece3ff611175612881565b838c60000160208101906111899190613afa565b8d602001356040518563ffffffff1660e01b81526004016111ad9493929190614068565b600060405180830381600087803b1580156111c757600080fd5b505af11580156111db573d6000803e3d6000fd5b5050505060006112936112108a8a8660ff168181106111fd576111fc613fae565b5b905060c00201604001358e608001612144565b60018b8b8760ff1681811061122857611227613fae565b5b905060c0020160800160208101906112409190613acd565b8c8c8860ff1681811061125657611255613fae565b5b905060c00201600001602081019061126e9190613afa565b8d8d8960ff1681811061128457611283613fae565b5b905060c0020160200135612212565b90506113026112a0612881565b8a8a8660ff168181106112b6576112b5613fae565b5b905060c0020160a00160208101906112ce9190613afa565b8b8b8760ff168181106112e4576112e3613fae565b5b905060c0020160600160208101906112fc9190613afa565b84612496565b5050808061130f906140e9565b915050610fda565b50505050505050505050565b61132b612889565b6113356000612907565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60006113928760c0018880610180019061137a9190613b36565b87606001602081019061138d9190613afa565b61188c565b5060006113a0888888611b77565b90506113c58189878860000160208101906113bb9190613afa565b8960200135611c7f565b8760000160208101906113d89190613afa565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e8960600160208101906114069190613afa565b8a60800160208101906114199190613afa565b8b602001356040518463ffffffff1660e01b815260040161143c93929190613f77565b600060405180830381600087803b15801561145657600080fd5b505af115801561146a573d6000803e3d6000fd5b5050505060006114b66114848a60a001358b60c001612144565b60018860800160208101906114999190613acd565b8c60000160208101906114ac9190613afa565b8d60200135612212565b90506114fa8960800160208101906114ce9190613afa565b8a60600160208101906114e19190613afa565b8860600160208101906114f49190613afa565b84612496565b88608001602081019061150d9190613afa565b73ffffffffffffffffffffffffffffffffffffffff1689602001358a606001602081019061153b9190613afa565b73ffffffffffffffffffffffffffffffffffffffff167fec34853c156da04e4792f1c735112ae54e5ed52bac58db5014b26746f306a36260016040516115819190613e87565b60405180910390a46001925050509695505050505050565b6115b78383838c60600160208101906115b29190613afa565b61188c565b5060006115c58a8a8a611ef0565b90506115e9818b8960000160208101906115df9190613afa565b8a60200135611ff8565b8660000160208101906115fc9190613afa565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb761161f612881565b8989896040518563ffffffff1660e01b81526004016116419493929190613db9565b602060405180830381600087803b15801561165b57600080fd5b505af115801561166f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116939190613e15565b5060006116d96116a78c6040013587612144565b60018d60800160208101906116bc9190613acd565b8e60000160208101906116cf9190613afa565b8f60200135612212565b90506117126116e6612881565b8c60a00160208101906116f99190613afa565b8d606001602081019061170c9190613afa565b84612496565b5050505050505050505050565b6000611729612889565b81600060146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055507fd93dd360d98fc20e8a1fed3ac984811d257edb945d5612328d87c1123eb42de8600060149054906101000a90046bffffffffffffffffffffffff166040516117a39190613538565b60405180910390a160019050919050565b6117bc612889565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561182c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611823906141f1565b60405180910390fd5b61183581612907565b50565b6000611842612889565b81600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b60008061192c7fe5579de087ffe1e52529a6be897e847ac3bf17870732c42155c69a1fe0c8f7648760000160208101906118c69190613afa565b886020013589604001358a60600160208101906118e39190613acd565b8b608001358c60a00160208101906118fb9190613afa565b604051602001611911979695949392919061422a565b604051602081830303815290604052805190602001206129cb565b9050600061197e8287878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506129e5565b9050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611a10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a07906142e5565b60405180910390fd5b866000016020810190611a239190613afa565b73ffffffffffffffffffffffffffffffffffffffff16611a41612881565b73ffffffffffffffffffffffffffffffffffffffff1614611a97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a8e90614351565b60405180910390fd5b8660a0016020810190611aaa9190613afa565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614611b17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b0e906143bd565b60405180910390fd5b6102588760800135611b2991906143dd565b4210611b6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b619061447f565b60405180910390fd5b8092505050949350505050565b600080611c257ff4b6c9318e472ce88743d274a0fc462a01c286f3d6853c27215e84b55ab87812866000016020810190611bb19190613afa565b8760200135886040016020810190611bc99190613afa565b896060016020810190611bdc9190613afa565b8a6080016020810190611bef9190613afa565b8b60a00135604051602001611c0a979695949392919061449f565b604051602081830303815290604052805190602001206129cb565b9050611c758185858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506129e5565b9150509392505050565b836080016020810190611c929190613afa565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614611cff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cf69061455a565b60405180910390fd5b8260a0016020810190611d129190613afa565b73ffffffffffffffffffffffffffffffffffffffff16846060016020810190611d3b9190613afa565b73ffffffffffffffffffffffffffffffffffffffff1614611d91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d889061415f565b60405180910390fd5b826060016020810190611da49190613afa565b73ffffffffffffffffffffffffffffffffffffffff16846040016020810190611dcd9190613afa565b73ffffffffffffffffffffffffffffffffffffffff1614611e23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e1a906145c6565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff16846000016020810190611e4d9190613afa565b73ffffffffffffffffffffffffffffffffffffffff1614611ea3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e9a90614632565b60405180910390fd5b80846020013514611ee9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ee09061469e565b60405180910390fd5b5050505050565b600080611f9e7f0227bfb59f2b64de4a76ceeb40f29a3307bf4135abb650aa8d0b824adbe4d673866000016020810190611f2a9190613afa565b87602001358860400135896060016020810190611f479190613afa565b8a6080016020810190611f5a9190613acd565b8b60a0016020810190611f6d9190613afa565b604051602001611f8397969594939291906146be565b604051602081830303815290604052805190602001206129cb565b9050611fee8185858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506129e5565b9150509392505050565b8260a001602081019061200b9190613afa565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614612078576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206f9061415f565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff168360000160208101906120a29190613afa565b73ffffffffffffffffffffffffffffffffffffffff16146120f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ef90614632565b60405180910390fd5b8083602001351461213e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121359061469e565b60405180910390fd5b50505050565b60008082606001602081019061215a9190613acd565b6bffffffffffffffffffffffff1614156121765782905061220c565b600182606001602081019061218b9190613acd565b6bffffffffffffffffffffffff1614156121d15781602001358260400135600a6121b59190614860565b846121c091906148ab565b6121ca9190614934565b905061220c565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612203906149d7565b60405180910390fd5b92915050565b61221a613127565b612710612266600060149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16866bffffffffffffffffffffffff16612a0c90919063ffffffff16565b11156122a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161229e90614a43565b60405180910390fd5b600080600080888a6122b991906148ab565b9050600061230c6127106122fe600060149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff1685612a2290919063ffffffff16565b612a3890919063ffffffff16565b905060006123456127106123378c6bffffffffffffffffffffffff1686612a2290919063ffffffff16565b612a3890919063ffffffff16565b9050600061236e826123608587612a4e90919063ffffffff16565b612a4e90919063ffffffff16565b905061239a8a7f2a55205a0000000000000000000000000000000000000000000000000000000061285c565b15612432578973ffffffffffffffffffffffffffffffffffffffff16632a55205a8a836040518363ffffffff1660e01b81526004016123da929190614a63565b604080518083038186803b1580156123f157600080fd5b505afa158015612405573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124299190614aa1565b80965081975050505b6124458582612a4e90919063ffffffff16565b96506040518060a001604052808481526020018381526020018881526020018681526020018773ffffffffffffffffffffffffffffffffffffffff1681525097505050505050505095945050505050565b600082905060008260000151111561259d578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685600001516040518463ffffffff1660e01b815260040161250b93929190613f77565b602060405180830381600087803b15801561252557600080fd5b505af1158015612539573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061255d9190614b0d565b61259c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161259390614b86565b60405180910390fd5b5b60008260200151111561269f578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685602001516040518463ffffffff1660e01b815260040161260d93929190613f77565b602060405180830381600087803b15801561262757600080fd5b505af115801561263b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061265f9190614b0d565b61269e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161269590614b86565b60405180910390fd5b5b600082606001511115612783578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86846080015185606001516040518463ffffffff1660e01b81526004016126f193929190613f77565b602060405180830381600087803b15801561270b57600080fd5b505af115801561271f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127439190614b0d565b612782576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161277990614b86565b60405180910390fd5b5b8073ffffffffffffffffffffffffffffffffffffffff166323b872dd868685604001516040518463ffffffff1660e01b81526004016127c493929190613f77565b602060405180830381600087803b1580156127de57600080fd5b505af11580156127f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128169190614b0d565b612855576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161284c90614b86565b60405180910390fd5b5050505050565b600061286783612a64565b801561287957506128788383612ab1565b5b905092915050565b600033905090565b612891612881565b73ffffffffffffffffffffffffffffffffffffffff166128af611337565b73ffffffffffffffffffffffffffffffffffffffff1614612905576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128fc90614bf2565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60006129de6129d8612bdc565b83612cf6565b9050919050565b60008060006129f48585612d29565b91509150612a0181612dac565b819250505092915050565b60008183612a1a91906143dd565b905092915050565b60008183612a3091906148ab565b905092915050565b60008183612a469190614934565b905092915050565b60008183612a5c9190614c12565b905092915050565b6000612a90827f01ffc9a700000000000000000000000000000000000000000000000000000000612ab1565b8015612aaa5750612aa88263ffffffff60e01b612ab1565b155b9050919050565b6000806301ffc9a760e01b83604051602401612acd91906134f6565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090506000808573ffffffffffffffffffffffffffffffffffffffff1661753084604051612b579190614cb5565b6000604051808303818686fa925050503d8060008114612b93576040519150601f19603f3d011682016040523d82523d6000602084013e612b98565b606091505b5091509150602081511015612bb35760009350505050612bd6565b818015612bd0575080806020019051810190612bcf9190614b0d565b5b93505050505b92915050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16148015612c5857507f000000000000000000000000000000000000000000000000000000000000000046145b15612c85577f00000000000000000000000000000000000000000000000000000000000000009050612cf3565b612cf07f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f0000000000000000000000000000000000000000000000000000000000000000612f81565b90505b90565b60008282604051602001612d0b929190614d44565b60405160208183030381529060405280519060200120905092915050565b600080604183511415612d6b5760008060006020860151925060408601519150606086015160001a9050612d5f87828585612fbb565b94509450505050612da5565b604083511415612d9c576000806020850151915060408501519050612d918683836130c8565b935093505050612da5565b60006002915091505b9250929050565b60006004811115612dc057612dbf614d7b565b5b816004811115612dd357612dd2614d7b565b5b1415612dde57612f7e565b60016004811115612df257612df1614d7b565b5b816004811115612e0557612e04614d7b565b5b1415612e46576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e3d90614df6565b60405180910390fd5b60026004811115612e5a57612e59614d7b565b5b816004811115612e6d57612e6c614d7b565b5b1415612eae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ea590614e62565b60405180910390fd5b60036004811115612ec257612ec1614d7b565b5b816004811115612ed557612ed4614d7b565b5b1415612f16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f0d90614ef4565b60405180910390fd5b600480811115612f2957612f28614d7b565b5b816004811115612f3c57612f3b614d7b565b5b1415612f7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f7490614f86565b60405180910390fd5b5b50565b60008383834630604051602001612f9c959493929190614fa6565b6040516020818303038152906040528051906020012090509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115612ff65760006003915091506130bf565b601b8560ff161415801561300e5750601c8560ff1614155b156130205760006004915091506130bf565b6000600187878787604051600081526020016040526040516130459493929190615008565b6020604051602081039080840390855afa158015613067573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156130b6576000600192509250506130bf565b80600092509250505b94509492505050565b60008060007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60001b841690506000601b60ff8660001c901c61310b91906143dd565b905061311987828885612fbb565b935093505050935093915050565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b600080fd5b600080fd5b600080fd5b60006101a0828403121561319257613191613176565b5b81905092915050565b600080fd5b600080fd5b600080fd5b60008083601f8401126131c0576131bf61319b565b5b8235905067ffffffffffffffff8111156131dd576131dc6131a0565b5b6020830191508360018202830111156131f9576131f86131a5565b5b9250929050565b600060c0828403121561321657613215613176565b5b81905092915050565b600060a0828403121561323557613234613176565b5b81905092915050565b60008060008060008060008060006101608a8c0312156132615761326061316c565b5b60008a013567ffffffffffffffff81111561327f5761327e613171565b5b61328b8c828d0161317b565b99505060208a013567ffffffffffffffff8111156132ac576132ab613171565b5b6132b88c828d016131aa565b985098505060406132cb8c828d01613200565b9650506101008a013567ffffffffffffffff8111156132ed576132ec613171565b5b6132f98c828d016131aa565b95509550506101208a013567ffffffffffffffff81111561331d5761331c613171565b5b6133298c828d0161321f565b9350506101408a013567ffffffffffffffff81111561334b5761334a613171565b5b6133578c828d016131aa565b92509250509295985092959850929598565b60008115159050919050565b61337e81613369565b82525050565b60006020820190506133996000830184613375565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006133ca8261339f565b9050919050565b6133da816133bf565b81146133e557600080fd5b50565b6000813590506133f7816133d1565b92915050565b6000819050919050565b613410816133fd565b811461341b57600080fd5b50565b60008135905061342d81613407565b92915050565b60008060008060006080868803121561344f5761344e61316c565b5b600061345d888289016133e8565b955050602061346e888289016133e8565b945050604061347f8882890161341e565b935050606086013567ffffffffffffffff8111156134a05761349f613171565b5b6134ac888289016131aa565b92509250509295509295909350565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6134f0816134bb565b82525050565b600060208201905061350b60008301846134e7565b92915050565b60006bffffffffffffffffffffffff82169050919050565b61353281613511565b82525050565b600060208201905061354d6000830184613529565b92915050565b6000610160828403121561356a57613569613176565b5b81905092915050565b60008083601f8401126135895761358861319b565b5b8235905067ffffffffffffffff8111156135a6576135a56131a0565b5b6020830191508360c08202830111156135c2576135c16131a5565b5b9250929050565b60008083601f8401126135df576135de61319b565b5b8235905067ffffffffffffffff8111156135fc576135fb6131a0565b5b602083019150836020820283011115613618576136176131a5565b5b9250929050565b600080600080600080610120878903121561363d5761363c61316c565b5b600087013567ffffffffffffffff81111561365b5761365a613171565b5b61366789828a01613553565b965050602061367889828a01613200565b95505060e087013567ffffffffffffffff81111561369957613698613171565b5b6136a589828a01613573565b945094505061010087013567ffffffffffffffff8111156136c9576136c8613171565b5b6136d589828a016135c9565b92509250509295509295509295565b600060c082840312156136fa576136f9613176565b5b81905092915050565b6000806000806000806101c087890312156137215761372061316c565b5b600061372f89828a01613200565b96505060c087013567ffffffffffffffff8111156137505761374f613171565b5b61375c89828a016131aa565b955095505060e061376f89828a016136e4565b9350506101a087013567ffffffffffffffff81111561379157613790613171565b5b61379d89828a016131aa565b92509250509295509295509295565b6000806000806000806000610140888a0312156137cc576137cb61316c565b5b600088013567ffffffffffffffff8111156137ea576137e9613171565b5b6137f68a828b01613553565b97505060206138078a828b01613200565b96505060e088013567ffffffffffffffff81111561382857613827613171565b5b6138348a828b0161321f565b95505061010088013567ffffffffffffffff81111561385657613855613171565b5b6138628a828b01613573565b945094505061012088013567ffffffffffffffff81111561388657613885613171565b5b6138928a828b016135c9565b925092505092959891949750929550565b6138ac816133bf565b82525050565b60006020820190506138c760008301846138a3565b92915050565b60008060008060008061012087890312156138eb576138ea61316c565b5b600087013567ffffffffffffffff81111561390957613908613171565b5b61391589828a0161317b565b965050602087013567ffffffffffffffff81111561393657613935613171565b5b61394289828a016131aa565b9550955050604061395589828a01613200565b93505061010087013567ffffffffffffffff81111561397757613976613171565b5b61398389828a016131aa565b92509250509295509295509295565b60008060008060008060008060006102008a8c0312156139b5576139b461316c565b5b60006139c38c828d01613200565b99505060c08a013567ffffffffffffffff8111156139e4576139e3613171565b5b6139f08c828d016131aa565b985098505060e08a013567ffffffffffffffff811115613a1357613a12613171565b5b613a1f8c828d0161321f565b9650506101008a013567ffffffffffffffff811115613a4157613a40613171565b5b613a4d8c828d016131aa565b9550955050610120613a618c828d016136e4565b9350506101e08a013567ffffffffffffffff811115613a8357613a82613171565b5b613a8f8c828d016131aa565b92509250509295985092959850929598565b613aaa81613511565b8114613ab557600080fd5b50565b600081359050613ac781613aa1565b92915050565b600060208284031215613ae357613ae261316c565b5b6000613af184828501613ab8565b91505092915050565b600060208284031215613b1057613b0f61316c565b5b6000613b1e848285016133e8565b91505092915050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112613b5357613b52613b27565b5b80840192508235915067ffffffffffffffff821115613b7557613b74613b2c565b5b602083019250600182023603831315613b9157613b90613b31565b5b509250929050565b6000613ba860208401846133e8565b905092915050565b613bb9816133bf565b82525050565b6000613bce602084018461341e565b905092915050565b613bdf816133fd565b82525050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112613c1157613c10613bef565b5b83810192508235915060208301925067ffffffffffffffff821115613c3957613c38613be5565b5b600182023603841315613c4f57613c4e613bea565b5b509250929050565b600082825260208201905092915050565b82818337600083830152505050565b6000601f19601f8301169050919050565b6000613c948385613c57565b9350613ca1838584613c68565b613caa83613c77565b840190509392505050565b6000613cc46020840184613ab8565b905092915050565b613cd581613511565b82525050565b600060a08301613cee6000840184613b99565b613cfb6000860182613bb0565b50613d096020840184613bbf565b613d166020860182613bd6565b50613d246040840184613bf4565b8583036040870152613d37838284613c88565b92505050613d486060840184613b99565b613d556060860182613bb0565b50613d636080840184613cb5565b613d706080860182613ccc565b508091505092915050565b600082825260208201905092915050565b6000613d988385613d7b565b9350613da5838584613c68565b613dae83613c77565b840190509392505050565b6000606082019050613dce60008301876138a3565b8181036020830152613de08186613cdb565b90508181036040830152613df5818486613d8c565b905095945050505050565b600081519050613e0f81613407565b92915050565b600060208284031215613e2b57613e2a61316c565b5b6000613e3984828501613e00565b91505092915050565b6000819050919050565b6000819050919050565b6000613e71613e6c613e6784613e42565b613e4c565b6133fd565b9050919050565b613e8181613e56565b82525050565b6000602082019050613e9c6000830184613e78565b92915050565b600081905092915050565b6000613eb98385613ea2565b9350613ec6838584613c68565b82840190509392505050565b6000613edf828486613ead565b91508190509392505050565b600082825260208201905092915050565b7f4f6e6c7920616c6c6f7765642045524337323120746f6b656e73000000000000600082015250565b6000613f32601a83613eeb565b9150613f3d82613efc565b602082019050919050565b60006020820190508181036000830152613f6181613f25565b9050919050565b613f71816133fd565b82525050565b6000606082019050613f8c60008301866138a3565b613f9960208301856138a3565b613fa66040830184613f68565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083356001602003843603038112613ffa57613ff9613b27565b5b80840192508235915067ffffffffffffffff82111561401c5761401b613b2c565b5b60208301925060208202360383131561403857614037613b31565b5b509250929050565b60008235600160a00383360303811261405c5761405b613b27565b5b80830191505092915050565b600060808201905061407d60008301876138a3565b61408a6020830186613f68565b61409760408301856138a3565b6140a46060830184613f68565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600060ff82169050919050565b60006140f4826140dc565b915060ff821415614108576141076140ad565b5b600182019050919050565b7f496e76616c69642073656c6c6572206164647265737300000000000000000000600082015250565b6000614149601683613eeb565b915061415482614113565b602082019050919050565b600060208201905081810360008301526141788161413c565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006141db602683613eeb565b91506141e68261417f565b604082019050919050565b6000602082019050818103600083015261420a816141ce565b9050919050565b6000819050919050565b61422481614211565b82525050565b600060e08201905061423f600083018a61421b565b61424c60208301896138a3565b6142596040830188613f68565b6142666060830187613f68565b6142736080830186613529565b61428060a0830185613f68565b61428d60c08301846138a3565b98975050505050505050565b7f50726963652076616c696461746f7220696e76616c6964000000000000000000600082015250565b60006142cf601783613eeb565b91506142da82614299565b602082019050919050565b600060208201905081810360008301526142fe816142c2565b9050919050565b7f4275796572207369676e20707269636520696e76616c69640000000000000000600082015250565b600061433b601883613eeb565b915061434682614305565b602082019050919050565b6000602082019050818103600083015261436a8161432e565b9050919050565b7f657263546f6b656e20696e76616c696400000000000000000000000000000000600082015250565b60006143a7601083613eeb565b91506143b282614371565b602082019050919050565b600060208201905081810360008301526143d68161439a565b9050919050565b60006143e8826133fd565b91506143f3836133fd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614428576144276140ad565b5b828201905092915050565b7f5072696365206973206578706972656400000000000000000000000000000000600082015250565b6000614469601083613eeb565b915061447482614433565b602082019050919050565b600060208201905081810360008301526144988161445c565b9050919050565b600060e0820190506144b4600083018a61421b565b6144c160208301896138a3565b6144ce6040830188613f68565b6144db60608301876138a3565b6144e860808301866138a3565b6144f560a08301856138a3565b61450260c0830184613f68565b98975050505050505050565b7f496e76616c696420626964646572206164647265737300000000000000000000600082015250565b6000614544601683613eeb565b915061454f8261450e565b602082019050919050565b6000602082019050818103600083015261457381614537565b9050919050565b7f496e76616c6964207061796d656e7420746f6b656e2061646472657373000000600082015250565b60006145b0601d83613eeb565b91506145bb8261457a565b602082019050919050565b600060208201905081810360008301526145df816145a3565b9050919050565b7f496e76616c696420746f6b656e20616464726573730000000000000000000000600082015250565b600061461c601583613eeb565b9150614627826145e6565b602082019050919050565b6000602082019050818103600083015261464b8161460f565b9050919050565b7f496e76616c696420746f6b656e20696400000000000000000000000000000000600082015250565b6000614688601083613eeb565b915061469382614652565b602082019050919050565b600060208201905081810360008301526146b78161467b565b9050919050565b600060e0820190506146d3600083018a61421b565b6146e060208301896138a3565b6146ed6040830188613f68565b6146fa6060830187613f68565b61470760808301866138a3565b61471460a0830185613529565b61472160c08301846138a3565b98975050505050505050565b60008160011c9050919050565b6000808291508390505b6001851115614784578086048111156147605761475f6140ad565b5b600185161561476f5780820291505b808102905061477d8561472d565b9450614744565b94509492505050565b60008261479d5760019050614859565b816147ab5760009050614859565b81600181146147c157600281146147cb576147fa565b6001915050614859565b60ff8411156147dd576147dc6140ad565b5b8360020a9150848211156147f4576147f36140ad565b5b50614859565b5060208310610133831016604e8410600b841016171561482f5782820a90508381111561482a576148296140ad565b5b614859565b61483c848484600161473a565b92509050818404811115614853576148526140ad565b5b81810290505b9392505050565b600061486b826133fd565b9150614876836133fd565b92506148a37fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848461478d565b905092915050565b60006148b6826133fd565b91506148c1836133fd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156148fa576148f96140ad565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061493f826133fd565b915061494a836133fd565b92508261495a57614959614905565b5b828204905092915050565b7f43757272656e637920696e76616c696420666f7220707269636520636f6e766560008201527f7273696f6e000000000000000000000000000000000000000000000000000000602082015250565b60006149c1602583613eeb565b91506149cc82614965565b604082019050919050565b600060208201905081810360008301526149f0816149b4565b9050919050565b7f496e76616c696420706c6174666f726d20666565206f72204e474f2066656500600082015250565b6000614a2d601f83613eeb565b9150614a38826149f7565b602082019050919050565b60006020820190508181036000830152614a5c81614a20565b9050919050565b6000604082019050614a786000830185613f68565b614a856020830184613f68565b9392505050565b600081519050614a9b816133d1565b92915050565b60008060408385031215614ab857614ab761316c565b5b6000614ac685828601614a8c565b9250506020614ad785828601613e00565b9150509250929050565b614aea81613369565b8114614af557600080fd5b50565b600081519050614b0781614ae1565b92915050565b600060208284031215614b2357614b2261316c565b5b6000614b3184828501614af8565b91505092915050565b7f6661696c757265207768696c65207472616e7366657272696e67000000000000600082015250565b6000614b70601a83613eeb565b9150614b7b82614b3a565b602082019050919050565b60006020820190508181036000830152614b9f81614b63565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000614bdc602083613eeb565b9150614be782614ba6565b602082019050919050565b60006020820190508181036000830152614c0b81614bcf565b9050919050565b6000614c1d826133fd565b9150614c28836133fd565b925082821015614c3b57614c3a6140ad565b5b828203905092915050565b600081519050919050565b60005b83811015614c6f578082015181840152602081019050614c54565b83811115614c7e576000848401525b50505050565b6000614c8f82614c46565b614c998185613ea2565b9350614ca9818560208601614c51565b80840191505092915050565b6000614cc18284614c84565b915081905092915050565b600081905092915050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000614d0d600283614ccc565b9150614d1882614cd7565b600282019050919050565b6000819050919050565b614d3e614d3982614211565b614d23565b82525050565b6000614d4f82614d00565b9150614d5b8285614d2d565b602082019150614d6b8284614d2d565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000614de0601883613eeb565b9150614deb82614daa565b602082019050919050565b60006020820190508181036000830152614e0f81614dd3565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000614e4c601f83613eeb565b9150614e5782614e16565b602082019050919050565b60006020820190508181036000830152614e7b81614e3f565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000614ede602283613eeb565b9150614ee982614e82565b604082019050919050565b60006020820190508181036000830152614f0d81614ed1565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202776272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000614f70602283613eeb565b9150614f7b82614f14565b604082019050919050565b60006020820190508181036000830152614f9f81614f63565b9050919050565b600060a082019050614fbb600083018861421b565b614fc8602083018761421b565b614fd5604083018661421b565b614fe26060830185613f68565b614fef60808301846138a3565b9695505050505050565b615002816140dc565b82525050565b600060808201905061501d600083018761421b565b61502a6020830186614ff9565b615037604083018561421b565b615044606083018461421b565b9594505050505056fea2646970667358221220adb0db8186f00b151bc89eb2f34b9bfbd040e48391773d790c2d00d5d7f09f7964736f6c6343000809003300000000000000000000000022cac6a8e7ff5ce7b35c862cdd5a11c288aef1420000000000000000000000007f451e5ae38647778721f88015e81713c136dc0c00000000000000000000000000000000000000000000000000000000000007d00000000000000000000000004c45c6d2f8ccd5e90802e3caee85af67e89e9f2c
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063715018a61161008c578063da04a09511610066578063da04a095146101fe578063e1c3b1401461021a578063f2fde38b1461024a578063fae5a83f14610266576100cf565b8063715018a6146101a65780638da5cb5b146101b0578063d027b928146101ce576100cf565b8063140baf99146100d4578063150b7a02146101045780632dec66b0146101345780634cd9b1df146101525780635e5641c51461016e5780636336db3c1461018a575b600080fd5b6100ee60048036038101906100e9919061323e565b610296565b6040516100fb9190613384565b60405180910390f35b61011e60048036038101906101199190613433565b6104ed565b60405161012b91906134f6565b60405180910390f35b61013c610587565b6040516101499190613538565b60405180910390f35b61016c6004803603810190610167919061361f565b6105a8565b005b61018860048036038101906101839190613703565b610be7565b005b6101a4600480360381019061019f91906137ac565b610e2d565b005b6101ae611323565b005b6101b8611337565b6040516101c591906138b2565b60405180910390f35b6101e860048036038101906101e391906138cd565b611360565b6040516101f59190613384565b60405180910390f35b61021860048036038101906102139190613992565b611599565b005b610234600480360381019061022f9190613acd565b61171f565b6040516102419190613384565b60405180910390f35b610264600480360381019061025f9190613afa565b6117b4565b005b610280600480360381019061027b9190613afa565b611838565b60405161028d9190613384565b60405180910390f35b60006102c88a60c0018b8061018001906102b09190613b36565b8a60600160208101906102c39190613afa565b61188c565b5060006102d68b8b8b611b77565b90506102fb818c8a8860000160208101906102f19190613afa565b8960200135611c7f565b6000610308898989611ef0565b905061032c818a8e60000160208101906103229190613afa565b8f60200135611ff8565b85600001602081019061033f9190613afa565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb7838888886040518563ffffffff1660e01b815260040161037d9493929190613db9565b602060405180830381600087803b15801561039757600080fd5b505af11580156103ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103cf9190613e15565b5060006104186103e68e60a001358f60c001612144565b60018c60800160208101906103fb9190613acd565b8d600001602081019061040e9190613afa565b8e60200135612212565b905061044a8d60800160208101906104309190613afa565b838c60600160208101906104449190613afa565b84612496565b8c608001602081019061045d9190613afa565b73ffffffffffffffffffffffffffffffffffffffff168d602001358e606001602081019061048b9190613afa565b73ffffffffffffffffffffffffffffffffffffffff167fec34853c156da04e4792f1c735112ae54e5ed52bac58db5014b26746f306a36260016040516104d19190613e87565b60405180910390a4600193505050509998505050505050505050565b60003373ffffffffffffffffffffffffffffffffffffffff168383604051610516929190613ed2565b6000604051808303816000865af19150503d8060008114610553576040519150601f19603f3d011682016040523d82523d6000602084013e610558565b606091505b5050507f150b7a023d4804d13e8c85fb27262cb750cf6ba9f9dd3bb30d90f482ceeb4b1f905095945050505050565b60008060149054906101000a90046bffffffffffffffffffffffff16905090565b6105e48560000160208101906105be9190613afa565b7f80ac58cd0000000000000000000000000000000000000000000000000000000061285c565b610623576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161061a90613f48565b60405180910390fd5b610653866080018780610140019061063b9190613b36565b88606001602081019061064e9190613afa565b61188c565b50600061066f8688806000019061066a9190613b36565b611ef0565b905061069381878860000160208101906106899190613afa565b8960200135611ff8565b8560000160208101906106a69190613afa565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e8760a00160208101906106d49190613afa565b6106dc612881565b89602001356040518463ffffffff1660e01b81526004016106ff93929190613f77565b600060405180830381600087803b15801561071957600080fd5b505af115801561072d573d6000803e3d6000fd5b50505050600061077961074788604001358a608001612144565b600189608001602081019061075c9190613acd565b8a600001602081019061076f9190613afa565b8b60200135612212565b90506107b2610786612881565b8860a00160208101906107999190613afa565b8960600160208101906107ac9190613afa565b84612496565b60005b848490508160ff161015610bdc57600061081f88888460ff168181106107de576107dd613fae565b5b905060c002018b80604001906107f49190613fdd565b8560ff1681811061080857610807613fae565b5b905060200281019061081a9190613b36565b611ef0565b90506108ac8189898560ff1681811061083b5761083a613fae565b5b905060c0020188888660ff1681811061085757610856613fae565b5b90506020028101906108699190614040565b600001602081019061087b9190613afa565b89898760ff1681811061089157610890613fae565b5b90506020028101906108a39190614040565b60200135611ff8565b600086868460ff168181106108c4576108c3613fae565b5b90506020028101906108d69190614040565b60000160208101906108e89190613afa565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb761090b612881565b89898760ff1681811061092157610920613fae565b5b90506020028101906109339190614040565b8e80606001906109439190613fdd565b8860ff1681811061095757610956613fae565b5b90506020028101906109699190613b36565b6040518563ffffffff1660e01b81526004016109889493929190613db9565b602060405180830381600087803b1580156109a257600080fd5b505af11580156109b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109da9190613e15565b905086868460ff168181106109f2576109f1613fae565b5b9050602002810190610a049190614040565b6000016020810190610a169190613afa565b73ffffffffffffffffffffffffffffffffffffffff1663e2ece3ff610a39612881565b838d6000016020810190610a4d9190613afa565b8e602001356040518563ffffffff1660e01b8152600401610a719493929190614068565b600060405180830381600087803b158015610a8b57600080fd5b505af1158015610a9f573d6000803e3d6000fd5b505050506000610b57610ad48b8b8760ff16818110610ac157610ac0613fae565b5b905060c00201604001358e608001612144565b60018c8c8860ff16818110610aec57610aeb613fae565b5b905060c002016080016020810190610b049190613acd565b8d8d8960ff16818110610b1a57610b19613fae565b5b905060c002016000016020810190610b329190613afa565b8e8e8a60ff16818110610b4857610b47613fae565b5b905060c0020160200135612212565b9050610bc6610b64612881565b8b8b8760ff16818110610b7a57610b79613fae565b5b905060c0020160a0016020810190610b929190613afa565b8c8c8860ff16818110610ba857610ba7613fae565b5b905060c002016060016020810190610bc09190613afa565b84612496565b5050508080610bd4906140e9565b9150506107b5565b505050505050505050565b610c05838383896060016020810190610c009190613afa565b61188c565b506000610c13878787611ef0565b90508660a0016020810190610c289190613afa565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8c9061415f565b60405180910390fd5b866000016020810190610ca89190613afa565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e8860a0016020810190610cd69190613afa565b610cde612881565b8a602001356040518463ffffffff1660e01b8152600401610d0193929190613f77565b600060405180830381600087803b158015610d1b57600080fd5b505af1158015610d2f573d6000803e3d6000fd5b50505050610d3b612881565b73ffffffffffffffffffffffffffffffffffffffff1687602001358273ffffffffffffffffffffffffffffffffffffffff167fb10197cef009fd301a90b892d25451c22c3701eb18ee2df1250d31e514fff3946001604051610d9d9190613e87565b60405180910390a46000610dea610db8896040013587612144565b60018a6080016020810190610dcd9190613acd565b8b6000016020810190610de09190613afa565b8c60200135612212565b9050610e23610df7612881565b8960a0016020810190610e0a9190613afa565b8a6060016020810190610e1d9190613afa565b84612496565b5050505050505050565b610e5d8760800188806101400190610e459190613b36565b896060016020810190610e589190613afa565b61188c565b506000610e7987898060000190610e749190613b36565b611ef0565b9050610e9d8188886000016020810190610e939190613afa565b8960200135611ff8565b856000016020810190610eb09190613afa565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb7610ed3612881565b888b8060200190610ee49190613b36565b6040518563ffffffff1660e01b8152600401610f039493929190613db9565b602060405180830381600087803b158015610f1d57600080fd5b505af1158015610f31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f559190613e15565b506000610f9e610f6c89604001358b608001612144565b60018a6080016020810190610f819190613acd565b8b6000016020810190610f949190613afa565b8c60200135612212565b9050610fd7610fab612881565b8960a0016020810190610fbe9190613afa565b8a6060016020810190610fd19190613afa565b84612496565b60005b848490508160ff16101561131757600085858360ff1681811061100057610fff613fae565b5b90506020028101906110129190614040565b60000160208101906110249190613afa565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb7611047612881565b88888660ff1681811061105d5761105c613fae565b5b905060200281019061106f9190614040565b8e806060019061107f9190613fdd565b8760ff1681811061109357611092613fae565b5b90506020028101906110a59190613b36565b6040518563ffffffff1660e01b81526004016110c49493929190613db9565b602060405180830381600087803b1580156110de57600080fd5b505af11580156110f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111169190613e15565b905085858360ff1681811061112e5761112d613fae565b5b90506020028101906111409190614040565b60000160208101906111529190613afa565b73ffffffffffffffffffffffffffffffffffffffff1663e2ece3ff611175612881565b838c60000160208101906111899190613afa565b8d602001356040518563ffffffff1660e01b81526004016111ad9493929190614068565b600060405180830381600087803b1580156111c757600080fd5b505af11580156111db573d6000803e3d6000fd5b5050505060006112936112108a8a8660ff168181106111fd576111fc613fae565b5b905060c00201604001358e608001612144565b60018b8b8760ff1681811061122857611227613fae565b5b905060c0020160800160208101906112409190613acd565b8c8c8860ff1681811061125657611255613fae565b5b905060c00201600001602081019061126e9190613afa565b8d8d8960ff1681811061128457611283613fae565b5b905060c0020160200135612212565b90506113026112a0612881565b8a8a8660ff168181106112b6576112b5613fae565b5b905060c0020160a00160208101906112ce9190613afa565b8b8b8760ff168181106112e4576112e3613fae565b5b905060c0020160600160208101906112fc9190613afa565b84612496565b5050808061130f906140e9565b915050610fda565b50505050505050505050565b61132b612889565b6113356000612907565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60006113928760c0018880610180019061137a9190613b36565b87606001602081019061138d9190613afa565b61188c565b5060006113a0888888611b77565b90506113c58189878860000160208101906113bb9190613afa565b8960200135611c7f565b8760000160208101906113d89190613afa565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e8960600160208101906114069190613afa565b8a60800160208101906114199190613afa565b8b602001356040518463ffffffff1660e01b815260040161143c93929190613f77565b600060405180830381600087803b15801561145657600080fd5b505af115801561146a573d6000803e3d6000fd5b5050505060006114b66114848a60a001358b60c001612144565b60018860800160208101906114999190613acd565b8c60000160208101906114ac9190613afa565b8d60200135612212565b90506114fa8960800160208101906114ce9190613afa565b8a60600160208101906114e19190613afa565b8860600160208101906114f49190613afa565b84612496565b88608001602081019061150d9190613afa565b73ffffffffffffffffffffffffffffffffffffffff1689602001358a606001602081019061153b9190613afa565b73ffffffffffffffffffffffffffffffffffffffff167fec34853c156da04e4792f1c735112ae54e5ed52bac58db5014b26746f306a36260016040516115819190613e87565b60405180910390a46001925050509695505050505050565b6115b78383838c60600160208101906115b29190613afa565b61188c565b5060006115c58a8a8a611ef0565b90506115e9818b8960000160208101906115df9190613afa565b8a60200135611ff8565b8660000160208101906115fc9190613afa565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb761161f612881565b8989896040518563ffffffff1660e01b81526004016116419493929190613db9565b602060405180830381600087803b15801561165b57600080fd5b505af115801561166f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116939190613e15565b5060006116d96116a78c6040013587612144565b60018d60800160208101906116bc9190613acd565b8e60000160208101906116cf9190613afa565b8f60200135612212565b90506117126116e6612881565b8c60a00160208101906116f99190613afa565b8d606001602081019061170c9190613afa565b84612496565b5050505050505050505050565b6000611729612889565b81600060146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055507fd93dd360d98fc20e8a1fed3ac984811d257edb945d5612328d87c1123eb42de8600060149054906101000a90046bffffffffffffffffffffffff166040516117a39190613538565b60405180910390a160019050919050565b6117bc612889565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561182c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611823906141f1565b60405180910390fd5b61183581612907565b50565b6000611842612889565b81600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b60008061192c7fe5579de087ffe1e52529a6be897e847ac3bf17870732c42155c69a1fe0c8f7648760000160208101906118c69190613afa565b886020013589604001358a60600160208101906118e39190613acd565b8b608001358c60a00160208101906118fb9190613afa565b604051602001611911979695949392919061422a565b604051602081830303815290604052805190602001206129cb565b9050600061197e8287878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506129e5565b9050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611a10576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a07906142e5565b60405180910390fd5b866000016020810190611a239190613afa565b73ffffffffffffffffffffffffffffffffffffffff16611a41612881565b73ffffffffffffffffffffffffffffffffffffffff1614611a97576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a8e90614351565b60405180910390fd5b8660a0016020810190611aaa9190613afa565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614611b17576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b0e906143bd565b60405180910390fd5b6102588760800135611b2991906143dd565b4210611b6a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611b619061447f565b60405180910390fd5b8092505050949350505050565b600080611c257ff4b6c9318e472ce88743d274a0fc462a01c286f3d6853c27215e84b55ab87812866000016020810190611bb19190613afa565b8760200135886040016020810190611bc99190613afa565b896060016020810190611bdc9190613afa565b8a6080016020810190611bef9190613afa565b8b60a00135604051602001611c0a979695949392919061449f565b604051602081830303815290604052805190602001206129cb565b9050611c758185858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506129e5565b9150509392505050565b836080016020810190611c929190613afa565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614611cff576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cf69061455a565b60405180910390fd5b8260a0016020810190611d129190613afa565b73ffffffffffffffffffffffffffffffffffffffff16846060016020810190611d3b9190613afa565b73ffffffffffffffffffffffffffffffffffffffff1614611d91576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d889061415f565b60405180910390fd5b826060016020810190611da49190613afa565b73ffffffffffffffffffffffffffffffffffffffff16846040016020810190611dcd9190613afa565b73ffffffffffffffffffffffffffffffffffffffff1614611e23576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e1a906145c6565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff16846000016020810190611e4d9190613afa565b73ffffffffffffffffffffffffffffffffffffffff1614611ea3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611e9a90614632565b60405180910390fd5b80846020013514611ee9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ee09061469e565b60405180910390fd5b5050505050565b600080611f9e7f0227bfb59f2b64de4a76ceeb40f29a3307bf4135abb650aa8d0b824adbe4d673866000016020810190611f2a9190613afa565b87602001358860400135896060016020810190611f479190613afa565b8a6080016020810190611f5a9190613acd565b8b60a0016020810190611f6d9190613afa565b604051602001611f8397969594939291906146be565b604051602081830303815290604052805190602001206129cb565b9050611fee8185858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050506129e5565b9150509392505050565b8260a001602081019061200b9190613afa565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614612078576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206f9061415f565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff168360000160208101906120a29190613afa565b73ffffffffffffffffffffffffffffffffffffffff16146120f8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120ef90614632565b60405180910390fd5b8083602001351461213e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016121359061469e565b60405180910390fd5b50505050565b60008082606001602081019061215a9190613acd565b6bffffffffffffffffffffffff1614156121765782905061220c565b600182606001602081019061218b9190613acd565b6bffffffffffffffffffffffff1614156121d15781602001358260400135600a6121b59190614860565b846121c091906148ab565b6121ca9190614934565b905061220c565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612203906149d7565b60405180910390fd5b92915050565b61221a613127565b612710612266600060149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16866bffffffffffffffffffffffff16612a0c90919063ffffffff16565b11156122a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161229e90614a43565b60405180910390fd5b600080600080888a6122b991906148ab565b9050600061230c6127106122fe600060149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff1685612a2290919063ffffffff16565b612a3890919063ffffffff16565b905060006123456127106123378c6bffffffffffffffffffffffff1686612a2290919063ffffffff16565b612a3890919063ffffffff16565b9050600061236e826123608587612a4e90919063ffffffff16565b612a4e90919063ffffffff16565b905061239a8a7f2a55205a0000000000000000000000000000000000000000000000000000000061285c565b15612432578973ffffffffffffffffffffffffffffffffffffffff16632a55205a8a836040518363ffffffff1660e01b81526004016123da929190614a63565b604080518083038186803b1580156123f157600080fd5b505afa158015612405573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124299190614aa1565b80965081975050505b6124458582612a4e90919063ffffffff16565b96506040518060a001604052808481526020018381526020018881526020018681526020018773ffffffffffffffffffffffffffffffffffffffff1681525097505050505050505095945050505050565b600082905060008260000151111561259d578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685600001516040518463ffffffff1660e01b815260040161250b93929190613f77565b602060405180830381600087803b15801561252557600080fd5b505af1158015612539573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061255d9190614b0d565b61259c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161259390614b86565b60405180910390fd5b5b60008260200151111561269f578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685602001516040518463ffffffff1660e01b815260040161260d93929190613f77565b602060405180830381600087803b15801561262757600080fd5b505af115801561263b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061265f9190614b0d565b61269e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161269590614b86565b60405180910390fd5b5b600082606001511115612783578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86846080015185606001516040518463ffffffff1660e01b81526004016126f193929190613f77565b602060405180830381600087803b15801561270b57600080fd5b505af115801561271f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127439190614b0d565b612782576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161277990614b86565b60405180910390fd5b5b8073ffffffffffffffffffffffffffffffffffffffff166323b872dd868685604001516040518463ffffffff1660e01b81526004016127c493929190613f77565b602060405180830381600087803b1580156127de57600080fd5b505af11580156127f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128169190614b0d565b612855576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161284c90614b86565b60405180910390fd5b5050505050565b600061286783612a64565b801561287957506128788383612ab1565b5b905092915050565b600033905090565b612891612881565b73ffffffffffffffffffffffffffffffffffffffff166128af611337565b73ffffffffffffffffffffffffffffffffffffffff1614612905576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016128fc90614bf2565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b60006129de6129d8612bdc565b83612cf6565b9050919050565b60008060006129f48585612d29565b91509150612a0181612dac565b819250505092915050565b60008183612a1a91906143dd565b905092915050565b60008183612a3091906148ab565b905092915050565b60008183612a469190614934565b905092915050565b60008183612a5c9190614c12565b905092915050565b6000612a90827f01ffc9a700000000000000000000000000000000000000000000000000000000612ab1565b8015612aaa5750612aa88263ffffffff60e01b612ab1565b155b9050919050565b6000806301ffc9a760e01b83604051602401612acd91906134f6565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090506000808573ffffffffffffffffffffffffffffffffffffffff1661753084604051612b579190614cb5565b6000604051808303818686fa925050503d8060008114612b93576040519150601f19603f3d011682016040523d82523d6000602084013e612b98565b606091505b5091509150602081511015612bb35760009350505050612bd6565b818015612bd0575080806020019051810190612bcf9190614b0d565b5b93505050505b92915050565b60007f00000000000000000000000049d9421864d462fc5acf1feef94ef00a0e692b1373ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16148015612c5857507f000000000000000000000000000000000000000000000000000000000000a4ec46145b15612c85577f0c4002cd6bba85e33b8d7b622856ac325e564b1b1cd4478d29526b523eecc8159050612cf3565b612cf07f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f7f6733c731225d42eb85e5bd0ab4cb44b6cc33da50aaf97ab8d9eadd30a19b98607fe6bbd6277e1bf288eed5e8d1780f9a50b239e86b153736bceebccf4ea79d90b3612f81565b90505b90565b60008282604051602001612d0b929190614d44565b60405160208183030381529060405280519060200120905092915050565b600080604183511415612d6b5760008060006020860151925060408601519150606086015160001a9050612d5f87828585612fbb565b94509450505050612da5565b604083511415612d9c576000806020850151915060408501519050612d918683836130c8565b935093505050612da5565b60006002915091505b9250929050565b60006004811115612dc057612dbf614d7b565b5b816004811115612dd357612dd2614d7b565b5b1415612dde57612f7e565b60016004811115612df257612df1614d7b565b5b816004811115612e0557612e04614d7b565b5b1415612e46576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e3d90614df6565b60405180910390fd5b60026004811115612e5a57612e59614d7b565b5b816004811115612e6d57612e6c614d7b565b5b1415612eae576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ea590614e62565b60405180910390fd5b60036004811115612ec257612ec1614d7b565b5b816004811115612ed557612ed4614d7b565b5b1415612f16576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f0d90614ef4565b60405180910390fd5b600480811115612f2957612f28614d7b565b5b816004811115612f3c57612f3b614d7b565b5b1415612f7d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f7490614f86565b60405180910390fd5b5b50565b60008383834630604051602001612f9c959493929190614fa6565b6040516020818303038152906040528051906020012090509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115612ff65760006003915091506130bf565b601b8560ff161415801561300e5750601c8560ff1614155b156130205760006004915091506130bf565b6000600187878787604051600081526020016040526040516130459493929190615008565b6020604051602081039080840390855afa158015613067573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156130b6576000600192509250506130bf565b80600092509250505b94509492505050565b60008060007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60001b841690506000601b60ff8660001c901c61310b91906143dd565b905061311987828885612fbb565b935093505050935093915050565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b600080fd5b600080fd5b600080fd5b60006101a0828403121561319257613191613176565b5b81905092915050565b600080fd5b600080fd5b600080fd5b60008083601f8401126131c0576131bf61319b565b5b8235905067ffffffffffffffff8111156131dd576131dc6131a0565b5b6020830191508360018202830111156131f9576131f86131a5565b5b9250929050565b600060c0828403121561321657613215613176565b5b81905092915050565b600060a0828403121561323557613234613176565b5b81905092915050565b60008060008060008060008060006101608a8c0312156132615761326061316c565b5b60008a013567ffffffffffffffff81111561327f5761327e613171565b5b61328b8c828d0161317b565b99505060208a013567ffffffffffffffff8111156132ac576132ab613171565b5b6132b88c828d016131aa565b985098505060406132cb8c828d01613200565b9650506101008a013567ffffffffffffffff8111156132ed576132ec613171565b5b6132f98c828d016131aa565b95509550506101208a013567ffffffffffffffff81111561331d5761331c613171565b5b6133298c828d0161321f565b9350506101408a013567ffffffffffffffff81111561334b5761334a613171565b5b6133578c828d016131aa565b92509250509295985092959850929598565b60008115159050919050565b61337e81613369565b82525050565b60006020820190506133996000830184613375565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006133ca8261339f565b9050919050565b6133da816133bf565b81146133e557600080fd5b50565b6000813590506133f7816133d1565b92915050565b6000819050919050565b613410816133fd565b811461341b57600080fd5b50565b60008135905061342d81613407565b92915050565b60008060008060006080868803121561344f5761344e61316c565b5b600061345d888289016133e8565b955050602061346e888289016133e8565b945050604061347f8882890161341e565b935050606086013567ffffffffffffffff8111156134a05761349f613171565b5b6134ac888289016131aa565b92509250509295509295909350565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6134f0816134bb565b82525050565b600060208201905061350b60008301846134e7565b92915050565b60006bffffffffffffffffffffffff82169050919050565b61353281613511565b82525050565b600060208201905061354d6000830184613529565b92915050565b6000610160828403121561356a57613569613176565b5b81905092915050565b60008083601f8401126135895761358861319b565b5b8235905067ffffffffffffffff8111156135a6576135a56131a0565b5b6020830191508360c08202830111156135c2576135c16131a5565b5b9250929050565b60008083601f8401126135df576135de61319b565b5b8235905067ffffffffffffffff8111156135fc576135fb6131a0565b5b602083019150836020820283011115613618576136176131a5565b5b9250929050565b600080600080600080610120878903121561363d5761363c61316c565b5b600087013567ffffffffffffffff81111561365b5761365a613171565b5b61366789828a01613553565b965050602061367889828a01613200565b95505060e087013567ffffffffffffffff81111561369957613698613171565b5b6136a589828a01613573565b945094505061010087013567ffffffffffffffff8111156136c9576136c8613171565b5b6136d589828a016135c9565b92509250509295509295509295565b600060c082840312156136fa576136f9613176565b5b81905092915050565b6000806000806000806101c087890312156137215761372061316c565b5b600061372f89828a01613200565b96505060c087013567ffffffffffffffff8111156137505761374f613171565b5b61375c89828a016131aa565b955095505060e061376f89828a016136e4565b9350506101a087013567ffffffffffffffff81111561379157613790613171565b5b61379d89828a016131aa565b92509250509295509295509295565b6000806000806000806000610140888a0312156137cc576137cb61316c565b5b600088013567ffffffffffffffff8111156137ea576137e9613171565b5b6137f68a828b01613553565b97505060206138078a828b01613200565b96505060e088013567ffffffffffffffff81111561382857613827613171565b5b6138348a828b0161321f565b95505061010088013567ffffffffffffffff81111561385657613855613171565b5b6138628a828b01613573565b945094505061012088013567ffffffffffffffff81111561388657613885613171565b5b6138928a828b016135c9565b925092505092959891949750929550565b6138ac816133bf565b82525050565b60006020820190506138c760008301846138a3565b92915050565b60008060008060008061012087890312156138eb576138ea61316c565b5b600087013567ffffffffffffffff81111561390957613908613171565b5b61391589828a0161317b565b965050602087013567ffffffffffffffff81111561393657613935613171565b5b61394289828a016131aa565b9550955050604061395589828a01613200565b93505061010087013567ffffffffffffffff81111561397757613976613171565b5b61398389828a016131aa565b92509250509295509295509295565b60008060008060008060008060006102008a8c0312156139b5576139b461316c565b5b60006139c38c828d01613200565b99505060c08a013567ffffffffffffffff8111156139e4576139e3613171565b5b6139f08c828d016131aa565b985098505060e08a013567ffffffffffffffff811115613a1357613a12613171565b5b613a1f8c828d0161321f565b9650506101008a013567ffffffffffffffff811115613a4157613a40613171565b5b613a4d8c828d016131aa565b9550955050610120613a618c828d016136e4565b9350506101e08a013567ffffffffffffffff811115613a8357613a82613171565b5b613a8f8c828d016131aa565b92509250509295985092959850929598565b613aaa81613511565b8114613ab557600080fd5b50565b600081359050613ac781613aa1565b92915050565b600060208284031215613ae357613ae261316c565b5b6000613af184828501613ab8565b91505092915050565b600060208284031215613b1057613b0f61316c565b5b6000613b1e848285016133e8565b91505092915050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112613b5357613b52613b27565b5b80840192508235915067ffffffffffffffff821115613b7557613b74613b2c565b5b602083019250600182023603831315613b9157613b90613b31565b5b509250929050565b6000613ba860208401846133e8565b905092915050565b613bb9816133bf565b82525050565b6000613bce602084018461341e565b905092915050565b613bdf816133fd565b82525050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112613c1157613c10613bef565b5b83810192508235915060208301925067ffffffffffffffff821115613c3957613c38613be5565b5b600182023603841315613c4f57613c4e613bea565b5b509250929050565b600082825260208201905092915050565b82818337600083830152505050565b6000601f19601f8301169050919050565b6000613c948385613c57565b9350613ca1838584613c68565b613caa83613c77565b840190509392505050565b6000613cc46020840184613ab8565b905092915050565b613cd581613511565b82525050565b600060a08301613cee6000840184613b99565b613cfb6000860182613bb0565b50613d096020840184613bbf565b613d166020860182613bd6565b50613d246040840184613bf4565b8583036040870152613d37838284613c88565b92505050613d486060840184613b99565b613d556060860182613bb0565b50613d636080840184613cb5565b613d706080860182613ccc565b508091505092915050565b600082825260208201905092915050565b6000613d988385613d7b565b9350613da5838584613c68565b613dae83613c77565b840190509392505050565b6000606082019050613dce60008301876138a3565b8181036020830152613de08186613cdb565b90508181036040830152613df5818486613d8c565b905095945050505050565b600081519050613e0f81613407565b92915050565b600060208284031215613e2b57613e2a61316c565b5b6000613e3984828501613e00565b91505092915050565b6000819050919050565b6000819050919050565b6000613e71613e6c613e6784613e42565b613e4c565b6133fd565b9050919050565b613e8181613e56565b82525050565b6000602082019050613e9c6000830184613e78565b92915050565b600081905092915050565b6000613eb98385613ea2565b9350613ec6838584613c68565b82840190509392505050565b6000613edf828486613ead565b91508190509392505050565b600082825260208201905092915050565b7f4f6e6c7920616c6c6f7765642045524337323120746f6b656e73000000000000600082015250565b6000613f32601a83613eeb565b9150613f3d82613efc565b602082019050919050565b60006020820190508181036000830152613f6181613f25565b9050919050565b613f71816133fd565b82525050565b6000606082019050613f8c60008301866138a3565b613f9960208301856138a3565b613fa66040830184613f68565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b60008083356001602003843603038112613ffa57613ff9613b27565b5b80840192508235915067ffffffffffffffff82111561401c5761401b613b2c565b5b60208301925060208202360383131561403857614037613b31565b5b509250929050565b60008235600160a00383360303811261405c5761405b613b27565b5b80830191505092915050565b600060808201905061407d60008301876138a3565b61408a6020830186613f68565b61409760408301856138a3565b6140a46060830184613f68565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600060ff82169050919050565b60006140f4826140dc565b915060ff821415614108576141076140ad565b5b600182019050919050565b7f496e76616c69642073656c6c6572206164647265737300000000000000000000600082015250565b6000614149601683613eeb565b915061415482614113565b602082019050919050565b600060208201905081810360008301526141788161413c565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006141db602683613eeb565b91506141e68261417f565b604082019050919050565b6000602082019050818103600083015261420a816141ce565b9050919050565b6000819050919050565b61422481614211565b82525050565b600060e08201905061423f600083018a61421b565b61424c60208301896138a3565b6142596040830188613f68565b6142666060830187613f68565b6142736080830186613529565b61428060a0830185613f68565b61428d60c08301846138a3565b98975050505050505050565b7f50726963652076616c696461746f7220696e76616c6964000000000000000000600082015250565b60006142cf601783613eeb565b91506142da82614299565b602082019050919050565b600060208201905081810360008301526142fe816142c2565b9050919050565b7f4275796572207369676e20707269636520696e76616c69640000000000000000600082015250565b600061433b601883613eeb565b915061434682614305565b602082019050919050565b6000602082019050818103600083015261436a8161432e565b9050919050565b7f657263546f6b656e20696e76616c696400000000000000000000000000000000600082015250565b60006143a7601083613eeb565b91506143b282614371565b602082019050919050565b600060208201905081810360008301526143d68161439a565b9050919050565b60006143e8826133fd565b91506143f3836133fd565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115614428576144276140ad565b5b828201905092915050565b7f5072696365206973206578706972656400000000000000000000000000000000600082015250565b6000614469601083613eeb565b915061447482614433565b602082019050919050565b600060208201905081810360008301526144988161445c565b9050919050565b600060e0820190506144b4600083018a61421b565b6144c160208301896138a3565b6144ce6040830188613f68565b6144db60608301876138a3565b6144e860808301866138a3565b6144f560a08301856138a3565b61450260c0830184613f68565b98975050505050505050565b7f496e76616c696420626964646572206164647265737300000000000000000000600082015250565b6000614544601683613eeb565b915061454f8261450e565b602082019050919050565b6000602082019050818103600083015261457381614537565b9050919050565b7f496e76616c6964207061796d656e7420746f6b656e2061646472657373000000600082015250565b60006145b0601d83613eeb565b91506145bb8261457a565b602082019050919050565b600060208201905081810360008301526145df816145a3565b9050919050565b7f496e76616c696420746f6b656e20616464726573730000000000000000000000600082015250565b600061461c601583613eeb565b9150614627826145e6565b602082019050919050565b6000602082019050818103600083015261464b8161460f565b9050919050565b7f496e76616c696420746f6b656e20696400000000000000000000000000000000600082015250565b6000614688601083613eeb565b915061469382614652565b602082019050919050565b600060208201905081810360008301526146b78161467b565b9050919050565b600060e0820190506146d3600083018a61421b565b6146e060208301896138a3565b6146ed6040830188613f68565b6146fa6060830187613f68565b61470760808301866138a3565b61471460a0830185613529565b61472160c08301846138a3565b98975050505050505050565b60008160011c9050919050565b6000808291508390505b6001851115614784578086048111156147605761475f6140ad565b5b600185161561476f5780820291505b808102905061477d8561472d565b9450614744565b94509492505050565b60008261479d5760019050614859565b816147ab5760009050614859565b81600181146147c157600281146147cb576147fa565b6001915050614859565b60ff8411156147dd576147dc6140ad565b5b8360020a9150848211156147f4576147f36140ad565b5b50614859565b5060208310610133831016604e8410600b841016171561482f5782820a90508381111561482a576148296140ad565b5b614859565b61483c848484600161473a565b92509050818404811115614853576148526140ad565b5b81810290505b9392505050565b600061486b826133fd565b9150614876836133fd565b92506148a37fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848461478d565b905092915050565b60006148b6826133fd565b91506148c1836133fd565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04831182151516156148fa576148f96140ad565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b600061493f826133fd565b915061494a836133fd565b92508261495a57614959614905565b5b828204905092915050565b7f43757272656e637920696e76616c696420666f7220707269636520636f6e766560008201527f7273696f6e000000000000000000000000000000000000000000000000000000602082015250565b60006149c1602583613eeb565b91506149cc82614965565b604082019050919050565b600060208201905081810360008301526149f0816149b4565b9050919050565b7f496e76616c696420706c6174666f726d20666565206f72204e474f2066656500600082015250565b6000614a2d601f83613eeb565b9150614a38826149f7565b602082019050919050565b60006020820190508181036000830152614a5c81614a20565b9050919050565b6000604082019050614a786000830185613f68565b614a856020830184613f68565b9392505050565b600081519050614a9b816133d1565b92915050565b60008060408385031215614ab857614ab761316c565b5b6000614ac685828601614a8c565b9250506020614ad785828601613e00565b9150509250929050565b614aea81613369565b8114614af557600080fd5b50565b600081519050614b0781614ae1565b92915050565b600060208284031215614b2357614b2261316c565b5b6000614b3184828501614af8565b91505092915050565b7f6661696c757265207768696c65207472616e7366657272696e67000000000000600082015250565b6000614b70601a83613eeb565b9150614b7b82614b3a565b602082019050919050565b60006020820190508181036000830152614b9f81614b63565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b6000614bdc602083613eeb565b9150614be782614ba6565b602082019050919050565b60006020820190508181036000830152614c0b81614bcf565b9050919050565b6000614c1d826133fd565b9150614c28836133fd565b925082821015614c3b57614c3a6140ad565b5b828203905092915050565b600081519050919050565b60005b83811015614c6f578082015181840152602081019050614c54565b83811115614c7e576000848401525b50505050565b6000614c8f82614c46565b614c998185613ea2565b9350614ca9818560208601614c51565b80840191505092915050565b6000614cc18284614c84565b915081905092915050565b600081905092915050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000614d0d600283614ccc565b9150614d1882614cd7565b600282019050919050565b6000819050919050565b614d3e614d3982614211565b614d23565b82525050565b6000614d4f82614d00565b9150614d5b8285614d2d565b602082019150614d6b8284614d2d565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000614de0601883613eeb565b9150614deb82614daa565b602082019050919050565b60006020820190508181036000830152614e0f81614dd3565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000614e4c601f83613eeb565b9150614e5782614e16565b602082019050919050565b60006020820190508181036000830152614e7b81614e3f565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000614ede602283613eeb565b9150614ee982614e82565b604082019050919050565b60006020820190508181036000830152614f0d81614ed1565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202776272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b6000614f70602283613eeb565b9150614f7b82614f14565b604082019050919050565b60006020820190508181036000830152614f9f81614f63565b9050919050565b600060a082019050614fbb600083018861421b565b614fc8602083018761421b565b614fd5604083018661421b565b614fe26060830185613f68565b614fef60808301846138a3565b9695505050505050565b615002816140dc565b82525050565b600060808201905061501d600083018761421b565b61502a6020830186614ff9565b615037604083018561421b565b615044606083018461421b565b9594505050505056fea2646970667358221220adb0db8186f00b151bc89eb2f34b9bfbd040e48391773d790c2d00d5d7f09f7964736f6c63430008090033