Address Details
contract
0x854724CF06B047a8C0116C702472673864E508C4
- Contract Name
- NFTStoreFrontV2
- Creator
- 0x4c45c6–9e9f2c at 0xf66c86–0dc67f
- 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,021
- Last Balance Update
- 15962159
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:32:59.783020Z
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.5.0-rc.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, _msgSender()); _; } /** * @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 `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. */ 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. */ 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`. */ 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. * * [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. */ 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. */ 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-rc.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 v4.4.1 (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 Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { 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/IERC165.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol";
/_openzeppelin/contracts/interfaces/IERC2981.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0-rc.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "./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 payed 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 v4.4.1 (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 Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { 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 v4.4.1 (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: balance query for the zero address"); 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 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: transfer caller is not 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(); _beforeTokenTransfer(operator, from, to, _asSingletonArray(id), _asSingletonArray(amount), 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); _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); _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(); _beforeTokenTransfer(operator, address(0), to, _asSingletonArray(id), _asSingletonArray(amount), data); _balances[id][to] += amount; emit TransferSingle(operator, address(0), to, id, amount); _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * 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); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `from` * * 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(); _beforeTokenTransfer(operator, from, address(0), _asSingletonArray(id), _asSingletonArray(amount), ""); 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); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * 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); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {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 `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 _beforeTokenTransfer( 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 v4.4.1 (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 be 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-rc.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 v4.4.1 (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 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 owner nor approved" ); _burnBatch(account, ids, values); } }
/_openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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) { _totalSupply[ids[i]] -= amounts[i]; } } } }
/_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 v4.4.1 (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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 `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount ) external returns (bool); /** * @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); }
/_openzeppelin/contracts/token/ERC721/ERC721.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0-rc.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: balance query for the zero address"); 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: owner query for nonexistent token"); 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) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); 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 overriden 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 owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); 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: transfer caller is not 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: transfer caller is not 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) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, 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 a {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 a {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 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 { 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 v4.4.1 (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`, 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 be 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 Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @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 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); /** * @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; }
/_openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (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 `IERC721.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 v4.4.1 (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 irreversibly 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), "ERC721Burnable: caller is not 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 v4.4.1 (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) { require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token"); 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 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 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-rc.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.5.0-rc.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) external view 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: * * - `tokenId` must be already minted. * - `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.5.0-rc.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 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 v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @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); } }
/_openzeppelin/contracts/utils/cryptography/ECDSA.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0-rc.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. 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. 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 v4.4.1 (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 substraction 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 v4.4.1 (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. */ 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; 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; 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
0x6101406040523480156200001257600080fd5b506040516200576a3803806200576a83398181016040528101906200003891906200042f565b6040518060400160405280600d81526020017f4e465453544f524546524f4e54000000000000000000000000000000000000008152506040518060400160405280600381526020017f312e300000000000000000000000000000000000000000000000000000000000815250620000c4620000b86200027460201b60201c565b6200027c60201b60201c565b60008280519060200120905060008280519060200120905060007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f90508260e081815250508161010081815250504660a081815250506200012d8184846200034060201b60201c565b608081815250503073ffffffffffffffffffffffffffffffffffffffff1660c08173ffffffffffffffffffffffffffffffffffffffff1681525050806101208181525050505050505083600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600060146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555080600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505062000545565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600083838346306040516020016200035d959493929190620004e8565b6040516020818303038152906040528051906020012090509392505050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620003ae8262000381565b9050919050565b620003c081620003a1565b8114620003cc57600080fd5b50565b600081519050620003e081620003b5565b92915050565b60006bffffffffffffffffffffffff82169050919050565b6200040981620003e6565b81146200041557600080fd5b50565b6000815190506200042981620003fe565b92915050565b600080600080608085870312156200044c576200044b6200037c565b5b60006200045c87828801620003cf565b94505060206200046f87828801620003cf565b9350506040620004828782880162000418565b92505060606200049587828801620003cf565b91505092959194509250565b6000819050919050565b620004b681620004a1565b82525050565b6000819050919050565b620004d181620004bc565b82525050565b620004e281620003a1565b82525050565b600060a082019050620004ff6000830188620004ab565b6200050e6020830187620004ab565b6200051d6040830186620004ab565b6200052c6060830185620004c6565b6200053b6080830184620004d7565b9695505050505050565b60805160a05160c05160e05161010051610120516151d5620005956000396000612ddc01526000612e1e01526000612dfd01526000612d3201526000612d8801526000612db101526151d56000f3fe608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063715018a61161008c578063da04a09511610066578063da04a095146101fe578063e1c3b1401461021a578063f2fde38b1461024a578063fae5a83f14610266576100cf565b8063715018a6146101a65780638da5cb5b146101b0578063d027b928146101ce576100cf565b8063140baf99146100d4578063150b7a02146101045780632dec66b0146101345780634cd9b1df146101525780635e5641c51461016e5780636336db3c1461018a575b600080fd5b6100ee60048036038101906100e99190613390565b610296565b6040516100fb91906134d6565b60405180910390f35b61011e60048036038101906101199190613585565b6104ed565b60405161012b9190613648565b60405180910390f35b61013c610587565b604051610149919061368a565b60405180910390f35b61016c60048036038101906101679190613771565b6105a8565b005b61018860048036038101906101839190613855565b610be7565b005b6101a4600480360381019061019f91906138fe565b610e2d565b005b6101ae611323565b005b6101b86113ab565b6040516101c59190613a04565b60405180910390f35b6101e860048036038101906101e39190613a1f565b6113d4565b6040516101f591906134d6565b60405180910390f35b61021860048036038101906102139190613ae4565b61160d565b005b610234600480360381019061022f9190613c1f565b611793565b60405161024191906134d6565b60405180910390f35b610264600480360381019061025f9190613c4c565b61189c565b005b610280600480360381019061027b9190613c4c565b611994565b60405161028d91906134d6565b60405180910390f35b60006102c88a60c0018b8061018001906102b09190613c88565b8a60600160208101906102c39190613c4c565b611a5c565b5060006102d68b8b8b611d47565b90506102fb818c8a8860000160208101906102f19190613c4c565b8960200135611e4f565b60006103088989896120c0565b905061032c818a8e60000160208101906103229190613c4c565b8f602001356121c8565b85600001602081019061033f9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb7838888886040518563ffffffff1660e01b815260040161037d9493929190613f0b565b602060405180830381600087803b15801561039757600080fd5b505af11580156103ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103cf9190613f67565b5060006104186103e68e60a001358f60c001612314565b60018c60800160208101906103fb9190613c1f565b8d600001602081019061040e9190613c4c565b8e602001356123e2565b905061044a8d60800160208101906104309190613c4c565b838c60600160208101906104449190613c4c565b84612666565b8c608001602081019061045d9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff168d602001358e606001602081019061048b9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff167fec34853c156da04e4792f1c735112ae54e5ed52bac58db5014b26746f306a36260016040516104d19190613fd9565b60405180910390a4600193505050509998505050505050505050565b60003373ffffffffffffffffffffffffffffffffffffffff168383604051610516929190614024565b6000604051808303816000865af19150503d8060008114610553576040519150601f19603f3d011682016040523d82523d6000602084013e610558565b606091505b5050507f150b7a023d4804d13e8c85fb27262cb750cf6ba9f9dd3bb30d90f482ceeb4b1f905095945050505050565b60008060149054906101000a90046bffffffffffffffffffffffff16905090565b6105e48560000160208101906105be9190613c4c565b7f80ac58cd00000000000000000000000000000000000000000000000000000000612a2c565b610623576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161061a9061409a565b60405180910390fd5b610653866080018780610140019061063b9190613c88565b88606001602081019061064e9190613c4c565b611a5c565b50600061066f8688806000019061066a9190613c88565b6120c0565b905061069381878860000160208101906106899190613c4c565b89602001356121c8565b8560000160208101906106a69190613c4c565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e8760a00160208101906106d49190613c4c565b6106dc612a51565b89602001356040518463ffffffff1660e01b81526004016106ff939291906140c9565b600060405180830381600087803b15801561071957600080fd5b505af115801561072d573d6000803e3d6000fd5b50505050600061077961074788604001358a608001612314565b600189608001602081019061075c9190613c1f565b8a600001602081019061076f9190613c4c565b8b602001356123e2565b90506107b2610786612a51565b8860a00160208101906107999190613c4c565b8960600160208101906107ac9190613c4c565b84612666565b60005b848490508160ff161015610bdc57600061081f88888460ff168181106107de576107dd614100565b5b905060c002018b80604001906107f4919061412f565b8560ff1681811061080857610807614100565b5b905060200281019061081a9190613c88565b6120c0565b90506108ac8189898560ff1681811061083b5761083a614100565b5b905060c0020188888660ff1681811061085757610856614100565b5b90506020028101906108699190614192565b600001602081019061087b9190613c4c565b89898760ff1681811061089157610890614100565b5b90506020028101906108a39190614192565b602001356121c8565b600086868460ff168181106108c4576108c3614100565b5b90506020028101906108d69190614192565b60000160208101906108e89190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb761090b612a51565b89898760ff1681811061092157610920614100565b5b90506020028101906109339190614192565b8e8060600190610943919061412f565b8860ff1681811061095757610956614100565b5b90506020028101906109699190613c88565b6040518563ffffffff1660e01b81526004016109889493929190613f0b565b602060405180830381600087803b1580156109a257600080fd5b505af11580156109b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109da9190613f67565b905086868460ff168181106109f2576109f1614100565b5b9050602002810190610a049190614192565b6000016020810190610a169190613c4c565b73ffffffffffffffffffffffffffffffffffffffff1663e2ece3ff610a39612a51565b838d6000016020810190610a4d9190613c4c565b8e602001356040518563ffffffff1660e01b8152600401610a7194939291906141ba565b600060405180830381600087803b158015610a8b57600080fd5b505af1158015610a9f573d6000803e3d6000fd5b505050506000610b57610ad48b8b8760ff16818110610ac157610ac0614100565b5b905060c00201604001358e608001612314565b60018c8c8860ff16818110610aec57610aeb614100565b5b905060c002016080016020810190610b049190613c1f565b8d8d8960ff16818110610b1a57610b19614100565b5b905060c002016000016020810190610b329190613c4c565b8e8e8a60ff16818110610b4857610b47614100565b5b905060c00201602001356123e2565b9050610bc6610b64612a51565b8b8b8760ff16818110610b7a57610b79614100565b5b905060c0020160a0016020810190610b929190613c4c565b8c8c8860ff16818110610ba857610ba7614100565b5b905060c002016060016020810190610bc09190613c4c565b84612666565b5050508080610bd49061423b565b9150506107b5565b505050505050505050565b610c05838383896060016020810190610c009190613c4c565b611a5c565b506000610c138787876120c0565b90508660a0016020810190610c289190613c4c565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8c906142b1565b60405180910390fd5b866000016020810190610ca89190613c4c565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e8860a0016020810190610cd69190613c4c565b610cde612a51565b8a602001356040518463ffffffff1660e01b8152600401610d01939291906140c9565b600060405180830381600087803b158015610d1b57600080fd5b505af1158015610d2f573d6000803e3d6000fd5b50505050610d3b612a51565b73ffffffffffffffffffffffffffffffffffffffff1687602001358273ffffffffffffffffffffffffffffffffffffffff167fb10197cef009fd301a90b892d25451c22c3701eb18ee2df1250d31e514fff3946001604051610d9d9190613fd9565b60405180910390a46000610dea610db8896040013587612314565b60018a6080016020810190610dcd9190613c1f565b8b6000016020810190610de09190613c4c565b8c602001356123e2565b9050610e23610df7612a51565b8960a0016020810190610e0a9190613c4c565b8a6060016020810190610e1d9190613c4c565b84612666565b5050505050505050565b610e5d8760800188806101400190610e459190613c88565b896060016020810190610e589190613c4c565b611a5c565b506000610e7987898060000190610e749190613c88565b6120c0565b9050610e9d8188886000016020810190610e939190613c4c565b89602001356121c8565b856000016020810190610eb09190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb7610ed3612a51565b888b8060200190610ee49190613c88565b6040518563ffffffff1660e01b8152600401610f039493929190613f0b565b602060405180830381600087803b158015610f1d57600080fd5b505af1158015610f31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f559190613f67565b506000610f9e610f6c89604001358b608001612314565b60018a6080016020810190610f819190613c1f565b8b6000016020810190610f949190613c4c565b8c602001356123e2565b9050610fd7610fab612a51565b8960a0016020810190610fbe9190613c4c565b8a6060016020810190610fd19190613c4c565b84612666565b60005b848490508160ff16101561131757600085858360ff1681811061100057610fff614100565b5b90506020028101906110129190614192565b60000160208101906110249190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb7611047612a51565b88888660ff1681811061105d5761105c614100565b5b905060200281019061106f9190614192565b8e806060019061107f919061412f565b8760ff1681811061109357611092614100565b5b90506020028101906110a59190613c88565b6040518563ffffffff1660e01b81526004016110c49493929190613f0b565b602060405180830381600087803b1580156110de57600080fd5b505af11580156110f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111169190613f67565b905085858360ff1681811061112e5761112d614100565b5b90506020028101906111409190614192565b60000160208101906111529190613c4c565b73ffffffffffffffffffffffffffffffffffffffff1663e2ece3ff611175612a51565b838c60000160208101906111899190613c4c565b8d602001356040518563ffffffff1660e01b81526004016111ad94939291906141ba565b600060405180830381600087803b1580156111c757600080fd5b505af11580156111db573d6000803e3d6000fd5b5050505060006112936112108a8a8660ff168181106111fd576111fc614100565b5b905060c00201604001358e608001612314565b60018b8b8760ff1681811061122857611227614100565b5b905060c0020160800160208101906112409190613c1f565b8c8c8860ff1681811061125657611255614100565b5b905060c00201600001602081019061126e9190613c4c565b8d8d8960ff1681811061128457611283614100565b5b905060c00201602001356123e2565b90506113026112a0612a51565b8a8a8660ff168181106112b6576112b5614100565b5b905060c0020160a00160208101906112ce9190613c4c565b8b8b8760ff168181106112e4576112e3614100565b5b905060c0020160600160208101906112fc9190613c4c565b84612666565b5050808061130f9061423b565b915050610fda565b50505050505050505050565b61132b612a51565b73ffffffffffffffffffffffffffffffffffffffff166113496113ab565b73ffffffffffffffffffffffffffffffffffffffff161461139f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113969061431d565b60405180910390fd5b6113a96000612a59565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60006114068760c001888061018001906113ee9190613c88565b8760600160208101906114019190613c4c565b611a5c565b506000611414888888611d47565b905061143981898788600001602081019061142f9190613c4c565b8960200135611e4f565b87600001602081019061144c9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e89606001602081019061147a9190613c4c565b8a608001602081019061148d9190613c4c565b8b602001356040518463ffffffff1660e01b81526004016114b0939291906140c9565b600060405180830381600087803b1580156114ca57600080fd5b505af11580156114de573d6000803e3d6000fd5b50505050600061152a6114f88a60a001358b60c001612314565b600188608001602081019061150d9190613c1f565b8c60000160208101906115209190613c4c565b8d602001356123e2565b905061156e8960800160208101906115429190613c4c565b8a60600160208101906115559190613c4c565b8860600160208101906115689190613c4c565b84612666565b8860800160208101906115819190613c4c565b73ffffffffffffffffffffffffffffffffffffffff1689602001358a60600160208101906115af9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff167fec34853c156da04e4792f1c735112ae54e5ed52bac58db5014b26746f306a36260016040516115f59190613fd9565b60405180910390a46001925050509695505050505050565b61162b8383838c60600160208101906116269190613c4c565b611a5c565b5060006116398a8a8a6120c0565b905061165d818b8960000160208101906116539190613c4c565b8a602001356121c8565b8660000160208101906116709190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb7611693612a51565b8989896040518563ffffffff1660e01b81526004016116b59493929190613f0b565b602060405180830381600087803b1580156116cf57600080fd5b505af11580156116e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117079190613f67565b50600061174d61171b8c6040013587612314565b60018d60800160208101906117309190613c1f565b8e60000160208101906117439190613c4c565b8f602001356123e2565b905061178661175a612a51565b8c60a001602081019061176d9190613c4c565b8d60600160208101906117809190613c4c565b84612666565b5050505050505050505050565b600061179d612a51565b73ffffffffffffffffffffffffffffffffffffffff166117bb6113ab565b73ffffffffffffffffffffffffffffffffffffffff1614611811576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118089061431d565b60405180910390fd5b81600060146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055507fd93dd360d98fc20e8a1fed3ac984811d257edb945d5612328d87c1123eb42de8600060149054906101000a90046bffffffffffffffffffffffff1660405161188b919061368a565b60405180910390a160019050919050565b6118a4612a51565b73ffffffffffffffffffffffffffffffffffffffff166118c26113ab565b73ffffffffffffffffffffffffffffffffffffffff1614611918576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190f9061431d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611988576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197f906143af565b60405180910390fd5b61199181612a59565b50565b600061199e612a51565b73ffffffffffffffffffffffffffffffffffffffff166119bc6113ab565b73ffffffffffffffffffffffffffffffffffffffff1614611a12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a099061431d565b60405180910390fd5b81600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b600080611afc7fe5579de087ffe1e52529a6be897e847ac3bf17870732c42155c69a1fe0c8f764876000016020810190611a969190613c4c565b886020013589604001358a6060016020810190611ab39190613c1f565b8b608001358c60a0016020810190611acb9190613c4c565b604051602001611ae197969594939291906143e8565b60405160208183030381529060405280519060200120612b1d565b90506000611b4e8287878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050612b37565b9050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611be0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bd7906144a3565b60405180910390fd5b866000016020810190611bf39190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16611c11612a51565b73ffffffffffffffffffffffffffffffffffffffff1614611c67576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c5e9061450f565b60405180910390fd5b8660a0016020810190611c7a9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614611ce7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cde9061457b565b60405180910390fd5b6102588760800135611cf9919061459b565b4210611d3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d319061463d565b60405180910390fd5b8092505050949350505050565b600080611df57ff4b6c9318e472ce88743d274a0fc462a01c286f3d6853c27215e84b55ab87812866000016020810190611d819190613c4c565b8760200135886040016020810190611d999190613c4c565b896060016020810190611dac9190613c4c565b8a6080016020810190611dbf9190613c4c565b8b60a00135604051602001611dda979695949392919061465d565b60405160208183030381529060405280519060200120612b1d565b9050611e458185858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050612b37565b9150509392505050565b836080016020810190611e629190613c4c565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614611ecf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec690614718565b60405180910390fd5b8260a0016020810190611ee29190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16846060016020810190611f0b9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff1614611f61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f58906142b1565b60405180910390fd5b826060016020810190611f749190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16846040016020810190611f9d9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff1614611ff3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fea90614784565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1684600001602081019061201d9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff1614612073576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206a906147f0565b60405180910390fd5b808460200135146120b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120b09061485c565b60405180910390fd5b5050505050565b60008061216e7f0227bfb59f2b64de4a76ceeb40f29a3307bf4135abb650aa8d0b824adbe4d6738660000160208101906120fa9190613c4c565b876020013588604001358960600160208101906121179190613c4c565b8a608001602081019061212a9190613c1f565b8b60a001602081019061213d9190613c4c565b604051602001612153979695949392919061487c565b60405160208183030381529060405280519060200120612b1d565b90506121be8185858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050612b37565b9150509392505050565b8260a00160208101906121db9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614612248576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223f906142b1565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff168360000160208101906122729190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16146122c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122bf906147f0565b60405180910390fd5b8083602001351461230e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123059061485c565b60405180910390fd5b50505050565b60008082606001602081019061232a9190613c1f565b6bffffffffffffffffffffffff161415612346578290506123dc565b600182606001602081019061235b9190613c1f565b6bffffffffffffffffffffffff1614156123a15781602001358260400135600a6123859190614a1e565b846123909190614a69565b61239a9190614af2565b90506123dc565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123d390614b95565b60405180910390fd5b92915050565b6123ea613279565b612710612436600060149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16866bffffffffffffffffffffffff16612b5e90919063ffffffff16565b1115612477576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161246e90614c01565b60405180910390fd5b600080600080888a6124899190614a69565b905060006124dc6127106124ce600060149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff1685612b7490919063ffffffff16565b612b8a90919063ffffffff16565b905060006125156127106125078c6bffffffffffffffffffffffff1686612b7490919063ffffffff16565b612b8a90919063ffffffff16565b9050600061253e826125308587612ba090919063ffffffff16565b612ba090919063ffffffff16565b905061256a8a7f2a55205a00000000000000000000000000000000000000000000000000000000612a2c565b15612602578973ffffffffffffffffffffffffffffffffffffffff16632a55205a8a836040518363ffffffff1660e01b81526004016125aa929190614c21565b604080518083038186803b1580156125c157600080fd5b505afa1580156125d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f99190614c5f565b80965081975050505b6126158582612ba090919063ffffffff16565b96506040518060a001604052808481526020018381526020018881526020018681526020018773ffffffffffffffffffffffffffffffffffffffff1681525097505050505050505095945050505050565b600082905060008260000151111561276d578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685600001516040518463ffffffff1660e01b81526004016126db939291906140c9565b602060405180830381600087803b1580156126f557600080fd5b505af1158015612709573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061272d9190614ccb565b61276c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276390614d44565b60405180910390fd5b5b60008260200151111561286f578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685602001516040518463ffffffff1660e01b81526004016127dd939291906140c9565b602060405180830381600087803b1580156127f757600080fd5b505af115801561280b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061282f9190614ccb565b61286e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161286590614d44565b60405180910390fd5b5b600082606001511115612953578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86846080015185606001516040518463ffffffff1660e01b81526004016128c1939291906140c9565b602060405180830381600087803b1580156128db57600080fd5b505af11580156128ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129139190614ccb565b612952576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161294990614d44565b60405180910390fd5b5b8073ffffffffffffffffffffffffffffffffffffffff166323b872dd868685604001516040518463ffffffff1660e01b8152600401612994939291906140c9565b602060405180830381600087803b1580156129ae57600080fd5b505af11580156129c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129e69190614ccb565b612a25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1c90614d44565b60405180910390fd5b5050505050565b6000612a3783612bb6565b8015612a495750612a488383612c03565b5b905092915050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000612b30612b2a612d2e565b83612e48565b9050919050565b6000806000612b468585612e7b565b91509150612b5381612efe565b819250505092915050565b60008183612b6c919061459b565b905092915050565b60008183612b829190614a69565b905092915050565b60008183612b989190614af2565b905092915050565b60008183612bae9190614d64565b905092915050565b6000612be2827f01ffc9a700000000000000000000000000000000000000000000000000000000612c03565b8015612bfc5750612bfa8263ffffffff60e01b612c03565b155b9050919050565b6000806301ffc9a760e01b83604051602401612c1f9190613648565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090506000808573ffffffffffffffffffffffffffffffffffffffff1661753084604051612ca99190614e07565b6000604051808303818686fa925050503d8060008114612ce5576040519150601f19603f3d011682016040523d82523d6000602084013e612cea565b606091505b5091509150602081511015612d055760009350505050612d28565b818015612d22575080806020019051810190612d219190614ccb565b5b93505050505b92915050565b60007f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16148015612daa57507f000000000000000000000000000000000000000000000000000000000000000046145b15612dd7577f00000000000000000000000000000000000000000000000000000000000000009050612e45565b612e427f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006130d3565b90505b90565b60008282604051602001612e5d929190614e96565b60405160208183030381529060405280519060200120905092915050565b600080604183511415612ebd5760008060006020860151925060408601519150606086015160001a9050612eb18782858561310d565b94509450505050612ef7565b604083511415612eee576000806020850151915060408501519050612ee386838361321a565b935093505050612ef7565b60006002915091505b9250929050565b60006004811115612f1257612f11614ecd565b5b816004811115612f2557612f24614ecd565b5b1415612f30576130d0565b60016004811115612f4457612f43614ecd565b5b816004811115612f5757612f56614ecd565b5b1415612f98576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f8f90614f48565b60405180910390fd5b60026004811115612fac57612fab614ecd565b5b816004811115612fbf57612fbe614ecd565b5b1415613000576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ff790614fb4565b60405180910390fd5b6003600481111561301457613013614ecd565b5b81600481111561302757613026614ecd565b5b1415613068576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161305f90615046565b60405180910390fd5b60048081111561307b5761307a614ecd565b5b81600481111561308e5761308d614ecd565b5b14156130cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130c6906150d8565b60405180910390fd5b5b50565b600083838346306040516020016130ee9594939291906150f8565b6040516020818303038152906040528051906020012090509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115613148576000600391509150613211565b601b8560ff16141580156131605750601c8560ff1614155b15613172576000600491509150613211565b600060018787878760405160008152602001604052604051613197949392919061515a565b6020604051602081039080840390855afa1580156131b9573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561320857600060019250925050613211565b80600092509250505b94509492505050565b60008060007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60001b841690506000601b60ff8660001c901c61325d919061459b565b905061326b8782888561310d565b935093505050935093915050565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b600080fd5b600080fd5b600080fd5b60006101a082840312156132e4576132e36132c8565b5b81905092915050565b600080fd5b600080fd5b600080fd5b60008083601f840112613312576133116132ed565b5b8235905067ffffffffffffffff81111561332f5761332e6132f2565b5b60208301915083600182028301111561334b5761334a6132f7565b5b9250929050565b600060c08284031215613368576133676132c8565b5b81905092915050565b600060a08284031215613387576133866132c8565b5b81905092915050565b60008060008060008060008060006101608a8c0312156133b3576133b26132be565b5b60008a013567ffffffffffffffff8111156133d1576133d06132c3565b5b6133dd8c828d016132cd565b99505060208a013567ffffffffffffffff8111156133fe576133fd6132c3565b5b61340a8c828d016132fc565b9850985050604061341d8c828d01613352565b9650506101008a013567ffffffffffffffff81111561343f5761343e6132c3565b5b61344b8c828d016132fc565b95509550506101208a013567ffffffffffffffff81111561346f5761346e6132c3565b5b61347b8c828d01613371565b9350506101408a013567ffffffffffffffff81111561349d5761349c6132c3565b5b6134a98c828d016132fc565b92509250509295985092959850929598565b60008115159050919050565b6134d0816134bb565b82525050565b60006020820190506134eb60008301846134c7565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061351c826134f1565b9050919050565b61352c81613511565b811461353757600080fd5b50565b60008135905061354981613523565b92915050565b6000819050919050565b6135628161354f565b811461356d57600080fd5b50565b60008135905061357f81613559565b92915050565b6000806000806000608086880312156135a1576135a06132be565b5b60006135af8882890161353a565b95505060206135c08882890161353a565b94505060406135d188828901613570565b935050606086013567ffffffffffffffff8111156135f2576135f16132c3565b5b6135fe888289016132fc565b92509250509295509295909350565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6136428161360d565b82525050565b600060208201905061365d6000830184613639565b92915050565b60006bffffffffffffffffffffffff82169050919050565b61368481613663565b82525050565b600060208201905061369f600083018461367b565b92915050565b600061016082840312156136bc576136bb6132c8565b5b81905092915050565b60008083601f8401126136db576136da6132ed565b5b8235905067ffffffffffffffff8111156136f8576136f76132f2565b5b6020830191508360c0820283011115613714576137136132f7565b5b9250929050565b60008083601f840112613731576137306132ed565b5b8235905067ffffffffffffffff81111561374e5761374d6132f2565b5b60208301915083602082028301111561376a576137696132f7565b5b9250929050565b600080600080600080610120878903121561378f5761378e6132be565b5b600087013567ffffffffffffffff8111156137ad576137ac6132c3565b5b6137b989828a016136a5565b96505060206137ca89828a01613352565b95505060e087013567ffffffffffffffff8111156137eb576137ea6132c3565b5b6137f789828a016136c5565b945094505061010087013567ffffffffffffffff81111561381b5761381a6132c3565b5b61382789828a0161371b565b92509250509295509295509295565b600060c0828403121561384c5761384b6132c8565b5b81905092915050565b6000806000806000806101c08789031215613873576138726132be565b5b600061388189828a01613352565b96505060c087013567ffffffffffffffff8111156138a2576138a16132c3565b5b6138ae89828a016132fc565b955095505060e06138c189828a01613836565b9350506101a087013567ffffffffffffffff8111156138e3576138e26132c3565b5b6138ef89828a016132fc565b92509250509295509295509295565b6000806000806000806000610140888a03121561391e5761391d6132be565b5b600088013567ffffffffffffffff81111561393c5761393b6132c3565b5b6139488a828b016136a5565b97505060206139598a828b01613352565b96505060e088013567ffffffffffffffff81111561397a576139796132c3565b5b6139868a828b01613371565b95505061010088013567ffffffffffffffff8111156139a8576139a76132c3565b5b6139b48a828b016136c5565b945094505061012088013567ffffffffffffffff8111156139d8576139d76132c3565b5b6139e48a828b0161371b565b925092505092959891949750929550565b6139fe81613511565b82525050565b6000602082019050613a1960008301846139f5565b92915050565b6000806000806000806101208789031215613a3d57613a3c6132be565b5b600087013567ffffffffffffffff811115613a5b57613a5a6132c3565b5b613a6789828a016132cd565b965050602087013567ffffffffffffffff811115613a8857613a876132c3565b5b613a9489828a016132fc565b95509550506040613aa789828a01613352565b93505061010087013567ffffffffffffffff811115613ac957613ac86132c3565b5b613ad589828a016132fc565b92509250509295509295509295565b60008060008060008060008060006102008a8c031215613b0757613b066132be565b5b6000613b158c828d01613352565b99505060c08a013567ffffffffffffffff811115613b3657613b356132c3565b5b613b428c828d016132fc565b985098505060e08a013567ffffffffffffffff811115613b6557613b646132c3565b5b613b718c828d01613371565b9650506101008a013567ffffffffffffffff811115613b9357613b926132c3565b5b613b9f8c828d016132fc565b9550955050610120613bb38c828d01613836565b9350506101e08a013567ffffffffffffffff811115613bd557613bd46132c3565b5b613be18c828d016132fc565b92509250509295985092959850929598565b613bfc81613663565b8114613c0757600080fd5b50565b600081359050613c1981613bf3565b92915050565b600060208284031215613c3557613c346132be565b5b6000613c4384828501613c0a565b91505092915050565b600060208284031215613c6257613c616132be565b5b6000613c708482850161353a565b91505092915050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112613ca557613ca4613c79565b5b80840192508235915067ffffffffffffffff821115613cc757613cc6613c7e565b5b602083019250600182023603831315613ce357613ce2613c83565b5b509250929050565b6000613cfa602084018461353a565b905092915050565b613d0b81613511565b82525050565b6000613d206020840184613570565b905092915050565b613d318161354f565b82525050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112613d6357613d62613d41565b5b83810192508235915060208301925067ffffffffffffffff821115613d8b57613d8a613d37565b5b600182023603841315613da157613da0613d3c565b5b509250929050565b600082825260208201905092915050565b82818337600083830152505050565b6000601f19601f8301169050919050565b6000613de68385613da9565b9350613df3838584613dba565b613dfc83613dc9565b840190509392505050565b6000613e166020840184613c0a565b905092915050565b613e2781613663565b82525050565b600060a08301613e406000840184613ceb565b613e4d6000860182613d02565b50613e5b6020840184613d11565b613e686020860182613d28565b50613e766040840184613d46565b8583036040870152613e89838284613dda565b92505050613e9a6060840184613ceb565b613ea76060860182613d02565b50613eb56080840184613e07565b613ec26080860182613e1e565b508091505092915050565b600082825260208201905092915050565b6000613eea8385613ecd565b9350613ef7838584613dba565b613f0083613dc9565b840190509392505050565b6000606082019050613f2060008301876139f5565b8181036020830152613f328186613e2d565b90508181036040830152613f47818486613ede565b905095945050505050565b600081519050613f6181613559565b92915050565b600060208284031215613f7d57613f7c6132be565b5b6000613f8b84828501613f52565b91505092915050565b6000819050919050565b6000819050919050565b6000613fc3613fbe613fb984613f94565b613f9e565b61354f565b9050919050565b613fd381613fa8565b82525050565b6000602082019050613fee6000830184613fca565b92915050565b600081905092915050565b600061400b8385613ff4565b9350614018838584613dba565b82840190509392505050565b6000614031828486613fff565b91508190509392505050565b600082825260208201905092915050565b7f4f6e6c7920616c6c6f7765642045524337323120746f6b656e73000000000000600082015250565b6000614084601a8361403d565b915061408f8261404e565b602082019050919050565b600060208201905081810360008301526140b381614077565b9050919050565b6140c38161354f565b82525050565b60006060820190506140de60008301866139f5565b6140eb60208301856139f5565b6140f860408301846140ba565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000808335600160200384360303811261414c5761414b613c79565b5b80840192508235915067ffffffffffffffff82111561416e5761416d613c7e565b5b60208301925060208202360383131561418a57614189613c83565b5b509250929050565b60008235600160a0038336030381126141ae576141ad613c79565b5b80830191505092915050565b60006080820190506141cf60008301876139f5565b6141dc60208301866140ba565b6141e960408301856139f5565b6141f660608301846140ba565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600060ff82169050919050565b60006142468261422e565b915060ff82141561425a576142596141ff565b5b600182019050919050565b7f496e76616c69642073656c6c6572206164647265737300000000000000000000600082015250565b600061429b60168361403d565b91506142a682614265565b602082019050919050565b600060208201905081810360008301526142ca8161428e565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061430760208361403d565b9150614312826142d1565b602082019050919050565b60006020820190508181036000830152614336816142fa565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061439960268361403d565b91506143a48261433d565b604082019050919050565b600060208201905081810360008301526143c88161438c565b9050919050565b6000819050919050565b6143e2816143cf565b82525050565b600060e0820190506143fd600083018a6143d9565b61440a60208301896139f5565b61441760408301886140ba565b61442460608301876140ba565b614431608083018661367b565b61443e60a08301856140ba565b61444b60c08301846139f5565b98975050505050505050565b7f50726963652076616c696461746f7220696e76616c6964000000000000000000600082015250565b600061448d60178361403d565b915061449882614457565b602082019050919050565b600060208201905081810360008301526144bc81614480565b9050919050565b7f4275796572207369676e20707269636520696e76616c69640000000000000000600082015250565b60006144f960188361403d565b9150614504826144c3565b602082019050919050565b60006020820190508181036000830152614528816144ec565b9050919050565b7f657263546f6b656e20696e76616c696400000000000000000000000000000000600082015250565b600061456560108361403d565b91506145708261452f565b602082019050919050565b6000602082019050818103600083015261459481614558565b9050919050565b60006145a68261354f565b91506145b18361354f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156145e6576145e56141ff565b5b828201905092915050565b7f5072696365206973206578706972656400000000000000000000000000000000600082015250565b600061462760108361403d565b9150614632826145f1565b602082019050919050565b600060208201905081810360008301526146568161461a565b9050919050565b600060e082019050614672600083018a6143d9565b61467f60208301896139f5565b61468c60408301886140ba565b61469960608301876139f5565b6146a660808301866139f5565b6146b360a08301856139f5565b6146c060c08301846140ba565b98975050505050505050565b7f496e76616c696420626964646572206164647265737300000000000000000000600082015250565b600061470260168361403d565b915061470d826146cc565b602082019050919050565b60006020820190508181036000830152614731816146f5565b9050919050565b7f496e76616c6964207061796d656e7420746f6b656e2061646472657373000000600082015250565b600061476e601d8361403d565b915061477982614738565b602082019050919050565b6000602082019050818103600083015261479d81614761565b9050919050565b7f496e76616c696420746f6b656e20616464726573730000000000000000000000600082015250565b60006147da60158361403d565b91506147e5826147a4565b602082019050919050565b60006020820190508181036000830152614809816147cd565b9050919050565b7f496e76616c696420746f6b656e20696400000000000000000000000000000000600082015250565b600061484660108361403d565b915061485182614810565b602082019050919050565b6000602082019050818103600083015261487581614839565b9050919050565b600060e082019050614891600083018a6143d9565b61489e60208301896139f5565b6148ab60408301886140ba565b6148b860608301876140ba565b6148c560808301866139f5565b6148d260a083018561367b565b6148df60c08301846139f5565b98975050505050505050565b60008160011c9050919050565b6000808291508390505b60018511156149425780860481111561491e5761491d6141ff565b5b600185161561492d5780820291505b808102905061493b856148eb565b9450614902565b94509492505050565b60008261495b5760019050614a17565b816149695760009050614a17565b816001811461497f5760028114614989576149b8565b6001915050614a17565b60ff84111561499b5761499a6141ff565b5b8360020a9150848211156149b2576149b16141ff565b5b50614a17565b5060208310610133831016604e8410600b84101617156149ed5782820a9050838111156149e8576149e76141ff565b5b614a17565b6149fa84848460016148f8565b92509050818404811115614a1157614a106141ff565b5b81810290505b9392505050565b6000614a298261354f565b9150614a348361354f565b9250614a617fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848461494b565b905092915050565b6000614a748261354f565b9150614a7f8361354f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614ab857614ab76141ff565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000614afd8261354f565b9150614b088361354f565b925082614b1857614b17614ac3565b5b828204905092915050565b7f43757272656e637920696e76616c696420666f7220707269636520636f6e766560008201527f7273696f6e000000000000000000000000000000000000000000000000000000602082015250565b6000614b7f60258361403d565b9150614b8a82614b23565b604082019050919050565b60006020820190508181036000830152614bae81614b72565b9050919050565b7f496e76616c696420706c6174666f726d20666565206f72204e474f2066656500600082015250565b6000614beb601f8361403d565b9150614bf682614bb5565b602082019050919050565b60006020820190508181036000830152614c1a81614bde565b9050919050565b6000604082019050614c3660008301856140ba565b614c4360208301846140ba565b9392505050565b600081519050614c5981613523565b92915050565b60008060408385031215614c7657614c756132be565b5b6000614c8485828601614c4a565b9250506020614c9585828601613f52565b9150509250929050565b614ca8816134bb565b8114614cb357600080fd5b50565b600081519050614cc581614c9f565b92915050565b600060208284031215614ce157614ce06132be565b5b6000614cef84828501614cb6565b91505092915050565b7f6661696c757265207768696c65207472616e7366657272696e67000000000000600082015250565b6000614d2e601a8361403d565b9150614d3982614cf8565b602082019050919050565b60006020820190508181036000830152614d5d81614d21565b9050919050565b6000614d6f8261354f565b9150614d7a8361354f565b925082821015614d8d57614d8c6141ff565b5b828203905092915050565b600081519050919050565b60005b83811015614dc1578082015181840152602081019050614da6565b83811115614dd0576000848401525b50505050565b6000614de182614d98565b614deb8185613ff4565b9350614dfb818560208601614da3565b80840191505092915050565b6000614e138284614dd6565b915081905092915050565b600081905092915050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000614e5f600283614e1e565b9150614e6a82614e29565b600282019050919050565b6000819050919050565b614e90614e8b826143cf565b614e75565b82525050565b6000614ea182614e52565b9150614ead8285614e7f565b602082019150614ebd8284614e7f565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000614f3260188361403d565b9150614f3d82614efc565b602082019050919050565b60006020820190508181036000830152614f6181614f25565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000614f9e601f8361403d565b9150614fa982614f68565b602082019050919050565b60006020820190508181036000830152614fcd81614f91565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b600061503060228361403d565b915061503b82614fd4565b604082019050919050565b6000602082019050818103600083015261505f81615023565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202776272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b60006150c260228361403d565b91506150cd82615066565b604082019050919050565b600060208201905081810360008301526150f1816150b5565b9050919050565b600060a08201905061510d60008301886143d9565b61511a60208301876143d9565b61512760408301866143d9565b61513460608301856140ba565b61514160808301846139f5565b9695505050505050565b6151548161422e565b82525050565b600060808201905061516f60008301876143d9565b61517c602083018661514b565b61518960408301856143d9565b61519660608301846143d9565b9594505050505056fea2646970667358221220f9c7cd8e083ad23ac8100cb4780a42f5905c57ee9cdded975a2438a94ce57c1b64736f6c6343000809003300000000000000000000000022cac6a8e7ff5ce7b35c862cdd5a11c288aef1420000000000000000000000007f451e5ae38647778721f88015e81713c136dc0c00000000000000000000000000000000000000000000000000000000000007d00000000000000000000000004c45c6d2f8ccd5e90802e3caee85af67e89e9f2c
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c8063715018a61161008c578063da04a09511610066578063da04a095146101fe578063e1c3b1401461021a578063f2fde38b1461024a578063fae5a83f14610266576100cf565b8063715018a6146101a65780638da5cb5b146101b0578063d027b928146101ce576100cf565b8063140baf99146100d4578063150b7a02146101045780632dec66b0146101345780634cd9b1df146101525780635e5641c51461016e5780636336db3c1461018a575b600080fd5b6100ee60048036038101906100e99190613390565b610296565b6040516100fb91906134d6565b60405180910390f35b61011e60048036038101906101199190613585565b6104ed565b60405161012b9190613648565b60405180910390f35b61013c610587565b604051610149919061368a565b60405180910390f35b61016c60048036038101906101679190613771565b6105a8565b005b61018860048036038101906101839190613855565b610be7565b005b6101a4600480360381019061019f91906138fe565b610e2d565b005b6101ae611323565b005b6101b86113ab565b6040516101c59190613a04565b60405180910390f35b6101e860048036038101906101e39190613a1f565b6113d4565b6040516101f591906134d6565b60405180910390f35b61021860048036038101906102139190613ae4565b61160d565b005b610234600480360381019061022f9190613c1f565b611793565b60405161024191906134d6565b60405180910390f35b610264600480360381019061025f9190613c4c565b61189c565b005b610280600480360381019061027b9190613c4c565b611994565b60405161028d91906134d6565b60405180910390f35b60006102c88a60c0018b8061018001906102b09190613c88565b8a60600160208101906102c39190613c4c565b611a5c565b5060006102d68b8b8b611d47565b90506102fb818c8a8860000160208101906102f19190613c4c565b8960200135611e4f565b60006103088989896120c0565b905061032c818a8e60000160208101906103229190613c4c565b8f602001356121c8565b85600001602081019061033f9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb7838888886040518563ffffffff1660e01b815260040161037d9493929190613f0b565b602060405180830381600087803b15801561039757600080fd5b505af11580156103ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103cf9190613f67565b5060006104186103e68e60a001358f60c001612314565b60018c60800160208101906103fb9190613c1f565b8d600001602081019061040e9190613c4c565b8e602001356123e2565b905061044a8d60800160208101906104309190613c4c565b838c60600160208101906104449190613c4c565b84612666565b8c608001602081019061045d9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff168d602001358e606001602081019061048b9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff167fec34853c156da04e4792f1c735112ae54e5ed52bac58db5014b26746f306a36260016040516104d19190613fd9565b60405180910390a4600193505050509998505050505050505050565b60003373ffffffffffffffffffffffffffffffffffffffff168383604051610516929190614024565b6000604051808303816000865af19150503d8060008114610553576040519150601f19603f3d011682016040523d82523d6000602084013e610558565b606091505b5050507f150b7a023d4804d13e8c85fb27262cb750cf6ba9f9dd3bb30d90f482ceeb4b1f905095945050505050565b60008060149054906101000a90046bffffffffffffffffffffffff16905090565b6105e48560000160208101906105be9190613c4c565b7f80ac58cd00000000000000000000000000000000000000000000000000000000612a2c565b610623576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161061a9061409a565b60405180910390fd5b610653866080018780610140019061063b9190613c88565b88606001602081019061064e9190613c4c565b611a5c565b50600061066f8688806000019061066a9190613c88565b6120c0565b905061069381878860000160208101906106899190613c4c565b89602001356121c8565b8560000160208101906106a69190613c4c565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e8760a00160208101906106d49190613c4c565b6106dc612a51565b89602001356040518463ffffffff1660e01b81526004016106ff939291906140c9565b600060405180830381600087803b15801561071957600080fd5b505af115801561072d573d6000803e3d6000fd5b50505050600061077961074788604001358a608001612314565b600189608001602081019061075c9190613c1f565b8a600001602081019061076f9190613c4c565b8b602001356123e2565b90506107b2610786612a51565b8860a00160208101906107999190613c4c565b8960600160208101906107ac9190613c4c565b84612666565b60005b848490508160ff161015610bdc57600061081f88888460ff168181106107de576107dd614100565b5b905060c002018b80604001906107f4919061412f565b8560ff1681811061080857610807614100565b5b905060200281019061081a9190613c88565b6120c0565b90506108ac8189898560ff1681811061083b5761083a614100565b5b905060c0020188888660ff1681811061085757610856614100565b5b90506020028101906108699190614192565b600001602081019061087b9190613c4c565b89898760ff1681811061089157610890614100565b5b90506020028101906108a39190614192565b602001356121c8565b600086868460ff168181106108c4576108c3614100565b5b90506020028101906108d69190614192565b60000160208101906108e89190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb761090b612a51565b89898760ff1681811061092157610920614100565b5b90506020028101906109339190614192565b8e8060600190610943919061412f565b8860ff1681811061095757610956614100565b5b90506020028101906109699190613c88565b6040518563ffffffff1660e01b81526004016109889493929190613f0b565b602060405180830381600087803b1580156109a257600080fd5b505af11580156109b6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109da9190613f67565b905086868460ff168181106109f2576109f1614100565b5b9050602002810190610a049190614192565b6000016020810190610a169190613c4c565b73ffffffffffffffffffffffffffffffffffffffff1663e2ece3ff610a39612a51565b838d6000016020810190610a4d9190613c4c565b8e602001356040518563ffffffff1660e01b8152600401610a7194939291906141ba565b600060405180830381600087803b158015610a8b57600080fd5b505af1158015610a9f573d6000803e3d6000fd5b505050506000610b57610ad48b8b8760ff16818110610ac157610ac0614100565b5b905060c00201604001358e608001612314565b60018c8c8860ff16818110610aec57610aeb614100565b5b905060c002016080016020810190610b049190613c1f565b8d8d8960ff16818110610b1a57610b19614100565b5b905060c002016000016020810190610b329190613c4c565b8e8e8a60ff16818110610b4857610b47614100565b5b905060c00201602001356123e2565b9050610bc6610b64612a51565b8b8b8760ff16818110610b7a57610b79614100565b5b905060c0020160a0016020810190610b929190613c4c565b8c8c8860ff16818110610ba857610ba7614100565b5b905060c002016060016020810190610bc09190613c4c565b84612666565b5050508080610bd49061423b565b9150506107b5565b505050505050505050565b610c05838383896060016020810190610c009190613c4c565b611a5c565b506000610c138787876120c0565b90508660a0016020810190610c289190613c4c565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614610c95576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c8c906142b1565b60405180910390fd5b866000016020810190610ca89190613c4c565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e8860a0016020810190610cd69190613c4c565b610cde612a51565b8a602001356040518463ffffffff1660e01b8152600401610d01939291906140c9565b600060405180830381600087803b158015610d1b57600080fd5b505af1158015610d2f573d6000803e3d6000fd5b50505050610d3b612a51565b73ffffffffffffffffffffffffffffffffffffffff1687602001358273ffffffffffffffffffffffffffffffffffffffff167fb10197cef009fd301a90b892d25451c22c3701eb18ee2df1250d31e514fff3946001604051610d9d9190613fd9565b60405180910390a46000610dea610db8896040013587612314565b60018a6080016020810190610dcd9190613c1f565b8b6000016020810190610de09190613c4c565b8c602001356123e2565b9050610e23610df7612a51565b8960a0016020810190610e0a9190613c4c565b8a6060016020810190610e1d9190613c4c565b84612666565b5050505050505050565b610e5d8760800188806101400190610e459190613c88565b896060016020810190610e589190613c4c565b611a5c565b506000610e7987898060000190610e749190613c88565b6120c0565b9050610e9d8188886000016020810190610e939190613c4c565b89602001356121c8565b856000016020810190610eb09190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb7610ed3612a51565b888b8060200190610ee49190613c88565b6040518563ffffffff1660e01b8152600401610f039493929190613f0b565b602060405180830381600087803b158015610f1d57600080fd5b505af1158015610f31573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f559190613f67565b506000610f9e610f6c89604001358b608001612314565b60018a6080016020810190610f819190613c1f565b8b6000016020810190610f949190613c4c565b8c602001356123e2565b9050610fd7610fab612a51565b8960a0016020810190610fbe9190613c4c565b8a6060016020810190610fd19190613c4c565b84612666565b60005b848490508160ff16101561131757600085858360ff1681811061100057610fff614100565b5b90506020028101906110129190614192565b60000160208101906110249190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb7611047612a51565b88888660ff1681811061105d5761105c614100565b5b905060200281019061106f9190614192565b8e806060019061107f919061412f565b8760ff1681811061109357611092614100565b5b90506020028101906110a59190613c88565b6040518563ffffffff1660e01b81526004016110c49493929190613f0b565b602060405180830381600087803b1580156110de57600080fd5b505af11580156110f2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111169190613f67565b905085858360ff1681811061112e5761112d614100565b5b90506020028101906111409190614192565b60000160208101906111529190613c4c565b73ffffffffffffffffffffffffffffffffffffffff1663e2ece3ff611175612a51565b838c60000160208101906111899190613c4c565b8d602001356040518563ffffffff1660e01b81526004016111ad94939291906141ba565b600060405180830381600087803b1580156111c757600080fd5b505af11580156111db573d6000803e3d6000fd5b5050505060006112936112108a8a8660ff168181106111fd576111fc614100565b5b905060c00201604001358e608001612314565b60018b8b8760ff1681811061122857611227614100565b5b905060c0020160800160208101906112409190613c1f565b8c8c8860ff1681811061125657611255614100565b5b905060c00201600001602081019061126e9190613c4c565b8d8d8960ff1681811061128457611283614100565b5b905060c00201602001356123e2565b90506113026112a0612a51565b8a8a8660ff168181106112b6576112b5614100565b5b905060c0020160a00160208101906112ce9190613c4c565b8b8b8760ff168181106112e4576112e3614100565b5b905060c0020160600160208101906112fc9190613c4c565b84612666565b5050808061130f9061423b565b915050610fda565b50505050505050505050565b61132b612a51565b73ffffffffffffffffffffffffffffffffffffffff166113496113ab565b73ffffffffffffffffffffffffffffffffffffffff161461139f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113969061431d565b60405180910390fd5b6113a96000612a59565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60006114068760c001888061018001906113ee9190613c88565b8760600160208101906114019190613c4c565b611a5c565b506000611414888888611d47565b905061143981898788600001602081019061142f9190613c4c565b8960200135611e4f565b87600001602081019061144c9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e89606001602081019061147a9190613c4c565b8a608001602081019061148d9190613c4c565b8b602001356040518463ffffffff1660e01b81526004016114b0939291906140c9565b600060405180830381600087803b1580156114ca57600080fd5b505af11580156114de573d6000803e3d6000fd5b50505050600061152a6114f88a60a001358b60c001612314565b600188608001602081019061150d9190613c1f565b8c60000160208101906115209190613c4c565b8d602001356123e2565b905061156e8960800160208101906115429190613c4c565b8a60600160208101906115559190613c4c565b8860600160208101906115689190613c4c565b84612666565b8860800160208101906115819190613c4c565b73ffffffffffffffffffffffffffffffffffffffff1689602001358a60600160208101906115af9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff167fec34853c156da04e4792f1c735112ae54e5ed52bac58db5014b26746f306a36260016040516115f59190613fd9565b60405180910390a46001925050509695505050505050565b61162b8383838c60600160208101906116269190613c4c565b611a5c565b5060006116398a8a8a6120c0565b905061165d818b8960000160208101906116539190613c4c565b8a602001356121c8565b8660000160208101906116709190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb7611693612a51565b8989896040518563ffffffff1660e01b81526004016116b59493929190613f0b565b602060405180830381600087803b1580156116cf57600080fd5b505af11580156116e3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117079190613f67565b50600061174d61171b8c6040013587612314565b60018d60800160208101906117309190613c1f565b8e60000160208101906117439190613c4c565b8f602001356123e2565b905061178661175a612a51565b8c60a001602081019061176d9190613c4c565b8d60600160208101906117809190613c4c565b84612666565b5050505050505050505050565b600061179d612a51565b73ffffffffffffffffffffffffffffffffffffffff166117bb6113ab565b73ffffffffffffffffffffffffffffffffffffffff1614611811576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016118089061431d565b60405180910390fd5b81600060146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055507fd93dd360d98fc20e8a1fed3ac984811d257edb945d5612328d87c1123eb42de8600060149054906101000a90046bffffffffffffffffffffffff1660405161188b919061368a565b60405180910390a160019050919050565b6118a4612a51565b73ffffffffffffffffffffffffffffffffffffffff166118c26113ab565b73ffffffffffffffffffffffffffffffffffffffff1614611918576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161190f9061431d565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611988576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161197f906143af565b60405180910390fd5b61199181612a59565b50565b600061199e612a51565b73ffffffffffffffffffffffffffffffffffffffff166119bc6113ab565b73ffffffffffffffffffffffffffffffffffffffff1614611a12576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611a099061431d565b60405180910390fd5b81600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b600080611afc7fe5579de087ffe1e52529a6be897e847ac3bf17870732c42155c69a1fe0c8f764876000016020810190611a969190613c4c565b886020013589604001358a6060016020810190611ab39190613c1f565b8b608001358c60a0016020810190611acb9190613c4c565b604051602001611ae197969594939291906143e8565b60405160208183030381529060405280519060200120612b1d565b90506000611b4e8287878080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050612b37565b9050600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614611be0576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611bd7906144a3565b60405180910390fd5b866000016020810190611bf39190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16611c11612a51565b73ffffffffffffffffffffffffffffffffffffffff1614611c67576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611c5e9061450f565b60405180910390fd5b8660a0016020810190611c7a9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614611ce7576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611cde9061457b565b60405180910390fd5b6102588760800135611cf9919061459b565b4210611d3a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611d319061463d565b60405180910390fd5b8092505050949350505050565b600080611df57ff4b6c9318e472ce88743d274a0fc462a01c286f3d6853c27215e84b55ab87812866000016020810190611d819190613c4c565b8760200135886040016020810190611d999190613c4c565b896060016020810190611dac9190613c4c565b8a6080016020810190611dbf9190613c4c565b8b60a00135604051602001611dda979695949392919061465d565b60405160208183030381529060405280519060200120612b1d565b9050611e458185858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050612b37565b9150509392505050565b836080016020810190611e629190613c4c565b73ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614611ecf576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611ec690614718565b60405180910390fd5b8260a0016020810190611ee29190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16846060016020810190611f0b9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff1614611f61576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611f58906142b1565b60405180910390fd5b826060016020810190611f749190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16846040016020810190611f9d9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff1614611ff3576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611fea90614784565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1684600001602081019061201d9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff1614612073576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161206a906147f0565b60405180910390fd5b808460200135146120b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016120b09061485c565b60405180910390fd5b5050505050565b60008061216e7f0227bfb59f2b64de4a76ceeb40f29a3307bf4135abb650aa8d0b824adbe4d6738660000160208101906120fa9190613c4c565b876020013588604001358960600160208101906121179190613c4c565b8a608001602081019061212a9190613c1f565b8b60a001602081019061213d9190613c4c565b604051602001612153979695949392919061487c565b60405160208183030381529060405280519060200120612b1d565b90506121be8185858080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f82011690508083019250505050505050612b37565b9150509392505050565b8260a00160208101906121db9190613c4c565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614612248576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161223f906142b1565b60405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff168360000160208101906122729190613c4c565b73ffffffffffffffffffffffffffffffffffffffff16146122c8576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016122bf906147f0565b60405180910390fd5b8083602001351461230e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123059061485c565b60405180910390fd5b50505050565b60008082606001602081019061232a9190613c1f565b6bffffffffffffffffffffffff161415612346578290506123dc565b600182606001602081019061235b9190613c1f565b6bffffffffffffffffffffffff1614156123a15781602001358260400135600a6123859190614a1e565b846123909190614a69565b61239a9190614af2565b90506123dc565b6040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016123d390614b95565b60405180910390fd5b92915050565b6123ea613279565b612710612436600060149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16866bffffffffffffffffffffffff16612b5e90919063ffffffff16565b1115612477576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161246e90614c01565b60405180910390fd5b600080600080888a6124899190614a69565b905060006124dc6127106124ce600060149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff1685612b7490919063ffffffff16565b612b8a90919063ffffffff16565b905060006125156127106125078c6bffffffffffffffffffffffff1686612b7490919063ffffffff16565b612b8a90919063ffffffff16565b9050600061253e826125308587612ba090919063ffffffff16565b612ba090919063ffffffff16565b905061256a8a7f2a55205a00000000000000000000000000000000000000000000000000000000612a2c565b15612602578973ffffffffffffffffffffffffffffffffffffffff16632a55205a8a836040518363ffffffff1660e01b81526004016125aa929190614c21565b604080518083038186803b1580156125c157600080fd5b505afa1580156125d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125f99190614c5f565b80965081975050505b6126158582612ba090919063ffffffff16565b96506040518060a001604052808481526020018381526020018881526020018681526020018773ffffffffffffffffffffffffffffffffffffffff1681525097505050505050505095945050505050565b600082905060008260000151111561276d578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685600001516040518463ffffffff1660e01b81526004016126db939291906140c9565b602060405180830381600087803b1580156126f557600080fd5b505af1158015612709573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061272d9190614ccb565b61276c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161276390614d44565b60405180910390fd5b5b60008260200151111561286f578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685602001516040518463ffffffff1660e01b81526004016127dd939291906140c9565b602060405180830381600087803b1580156127f757600080fd5b505af115801561280b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061282f9190614ccb565b61286e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161286590614d44565b60405180910390fd5b5b600082606001511115612953578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86846080015185606001516040518463ffffffff1660e01b81526004016128c1939291906140c9565b602060405180830381600087803b1580156128db57600080fd5b505af11580156128ef573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129139190614ccb565b612952576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161294990614d44565b60405180910390fd5b5b8073ffffffffffffffffffffffffffffffffffffffff166323b872dd868685604001516040518463ffffffff1660e01b8152600401612994939291906140c9565b602060405180830381600087803b1580156129ae57600080fd5b505af11580156129c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129e69190614ccb565b612a25576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612a1c90614d44565b60405180910390fd5b5050505050565b6000612a3783612bb6565b8015612a495750612a488383612c03565b5b905092915050565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000612b30612b2a612d2e565b83612e48565b9050919050565b6000806000612b468585612e7b565b91509150612b5381612efe565b819250505092915050565b60008183612b6c919061459b565b905092915050565b60008183612b829190614a69565b905092915050565b60008183612b989190614af2565b905092915050565b60008183612bae9190614d64565b905092915050565b6000612be2827f01ffc9a700000000000000000000000000000000000000000000000000000000612c03565b8015612bfc5750612bfa8263ffffffff60e01b612c03565b155b9050919050565b6000806301ffc9a760e01b83604051602401612c1f9190613648565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090506000808573ffffffffffffffffffffffffffffffffffffffff1661753084604051612ca99190614e07565b6000604051808303818686fa925050503d8060008114612ce5576040519150601f19603f3d011682016040523d82523d6000602084013e612cea565b606091505b5091509150602081511015612d055760009350505050612d28565b818015612d22575080806020019051810190612d219190614ccb565b5b93505050505b92915050565b60007f000000000000000000000000854724cf06b047a8c0116c702472673864e508c473ffffffffffffffffffffffffffffffffffffffff163073ffffffffffffffffffffffffffffffffffffffff16148015612daa57507f000000000000000000000000000000000000000000000000000000000000a4ec46145b15612dd7577febde1fb2b3dac8f9cf2fa4e76f70f6ee5781ae2192474b546459cce8ed08f38a9050612e45565b612e427f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f7f6733c731225d42eb85e5bd0ab4cb44b6cc33da50aaf97ab8d9eadd30a19b98607fe6bbd6277e1bf288eed5e8d1780f9a50b239e86b153736bceebccf4ea79d90b36130d3565b90505b90565b60008282604051602001612e5d929190614e96565b60405160208183030381529060405280519060200120905092915050565b600080604183511415612ebd5760008060006020860151925060408601519150606086015160001a9050612eb18782858561310d565b94509450505050612ef7565b604083511415612eee576000806020850151915060408501519050612ee386838361321a565b935093505050612ef7565b60006002915091505b9250929050565b60006004811115612f1257612f11614ecd565b5b816004811115612f2557612f24614ecd565b5b1415612f30576130d0565b60016004811115612f4457612f43614ecd565b5b816004811115612f5757612f56614ecd565b5b1415612f98576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612f8f90614f48565b60405180910390fd5b60026004811115612fac57612fab614ecd565b5b816004811115612fbf57612fbe614ecd565b5b1415613000576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612ff790614fb4565b60405180910390fd5b6003600481111561301457613013614ecd565b5b81600481111561302757613026614ecd565b5b1415613068576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161305f90615046565b60405180910390fd5b60048081111561307b5761307a614ecd565b5b81600481111561308e5761308d614ecd565b5b14156130cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016130c6906150d8565b60405180910390fd5b5b50565b600083838346306040516020016130ee9594939291906150f8565b6040516020818303038152906040528051906020012090509392505050565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08360001c1115613148576000600391509150613211565b601b8560ff16141580156131605750601c8560ff1614155b15613172576000600491509150613211565b600060018787878760405160008152602001604052604051613197949392919061515a565b6020604051602081039080840390855afa1580156131b9573d6000803e3d6000fd5b505050602060405103519050600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16141561320857600060019250925050613211565b80600092509250505b94509492505050565b60008060007f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60001b841690506000601b60ff8660001c901c61325d919061459b565b905061326b8782888561310d565b935093505050935093915050565b6040518060a0016040528060008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b600080fd5b600080fd5b600080fd5b60006101a082840312156132e4576132e36132c8565b5b81905092915050565b600080fd5b600080fd5b600080fd5b60008083601f840112613312576133116132ed565b5b8235905067ffffffffffffffff81111561332f5761332e6132f2565b5b60208301915083600182028301111561334b5761334a6132f7565b5b9250929050565b600060c08284031215613368576133676132c8565b5b81905092915050565b600060a08284031215613387576133866132c8565b5b81905092915050565b60008060008060008060008060006101608a8c0312156133b3576133b26132be565b5b60008a013567ffffffffffffffff8111156133d1576133d06132c3565b5b6133dd8c828d016132cd565b99505060208a013567ffffffffffffffff8111156133fe576133fd6132c3565b5b61340a8c828d016132fc565b9850985050604061341d8c828d01613352565b9650506101008a013567ffffffffffffffff81111561343f5761343e6132c3565b5b61344b8c828d016132fc565b95509550506101208a013567ffffffffffffffff81111561346f5761346e6132c3565b5b61347b8c828d01613371565b9350506101408a013567ffffffffffffffff81111561349d5761349c6132c3565b5b6134a98c828d016132fc565b92509250509295985092959850929598565b60008115159050919050565b6134d0816134bb565b82525050565b60006020820190506134eb60008301846134c7565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061351c826134f1565b9050919050565b61352c81613511565b811461353757600080fd5b50565b60008135905061354981613523565b92915050565b6000819050919050565b6135628161354f565b811461356d57600080fd5b50565b60008135905061357f81613559565b92915050565b6000806000806000608086880312156135a1576135a06132be565b5b60006135af8882890161353a565b95505060206135c08882890161353a565b94505060406135d188828901613570565b935050606086013567ffffffffffffffff8111156135f2576135f16132c3565b5b6135fe888289016132fc565b92509250509295509295909350565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6136428161360d565b82525050565b600060208201905061365d6000830184613639565b92915050565b60006bffffffffffffffffffffffff82169050919050565b61368481613663565b82525050565b600060208201905061369f600083018461367b565b92915050565b600061016082840312156136bc576136bb6132c8565b5b81905092915050565b60008083601f8401126136db576136da6132ed565b5b8235905067ffffffffffffffff8111156136f8576136f76132f2565b5b6020830191508360c0820283011115613714576137136132f7565b5b9250929050565b60008083601f840112613731576137306132ed565b5b8235905067ffffffffffffffff81111561374e5761374d6132f2565b5b60208301915083602082028301111561376a576137696132f7565b5b9250929050565b600080600080600080610120878903121561378f5761378e6132be565b5b600087013567ffffffffffffffff8111156137ad576137ac6132c3565b5b6137b989828a016136a5565b96505060206137ca89828a01613352565b95505060e087013567ffffffffffffffff8111156137eb576137ea6132c3565b5b6137f789828a016136c5565b945094505061010087013567ffffffffffffffff81111561381b5761381a6132c3565b5b61382789828a0161371b565b92509250509295509295509295565b600060c0828403121561384c5761384b6132c8565b5b81905092915050565b6000806000806000806101c08789031215613873576138726132be565b5b600061388189828a01613352565b96505060c087013567ffffffffffffffff8111156138a2576138a16132c3565b5b6138ae89828a016132fc565b955095505060e06138c189828a01613836565b9350506101a087013567ffffffffffffffff8111156138e3576138e26132c3565b5b6138ef89828a016132fc565b92509250509295509295509295565b6000806000806000806000610140888a03121561391e5761391d6132be565b5b600088013567ffffffffffffffff81111561393c5761393b6132c3565b5b6139488a828b016136a5565b97505060206139598a828b01613352565b96505060e088013567ffffffffffffffff81111561397a576139796132c3565b5b6139868a828b01613371565b95505061010088013567ffffffffffffffff8111156139a8576139a76132c3565b5b6139b48a828b016136c5565b945094505061012088013567ffffffffffffffff8111156139d8576139d76132c3565b5b6139e48a828b0161371b565b925092505092959891949750929550565b6139fe81613511565b82525050565b6000602082019050613a1960008301846139f5565b92915050565b6000806000806000806101208789031215613a3d57613a3c6132be565b5b600087013567ffffffffffffffff811115613a5b57613a5a6132c3565b5b613a6789828a016132cd565b965050602087013567ffffffffffffffff811115613a8857613a876132c3565b5b613a9489828a016132fc565b95509550506040613aa789828a01613352565b93505061010087013567ffffffffffffffff811115613ac957613ac86132c3565b5b613ad589828a016132fc565b92509250509295509295509295565b60008060008060008060008060006102008a8c031215613b0757613b066132be565b5b6000613b158c828d01613352565b99505060c08a013567ffffffffffffffff811115613b3657613b356132c3565b5b613b428c828d016132fc565b985098505060e08a013567ffffffffffffffff811115613b6557613b646132c3565b5b613b718c828d01613371565b9650506101008a013567ffffffffffffffff811115613b9357613b926132c3565b5b613b9f8c828d016132fc565b9550955050610120613bb38c828d01613836565b9350506101e08a013567ffffffffffffffff811115613bd557613bd46132c3565b5b613be18c828d016132fc565b92509250509295985092959850929598565b613bfc81613663565b8114613c0757600080fd5b50565b600081359050613c1981613bf3565b92915050565b600060208284031215613c3557613c346132be565b5b6000613c4384828501613c0a565b91505092915050565b600060208284031215613c6257613c616132be565b5b6000613c708482850161353a565b91505092915050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112613ca557613ca4613c79565b5b80840192508235915067ffffffffffffffff821115613cc757613cc6613c7e565b5b602083019250600182023603831315613ce357613ce2613c83565b5b509250929050565b6000613cfa602084018461353a565b905092915050565b613d0b81613511565b82525050565b6000613d206020840184613570565b905092915050565b613d318161354f565b82525050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112613d6357613d62613d41565b5b83810192508235915060208301925067ffffffffffffffff821115613d8b57613d8a613d37565b5b600182023603841315613da157613da0613d3c565b5b509250929050565b600082825260208201905092915050565b82818337600083830152505050565b6000601f19601f8301169050919050565b6000613de68385613da9565b9350613df3838584613dba565b613dfc83613dc9565b840190509392505050565b6000613e166020840184613c0a565b905092915050565b613e2781613663565b82525050565b600060a08301613e406000840184613ceb565b613e4d6000860182613d02565b50613e5b6020840184613d11565b613e686020860182613d28565b50613e766040840184613d46565b8583036040870152613e89838284613dda565b92505050613e9a6060840184613ceb565b613ea76060860182613d02565b50613eb56080840184613e07565b613ec26080860182613e1e565b508091505092915050565b600082825260208201905092915050565b6000613eea8385613ecd565b9350613ef7838584613dba565b613f0083613dc9565b840190509392505050565b6000606082019050613f2060008301876139f5565b8181036020830152613f328186613e2d565b90508181036040830152613f47818486613ede565b905095945050505050565b600081519050613f6181613559565b92915050565b600060208284031215613f7d57613f7c6132be565b5b6000613f8b84828501613f52565b91505092915050565b6000819050919050565b6000819050919050565b6000613fc3613fbe613fb984613f94565b613f9e565b61354f565b9050919050565b613fd381613fa8565b82525050565b6000602082019050613fee6000830184613fca565b92915050565b600081905092915050565b600061400b8385613ff4565b9350614018838584613dba565b82840190509392505050565b6000614031828486613fff565b91508190509392505050565b600082825260208201905092915050565b7f4f6e6c7920616c6c6f7765642045524337323120746f6b656e73000000000000600082015250565b6000614084601a8361403d565b915061408f8261404e565b602082019050919050565b600060208201905081810360008301526140b381614077565b9050919050565b6140c38161354f565b82525050565b60006060820190506140de60008301866139f5565b6140eb60208301856139f5565b6140f860408301846140ba565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000808335600160200384360303811261414c5761414b613c79565b5b80840192508235915067ffffffffffffffff82111561416e5761416d613c7e565b5b60208301925060208202360383131561418a57614189613c83565b5b509250929050565b60008235600160a0038336030381126141ae576141ad613c79565b5b80830191505092915050565b60006080820190506141cf60008301876139f5565b6141dc60208301866140ba565b6141e960408301856139f5565b6141f660608301846140ba565b95945050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600060ff82169050919050565b60006142468261422e565b915060ff82141561425a576142596141ff565b5b600182019050919050565b7f496e76616c69642073656c6c6572206164647265737300000000000000000000600082015250565b600061429b60168361403d565b91506142a682614265565b602082019050919050565b600060208201905081810360008301526142ca8161428e565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061430760208361403d565b9150614312826142d1565b602082019050919050565b60006020820190508181036000830152614336816142fa565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b600061439960268361403d565b91506143a48261433d565b604082019050919050565b600060208201905081810360008301526143c88161438c565b9050919050565b6000819050919050565b6143e2816143cf565b82525050565b600060e0820190506143fd600083018a6143d9565b61440a60208301896139f5565b61441760408301886140ba565b61442460608301876140ba565b614431608083018661367b565b61443e60a08301856140ba565b61444b60c08301846139f5565b98975050505050505050565b7f50726963652076616c696461746f7220696e76616c6964000000000000000000600082015250565b600061448d60178361403d565b915061449882614457565b602082019050919050565b600060208201905081810360008301526144bc81614480565b9050919050565b7f4275796572207369676e20707269636520696e76616c69640000000000000000600082015250565b60006144f960188361403d565b9150614504826144c3565b602082019050919050565b60006020820190508181036000830152614528816144ec565b9050919050565b7f657263546f6b656e20696e76616c696400000000000000000000000000000000600082015250565b600061456560108361403d565b91506145708261452f565b602082019050919050565b6000602082019050818103600083015261459481614558565b9050919050565b60006145a68261354f565b91506145b18361354f565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156145e6576145e56141ff565b5b828201905092915050565b7f5072696365206973206578706972656400000000000000000000000000000000600082015250565b600061462760108361403d565b9150614632826145f1565b602082019050919050565b600060208201905081810360008301526146568161461a565b9050919050565b600060e082019050614672600083018a6143d9565b61467f60208301896139f5565b61468c60408301886140ba565b61469960608301876139f5565b6146a660808301866139f5565b6146b360a08301856139f5565b6146c060c08301846140ba565b98975050505050505050565b7f496e76616c696420626964646572206164647265737300000000000000000000600082015250565b600061470260168361403d565b915061470d826146cc565b602082019050919050565b60006020820190508181036000830152614731816146f5565b9050919050565b7f496e76616c6964207061796d656e7420746f6b656e2061646472657373000000600082015250565b600061476e601d8361403d565b915061477982614738565b602082019050919050565b6000602082019050818103600083015261479d81614761565b9050919050565b7f496e76616c696420746f6b656e20616464726573730000000000000000000000600082015250565b60006147da60158361403d565b91506147e5826147a4565b602082019050919050565b60006020820190508181036000830152614809816147cd565b9050919050565b7f496e76616c696420746f6b656e20696400000000000000000000000000000000600082015250565b600061484660108361403d565b915061485182614810565b602082019050919050565b6000602082019050818103600083015261487581614839565b9050919050565b600060e082019050614891600083018a6143d9565b61489e60208301896139f5565b6148ab60408301886140ba565b6148b860608301876140ba565b6148c560808301866139f5565b6148d260a083018561367b565b6148df60c08301846139f5565b98975050505050505050565b60008160011c9050919050565b6000808291508390505b60018511156149425780860481111561491e5761491d6141ff565b5b600185161561492d5780820291505b808102905061493b856148eb565b9450614902565b94509492505050565b60008261495b5760019050614a17565b816149695760009050614a17565b816001811461497f5760028114614989576149b8565b6001915050614a17565b60ff84111561499b5761499a6141ff565b5b8360020a9150848211156149b2576149b16141ff565b5b50614a17565b5060208310610133831016604e8410600b84101617156149ed5782820a9050838111156149e8576149e76141ff565b5b614a17565b6149fa84848460016148f8565b92509050818404811115614a1157614a106141ff565b5b81810290505b9392505050565b6000614a298261354f565b9150614a348361354f565b9250614a617fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848461494b565b905092915050565b6000614a748261354f565b9150614a7f8361354f565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0483118215151615614ab857614ab76141ff565b5b828202905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000614afd8261354f565b9150614b088361354f565b925082614b1857614b17614ac3565b5b828204905092915050565b7f43757272656e637920696e76616c696420666f7220707269636520636f6e766560008201527f7273696f6e000000000000000000000000000000000000000000000000000000602082015250565b6000614b7f60258361403d565b9150614b8a82614b23565b604082019050919050565b60006020820190508181036000830152614bae81614b72565b9050919050565b7f496e76616c696420706c6174666f726d20666565206f72204e474f2066656500600082015250565b6000614beb601f8361403d565b9150614bf682614bb5565b602082019050919050565b60006020820190508181036000830152614c1a81614bde565b9050919050565b6000604082019050614c3660008301856140ba565b614c4360208301846140ba565b9392505050565b600081519050614c5981613523565b92915050565b60008060408385031215614c7657614c756132be565b5b6000614c8485828601614c4a565b9250506020614c9585828601613f52565b9150509250929050565b614ca8816134bb565b8114614cb357600080fd5b50565b600081519050614cc581614c9f565b92915050565b600060208284031215614ce157614ce06132be565b5b6000614cef84828501614cb6565b91505092915050565b7f6661696c757265207768696c65207472616e7366657272696e67000000000000600082015250565b6000614d2e601a8361403d565b9150614d3982614cf8565b602082019050919050565b60006020820190508181036000830152614d5d81614d21565b9050919050565b6000614d6f8261354f565b9150614d7a8361354f565b925082821015614d8d57614d8c6141ff565b5b828203905092915050565b600081519050919050565b60005b83811015614dc1578082015181840152602081019050614da6565b83811115614dd0576000848401525b50505050565b6000614de182614d98565b614deb8185613ff4565b9350614dfb818560208601614da3565b80840191505092915050565b6000614e138284614dd6565b915081905092915050565b600081905092915050565b7f1901000000000000000000000000000000000000000000000000000000000000600082015250565b6000614e5f600283614e1e565b9150614e6a82614e29565b600282019050919050565b6000819050919050565b614e90614e8b826143cf565b614e75565b82525050565b6000614ea182614e52565b9150614ead8285614e7f565b602082019150614ebd8284614e7f565b6020820191508190509392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b7f45434453413a20696e76616c6964207369676e61747572650000000000000000600082015250565b6000614f3260188361403d565b9150614f3d82614efc565b602082019050919050565b60006020820190508181036000830152614f6181614f25565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265206c656e67746800600082015250565b6000614f9e601f8361403d565b9150614fa982614f68565b602082019050919050565b60006020820190508181036000830152614fcd81614f91565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202773272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b600061503060228361403d565b915061503b82614fd4565b604082019050919050565b6000602082019050818103600083015261505f81615023565b9050919050565b7f45434453413a20696e76616c6964207369676e6174757265202776272076616c60008201527f7565000000000000000000000000000000000000000000000000000000000000602082015250565b60006150c260228361403d565b91506150cd82615066565b604082019050919050565b600060208201905081810360008301526150f1816150b5565b9050919050565b600060a08201905061510d60008301886143d9565b61511a60208301876143d9565b61512760408301866143d9565b61513460608301856140ba565b61514160808301846139f5565b9695505050505050565b6151548161422e565b82525050565b600060808201905061516f60008301876143d9565b61517c602083018661514b565b61518960408301856143d9565b61519660608301846143d9565b9594505050505056fea2646970667358221220f9c7cd8e083ad23ac8100cb4780a42f5905c57ee9cdded975a2438a94ce57c1b64736f6c63430008090033