Address Details
contract
0x7257f454ba183c50a67a55572e04B11e8FB52003
- Contract Name
- NFTStoreFrontV3
- Creator
- 0x4c45c6–9e9f2c at 0xcd63bd–272ac8
- 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
- 254 Transactions
- Transfers
- 0 Transfers
- Gas Used
- 72,452,517
- Last Balance Update
- 23955601
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- NFTStoreFrontV3
- Optimization enabled
- false
- Compiler version
- v0.8.9+commit.e5eed63a
- EVM Version
- london
- Verified at
- 2022-11-03T12:05:05.722632Z
contracts/NFTStoreFrontV3.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 "./UtilsV2.sol"; import "./PlastikPRGV2.sol"; import "./PlastikNFTV3.sol"; import "./PlastikNFTMulV3.sol"; import "./PlastikCryptoV2.sol"; import "./PlasticRecoveryProjects.sol"; import "./PlastikBurner.sol"; interface IPlastikNFTLazyMint { function safeLazyMint( address buyer, NFTVoucher calldata voucher, bytes calldata signature ) external payable returns (uint256); } contract NFTStoreFrontV3 is Ownable, IERC721Receiver { using SafeMath for uint256; using SafeMath for uint96; event PlatformFee(uint96 platformFee); event RewardsFee(uint96 rewardsFeePct); event PlastikBurned(address indexed burner, uint256 amount); event BuyPRG( address indexed assetOwner, uint256 indexed tokenId, uint256 quantity, address indexed buyer ); uint96 private platformFeePct; uint96 private rewardsFeePct; struct Fee { uint256 platformFee; uint256 ngoFee; uint256 assetFee; uint256 royaltyFee; uint256 rewardFee; uint256 burnAmount; address tokenCreator; } struct PurchaseSignatures { bytes artSellSignature; bytes artVoucherSignature; bytes[] prgSellSignatures; bytes[] prgSignatures; PlastikSellPrice sellPrice; bytes signaturePrice; uint256 amountNft; bool isMultiNft; uint256[] amountsPrg; address sendTo; } struct PurchasePRG { SellRequest sellRequest; bytes sellSignature; PlastikSellPrice sellPrice; bytes signaturePrice; uint256 amount; address sendTo; } struct CalcFee { SellRequest sellRequest; uint256 amountToBuy; PlastikSellPrice sellPrice; bool isPRG; } address platformWalletAddress; address ngoWalletAddress; address rewardsWalletAddress; PlastikBurner plastikBurner; PlastikCryptoV2 plastikCrypto; PlasticRecoveryProjects plasticRecoveryProjects; constructor( address _platformWalletAddress, address _ngoWalletAddress, address _rewardsWalletAddress, uint96 _platformFeePct, uint96 _rewardsFeePct, address _plastikCrypto, address _plasticRecoveryProjects, address payable _plastikBurner ) Ownable() { platformWalletAddress = _platformWalletAddress; ngoWalletAddress = _ngoWalletAddress; rewardsWalletAddress = _rewardsWalletAddress; platformFeePct = _platformFeePct; rewardsFeePct = _rewardsFeePct; plastikCrypto = PlastikCryptoV2(_plastikCrypto); plasticRecoveryProjects = PlasticRecoveryProjects( _plasticRecoveryProjects ); plastikBurner = PlastikBurner(_plastikBurner); } function mixLazyMintedNFTV1WithPRGs( PurchaseSignatures calldata purchase, SellRequest calldata artSellRequest, NFTVoucher calldata artVoucher, SellRequest[] calldata prgSellRequests, PRGVoucher[] calldata prgVouchers ) public { plastikCrypto.verifyPriceSignature( _msgSender(), purchase.sellPrice, purchase.signaturePrice, artSellRequest.erc20Address ); address artSeller = plastikCrypto.verifySellerSign( artSellRequest, purchase.artSellSignature ); plastikCrypto.verifySellerSellRequest( artSeller, artSellRequest, artVoucher.tokenAddress, artVoucher.tokenId ); IPlastikNFTLazyMint(artVoucher.tokenAddress).safeLazyMint( purchase.sendTo, artVoucher, purchase.artVoucherSignature ); Fee memory artFee = getFees( CalcFee( artSellRequest, purchase.amountNft, purchase.sellPrice, false ) ); _distributeFee( _msgSender(), artSellRequest.sellerAddress, artSellRequest.erc20Address, artFee ); for (uint8 i = 0; i < prgVouchers.length; i++) { address rrgSeller = plastikCrypto.verifySellerSign( prgSellRequests[i], purchase.prgSellSignatures[i] ); } for (uint8 i = 0; i < prgVouchers.length; i++) { uint256 tokenId = PlastikPRGV2(prgVouchers[i].tokenAddress) .safeLazyMint( purchase.sendTo, purchase.amountsPrg[i], prgVouchers[i], purchase.prgSignatures[i], "" ); PlastikPRGV2(prgVouchers[i].tokenAddress).attachPRGToNFT( purchase.sendTo, tokenId, purchase.amountsPrg[i], artVoucher.tokenAddress, artVoucher.tokenId ); Fee memory fee = getFees( CalcFee( prgSellRequests[i], purchase.amountsPrg[i], purchase.sellPrice, true ) ); _distributeFee( _msgSender(), prgSellRequests[i].sellerAddress, prgSellRequests[i].erc20Address, fee ); emit BuyPRG( prgSellRequests[i].sellerAddress, prgVouchers[i].tokenId, purchase.amountsPrg[i], purchase.sendTo ); } } function mixLazyMintedNFTWithPRGs( PurchaseSignatures calldata purchase, SellRequest calldata artSellRequest, NFTVoucherV2 calldata artVoucher, SellRequest[] calldata prgSellRequests, PRGVoucher[] calldata prgVouchers ) public { plastikCrypto.verifyPriceSignature( _msgSender(), purchase.sellPrice, purchase.signaturePrice, artSellRequest.erc20Address ); address artSeller = plastikCrypto.verifySellerSign( artSellRequest, purchase.artSellSignature ); plastikCrypto.verifySellerSellRequest( artSeller, artSellRequest, artVoucher.tokenAddress, artVoucher.tokenId ); if (purchase.isMultiNft) { PlastikNFTMulV3(artVoucher.tokenAddress).safeLazyMint( purchase.sendTo, purchase.amountNft, artVoucher, purchase.artVoucherSignature, "" ); } else { PlastikNFTV3(artVoucher.tokenAddress).safeLazyMint( purchase.sendTo, artVoucher, purchase.artVoucherSignature ); } Fee memory artFee = getFees( CalcFee( artSellRequest, purchase.amountNft, purchase.sellPrice, false ) ); _distributeFee( _msgSender(), artSellRequest.sellerAddress, artSellRequest.erc20Address, artFee ); for (uint8 i = 0; i < prgVouchers.length; i++) { address rrgSeller = plastikCrypto.verifySellerSign( prgSellRequests[i], purchase.prgSellSignatures[i] ); } for (uint8 i = 0; i < prgVouchers.length; i++) { uint256 tokenId = PlastikPRGV2(prgVouchers[i].tokenAddress) .safeLazyMint( purchase.sendTo, purchase.amountsPrg[i], prgVouchers[i], purchase.prgSignatures[i], "" ); PlastikPRGV2(prgVouchers[i].tokenAddress).attachPRGToNFT( purchase.sendTo, tokenId, purchase.amountsPrg[i], artVoucher.tokenAddress, artVoucher.tokenId ); Fee memory fee = getFees( CalcFee( prgSellRequests[i], purchase.amountsPrg[i], purchase.sellPrice, true ) ); _distributeFee( _msgSender(), prgSellRequests[i].sellerAddress, prgSellRequests[i].erc20Address, fee ); emit BuyPRG( prgSellRequests[i].sellerAddress, prgVouchers[i].tokenId, purchase.amountsPrg[i], purchase.sendTo ); } } function mixExistingNFTWithPRGs( PurchaseSignatures calldata purchase, SellRequest calldata artSellRequest, SellRequest[] calldata prgSellRequests, PRGVoucher[] calldata prgVouchers ) public { plastikCrypto.verifyPriceSignature( _msgSender(), purchase.sellPrice, purchase.signaturePrice, artSellRequest.erc20Address ); address artSeller = plastikCrypto.verifySellerSign( artSellRequest, purchase.artSellSignature ); plastikCrypto.verifySellerSellRequest( artSeller, artSellRequest, artSellRequest.tokenAddress, artSellRequest.tokenId ); if (purchase.isMultiNft) { IERC1155(artSellRequest.tokenAddress).safeTransferFrom( artSellRequest.sellerAddress, purchase.sendTo, artSellRequest.tokenId, purchase.amountNft, "" ); } else { IERC721(artSellRequest.tokenAddress).safeTransferFrom( artSellRequest.sellerAddress, purchase.sendTo, artSellRequest.tokenId ); } Fee memory artFee = getFees( CalcFee( artSellRequest, purchase.amountNft, purchase.sellPrice, false ) ); _distributeFee( _msgSender(), artSellRequest.sellerAddress, artSellRequest.erc20Address, artFee ); for (uint8 i = 0; i < prgVouchers.length; i++) { address rrgSeller = plastikCrypto.verifySellerSign( prgSellRequests[i], purchase.prgSellSignatures[i] ); plastikCrypto.verifySellerSellRequest( rrgSeller, prgSellRequests[i], prgVouchers[i].tokenAddress, prgVouchers[i].tokenId ); uint256 tokenId = PlastikPRGV2(prgVouchers[i].tokenAddress) .safeLazyMint( purchase.sendTo, purchase.amountsPrg[i], prgVouchers[i], purchase.prgSignatures[i], "" ); PlastikPRGV2(prgVouchers[i].tokenAddress).attachPRGToNFT( purchase.sendTo, tokenId, purchase.amountsPrg[i], artSellRequest.tokenAddress, artSellRequest.tokenId ); Fee memory fee = getFees( CalcFee( prgSellRequests[i], purchase.amountsPrg[i], purchase.sellPrice, true ) ); _distributeFee( _msgSender(), prgSellRequests[i].sellerAddress, prgSellRequests[i].erc20Address, fee ); emit BuyPRG( rrgSeller, prgVouchers[i].tokenId, purchase.amountsPrg[i], purchase.sendTo ); } } function buyLazyMintedPRG( PurchasePRG calldata purchasePRG, PRGVoucher calldata voucher, bytes calldata signature ) public { plastikCrypto.verifyPriceSignature( _msgSender(), purchasePRG.sellPrice, purchasePRG.signaturePrice, purchasePRG.sellRequest.erc20Address ); address seller = plastikCrypto.verifySellerSign( purchasePRG.sellRequest, purchasePRG.sellSignature ); plastikCrypto.verifySellerSellRequest( seller, purchasePRG.sellRequest, voucher.tokenAddress, voucher.tokenId ); PlastikPRGV2(voucher.tokenAddress).safeLazyMint( purchasePRG.sendTo, purchasePRG.amount, voucher, signature, "" ); Fee memory fee = getFees( CalcFee( purchasePRG.sellRequest, purchasePRG.amount, purchasePRG.sellPrice, true ) ); _distributeFee( _msgSender(), purchasePRG.sellRequest.sellerAddress, purchasePRG.sellRequest.erc20Address, fee ); emit BuyPRG( seller, voucher.tokenId, purchasePRG.amount, purchasePRG.sendTo ); } function buyPRG(PurchasePRG calldata purchasePRG) public { plastikCrypto.verifyPriceSignature( _msgSender(), purchasePRG.sellPrice, purchasePRG.signaturePrice, purchasePRG.sellRequest.erc20Address ); address seller = plastikCrypto.verifySellerSign( purchasePRG.sellRequest, purchasePRG.sellSignature ); require( seller == purchasePRG.sellRequest.sellerAddress, "Invalid seller address" ); IERC1155(purchasePRG.sellRequest.tokenAddress).safeTransferFrom( purchasePRG.sellRequest.sellerAddress, purchasePRG.sendTo, purchasePRG.sellRequest.tokenId, purchasePRG.amount, "" ); emit BuyPRG( seller, purchasePRG.sellRequest.tokenId, purchasePRG.amount, purchasePRG.sendTo ); Fee memory fee = getFees( CalcFee( purchasePRG.sellRequest, purchasePRG.amount, purchasePRG.sellPrice, true ) ); _distributeFee( _msgSender(), purchasePRG.sellRequest.sellerAddress, purchasePRG.sellRequest.erc20Address, fee ); } function _convertCurrencyToPlastik( uint256 price, PlastikSellPrice memory sellPrice ) private view returns (uint256) { 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"); } 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 platform fee" ); } if (_fee.ngoFee > 0) { require( erc20Address.transferFrom( _buyer, ngoWalletAddress, _fee.ngoFee ), "failure while transferring ngo fee" ); } if (_fee.royaltyFee > 0) { require( erc20Address.transferFrom( _buyer, _fee.tokenCreator, _fee.royaltyFee ), "failure while transferring royalty fee" ); } if (_fee.rewardFee > 0) { require( erc20Address.transferFrom( _buyer, rewardsWalletAddress, _fee.rewardFee ), "failure while transferring reward fee" ); } if (_fee.burnAmount > 0) { require( erc20Address.transferFrom( _buyer, address(plastikBurner), _fee.burnAmount ), "failure while transferring burn amount" ); emit PlastikBurned(_buyer, _fee.burnAmount); } require( erc20Address.transferFrom(_buyer, _seller, _fee.assetFee), "failure while transferring asset fee" ); } 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(CalcFee memory calcFee) internal view returns (Fee memory) { require( calcFee.sellRequest.ngoFeePct.add(platformFeePct) <= 10000, "Invalid platform fee or NGO fee" ); uint256 price = _convertCurrencyToPlastik( calcFee.sellRequest.price, calcFee.sellPrice ); uint256 assetFee; address creator; uint256 royaltyFee; uint256 burnAmount = 0; uint256 paymentAmt = price * calcFee.amountToBuy; uint256 platformFee = paymentAmt.mul(platformFeePct).div(10000); uint256 rewardFee = 0; uint256 ngoFee = paymentAmt.mul(calcFee.sellRequest.ngoFeePct).div( 10000 ); uint256 amount = paymentAmt.sub(platformFee).sub(ngoFee); if (calcFee.isPRG) { burnAmount = plastikBurner.currentBurnRate() * calcFee.amountToBuy; if (platformFee > burnAmount) { platformFee -= burnAmount; } else { burnAmount = platformFee; platformFee = 0; } } else { rewardFee = platformFee.mul(rewardsFeePct).div(10000); if (platformFee > rewardFee) { platformFee -= rewardFee; } else { rewardFee = platformFee; platformFee = 0; } } if ( ERC165Checker.supportsInterface( calcFee.sellRequest.tokenAddress, type(IERC2981).interfaceId ) ) { (creator, royaltyFee) = ( ( IERC2981(calcFee.sellRequest.tokenAddress).royaltyInfo( calcFee.sellRequest.tokenId, amount ) ) ); } assetFee = amount.sub(royaltyFee); if ( plasticRecoveryProjects.isPlasticRecoveryProject( calcFee.sellRequest.sellerAddress ) ) { assetFee += ngoFee; ngoFee = 0; } return Fee( platformFee, ngoFee, assetFee, royaltyFee, rewardFee, burnAmount, creator ); } function setPlastikCrypto(address _crypto) public onlyOwner returns (bool) { plastikCrypto = PlastikCryptoV2(_crypto); return true; } function setPlasticRecoveryProjects(address _recoveryProjects) public onlyOwner returns (bool) { plasticRecoveryProjects = PlasticRecoveryProjects(_recoveryProjects); return true; } function setPlasticBurner(address payable _plasticBurner) public onlyOwner returns (bool) { plastikBurner = PlastikBurner(_plasticBurner); return true; } function rewardsFee() public view virtual returns (uint96) { return rewardsFeePct; } function setRewardsFeePct(uint96 _rewardsFeePct) public onlyOwner returns (bool) { rewardsFeePct = _rewardsFeePct; emit RewardsFee(rewardsFeePct); return true; } }
/_openzeppelin/contracts/access/AccessControl.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
/_openzeppelin/contracts/access/AccessControlEnumerable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerable.sol"; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view virtual override returns (address) { return _roleMembers[role].at(index); } /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) public view virtual override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {_grantRole} to track enumerable memberships */ function _grantRole(bytes32 role, address account) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
/_openzeppelin/contracts/access/IAccessControl.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
/_openzeppelin/contracts/access/IAccessControlEnumerable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
/_openzeppelin/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
/_openzeppelin/contracts/interfaces/IERC1155.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1155.sol) pragma solidity ^0.8.0; import "../token/ERC1155/IERC1155.sol";
/_openzeppelin/contracts/interfaces/IERC2981.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard. * * A standardized way to retrieve royalty payment information for non-fungible tokens (NFTs) to enable universal * support for royalty payments across all NFT marketplaces and ecosystem participants. * * _Available since v4.5._ */ interface IERC2981 is IERC165 { /** * @dev Returns how much royalty is owed and to whom, based on a sale price that may be denominated in any unit of * exchange. The royalty amount is denominated and should be paid in that same unit of exchange. */ function royaltyInfo(uint256 tokenId, uint256 salePrice) external view returns (address receiver, uint256 royaltyAmount); }
/_openzeppelin/contracts/interfaces/IERC721.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol) pragma solidity ^0.8.0; import "../token/ERC721/IERC721.sol";
/_openzeppelin/contracts/security/Pausable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
/_openzeppelin/contracts/token/ERC1155/ERC1155.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/ERC1155.sol) pragma solidity ^0.8.0; import "./IERC1155.sol"; import "./IERC1155Receiver.sol"; import "./extensions/IERC1155MetadataURI.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the basic standard multi-token. * See https://eips.ethereum.org/EIPS/eip-1155 * Originally based on code by Enjin: https://github.com/enjin/erc-1155 * * _Available since v3.1._ */ contract ERC1155 is Context, ERC165, IERC1155, IERC1155MetadataURI { using Address for address; // Mapping from token ID to account balances mapping(uint256 => mapping(address => uint256)) private _balances; // Mapping from account to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json string private _uri; /** * @dev See {_setURI}. */ constructor(string memory uri_) { _setURI(uri_); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155).interfaceId || interfaceId == type(IERC1155MetadataURI).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the same URI for *all* token types. It relies * on the token type ID substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * Clients calling this function must replace the `\{id\}` substring with the * actual token type ID. */ function uri(uint256) public view virtual override returns (string memory) { return _uri; } /** * @dev See {IERC1155-balanceOf}. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) public view virtual override returns (uint256) { require(account != address(0), "ERC1155: address zero is not a valid owner"); return _balances[id][account]; } /** * @dev See {IERC1155-balanceOfBatch}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] memory accounts, uint256[] memory ids) public view virtual override returns (uint256[] memory) { require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch"); uint256[] memory batchBalances = new uint256[](accounts.length); for (uint256 i = 0; i < accounts.length; ++i) { batchBalances[i] = balanceOf(accounts[i], ids[i]); } return batchBalances; } /** * @dev See {IERC1155-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC1155-isApprovedForAll}. */ function isApprovedForAll(address account, address operator) public view virtual override returns (bool) { return _operatorApprovals[account][operator]; } /** * @dev See {IERC1155-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not token owner nor approved" ); _safeTransferFrom(from, to, id, amount, data); } /** * @dev See {IERC1155-safeBatchTransferFrom}. */ function safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) public virtual override { require( from == _msgSender() || isApprovedForAll(from, _msgSender()), "ERC1155: caller is not token owner nor approved" ); _safeBatchTransferFrom(from, to, ids, amounts, data); } /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, to, ids, amounts, data); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; emit TransferSingle(operator, from, to, id, amount); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _safeBatchTransferFrom( address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); require(to != address(0), "ERC1155: transfer to the zero address"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, to, ids, amounts, data); for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: insufficient balance for transfer"); unchecked { _balances[id][from] = fromBalance - amount; } _balances[id][to] += amount; } emit TransferBatch(operator, from, to, ids, amounts); _afterTokenTransfer(operator, from, to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data); } /** * @dev Sets a new URI for all token types, by relying on the token type ID * substitution mechanism * https://eips.ethereum.org/EIPS/eip-1155#metadata[defined in the EIP]. * * By this mechanism, any occurrence of the `\{id\}` substring in either the * URI or any of the amounts in the JSON file at said URI will be replaced by * clients with the token type ID. * * For example, the `https://token-cdn-domain/\{id\}.json` URI would be * interpreted by clients as * `https://token-cdn-domain/000000000000000000000000000000000000000000000000000000000004cce0.json` * for token type ID 0x4cce0. * * See {uri}. * * Because these URIs cannot be meaningfully represented by the {URI} event, * this function emits no events. */ function _setURI(string memory newuri) internal virtual { _uri = newuri; } /** * @dev Creates `amount` tokens of token type `id`, and assigns them to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function _mint( address to, uint256 id, uint256 amount, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); _balances[id][to] += amount; emit TransferSingle(operator, address(0), to, id, amount); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_mint}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function _mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual { require(to != address(0), "ERC1155: mint to the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, address(0), to, ids, amounts, data); for (uint256 i = 0; i < ids.length; i++) { _balances[ids[i]][to] += amounts[i]; } emit TransferBatch(operator, address(0), to, ids, amounts); _afterTokenTransfer(operator, address(0), to, ids, amounts, data); _doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data); } /** * @dev Destroys `amount` tokens of token type `id` from `from` * * Emits a {TransferSingle} event. * * Requirements: * * - `from` cannot be the zero address. * - `from` must have at least `amount` tokens of token type `id`. */ function _burn( address from, uint256 id, uint256 amount ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); address operator = _msgSender(); uint256[] memory ids = _asSingletonArray(id); uint256[] memory amounts = _asSingletonArray(amount); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } emit TransferSingle(operator, from, address(0), id, amount); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {_burn}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. */ function _burnBatch( address from, uint256[] memory ids, uint256[] memory amounts ) internal virtual { require(from != address(0), "ERC1155: burn from the zero address"); require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch"); address operator = _msgSender(); _beforeTokenTransfer(operator, from, address(0), ids, amounts, ""); for (uint256 i = 0; i < ids.length; i++) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 fromBalance = _balances[id][from]; require(fromBalance >= amount, "ERC1155: burn amount exceeds balance"); unchecked { _balances[id][from] = fromBalance - amount; } } emit TransferBatch(operator, from, address(0), ids, amounts); _afterTokenTransfer(operator, from, address(0), ids, amounts, ""); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC1155: setting approval status for self"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Hook that is called before any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `ids` and `amounts` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} /** * @dev Hook that is called after any token transfer. This includes minting * and burning, as well as batched variants. * * The same hook is called on both single and batched variants. For single * transfers, the length of the `id` and `amount` arrays will be 1. * * Calling conditions (for each `id` and `amount` pair): * * - When `from` and `to` are both non-zero, `amount` of ``from``'s tokens * of token type `id` will be transferred to `to`. * - When `from` is zero, `amount` tokens of token type `id` will be minted * for `to`. * - when `to` is zero, `amount` of ``from``'s tokens of token type `id` * will be burned. * - `from` and `to` are never both zero. * - `ids` and `amounts` have the same, non-zero length. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual {} function _doSafeTransferAcceptanceCheck( address operator, address from, address to, uint256 id, uint256 amount, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) { if (response != IERC1155Receiver.onERC1155Received.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _doSafeBatchTransferAcceptanceCheck( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) private { if (to.isContract()) { try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns ( bytes4 response ) { if (response != IERC1155Receiver.onERC1155BatchReceived.selector) { revert("ERC1155: ERC1155Receiver rejected tokens"); } } catch Error(string memory reason) { revert(reason); } catch { revert("ERC1155: transfer to non ERC1155Receiver implementer"); } } } function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) { uint256[] memory array = new uint256[](1); array[0] = element; return array; } }
/_openzeppelin/contracts/token/ERC1155/IERC1155.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/IERC1155.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC1155 compliant contract, as defined in the * https://eips.ethereum.org/EIPS/eip-1155[EIP]. * * _Available since v3.1._ */ interface IERC1155 is IERC165 { /** * @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`. */ event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value); /** * @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all * transfers. */ event TransferBatch( address indexed operator, address indexed from, address indexed to, uint256[] ids, uint256[] values ); /** * @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to * `approved`. */ event ApprovalForAll(address indexed account, address indexed operator, bool approved); /** * @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI. * * If an {URI} event was emitted for `id`, the standard * https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value * returned by {IERC1155MetadataURI-uri}. */ event URI(string value, uint256 indexed id); /** * @dev Returns the amount of tokens of token type `id` owned by `account`. * * Requirements: * * - `account` cannot be the zero address. */ function balanceOf(address account, uint256 id) external view returns (uint256); /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}. * * Requirements: * * - `accounts` and `ids` must have the same length. */ function balanceOfBatch(address[] calldata accounts, uint256[] calldata ids) external view returns (uint256[] memory); /** * @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`, * * Emits an {ApprovalForAll} event. * * Requirements: * * - `operator` cannot be the caller. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns true if `operator` is approved to transfer ``account``'s tokens. * * See {setApprovalForAll}. */ function isApprovedForAll(address account, address operator) external view returns (bool); /** * @dev Transfers `amount` tokens of token type `id` from `from` to `to`. * * Emits a {TransferSingle} event. * * Requirements: * * - `to` cannot be the zero address. * - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}. * - `from` must have a balance of tokens of type `id` of at least `amount`. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the * acceptance magic value. */ function safeTransferFrom( address from, address to, uint256 id, uint256 amount, bytes calldata data ) external; /** * @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}. * * Emits a {TransferBatch} event. * * Requirements: * * - `ids` and `amounts` must have the same length. * - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the * acceptance magic value. */ function safeBatchTransferFrom( address from, address to, uint256[] calldata ids, uint256[] calldata amounts, bytes calldata data ) external; }
/_openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
/_openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC1155/extensions/ERC1155Burnable.sol) pragma solidity ^0.8.0; import "../ERC1155.sol"; /** * @dev Extension of {ERC1155} that allows token holders to destroy both their * own tokens and those that they have been approved to use. * * _Available since v3.1._ */ abstract contract ERC1155Burnable is ERC1155 { function burn( address account, uint256 id, uint256 value ) public virtual { require( account == _msgSender() || isApprovedForAll(account, _msgSender()), "ERC1155: caller is not token owner nor approved" ); _burn(account, id, value); } function burnBatch( address account, uint256[] memory ids, uint256[] memory values ) public virtual { require( account == _msgSender() || isApprovedForAll(account, _msgSender()), "ERC1155: caller is not token owner nor approved" ); _burnBatch(account, ids, values); } }
/_openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155Supply.sol) pragma solidity ^0.8.0; import "../ERC1155.sol"; /** * @dev Extension of ERC1155 that adds tracking of total supply per id. * * Useful for scenarios where Fungible and Non-fungible tokens have to be * clearly identified. Note: While a totalSupply of 1 might mean the * corresponding is an NFT, there is no guarantees that no other token with the * same id are not going to be minted. */ abstract contract ERC1155Supply is ERC1155 { mapping(uint256 => uint256) private _totalSupply; /** * @dev Total amount of tokens in with a given id. */ function totalSupply(uint256 id) public view virtual returns (uint256) { return _totalSupply[id]; } /** * @dev Indicates whether any token exist with a given id, or not. */ function exists(uint256 id) public view virtual returns (bool) { return ERC1155Supply.totalSupply(id) > 0; } /** * @dev See {ERC1155-_beforeTokenTransfer}. */ function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal virtual override { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); if (from == address(0)) { for (uint256 i = 0; i < ids.length; ++i) { _totalSupply[ids[i]] += amounts[i]; } } if (to == address(0)) { for (uint256 i = 0; i < ids.length; ++i) { uint256 id = ids[i]; uint256 amount = amounts[i]; uint256 supply = _totalSupply[id]; require(supply >= amount, "ERC1155: burn amount exceeds totalSupply"); unchecked { _totalSupply[id] = supply - amount; } } } } }
/_openzeppelin/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC1155/extensions/ERC1155URIStorage.sol) pragma solidity ^0.8.0; import "../../../utils/Strings.sol"; import "../ERC1155.sol"; /** * @dev ERC1155 token with storage based token URI management. * Inspired by the ERC721URIStorage extension * * _Available since v4.6._ */ abstract contract ERC1155URIStorage is ERC1155 { using Strings for uint256; // Optional base URI string private _baseURI = ""; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /** * @dev See {IERC1155MetadataURI-uri}. * * This implementation returns the concatenation of the `_baseURI` * and the token-specific uri if the latter is set * * This enables the following behaviors: * * - if `_tokenURIs[tokenId]` is set, then the result is the concatenation * of `_baseURI` and `_tokenURIs[tokenId]` (keep in mind that `_baseURI` * is empty per default); * * - if `_tokenURIs[tokenId]` is NOT set then we fallback to `super.uri()` * which in most cases will contain `ERC1155._uri`; * * - if `_tokenURIs[tokenId]` is NOT set, and if the parents do not have a * uri value set, then the result is empty. */ function uri(uint256 tokenId) public view virtual override returns (string memory) { string memory tokenURI = _tokenURIs[tokenId]; // If token URI is set, concatenate base URI and tokenURI (via abi.encodePacked). return bytes(tokenURI).length > 0 ? string(abi.encodePacked(_baseURI, tokenURI)) : super.uri(tokenId); } /** * @dev Sets `tokenURI` as the tokenURI of `tokenId`. */ function _setURI(uint256 tokenId, string memory tokenURI) internal virtual { _tokenURIs[tokenId] = tokenURI; emit URI(uri(tokenId), tokenId); } /** * @dev Sets `baseURI` as the `_baseURI` for all tokens */ function _setBaseURI(string memory baseURI) internal virtual { _baseURI = baseURI; } }
/_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/ERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens 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 amount ) 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, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
/_openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
/_openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/ERC20Pausable.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../security/Pausable.sol"; /** * @dev ERC20 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. */ abstract contract ERC20Pausable is ERC20, Pausable { /** * @dev See {ERC20-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override { super._beforeTokenTransfer(from, to, amount); require(!paused(), "ERC20Pausable: token transfer while paused"); } }
/_openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
/_openzeppelin/contracts/token/ERC721/ERC721.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: address zero is not a valid owner"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: invalid token ID"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not token owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); _safeTransfer(from, to, tokenId, data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { address owner = ERC721.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
/_openzeppelin/contracts/token/ERC721/IERC721.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
/_openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
/_openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721Burnable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "../../../utils/Context.sol"; /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be burned (destroyed). */ abstract contract ERC721Burnable is Context, ERC721 { /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); _burn(tokenId); } }
/_openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } }
/_openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721URIStorage.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; /** * @dev ERC721 token with storage based token URI management. */ abstract contract ERC721URIStorage is ERC721 { using Strings for uint256; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = _baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } return super.tokenURI(tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev See {ERC721-_burn}. This override additionally checks to see if a * token-specific URI was set for the token, and if so, it deletes the token URI from * the storage mapping. */ function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } }
/_openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
/_openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
/_openzeppelin/contracts/token/common/ERC2981.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "../../interfaces/IERC2981.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) public view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
/_openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/_openzeppelin/contracts/utils/Context.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
/_openzeppelin/contracts/utils/Strings.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
/_openzeppelin/contracts/utils/cryptography/ECDSA.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
/_openzeppelin/contracts/utils/cryptography/draft-EIP712.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
/_openzeppelin/contracts/utils/introspection/ERC165.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
/_openzeppelin/contracts/utils/introspection/ERC165Checker.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Checker.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Library used to query support of an interface declared via {IERC165}. * * Note that these functions return the actual result of the query: they do not * `revert` if an interface is not supported. It is up to the caller to decide * what to do in these cases. */ library ERC165Checker { // As per the EIP-165 spec, no interface should ever match 0xffffffff bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff; /** * @dev Returns true if `account` supports the {IERC165} interface, */ function supportsERC165(address account) internal view returns (bool) { // Any contract that implements ERC165 must explicitly indicate support of // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid return _supportsERC165Interface(account, type(IERC165).interfaceId) && !_supportsERC165Interface(account, _INTERFACE_ID_INVALID); } /** * @dev Returns true if `account` supports the interface defined by * `interfaceId`. Support for {IERC165} itself is queried automatically. * * See {IERC165-supportsInterface}. */ function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) { // query support of both ERC165 as per the spec and support of _interfaceId return supportsERC165(account) && _supportsERC165Interface(account, interfaceId); } /** * @dev Returns a boolean array where each value corresponds to the * interfaces passed in and whether they're supported or not. This allows * you to batch check interfaces for a contract where your expectation * is that some interfaces may not be supported. * * See {IERC165-supportsInterface}. * * _Available since v3.4._ */ function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool[] memory) { // an array of booleans corresponding to interfaceIds and whether they're supported or not bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length); // query support of ERC165 itself if (supportsERC165(account)) { // query support of each interface in interfaceIds for (uint256 i = 0; i < interfaceIds.length; i++) { interfaceIdsSupported[i] = _supportsERC165Interface(account, interfaceIds[i]); } } return interfaceIdsSupported; } /** * @dev Returns true if `account` supports all the interfaces defined in * `interfaceIds`. Support for {IERC165} itself is queried automatically. * * Batch-querying can lead to gas savings by skipping repeated checks for * {IERC165} support. * * See {IERC165-supportsInterface}. */ function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) { // query support of ERC165 itself if (!supportsERC165(account)) { return false; } // query support of each interface in _interfaceIds for (uint256 i = 0; i < interfaceIds.length; i++) { if (!_supportsERC165Interface(account, interfaceIds[i])) { return false; } } // all interfaces supported return true; } /** * @notice Query if a contract implements an interface, does not check ERC165 support * @param account The address of the contract to query for support of an interface * @param interfaceId The interface identifier, as specified in ERC-165 * @return true if the contract at account indicates support of the interface with * identifier interfaceId, false otherwise * @dev Assumes that account contains a contract that supports ERC165, otherwise * the behavior of this method is undefined. This precondition can be checked * with {supportsERC165}. * Interface identification is specified in ERC-165. */ function _supportsERC165Interface(address account, bytes4 interfaceId) private view returns (bool) { bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId); (bool success, bytes memory result) = account.staticcall{gas: 30000}(encodedParams); if (result.length < 32) return false; return success && abi.decode(result, (bool)); } }
/_openzeppelin/contracts/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
/_openzeppelin/contracts/utils/math/SafeMath.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
/_openzeppelin/contracts/utils/structs/EnumerableSet.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
/contracts/PlasticRecoveryProjects.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/AccessControlEnumerable.sol"; contract PlasticRecoveryProjects is Ownable, AccessControlEnumerable { bytes32 public constant ADMIN_ROLE = keccak256("ADMIN_ROLE"); mapping(address => bool) public plasticRecoveryProjects; event PlasticRecoveryProjectAdded(address indexed _address); event PlasticRecoveryProjectRemoved(address indexed _address); constructor() Ownable() { _grantRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(ADMIN_ROLE, _msgSender()); plasticRecoveryProjects[_msgSender()] = true; } function addPlasticRecoveryProject(address _address, bool value) public { require(hasRole(ADMIN_ROLE, msg.sender), "Only admin can verify"); plasticRecoveryProjects[_address] = value; if (value) { emit PlasticRecoveryProjectAdded(_address); } else { emit PlasticRecoveryProjectRemoved(_address); } } function isPlasticRecoveryProject(address _address) public view returns (bool) { return plasticRecoveryProjects[_address]; } }
/contracts/PlastikBaseERC721V3.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 "./PlastikCryptoV2.sol"; import "./PlastikRoleV2.sol"; import "./UtilsV2.sol"; import "./PlastikRoyaltyCal.sol"; /// @custom:security-contact daniel@nozama.green abstract contract PlastikBaseERC721V3 is Ownable, ERC721, ERC721Enumerable, ERC721URIStorage, ERC721Burnable, IERC2981 { string internal __baseURI; IPlastikRoyaltyCal internal royaltyCal; PlastikCryptoV2 internal plastikCrypto; PlastikRoleV2 internal plastikRole; constructor( IPlastikRoyaltyCal _royaltyCal, PlastikCryptoV2 _plastikCrypto, PlastikRoleV2 _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 onlyMinterRoleOrOwner() { if (_msgSender() != owner()) { 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 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/PlastikBurner.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "./PlastikToken.sol"; // 35714285714285714 = MAX Burn per year = ((Total PLASTIK supply) / (Years to meet plastic neutrallity)) // 1Kg PRG burns = ((Total PLASTIK supply) / (Years to meet plastic neutrallity)) / (Yearly Plastic production in KG) PLASTIK // Total PLASTIK supply = 1.000.000.000 PLASTIK // Years to meet plastic neutrallity = 28 // MAX Burn per year = 35.714.285 PLASTIK // Yearly Plastic production in KG = (will vary every year, but for now) 300.000.000.000 KG // 1KG PRG burns (until MAX Burn per year is achieve) -> 0.000119047 PLASTIK (edited) contract PlastikBurner is Ownable { PlastikToken plastikToken; uint96 year = 2022; uint256 maxBurnYear = 35714285714285714; uint256 plasticProduction = 300000000000; // 300 bil uint256 burnPerKg = 119047; // 0.000119047 PLASTIK per Kg event PlastikBurned(address indexed sender, uint256 quantity, uint96 indexed year); constructor(address plastikTokenAddress, uint96 _year, uint256 _plasticProduction, uint256 _maxBurnYear) { plastikToken = PlastikToken(plastikTokenAddress); year = _year; plasticProduction = _plasticProduction; require(_plasticProduction > 0, "plasticProduction must be bigger than 0"); require(_maxBurnYear > 0, "maxBurnYear must be bigger than 0"); maxBurnYear = _maxBurnYear; burnPerKg = _maxBurnYear / _plasticProduction; } //Burn Rate per Kg function currentBurnRate() public view returns (uint256) { uint256 balance = plastikToken.balanceOf(address(this)); if(balance < maxBurnYear) { return burnPerKg; } return 0; } function getBalance() external view returns (uint256){ return plastikToken.balanceOf(address(this)); } function setPlasticProduction(uint256 quantity) onlyOwner public returns (bool) { require(quantity > 0, "plasticProduction must be bigger than 0"); plasticProduction = quantity; burnPerKg = maxBurnYear / plasticProduction; return true; } function setMaxBurnYear(uint256 quantity) onlyOwner public returns (bool) { require(quantity > 0, "maxBurnYear must be bigger than 0"); maxBurnYear = quantity; burnPerKg = maxBurnYear / plasticProduction; return true; } }
/contracts/PlastikCryptoV2.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import "./UtilsV2.sol"; contract PlastikCryptoV2 is Ownable, EIP712 { address priceValidator; constructor(address _priceSigner) EIP712("PLASTIK", "2.0") { priceValidator = _priceSigner; } function setPriceValidator(address newValidator) public onlyOwner returns (bool) { priceValidator = newValidator; return true; } /// @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 verifyNFTVoucher( NFTVoucherV2 calldata voucher, bytes memory signature ) public view returns (address) { bytes32 digest = _hashTypedDataV4( keccak256( abi.encode( Constants.NFTVOUCHERV2_TYPEHASH, voucher.tokenAddress, voucher.tokenId, voucher.amount, keccak256(bytes(voucher.tokenURI)), voucher.creatorAddress, voucher.royalty ) ) ); return ECDSA.recover(digest, signature); } function verifyPriceSignature( address sender, PlastikSellPrice calldata item, bytes calldata signature, address ercToken ) public 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(sender == 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 verifySellerSign( SellRequest calldata item, bytes calldata signature ) public view returns (address) { bytes32 digest = _hashTypedDataV4( keccak256( abi.encode( Constants.SELLREQUEST_TYPEHASH, item.tokenAddress, item.tokenId, item.price, item.amount, item.erc20Address, item.ngoFeePct, item.sellerAddress ) ) ); return ECDSA.recover(digest, signature); } function verifySellerSellRequest( address seller, SellRequest calldata sellRequest, address tokenAddress, uint256 tokenId ) public pure { require(seller == sellRequest.sellerAddress, "Invalid seller address"); require( sellRequest.tokenAddress == tokenAddress, "Invalid token address" ); require(sellRequest.tokenId == tokenId, "Invalid token id"); } function verifyPRGVoucher(PRGVoucher calldata voucher, bytes memory signature) public view returns (address) { bytes32 digest = _hashTypedDataV4( keccak256( abi.encode( Constants.PRGVOUCHER_TYPEHASH, voucher.tokenAddress, voucher.tokenId, voucher.amount, keccak256(bytes(voucher.tokenURI)), voucher.creatorAddress ) ) ); return ECDSA.recover(digest, signature); } }
/contracts/PlastikNFTMulV3.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol"; import "./UtilsV2.sol"; import "./PlastikCryptoV2.sol"; import "./PlastikRoleV2.sol"; import "./PlastikRoyaltyCal.sol"; /// @custom:security-contact daniel@nozama.green contract PlastikNFTMulV3 is Ownable, ERC1155URIStorage, ERC1155Burnable, ERC1155Supply { IPlastikRoyaltyCal internal royaltyCal; PlastikCryptoV2 internal plastikCrypto; PlastikRoleV2 internal plastikRole; event PlastikNFTMultiMinted( address mintTo, uint256 tokenId, uint256 amount ); constructor( address _royaltyCal, address _plastikCrypto, address _plastikRole ) ERC1155("https://plastiks.io/ipfs") { royaltyCal = IPlastikRoyaltyCal(_royaltyCal); plastikCrypto = PlastikCryptoV2(_plastikCrypto); plastikRole = PlastikRoleV2(_plastikRole); } modifier onlyMinter() { if (_msgSender() != owner()) { plastikRole.verifyMinterRole(_msgSender()); } _; } function setBaseURI(string memory newuri) public onlyOwner { _setBaseURI(newuri); } function mint( address to, uint256 id, uint256 amount, string memory tokenURI, uint96 royaltyFee, bytes memory data ) external onlyMinter returns (uint256) { _mint(to, id, amount, data); _setURI(id, tokenURI); royaltyCal.setTokenRoyalty(id, to, royaltyFee); emit PlastikNFTMultiMinted(to, id, amount); return id; } function mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, string[] memory uris, uint96[] memory royaltyFee, bytes memory data ) public onlyMinter { require( uris.length == amounts.length, "ERC1155: uris and amounts length mismatch" ); _mintBatch(to, ids, amounts, data); for (uint256 i = 0; i < uris.length; i++) { _setURI(ids[i], uris[i]); royaltyCal.setTokenRoyalty(ids[i], to, royaltyFee[i]); emit PlastikNFTMultiMinted(to, ids[i], amounts[i]); } } function uri(uint256 tokenId) public view virtual override(ERC1155, ERC1155URIStorage) returns (string memory) { return super.uri(tokenId); } function safeLazyMint( address buyer, uint256 amount, NFTVoucherV2 calldata voucher, bytes memory signature, bytes memory data ) external payable onlyMinter 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.verifyNFTVoucher(voucher, signature); require( signer == voucher.creatorAddress, "Creator Address does not match" ); if (!exists(voucher.tokenId)) { _mint(signer, voucher.tokenId, voucher.amount, data); _setURI(voucher.tokenId, voucher.tokenURI); royaltyCal.setTokenRoyalty( voucher.tokenId, signer, voucher.royalty ); emit PlastikNFTMultiMinted(signer, voucher.tokenId, voucher.amount); } safeTransferFrom(signer, buyer, voucher.tokenId, amount, data); return voucher.tokenId; } function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal override(ERC1155, ERC1155Supply) { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); } function supportsInterface(bytes4 interfaceId) public view override(ERC1155) returns (bool) { return super.supportsInterface(interfaceId); } }
/contracts/PlastikNFTV3.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "./UtilsV2.sol"; import "./PlastikBaseERC721V3.sol"; /// @custom:security-contact daniel@nozama.green contract PlastikNFTV3 is PlastikBaseERC721V3, IPlastikArtLazyMint { event PlastikNFTMinted(address mintTo, uint256 tokenId); constructor( IPlastikRoyaltyCal _royaltyCal, PlastikCryptoV2 _plastikCrypto, PlastikRoleV2 _plastikRole, string memory name, string memory symbol ) PlastikBaseERC721V3( _royaltyCal, _plastikCrypto, _plastikRole, name, symbol ) {} function safeLazyMint( address buyer, NFTVoucherV2 calldata voucher, bytes calldata signature ) external payable onlyMinterRoleOrOwner 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.verifyNFTVoucher(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 transferFrom(signer, buyer, voucher.tokenId); return voucher.tokenId; } function safeMint(string memory tokenURI, uint256 tokenId, uint96 royaltyFee) onlyMinterRoleOrOwner public returns (uint256) { _safeMint(msg.sender, tokenId); _setTokenURI(tokenId, tokenURI); emit PlastikNFTMinted(msg.sender, tokenId); royaltyCal.setTokenRoyalty(tokenId, msg.sender, royaltyFee); return tokenId; } }
/contracts/PlastikPRGV2.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155URIStorage.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol"; import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Supply.sol"; import "./UtilsV2.sol"; import "./VerifiedAccounts.sol"; import "./PlastikCryptoV2.sol"; import "./PlastikRoleV2.sol"; /// @custom:security-contact daniel@nozama.green contract PlastikPRGV2 is Ownable, ERC1155URIStorage, ERC1155Burnable, ERC1155Supply { mapping(uint256 => mapping(address => mapping(uint256 => uint256))) public attachedPRGToNFT; //tokenId => NFTAdress => tokenIdNFTAdrress => amount mapping(address => bool) whiteListSenders; event PRGNFTMinted(address indexed mintTo, uint256 tokenId, uint256 amount); event TheArtOfRecycling( address indexed sustainableUser, uint256 tokenId, uint256 amount, address indexed nftAddress, uint256 indexed nftTokenId ); VerifiedAccounts internal verifiedAccounts; PlastikCryptoV2 internal plastikCrypto; PlastikRoleV2 internal plastikRole; constructor(address _addressVerification, address _plastikCrypto, address _plastikRole) ERC1155("https://plastiks.io/ipfs") { verifiedAccounts = VerifiedAccounts(_addressVerification); plastikCrypto = PlastikCryptoV2(_plastikCrypto); plastikRole = PlastikRoleV2(_plastikRole); whiteListSenders[_msgSender()] = true; } modifier onlyMinter() { if (_msgSender() != owner()) { plastikRole.verifyMinterRole(_msgSender()); } _; } function setBaseURI(string memory newuri) public onlyOwner { _setBaseURI(newuri); } function setVerification(address _verifiedAddress) public onlyOwner returns (bool) { verifiedAccounts = VerifiedAccounts(_verifiedAddress); return true; } function mint( address to, uint256 id, uint256 amount, string memory tokenURI, bytes memory data ) external onlyMinter returns (uint256) { require( verifiedAccounts.isVerified(to), "Creator is not a verified recycler" ); _mint(to, id, amount, data); _setURI(id, tokenURI); emit PRGNFTMinted(to, id, amount); return id; } function mintBatch( address to, uint256[] memory ids, uint256[] memory amounts, string[] memory uris, bytes memory data ) public onlyMinter { require( verifiedAccounts.isVerified(to), "Creator is not a verified recycler" ); require( uris.length == amounts.length, "ERC1155: uris and amounts length mismatch" ); _mintBatch(to, ids, amounts, data); for (uint256 i = 0; i < uris.length; i++) { _setURI(ids[i], uris[i]); emit PRGNFTMinted(to, ids[i], amounts[i]); } } function safeLazyMint( address buyer, uint256 amount, PRGVoucher calldata voucher, bytes memory signature, bytes memory data ) external payable onlyMinter 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.verifyPRGVoucher(voucher, signature); require( signer == voucher.creatorAddress, "Creator Address does not match" ); require( verifiedAccounts.isVerified(voucher.creatorAddress), "Creator is not a verified recycler" ); if (!exists(voucher.tokenId)) { _mint(signer, voucher.tokenId, voucher.amount, data); _setURI(voucher.tokenId, voucher.tokenURI); emit PRGNFTMinted(signer, voucher.tokenId, voucher.amount); } safeTransferFrom(signer, buyer, voucher.tokenId, amount, data); return voucher.tokenId; } function uri(uint256 tokenId) public view virtual override(ERC1155, ERC1155URIStorage) returns (string memory) { return super.uri(tokenId); } function attachPRGToNFT( address sustainableUser, uint256 tokenId, uint256 amount, address nftTokenAddress, uint256 nftTokenId ) public onlyMinter returns (bool) { attachedPRGToNFT[tokenId][nftTokenAddress][nftTokenId] += amount; emit TheArtOfRecycling( sustainableUser, tokenId, amount, nftTokenAddress, nftTokenId ); return true; } function _beforeTokenTransfer( address operator, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data ) internal override(ERC1155, ERC1155Supply) { super._beforeTokenTransfer(operator, from, to, ids, amounts, data); require( from == address(0) || whiteListSenders[from] || verifiedAccounts.isVerified(from), "from account is not a verified recycler" ); } function addWhiteListSenderAddress(address _address, bool value) onlyOwner public returns(bool) { whiteListSenders[_address] = value; return true; } function supportsInterface(bytes4 interfaceId) public view override(ERC1155) returns (bool) { return super.supportsInterface(interfaceId); } }
/contracts/PlastikRoleV2.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import "@openzeppelin/contracts/access/AccessControl.sol"; import "./UtilsV2.sol"; contract PlastikRoleV2 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/PlastikToken.sol
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Pausable.sol"; contract PlastikToken is ERC20, ERC20Pausable { address private _owner; mapping(address => bool) private _lockers; mapping(address => uint256) private _locks; constructor() ERC20("PLASTIK Token", "PLASTIK") { _owner = _msgSender(); _lockers[_msgSender()] = true; _mint(_msgSender(), 1000000000 * (10 ** decimals())); } modifier onlyOwner { require(msg.sender == _owner); _; } function pause() public virtual onlyOwner { _pause(); } function unpause() public virtual onlyOwner { _unpause(); } function decimals() public view virtual override(ERC20) returns (uint8) { return 9; } function setLocker(address locker, bool canLock) public virtual onlyOwner { _lockers[locker] = canLock; } function getLockupTime(address _address) public view virtual returns (uint256) { return _locks[_address]; } function transferWithLockup(address recipient, uint256 amount, uint numMonthsLockup) public virtual returns (bool) { require(numMonthsLockup > 0 && numMonthsLockup <= 12, "Lockup cannot be smaller than 0 or greater than 12 months"); require(_lockers[_msgSender()], "Only lockers can lock"); uint256 previousBalance = balanceOf(recipient); transfer(recipient, amount); if(_locks[recipient] == 0 && previousBalance == 0) { _locks[recipient] = block.timestamp + (numMonthsLockup * 4 weeks ); } return true; } function transferFromWithLockup(address sender, address recipient, uint256 amount, uint numMonthsLockup) public virtual returns (bool) { require(numMonthsLockup > 0 && numMonthsLockup <= 12, "Lockup cannot be smaller than 0 or greater than 12 months"); require(_lockers[_msgSender()], "Only lockers can lock"); uint256 previousBalance = balanceOf(recipient); transferFrom(sender, recipient, amount); if(_locks[recipient] == 0 && previousBalance == 0) { _locks[recipient] = block.timestamp + (numMonthsLockup * 4 weeks ); } return true; } function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override(ERC20, ERC20Pausable) { require(_owner == from || _locks[from] == 0 || _locks[from] <= block.timestamp, "Wallet is locked"); super._beforeTokenTransfer(from, to, amount); } }
/contracts/UtilsV2.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 NFTVOUCHERV2_TYPEHASH = keccak256( "NFTVoucherV2(address tokenAddress,uint256 tokenId,uint256 amount,string tokenURI,address creatorAddress,uint96 royalty)" ); bytes32 constant PRGVOUCHER_TYPEHASH = keccak256( "PRGVoucher(address tokenAddress,uint256 tokenId,uint256 amount,string tokenURI,address creatorAddress)" ); bytes32 constant SELLREQUEST_TYPEHASH = keccak256( "SellRequest(address tokenAddress,uint256 tokenId,uint256 price,uint256 amount,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; } /// @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 NFTVoucherV2 { /// @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 amount of tokens to mint uint256 amount; /// @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; } struct PRGVoucher { /// @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 amount of tokens to mint uint256 amount; /// @notice The metadata URI to associate with this token. string tokenURI; /// @notice The address of the original signer of this lazy minting address creatorAddress; } struct SellRequest { address tokenAddress; uint256 tokenId; uint256 price; uint256 amount; address erc20Address; uint96 ngoFeePct; address sellerAddress; } struct PlastikSellPrice { address buyer; uint256 ratio; uint256 decimals; uint96 currency; uint256 timestamp; address tokenAddress; } interface IPlastikArtLazyMint { function safeLazyMint( address buyer, NFTVoucherV2 calldata voucher, bytes calldata signature ) external payable returns (uint256); } interface IPlastikRRGLazyMint { function safeLazyMint( address buyer, NFTVoucherV2 calldata voucher, bytes calldata signature ) external payable returns (uint256); } interface IPlastikPRGLazyMint { function safeLazyMint( address buyer, PRGVoucher 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":"address","name":"_rewardsWalletAddress","internalType":"address"},{"type":"uint96","name":"_platformFeePct","internalType":"uint96"},{"type":"uint96","name":"_rewardsFeePct","internalType":"uint96"},{"type":"address","name":"_plastikCrypto","internalType":"address"},{"type":"address","name":"_plasticRecoveryProjects","internalType":"address"},{"type":"address","name":"_plastikBurner","internalType":"address payable"}]},{"type":"event","name":"BuyPRG","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":"PlastikBurned","inputs":[{"type":"address","name":"burner","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"PlatformFee","inputs":[{"type":"uint96","name":"platformFee","internalType":"uint96","indexed":false}],"anonymous":false},{"type":"event","name":"RewardsFee","inputs":[{"type":"uint96","name":"rewardsFeePct","internalType":"uint96","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"buyLazyMintedPRG","inputs":[{"type":"tuple","name":"purchasePRG","internalType":"struct NFTStoreFrontV3.PurchasePRG","components":[{"type":"tuple","name":"sellRequest","internalType":"struct SellRequest","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"uint256","name":"amount","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 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":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"sendTo","internalType":"address"}]},{"type":"tuple","name":"voucher","internalType":"struct PRGVoucher","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"string","name":"tokenURI","internalType":"string"},{"type":"address","name":"creatorAddress","internalType":"address"}]},{"type":"bytes","name":"signature","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"buyPRG","inputs":[{"type":"tuple","name":"purchasePRG","internalType":"struct NFTStoreFrontV3.PurchasePRG","components":[{"type":"tuple","name":"sellRequest","internalType":"struct SellRequest","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"uint256","name":"amount","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 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":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"sendTo","internalType":"address"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mixExistingNFTWithPRGs","inputs":[{"type":"tuple","name":"purchase","internalType":"struct NFTStoreFrontV3.PurchaseSignatures","components":[{"type":"bytes","name":"artSellSignature","internalType":"bytes"},{"type":"bytes","name":"artVoucherSignature","internalType":"bytes"},{"type":"bytes[]","name":"prgSellSignatures","internalType":"bytes[]"},{"type":"bytes[]","name":"prgSignatures","internalType":"bytes[]"},{"type":"tuple","name":"sellPrice","internalType":"struct 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":"uint256","name":"amountNft","internalType":"uint256"},{"type":"bool","name":"isMultiNft","internalType":"bool"},{"type":"uint256[]","name":"amountsPrg","internalType":"uint256[]"},{"type":"address","name":"sendTo","internalType":"address"}]},{"type":"tuple","name":"artSellRequest","internalType":"struct SellRequest","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"erc20Address","internalType":"address"},{"type":"uint96","name":"ngoFeePct","internalType":"uint96"},{"type":"address","name":"sellerAddress","internalType":"address"}]},{"type":"tuple[]","name":"prgSellRequests","internalType":"struct SellRequest[]","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"erc20Address","internalType":"address"},{"type":"uint96","name":"ngoFeePct","internalType":"uint96"},{"type":"address","name":"sellerAddress","internalType":"address"}]},{"type":"tuple[]","name":"prgVouchers","internalType":"struct PRGVoucher[]","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"string","name":"tokenURI","internalType":"string"},{"type":"address","name":"creatorAddress","internalType":"address"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mixLazyMintedNFTV1WithPRGs","inputs":[{"type":"tuple","name":"purchase","internalType":"struct NFTStoreFrontV3.PurchaseSignatures","components":[{"type":"bytes","name":"artSellSignature","internalType":"bytes"},{"type":"bytes","name":"artVoucherSignature","internalType":"bytes"},{"type":"bytes[]","name":"prgSellSignatures","internalType":"bytes[]"},{"type":"bytes[]","name":"prgSignatures","internalType":"bytes[]"},{"type":"tuple","name":"sellPrice","internalType":"struct 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":"uint256","name":"amountNft","internalType":"uint256"},{"type":"bool","name":"isMultiNft","internalType":"bool"},{"type":"uint256[]","name":"amountsPrg","internalType":"uint256[]"},{"type":"address","name":"sendTo","internalType":"address"}]},{"type":"tuple","name":"artSellRequest","internalType":"struct SellRequest","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"uint256","name":"amount","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":"prgSellRequests","internalType":"struct SellRequest[]","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"erc20Address","internalType":"address"},{"type":"uint96","name":"ngoFeePct","internalType":"uint96"},{"type":"address","name":"sellerAddress","internalType":"address"}]},{"type":"tuple[]","name":"prgVouchers","internalType":"struct PRGVoucher[]","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"string","name":"tokenURI","internalType":"string"},{"type":"address","name":"creatorAddress","internalType":"address"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"mixLazyMintedNFTWithPRGs","inputs":[{"type":"tuple","name":"purchase","internalType":"struct NFTStoreFrontV3.PurchaseSignatures","components":[{"type":"bytes","name":"artSellSignature","internalType":"bytes"},{"type":"bytes","name":"artVoucherSignature","internalType":"bytes"},{"type":"bytes[]","name":"prgSellSignatures","internalType":"bytes[]"},{"type":"bytes[]","name":"prgSignatures","internalType":"bytes[]"},{"type":"tuple","name":"sellPrice","internalType":"struct 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":"uint256","name":"amountNft","internalType":"uint256"},{"type":"bool","name":"isMultiNft","internalType":"bool"},{"type":"uint256[]","name":"amountsPrg","internalType":"uint256[]"},{"type":"address","name":"sendTo","internalType":"address"}]},{"type":"tuple","name":"artSellRequest","internalType":"struct SellRequest","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"uint256","name":"amount","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 NFTVoucherV2","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"string","name":"tokenURI","internalType":"string"},{"type":"address","name":"creatorAddress","internalType":"address"},{"type":"uint96","name":"royalty","internalType":"uint96"}]},{"type":"tuple[]","name":"prgSellRequests","internalType":"struct SellRequest[]","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"price","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"address","name":"erc20Address","internalType":"address"},{"type":"uint96","name":"ngoFeePct","internalType":"uint96"},{"type":"address","name":"sellerAddress","internalType":"address"}]},{"type":"tuple[]","name":"prgVouchers","internalType":"struct PRGVoucher[]","components":[{"type":"address","name":"tokenAddress","internalType":"address"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint256","name":"amount","internalType":"uint256"},{"type":"string","name":"tokenURI","internalType":"string"},{"type":"address","name":"creatorAddress","internalType":"address"}]}]},{"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":"view","outputs":[{"type":"uint96","name":"","internalType":"uint96"}],"name":"rewardsFee","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"setPlasticBurner","inputs":[{"type":"address","name":"_plasticBurner","internalType":"address payable"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"setPlasticRecoveryProjects","inputs":[{"type":"address","name":"_recoveryProjects","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"setPlastikCrypto","inputs":[{"type":"address","name":"_crypto","internalType":"address"}]},{"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":"setRewardsFeePct","inputs":[{"type":"uint96","name":"_rewardsFeePct","internalType":"uint96"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
Contract Creation Code
0x60806040523480156200001157600080fd5b506040516200628b3803806200628b833981810160405281019062000037919062000411565b620000576200004b6200024d60201b60201c565b6200025560201b60201c565b876001600c6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555086600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555085600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555084600060146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555083600160006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff16021790555082600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555081600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055505050505050505050620004da565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006200034b826200031e565b9050919050565b6200035d816200033e565b81146200036957600080fd5b50565b6000815190506200037d8162000352565b92915050565b60006bffffffffffffffffffffffff82169050919050565b620003a68162000383565b8114620003b257600080fd5b50565b600081519050620003c6816200039b565b92915050565b6000620003d9826200031e565b9050919050565b620003eb81620003cc565b8114620003f757600080fd5b50565b6000815190506200040b81620003e0565b92915050565b600080600080600080600080610100898b03121562000435576200043462000319565b5b6000620004458b828c016200036c565b9850506020620004588b828c016200036c565b97505060406200046b8b828c016200036c565b96505060606200047e8b828c01620003b5565b9550506080620004918b828c01620003b5565b94505060a0620004a48b828c016200036c565b93505060c0620004b78b828c016200036c565b92505060e0620004ca8b828c01620003fa565b9150509295985092959890939650565b615da180620004ea6000396000f3fe608060405234801561001057600080fd5b50600436106101005760003560e01c80639cf95a8711610097578063be3a151a11610066578063be3a151a146102ad578063caf50258146102c9578063e1c3b140146102e5578063f2fde38b1461031557610100565b80639cf95a8714610215578063b4d68d8314610231578063b4efc5fd14610261578063b7520cf51461029157610100565b8063715018a6116100d3578063715018a6146101a15780638da5cb5b146101ab5780639908d845146101c95780639b577673146101e557610100565b8063150b7a02146101055780632bb14e1d146101355780632dec66b014610153578063522f118714610171575b600080fd5b61011f600480360381019061011a9190613e7a565b610331565b60405161012c9190613f3d565b60405180910390f35b61013d6103cb565b60405161014a9190613f7f565b60405180910390f35b61015b6103ed565b6040516101689190613f7f565b60405180910390f35b61018b60048036038101906101869190613f9a565b61040e565b6040516101989190613fe2565b60405180910390f35b6101a9610462565b005b6101b3610476565b6040516101c0919061400c565b60405180910390f35b6101e360048036038101906101de919061404c565b61049f565b005b6101ff60048036038101906101fa91906140c1565b6108a6565b60405161020c9190613fe2565b60405180910390f35b61022f600480360381019061022a919061410d565b61093b565b005b61024b60048036038101906102469190613f9a565b610d6d565b6040516102589190613fe2565b60405180910390f35b61027b600480360381019061027691906141f7565b610dc1565b6040516102889190613fe2565b60405180910390f35b6102ab60048036038101906102a6919061430f565b610e15565b005b6102c760048036038101906102c291906143f4565b611908565b005b6102e360048036038101906102de919061450b565b612289565b005b6102ff60048036038101906102fa91906140c1565b612cf5565b60405161030c9190613fe2565b60405180910390f35b61032f600480360381019061032a9190613f9a565b612d8a565b005b60003373ffffffffffffffffffffffffffffffffffffffff16838360405161035a929190614642565b6000604051808303816000865af19150503d8060008114610397576040519150601f19603f3d011682016040523d82523d6000602084013e61039c565b606091505b5050507f150b7a023d4804d13e8c85fb27262cb750cf6ba9f9dd3bb30d90f482ceeb4b1f905095945050505050565b6000600160009054906101000a90046bffffffffffffffffffffffff16905090565b60008060149054906101000a90046bffffffffffffffffffffffff16905090565b6000610418612e0e565b81600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b61046a612e0e565b6104746000612e8c565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d323c15f6104e5612f50565b836101000184806101c001906104fb919061466a565b8660000160800160208101906105119190613f9a565b6040518663ffffffff1660e01b8152600401610531959493929190614839565b60206040518083038186803b15801561054957600080fd5b505afa15801561055d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610581919061489e565b506000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adb0ae1883600001848060e001906105d6919061466a565b6040518463ffffffff1660e01b81526004016105f493929190614991565b60206040518083038186803b15801561060c57600080fd5b505afa158015610620573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610644919061489e565b90508160000160c001602081019061065c9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146106c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c090614a21565b60405180910390fd5b8160000160000160208101906106df9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1663f242432a8360000160c00160208101906107109190613f9a565b846102000160208101906107249190613f9a565b8560000160200135866101e001356040518563ffffffff1660e01b81526004016107519493929190614a76565b600060405180830381600087803b15801561076b57600080fd5b505af115801561077f573d6000803e3d6000fd5b50505050816102000160208101906107979190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1682600001602001358273ffffffffffffffffffffffffffffffffffffffff167fad2b9da5ba4cd295855c53cb1028d30048449d24d2b20e0766210678f53fcfb1856101e001356040516108009190614ace565b60405180910390a4600061086260405180608001604052808560000180360381019061082c9190614c1d565b8152602001856101e00135815260200185610100018036038101906108519190614cea565b815260200160011515815250612f58565b90506108a161086f612f50565b8460000160c00160208101906108859190613f9a565b85600001608001602081019061089b9190613f9a565b84613457565b505050565b60006108b0612e0e565b81600160006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055507f754c3ea964b0f6c4f74335ce4f36e1fc35bb9bc7b7f46512b6c887c723ff2b9b600160009054906101000a90046bffffffffffffffffffffffff1660405161092a9190613f7f565b60405180910390a160019050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d323c15f610981612f50565b866101000187806101c00190610997919061466a565b8960000160800160208101906109ad9190613f9a565b6040518663ffffffff1660e01b81526004016109cd959493929190614839565b60206040518083038186803b1580156109e557600080fd5b505afa1580156109f9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1d919061489e565b506000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adb0ae1886600001878060e00190610a72919061466a565b6040518463ffffffff1660e01b8152600401610a9093929190614991565b60206040518083038186803b158015610aa857600080fd5b505afa158015610abc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae0919061489e565b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663285588f88287600001876000016020810190610b389190613f9a565b88602001356040518563ffffffff1660e01b8152600401610b5c9493929190614d17565b60006040518083038186803b158015610b7457600080fd5b505afa158015610b88573d6000803e3d6000fd5b50505050836000016020810190610b9f9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff16634f78a38f86610200016020810190610bce9190613f9a565b876101e001358787876040518663ffffffff1660e01b8152600401610bf7959493929190614eaf565b602060405180830381600087803b158015610c1157600080fd5b505af1158015610c25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c499190614f2c565b506000610ca4604051806080016040528088600001803603810190610c6e9190614c1d565b8152602001886101e0013581526020018861010001803603810190610c939190614cea565b815260200160011515815250612f58565b9050610ce3610cb1612f50565b8760000160c0016020810190610cc79190613f9a565b886000016080016020810190610cdd9190613f9a565b84613457565b85610200016020810190610cf79190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1685602001358373ffffffffffffffffffffffffffffffffffffffff167fad2b9da5ba4cd295855c53cb1028d30048449d24d2b20e0766210678f53fcfb1896101e00135604051610d5d9190614ace565b60405180910390a4505050505050565b6000610d77612e0e565b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000610dcb612e0e565b81600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d323c15f610e5b612f50565b8860800189806101400190610e70919061466a565b8a6080016020810190610e839190613f9a565b6040518663ffffffff1660e01b8152600401610ea3959493929190614839565b60206040518083038186803b158015610ebb57600080fd5b505afa158015610ecf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef3919061489e565b506000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adb0ae1887898060000190610f45919061466a565b6040518463ffffffff1660e01b8152600401610f6393929190614991565b60206040518083038186803b158015610f7b57600080fd5b505afa158015610f8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb3919061489e565b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663285588f882888960000160208101906110089190613f9a565b8a602001356040518563ffffffff1660e01b815260040161102c9493929190614d17565b60006040518083038186803b15801561104457600080fd5b505afa158015611058573d6000803e3d6000fd5b50505050866101800160208101906110709190614f85565b1561112b578560000160208101906110889190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1663f242432a8760c00160208101906110b69190613f9a565b896101c00160208101906110ca9190613f9a565b89602001358b61016001356040518563ffffffff1660e01b81526004016110f49493929190614a76565b600060405180830381600087803b15801561110e57600080fd5b505af1158015611122573d6000803e3d6000fd5b505050506111d6565b85600001602081019061113e9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e8760c001602081019061116c9190613f9a565b896101c00160208101906111809190613f9a565b89602001356040518463ffffffff1660e01b81526004016111a393929190614fb2565b600060405180830381600087803b1580156111bd57600080fd5b505af11580156111d1573d6000803e3d6000fd5b505050505b600061122c6040518060800160405280898036038101906111f79190614c1d565b81526020018a610160013581526020018a60800180360381019061121b9190614cea565b815260200160001515815250612f58565b9050611265611239612f50565b8860c001602081019061124c9190613f9a565b89608001602081019061125f9190613f9a565b84613457565b60005b848490508160ff1610156118fd576000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adb0ae1889898560ff168181106112cc576112cb614fe9565b5b905060e002018c80604001906112e29190615018565b8660ff168181106112f6576112f5614fe9565b5b9050602002810190611308919061466a565b6040518463ffffffff1660e01b815260040161132693929190614991565b60206040518083038186803b15801561133e57600080fd5b505afa158015611352573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611376919061489e565b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663285588f8828a8a8660ff168181106113cd576113cc614fe9565b5b905060e0020189898760ff168181106113e9576113e8614fe9565b5b90506020028101906113fb919061507b565b600001602081019061140d9190613f9a565b8a8a8860ff1681811061142357611422614fe9565b5b9050602002810190611435919061507b565b602001356040518563ffffffff1660e01b81526004016114589493929190614d17565b60006040518083038186803b15801561147057600080fd5b505afa158015611484573d6000803e3d6000fd5b50505050600086868460ff168181106114a05761149f614fe9565b5b90506020028101906114b2919061507b565b60000160208101906114c49190613f9a565b73ffffffffffffffffffffffffffffffffffffffff16634f78a38f8c6101c00160208101906114f39190613f9a565b8d806101a0019061150491906150a3565b8760ff1681811061151857611517614fe9565b5b905060200201358a8a8860ff1681811061153557611534614fe9565b5b9050602002810190611547919061507b565b8f80606001906115579190615018565b8960ff1681811061156b5761156a614fe9565b5b905060200281019061157d919061466a565b6040518663ffffffff1660e01b815260040161159d959493929190614eaf565b602060405180830381600087803b1580156115b757600080fd5b505af11580156115cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ef9190614f2c565b905086868460ff1681811061160757611606614fe9565b5b9050602002810190611619919061507b565b600001602081019061162b9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1663bd969c258c6101c001602081019061165a9190613f9a565b838e806101a0019061166c91906150a3565b8860ff168181106116805761167f614fe9565b5b905060200201358e600001602081019061169a9190613f9a565b8f602001356040518663ffffffff1660e01b81526004016116bf959493929190615106565b602060405180830381600087803b1580156116d957600080fd5b505af11580156116ed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611711919061516e565b5060006117a960405180608001604052808c8c8860ff1681811061173857611737614fe9565b5b905060e0020180360381019061174e9190614c1d565b81526020018e806101a0019061176491906150a3565b8860ff1681811061177857611777614fe9565b5b9050602002013581526020018e6080018036038101906117989190614cea565b815260200160011515815250612f58565b90506118186117b6612f50565b8b8b8760ff168181106117cc576117cb614fe9565b5b905060e0020160c00160208101906117e49190613f9a565b8c8c8860ff168181106117fa576117f9614fe9565b5b905060e0020160800160208101906118129190613f9a565b84613457565b8b6101c001602081019061182c9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1688888660ff1681811061185857611857614fe9565b5b905060200281019061186a919061507b565b602001358473ffffffffffffffffffffffffffffffffffffffff167fad2b9da5ba4cd295855c53cb1028d30048449d24d2b20e0766210678f53fcfb18f806101a001906118b791906150a3565b8960ff168181106118cb576118ca614fe9565b5b905060200201356040516118df9190614ace565b60405180910390a450505080806118f5906151d7565b915050611268565b505050505050505050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d323c15f61194e612f50565b896080018a806101400190611963919061466a565b8b60800160208101906119769190613f9a565b6040518663ffffffff1660e01b8152600401611996959493929190614839565b60206040518083038186803b1580156119ae57600080fd5b505afa1580156119c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e6919061489e565b506000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adb0ae18888a8060000190611a38919061466a565b6040518463ffffffff1660e01b8152600401611a5693929190614991565b60206040518083038186803b158015611a6e57600080fd5b505afa158015611a82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa6919061489e565b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663285588f88289896000016020810190611afb9190613f9a565b8a602001356040518563ffffffff1660e01b8152600401611b1f9493929190614d17565b60006040518083038186803b158015611b3757600080fd5b505afa158015611b4b573d6000803e3d6000fd5b50505050856000016020810190611b629190613f9a565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb7896101c0016020810190611b919190613f9a565b888b8060200190611ba2919061466a565b6040518563ffffffff1660e01b8152600401611bc194939291906152a1565b602060405180830381600087803b158015611bdb57600080fd5b505af1158015611bef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c139190614f2c565b506000611c6a60405180608001604052808a803603810190611c359190614c1d565b81526020018b610160013581526020018b608001803603810190611c599190614cea565b815260200160001515815250612f58565b9050611ca3611c77612f50565b8960c0016020810190611c8a9190613f9a565b8a6080016020810190611c9d9190613f9a565b84613457565b60005b848490508160ff161015611dca576000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adb0ae1889898560ff16818110611d0a57611d09614fe9565b5b905060e002018d8060400190611d209190615018565b8660ff16818110611d3457611d33614fe9565b5b9050602002810190611d46919061466a565b6040518463ffffffff1660e01b8152600401611d6493929190614991565b60206040518083038186803b158015611d7c57600080fd5b505afa158015611d90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611db4919061489e565b9050508080611dc2906151d7565b915050611ca6565b5060005b848490508160ff16101561227d57600085858360ff16818110611df457611df3614fe9565b5b9050602002810190611e06919061507b565b6000016020810190611e189190613f9a565b73ffffffffffffffffffffffffffffffffffffffff16634f78a38f8c6101c0016020810190611e479190613f9a565b8d806101a00190611e5891906150a3565b8660ff16818110611e6c57611e6b614fe9565b5b9050602002013589898760ff16818110611e8957611e88614fe9565b5b9050602002810190611e9b919061507b565b8f8060600190611eab9190615018565b8860ff16818110611ebf57611ebe614fe9565b5b9050602002810190611ed1919061466a565b6040518663ffffffff1660e01b8152600401611ef1959493929190614eaf565b602060405180830381600087803b158015611f0b57600080fd5b505af1158015611f1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f439190614f2c565b905085858360ff16818110611f5b57611f5a614fe9565b5b9050602002810190611f6d919061507b565b6000016020810190611f7f9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1663bd969c258c6101c0016020810190611fae9190613f9a565b838e806101a00190611fc091906150a3565b8760ff16818110611fd457611fd3614fe9565b5b905060200201358d6000016020810190611fee9190613f9a565b8e602001356040518663ffffffff1660e01b8152600401612013959493929190615106565b602060405180830381600087803b15801561202d57600080fd5b505af1158015612041573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612065919061516e565b5060006120fd60405180608001604052808b8b8760ff1681811061208c5761208b614fe9565b5b905060e002018036038101906120a29190614c1d565b81526020018e806101a001906120b891906150a3565b8760ff168181106120cc576120cb614fe9565b5b9050602002013581526020018e6080018036038101906120ec9190614cea565b815260200160011515815250612f58565b905061216c61210a612f50565b8a8a8660ff168181106121205761211f614fe9565b5b905060e0020160c00160208101906121389190613f9a565b8b8b8760ff1681811061214e5761214d614fe9565b5b905060e0020160800160208101906121669190613f9a565b84613457565b8b6101c00160208101906121809190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1687878560ff168181106121ac576121ab614fe9565b5b90506020028101906121be919061507b565b602001358a8a8660ff168181106121d8576121d7614fe9565b5b905060e0020160c00160208101906121f09190613f9a565b73ffffffffffffffffffffffffffffffffffffffff167fad2b9da5ba4cd295855c53cb1028d30048449d24d2b20e0766210678f53fcfb18f806101a0019061223891906150a3565b8860ff1681811061224c5761224b614fe9565b5b905060200201356040516122609190614ace565b60405180910390a450508080612275906151d7565b915050611dce565b50505050505050505050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d323c15f6122cf612f50565b896080018a8061014001906122e4919061466a565b8b60800160208101906122f79190613f9a565b6040518663ffffffff1660e01b8152600401612317959493929190614839565b60206040518083038186803b15801561232f57600080fd5b505afa158015612343573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612367919061489e565b506000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adb0ae18888a80600001906123b9919061466a565b6040518463ffffffff1660e01b81526004016123d793929190614991565b60206040518083038186803b1580156123ef57600080fd5b505afa158015612403573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612427919061489e565b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663285588f8828989600001602081019061247c9190613f9a565b8a602001356040518563ffffffff1660e01b81526004016124a09493929190614d17565b60006040518083038186803b1580156124b857600080fd5b505afa1580156124cc573d6000803e3d6000fd5b50505050876101800160208101906124e49190614f85565b156125ba578560000160208101906124fc9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff16631dca5f9b896101c001602081019061252b9190613f9a565b8a6101600135898c8060200190612542919061466a565b6040518663ffffffff1660e01b81526004016125629594939291906153a3565b602060405180830381600087803b15801561257c57600080fd5b505af1158015612590573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b49190614f2c565b50612680565b8560000160208101906125cd9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff166386f7dfc3896101c00160208101906125fc9190613f9a565b888b806020019061260d919061466a565b6040518563ffffffff1660e01b815260040161262c949392919061540b565b602060405180830381600087803b15801561264657600080fd5b505af115801561265a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061267e9190614f2c565b505b60006126d660405180608001604052808a8036038101906126a19190614c1d565b81526020018b610160013581526020018b6080018036038101906126c59190614cea565b815260200160001515815250612f58565b905061270f6126e3612f50565b8960c00160208101906126f69190613f9a565b8a60800160208101906127099190613f9a565b84613457565b60005b848490508160ff161015612836576000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adb0ae1889898560ff1681811061277657612775614fe9565b5b905060e002018d806040019061278c9190615018565b8660ff168181106127a05761279f614fe9565b5b90506020028101906127b2919061466a565b6040518463ffffffff1660e01b81526004016127d093929190614991565b60206040518083038186803b1580156127e857600080fd5b505afa1580156127fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612820919061489e565b905050808061282e906151d7565b915050612712565b5060005b848490508160ff161015612ce957600085858360ff168181106128605761285f614fe9565b5b9050602002810190612872919061507b565b60000160208101906128849190613f9a565b73ffffffffffffffffffffffffffffffffffffffff16634f78a38f8c6101c00160208101906128b39190613f9a565b8d806101a001906128c491906150a3565b8660ff168181106128d8576128d7614fe9565b5b9050602002013589898760ff168181106128f5576128f4614fe9565b5b9050602002810190612907919061507b565b8f80606001906129179190615018565b8860ff1681811061292b5761292a614fe9565b5b905060200281019061293d919061466a565b6040518663ffffffff1660e01b815260040161295d959493929190614eaf565b602060405180830381600087803b15801561297757600080fd5b505af115801561298b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129af9190614f2c565b905085858360ff168181106129c7576129c6614fe9565b5b90506020028101906129d9919061507b565b60000160208101906129eb9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1663bd969c258c6101c0016020810190612a1a9190613f9a565b838e806101a00190612a2c91906150a3565b8760ff16818110612a4057612a3f614fe9565b5b905060200201358d6000016020810190612a5a9190613f9a565b8e602001356040518663ffffffff1660e01b8152600401612a7f959493929190615106565b602060405180830381600087803b158015612a9957600080fd5b505af1158015612aad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ad1919061516e565b506000612b6960405180608001604052808b8b8760ff16818110612af857612af7614fe9565b5b905060e00201803603810190612b0e9190614c1d565b81526020018e806101a00190612b2491906150a3565b8760ff16818110612b3857612b37614fe9565b5b9050602002013581526020018e608001803603810190612b589190614cea565b815260200160011515815250612f58565b9050612bd8612b76612f50565b8a8a8660ff16818110612b8c57612b8b614fe9565b5b905060e0020160c0016020810190612ba49190613f9a565b8b8b8760ff16818110612bba57612bb9614fe9565b5b905060e002016080016020810190612bd29190613f9a565b84613457565b8b6101c0016020810190612bec9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1687878560ff16818110612c1857612c17614fe9565b5b9050602002810190612c2a919061507b565b602001358a8a8660ff16818110612c4457612c43614fe9565b5b905060e0020160c0016020810190612c5c9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff167fad2b9da5ba4cd295855c53cb1028d30048449d24d2b20e0766210678f53fcfb18f806101a00190612ca491906150a3565b8860ff16818110612cb857612cb7614fe9565b5b90506020020135604051612ccc9190614ace565b60405180910390a450508080612ce1906151d7565b91505061283a565b50505050505050505050565b6000612cff612e0e565b81600060146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055507fd93dd360d98fc20e8a1fed3ac984811d257edb945d5612328d87c1123eb42de8600060149054906101000a90046bffffffffffffffffffffffff16604051612d799190613f7f565b60405180910390a160019050919050565b612d92612e0e565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612e02576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612df9906154c4565b60405180910390fd5b612e0b81612e8c565b50565b612e16612f50565b73ffffffffffffffffffffffffffffffffffffffff16612e34610476565b73ffffffffffffffffffffffffffffffffffffffff1614612e8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e8190615530565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b612f60613d1a565b612710612fb4600060149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16846000015160a001516bffffffffffffffffffffffff16613a7390919063ffffffff16565b1115612ff5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fec9061559c565b60405180910390fd5b600061300d8360000151604001518460400151613a89565b905060008060008060009050600087602001518661302b91906155bc565b9050600061307e612710613070600060149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff1685613b3b90919063ffffffff16565b613b5190919063ffffffff16565b90506000806130c06127106130b28d6000015160a001516bffffffffffffffffffffffff1687613b3b90919063ffffffff16565b613b5190919063ffffffff16565b905060006130e9826130db8688613b6790919063ffffffff16565b613b6790919063ffffffff16565b90508b60600151156131ce578b60200151600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ae6180c26040518163ffffffff1660e01b815260040160206040518083038186803b15801561316257600080fd5b505afa158015613176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061319a9190614f2c565b6131a491906155bc565b9550858411156131c15785846131ba9190615616565b93506131c9565b839550600093505b613243565b61321d61271061320f600160009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff1687613b3b90919063ffffffff16565b613b5190919063ffffffff16565b92508284111561323a5782846132339190615616565b9350613242565b839250600093505b5b6132758c60000151600001517f2a55205a00000000000000000000000000000000000000000000000000000000613b7d565b1561331d578b600001516000015173ffffffffffffffffffffffffffffffffffffffff16632a55205a8d6000015160200151836040518363ffffffff1660e01b81526004016132c592919061564a565b604080518083038186803b1580156132dc57600080fd5b505afa1580156132f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133149190615673565b80985081995050505b6133308782613b6790919063ffffffff16565b9850600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663901212b88d6000015160c001516040518263ffffffff1660e01b8152600401613395919061400c565b60206040518083038186803b1580156133ad57600080fd5b505afa1580156133c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133e5919061516e565b156133fd5781896133f691906156b3565b9850600091505b6040518060e001604052808581526020018381526020018a81526020018881526020018481526020018781526020018973ffffffffffffffffffffffffffffffffffffffff168152509a5050505050505050505050919050565b600082905060008260000151111561355e578073ffffffffffffffffffffffffffffffffffffffff166323b872dd866001600c9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685600001516040518463ffffffff1660e01b81526004016134cc93929190614fb2565b602060405180830381600087803b1580156134e657600080fd5b505af11580156134fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061351e919061516e565b61355d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016135549061577b565b60405180910390fd5b5b600082602001511115613660578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685602001516040518463ffffffff1660e01b81526004016135ce93929190614fb2565b602060405180830381600087803b1580156135e857600080fd5b505af11580156135fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613620919061516e565b61365f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016136569061580d565b60405180910390fd5b5b600082606001511115613744578073ffffffffffffffffffffffffffffffffffffffff166323b872dd868460c0015185606001516040518463ffffffff1660e01b81526004016136b293929190614fb2565b602060405180830381600087803b1580156136cc57600080fd5b505af11580156136e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613704919061516e565b613743576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161373a9061589f565b60405180910390fd5b5b600082608001511115613846578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685608001516040518463ffffffff1660e01b81526004016137b493929190614fb2565b602060405180830381600087803b1580156137ce57600080fd5b505af11580156137e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613806919061516e565b613845576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161383c90615931565b60405180910390fd5b5b60008260a00151111561399a578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560a001516040518463ffffffff1660e01b81526004016138b693929190614fb2565b602060405180830381600087803b1580156138d057600080fd5b505af11580156138e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613908919061516e565b613947576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161393e906159c3565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff167f03960d319b25a13b07a295a42c9b06ee2f300ad873efc9e1c2ebf2a9692896c78360a001516040516139919190614ace565b60405180910390a25b8073ffffffffffffffffffffffffffffffffffffffff166323b872dd868685604001516040518463ffffffff1660e01b81526004016139db93929190614fb2565b602060405180830381600087803b1580156139f557600080fd5b505af1158015613a09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a2d919061516e565b613a6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613a6390615a55565b60405180910390fd5b5050505050565b60008183613a8191906156b3565b905092915050565b60008082606001516bffffffffffffffffffffffff161415613aad57829050613b35565b600182606001516bffffffffffffffffffffffff161415613afa5781602001518260400151600a613ade9190615ba8565b84613ae991906155bc565b613af39190615c22565b9050613b35565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613b2c90615cc5565b60405180910390fd5b92915050565b60008183613b4991906155bc565b905092915050565b60008183613b5f9190615c22565b905092915050565b60008183613b759190615616565b905092915050565b6000613b8883613ba2565b8015613b9a5750613b998383613bef565b5b905092915050565b6000613bce827f01ffc9a700000000000000000000000000000000000000000000000000000000613bef565b8015613be85750613be68263ffffffff60e01b613bef565b155b9050919050565b6000806301ffc9a760e01b83604051602401613c0b9190613f3d565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090506000808573ffffffffffffffffffffffffffffffffffffffff1661753084604051613c959190615d54565b6000604051808303818686fa925050503d8060008114613cd1576040519150601f19603f3d011682016040523d82523d6000602084013e613cd6565b606091505b5091509150602081511015613cf15760009350505050613d14565b818015613d0e575080806020019051810190613d0d919061516e565b5b93505050505b92915050565b6040518060e00160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000613dac82613d81565b9050919050565b613dbc81613da1565b8114613dc757600080fd5b50565b600081359050613dd981613db3565b92915050565b6000819050919050565b613df281613ddf565b8114613dfd57600080fd5b50565b600081359050613e0f81613de9565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112613e3a57613e39613e15565b5b8235905067ffffffffffffffff811115613e5757613e56613e1a565b5b602083019150836001820283011115613e7357613e72613e1f565b5b9250929050565b600080600080600060808688031215613e9657613e95613d77565b5b6000613ea488828901613dca565b9550506020613eb588828901613dca565b9450506040613ec688828901613e00565b935050606086013567ffffffffffffffff811115613ee757613ee6613d7c565b5b613ef388828901613e24565b92509250509295509295909350565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613f3781613f02565b82525050565b6000602082019050613f526000830184613f2e565b92915050565b60006bffffffffffffffffffffffff82169050919050565b613f7981613f58565b82525050565b6000602082019050613f946000830184613f70565b92915050565b600060208284031215613fb057613faf613d77565b5b6000613fbe84828501613dca565b91505092915050565b60008115159050919050565b613fdc81613fc7565b82525050565b6000602082019050613ff76000830184613fd3565b92915050565b61400681613da1565b82525050565b60006020820190506140216000830184613ffd565b92915050565b600080fd5b6000610220828403121561404357614042614027565b5b81905092915050565b60006020828403121561406257614061613d77565b5b600082013567ffffffffffffffff8111156140805761407f613d7c565b5b61408c8482850161402c565b91505092915050565b61409e81613f58565b81146140a957600080fd5b50565b6000813590506140bb81614095565b92915050565b6000602082840312156140d7576140d6613d77565b5b60006140e5848285016140ac565b91505092915050565b600060a0828403121561410457614103614027565b5b81905092915050565b6000806000806060858703121561412757614126613d77565b5b600085013567ffffffffffffffff81111561414557614144613d7c565b5b6141518782880161402c565b945050602085013567ffffffffffffffff81111561417257614171613d7c565b5b61417e878288016140ee565b935050604085013567ffffffffffffffff81111561419f5761419e613d7c565b5b6141ab87828801613e24565b925092505092959194509250565b60006141c482613d81565b9050919050565b6141d4816141b9565b81146141df57600080fd5b50565b6000813590506141f1816141cb565b92915050565b60006020828403121561420d5761420c613d77565b5b600061421b848285016141e2565b91505092915050565b60006101e0828403121561423b5761423a614027565b5b81905092915050565b600060e0828403121561425a57614259614027565b5b81905092915050565b60008083601f84011261427957614278613e15565b5b8235905067ffffffffffffffff81111561429657614295613e1a565b5b6020830191508360e08202830111156142b2576142b1613e1f565b5b9250929050565b60008083601f8401126142cf576142ce613e15565b5b8235905067ffffffffffffffff8111156142ec576142eb613e1a565b5b60208301915083602082028301111561430857614307613e1f565b5b9250929050565b600080600080600080610140878903121561432d5761432c613d77565b5b600087013567ffffffffffffffff81111561434b5761434a613d7c565b5b61435789828a01614224565b965050602061436889828a01614244565b95505061010087013567ffffffffffffffff81111561438a57614389613d7c565b5b61439689828a01614263565b945094505061012087013567ffffffffffffffff8111156143ba576143b9613d7c565b5b6143c689828a016142b9565b92509250509295509295509295565b600060a082840312156143eb576143ea614027565b5b81905092915050565b6000806000806000806000610160888a03121561441457614413613d77565b5b600088013567ffffffffffffffff81111561443257614431613d7c565b5b61443e8a828b01614224565b975050602061444f8a828b01614244565b96505061010088013567ffffffffffffffff81111561447157614470613d7c565b5b61447d8a828b016143d5565b95505061012088013567ffffffffffffffff81111561449f5761449e613d7c565b5b6144ab8a828b01614263565b945094505061014088013567ffffffffffffffff8111156144cf576144ce613d7c565b5b6144db8a828b016142b9565b925092505092959891949750929550565b600060c0828403121561450257614501614027565b5b81905092915050565b6000806000806000806000610160888a03121561452b5761452a613d77565b5b600088013567ffffffffffffffff81111561454957614548613d7c565b5b6145558a828b01614224565b97505060206145668a828b01614244565b96505061010088013567ffffffffffffffff81111561458857614587613d7c565b5b6145948a828b016144ec565b95505061012088013567ffffffffffffffff8111156145b6576145b5613d7c565b5b6145c28a828b01614263565b945094505061014088013567ffffffffffffffff8111156145e6576145e5613d7c565b5b6145f28a828b016142b9565b925092505092959891949750929550565b600081905092915050565b82818337600083830152505050565b60006146298385614603565b935061463683858461460e565b82840190509392505050565b600061464f82848661461d565b91508190509392505050565b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126146875761468661465b565b5b80840192508235915067ffffffffffffffff8211156146a9576146a8614660565b5b6020830192506001820236038313156146c5576146c4614665565b5b509250929050565b60006146dc6020840184613dca565b905092915050565b6146ed81613da1565b82525050565b60006147026020840184613e00565b905092915050565b61471381613ddf565b82525050565b600061472860208401846140ac565b905092915050565b61473981613f58565b82525050565b60c0820161475060008301836146cd565b61475d60008501826146e4565b5061476b60208301836146f3565b614778602085018261470a565b5061478660408301836146f3565b614793604085018261470a565b506147a16060830183614719565b6147ae6060850182614730565b506147bc60808301836146f3565b6147c9608085018261470a565b506147d760a08301836146cd565b6147e460a08501826146e4565b50505050565b600082825260208201905092915050565b6000601f19601f8301169050919050565b600061481883856147ea565b935061482583858461460e565b61482e836147fb565b840190509392505050565b60006101208201905061484f6000830188613ffd565b61485c602083018761473f565b81810360e083015261486f81858761480c565b905061487f610100830184613ffd565b9695505050505050565b60008151905061489881613db3565b92915050565b6000602082840312156148b4576148b3613d77565b5b60006148c284828501614889565b91505092915050565b60e082016148dc60008301836146cd565b6148e960008501826146e4565b506148f760208301836146f3565b614904602085018261470a565b5061491260408301836146f3565b61491f604085018261470a565b5061492d60608301836146f3565b61493a606085018261470a565b5061494860808301836146cd565b61495560808501826146e4565b5061496360a0830183614719565b61497060a0850182614730565b5061497e60c08301836146cd565b61498b60c08501826146e4565b50505050565b6000610100820190506149a760008301866148cb565b81810360e08301526149ba81848661480c565b9050949350505050565b600082825260208201905092915050565b7f496e76616c69642073656c6c6572206164647265737300000000000000000000600082015250565b6000614a0b6016836149c4565b9150614a16826149d5565b602082019050919050565b60006020820190508181036000830152614a3a816149fe565b9050919050565b614a4a81613ddf565b82525050565b50565b6000614a606000836147ea565b9150614a6b82614a50565b600082019050919050565b600060a082019050614a8b6000830187613ffd565b614a986020830186613ffd565b614aa56040830185614a41565b614ab26060830184614a41565b8181036080830152614ac381614a53565b905095945050505050565b6000602082019050614ae36000830184614a41565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b614b26826147fb565b810181811067ffffffffffffffff82111715614b4557614b44614aee565b5b80604052505050565b6000614b58613d6d565b9050614b648282614b1d565b919050565b600060e08284031215614b7f57614b7e614ae9565b5b614b8960e0614b4e565b90506000614b9984828501613dca565b6000830152506020614bad84828501613e00565b6020830152506040614bc184828501613e00565b6040830152506060614bd584828501613e00565b6060830152506080614be984828501613dca565b60808301525060a0614bfd848285016140ac565b60a08301525060c0614c1184828501613dca565b60c08301525092915050565b600060e08284031215614c3357614c32613d77565b5b6000614c4184828501614b69565b91505092915050565b600060c08284031215614c6057614c5f614ae9565b5b614c6a60c0614b4e565b90506000614c7a84828501613dca565b6000830152506020614c8e84828501613e00565b6020830152506040614ca284828501613e00565b6040830152506060614cb6848285016140ac565b6060830152506080614cca84828501613e00565b60808301525060a0614cde84828501613dca565b60a08301525092915050565b600060c08284031215614d0057614cff613d77565b5b6000614d0e84828501614c4a565b91505092915050565b600061014082019050614d2d6000830187613ffd565b614d3a60208301866148cb565b614d48610100830185613ffd565b614d56610120830184614a41565b95945050505050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112614d8b57614d8a614d69565b5b83810192508235915060208301925067ffffffffffffffff821115614db357614db2614d5f565b5b600182023603841315614dc957614dc8614d64565b5b509250929050565b600082825260208201905092915050565b6000614dee8385614dd1565b9350614dfb83858461460e565b614e04836147fb565b840190509392505050565b600060a08301614e2260008401846146cd565b614e2f60008601826146e4565b50614e3d60208401846146f3565b614e4a602086018261470a565b50614e5860408401846146f3565b614e65604086018261470a565b50614e736060840184614d6e565b8583036060870152614e86838284614de2565b92505050614e9760808401846146cd565b614ea460808601826146e4565b508091505092915050565b600060a082019050614ec46000830188613ffd565b614ed16020830187614a41565b8181036040830152614ee38186614e0f565b90508181036060830152614ef881848661480c565b90508181036080830152614f0b81614a53565b90509695505050505050565b600081519050614f2681613de9565b92915050565b600060208284031215614f4257614f41613d77565b5b6000614f5084828501614f17565b91505092915050565b614f6281613fc7565b8114614f6d57600080fd5b50565b600081359050614f7f81614f59565b92915050565b600060208284031215614f9b57614f9a613d77565b5b6000614fa984828501614f70565b91505092915050565b6000606082019050614fc76000830186613ffd565b614fd46020830185613ffd565b614fe16040830184614a41565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080833560016020038436030381126150355761503461465b565b5b80840192508235915067ffffffffffffffff82111561505757615056614660565b5b60208301925060208202360383131561507357615072614665565b5b509250929050565b60008235600160a0038336030381126150975761509661465b565b5b80830191505092915050565b600080833560016020038436030381126150c0576150bf61465b565b5b80840192508235915067ffffffffffffffff8211156150e2576150e1614660565b5b6020830192506020820236038313156150fe576150fd614665565b5b509250929050565b600060a08201905061511b6000830188613ffd565b6151286020830187614a41565b6151356040830186614a41565b6151426060830185613ffd565b61514f6080830184614a41565b9695505050505050565b60008151905061516881614f59565b92915050565b60006020828403121561518457615183613d77565b5b600061519284828501615159565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600060ff82169050919050565b60006151e2826151ca565b915060ff8214156151f6576151f561519b565b5b600182019050919050565b600060a0830161521460008401846146cd565b61522160008601826146e4565b5061522f60208401846146f3565b61523c602086018261470a565b5061524a6040840184614d6e565b858303604087015261525d838284614de2565b9250505061526e60608401846146cd565b61527b60608601826146e4565b506152896080840184614719565b6152966080860182614730565b508091505092915050565b60006060820190506152b66000830187613ffd565b81810360208301526152c88186615201565b905081810360408301526152dd81848661480c565b905095945050505050565b600060c083016152fb60008401846146cd565b61530860008601826146e4565b5061531660208401846146f3565b615323602086018261470a565b5061533160408401846146f3565b61533e604086018261470a565b5061534c6060840184614d6e565b858303606087015261535f838284614de2565b9250505061537060808401846146cd565b61537d60808601826146e4565b5061538b60a0840184614719565b61539860a0860182614730565b508091505092915050565b600060a0820190506153b86000830188613ffd565b6153c56020830187614a41565b81810360408301526153d781866152e8565b905081810360608301526153ec81848661480c565b905081810360808301526153ff81614a53565b90509695505050505050565b60006060820190506154206000830187613ffd565b818103602083015261543281866152e8565b9050818103604083015261544781848661480c565b905095945050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006154ae6026836149c4565b91506154b982615452565b604082019050919050565b600060208201905081810360008301526154dd816154a1565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061551a6020836149c4565b9150615525826154e4565b602082019050919050565b600060208201905081810360008301526155498161550d565b9050919050565b7f496e76616c696420706c6174666f726d20666565206f72204e474f2066656500600082015250565b6000615586601f836149c4565b915061559182615550565b602082019050919050565b600060208201905081810360008301526155b581615579565b9050919050565b60006155c782613ddf565b91506155d283613ddf565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561560b5761560a61519b565b5b828202905092915050565b600061562182613ddf565b915061562c83613ddf565b92508282101561563f5761563e61519b565b5b828203905092915050565b600060408201905061565f6000830185614a41565b61566c6020830184614a41565b9392505050565b6000806040838503121561568a57615689613d77565b5b600061569885828601614889565b92505060206156a985828601614f17565b9150509250929050565b60006156be82613ddf565b91506156c983613ddf565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156156fe576156fd61519b565b5b828201905092915050565b7f6661696c757265207768696c65207472616e7366657272696e6720706c61746660008201527f6f726d2066656500000000000000000000000000000000000000000000000000602082015250565b60006157656027836149c4565b915061577082615709565b604082019050919050565b6000602082019050818103600083015261579481615758565b9050919050565b7f6661696c757265207768696c65207472616e7366657272696e67206e676f206660008201527f6565000000000000000000000000000000000000000000000000000000000000602082015250565b60006157f76022836149c4565b91506158028261579b565b604082019050919050565b60006020820190508181036000830152615826816157ea565b9050919050565b7f6661696c757265207768696c65207472616e7366657272696e6720726f79616c60008201527f7479206665650000000000000000000000000000000000000000000000000000602082015250565b60006158896026836149c4565b91506158948261582d565b604082019050919050565b600060208201905081810360008301526158b88161587c565b9050919050565b7f6661696c757265207768696c65207472616e7366657272696e6720726577617260008201527f6420666565000000000000000000000000000000000000000000000000000000602082015250565b600061591b6025836149c4565b9150615926826158bf565b604082019050919050565b6000602082019050818103600083015261594a8161590e565b9050919050565b7f6661696c757265207768696c65207472616e7366657272696e67206275726e2060008201527f616d6f756e740000000000000000000000000000000000000000000000000000602082015250565b60006159ad6026836149c4565b91506159b882615951565b604082019050919050565b600060208201905081810360008301526159dc816159a0565b9050919050565b7f6661696c757265207768696c65207472616e7366657272696e6720617373657460008201527f2066656500000000000000000000000000000000000000000000000000000000602082015250565b6000615a3f6024836149c4565b9150615a4a826159e3565b604082019050919050565b60006020820190508181036000830152615a6e81615a32565b9050919050565b60008160011c9050919050565b6000808291508390505b6001851115615acc57808604811115615aa857615aa761519b565b5b6001851615615ab75780820291505b8081029050615ac585615a75565b9450615a8c565b94509492505050565b600082615ae55760019050615ba1565b81615af35760009050615ba1565b8160018114615b095760028114615b1357615b42565b6001915050615ba1565b60ff841115615b2557615b2461519b565b5b8360020a915084821115615b3c57615b3b61519b565b5b50615ba1565b5060208310610133831016604e8410600b8410161715615b775782820a905083811115615b7257615b7161519b565b5b615ba1565b615b848484846001615a82565b92509050818404811115615b9b57615b9a61519b565b5b81810290505b9392505050565b6000615bb382613ddf565b9150615bbe83613ddf565b9250615beb7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484615ad5565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000615c2d82613ddf565b9150615c3883613ddf565b925082615c4857615c47615bf3565b5b828204905092915050565b7f43757272656e637920696e76616c696420666f7220707269636520636f6e766560008201527f7273696f6e000000000000000000000000000000000000000000000000000000602082015250565b6000615caf6025836149c4565b9150615cba82615c53565b604082019050919050565b60006020820190508181036000830152615cde81615ca2565b9050919050565b600081519050919050565b60005b83811015615d0e578082015181840152602081019050615cf3565b83811115615d1d576000848401525b50505050565b6000615d2e82615ce5565b615d388185614603565b9350615d48818560208601615cf0565b80840191505092915050565b6000615d608284615d23565b91508190509291505056fea264697066735822122067b7132cc3d114155c586ac54d0ebad9786c0dabf024ca422d0cb4fef307084264736f6c6343000809003300000000000000000000000022cac6a8e7ff5ce7b35c862cdd5a11c288aef1420000000000000000000000007f451e5ae38647778721f88015e81713c136dc0c000000000000000000000000459e6103568faaad5645ef272bf38dea50577f5000000000000000000000000000000000000000000000000000000000000007d0000000000000000000000000000000000000000000000000000000000000006400000000000000000000000033c37b39f226823d23bfe74aa538948c0e999293000000000000000000000000e3441aa03f37e2c4b6a34eab9852e1c16a7453c200000000000000000000000091817e31488789acbc4403acba8805b2c68e2e88
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106101005760003560e01c80639cf95a8711610097578063be3a151a11610066578063be3a151a146102ad578063caf50258146102c9578063e1c3b140146102e5578063f2fde38b1461031557610100565b80639cf95a8714610215578063b4d68d8314610231578063b4efc5fd14610261578063b7520cf51461029157610100565b8063715018a6116100d3578063715018a6146101a15780638da5cb5b146101ab5780639908d845146101c95780639b577673146101e557610100565b8063150b7a02146101055780632bb14e1d146101355780632dec66b014610153578063522f118714610171575b600080fd5b61011f600480360381019061011a9190613e7a565b610331565b60405161012c9190613f3d565b60405180910390f35b61013d6103cb565b60405161014a9190613f7f565b60405180910390f35b61015b6103ed565b6040516101689190613f7f565b60405180910390f35b61018b60048036038101906101869190613f9a565b61040e565b6040516101989190613fe2565b60405180910390f35b6101a9610462565b005b6101b3610476565b6040516101c0919061400c565b60405180910390f35b6101e360048036038101906101de919061404c565b61049f565b005b6101ff60048036038101906101fa91906140c1565b6108a6565b60405161020c9190613fe2565b60405180910390f35b61022f600480360381019061022a919061410d565b61093b565b005b61024b60048036038101906102469190613f9a565b610d6d565b6040516102589190613fe2565b60405180910390f35b61027b600480360381019061027691906141f7565b610dc1565b6040516102889190613fe2565b60405180910390f35b6102ab60048036038101906102a6919061430f565b610e15565b005b6102c760048036038101906102c291906143f4565b611908565b005b6102e360048036038101906102de919061450b565b612289565b005b6102ff60048036038101906102fa91906140c1565b612cf5565b60405161030c9190613fe2565b60405180910390f35b61032f600480360381019061032a9190613f9a565b612d8a565b005b60003373ffffffffffffffffffffffffffffffffffffffff16838360405161035a929190614642565b6000604051808303816000865af19150503d8060008114610397576040519150601f19603f3d011682016040523d82523d6000602084013e61039c565b606091505b5050507f150b7a023d4804d13e8c85fb27262cb750cf6ba9f9dd3bb30d90f482ceeb4b1f905095945050505050565b6000600160009054906101000a90046bffffffffffffffffffffffff16905090565b60008060149054906101000a90046bffffffffffffffffffffffff16905090565b6000610418612e0e565b81600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b61046a612e0e565b6104746000612e8c565b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d323c15f6104e5612f50565b836101000184806101c001906104fb919061466a565b8660000160800160208101906105119190613f9a565b6040518663ffffffff1660e01b8152600401610531959493929190614839565b60206040518083038186803b15801561054957600080fd5b505afa15801561055d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610581919061489e565b506000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adb0ae1883600001848060e001906105d6919061466a565b6040518463ffffffff1660e01b81526004016105f493929190614991565b60206040518083038186803b15801561060c57600080fd5b505afa158015610620573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610644919061489e565b90508160000160c001602081019061065c9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16146106c9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106c090614a21565b60405180910390fd5b8160000160000160208101906106df9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1663f242432a8360000160c00160208101906107109190613f9a565b846102000160208101906107249190613f9a565b8560000160200135866101e001356040518563ffffffff1660e01b81526004016107519493929190614a76565b600060405180830381600087803b15801561076b57600080fd5b505af115801561077f573d6000803e3d6000fd5b50505050816102000160208101906107979190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1682600001602001358273ffffffffffffffffffffffffffffffffffffffff167fad2b9da5ba4cd295855c53cb1028d30048449d24d2b20e0766210678f53fcfb1856101e001356040516108009190614ace565b60405180910390a4600061086260405180608001604052808560000180360381019061082c9190614c1d565b8152602001856101e00135815260200185610100018036038101906108519190614cea565b815260200160011515815250612f58565b90506108a161086f612f50565b8460000160c00160208101906108859190613f9a565b85600001608001602081019061089b9190613f9a565b84613457565b505050565b60006108b0612e0e565b81600160006101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055507f754c3ea964b0f6c4f74335ce4f36e1fc35bb9bc7b7f46512b6c887c723ff2b9b600160009054906101000a90046bffffffffffffffffffffffff1660405161092a9190613f7f565b60405180910390a160019050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d323c15f610981612f50565b866101000187806101c00190610997919061466a565b8960000160800160208101906109ad9190613f9a565b6040518663ffffffff1660e01b81526004016109cd959493929190614839565b60206040518083038186803b1580156109e557600080fd5b505afa1580156109f9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a1d919061489e565b506000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adb0ae1886600001878060e00190610a72919061466a565b6040518463ffffffff1660e01b8152600401610a9093929190614991565b60206040518083038186803b158015610aa857600080fd5b505afa158015610abc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ae0919061489e565b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663285588f88287600001876000016020810190610b389190613f9a565b88602001356040518563ffffffff1660e01b8152600401610b5c9493929190614d17565b60006040518083038186803b158015610b7457600080fd5b505afa158015610b88573d6000803e3d6000fd5b50505050836000016020810190610b9f9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff16634f78a38f86610200016020810190610bce9190613f9a565b876101e001358787876040518663ffffffff1660e01b8152600401610bf7959493929190614eaf565b602060405180830381600087803b158015610c1157600080fd5b505af1158015610c25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c499190614f2c565b506000610ca4604051806080016040528088600001803603810190610c6e9190614c1d565b8152602001886101e0013581526020018861010001803603810190610c939190614cea565b815260200160011515815250612f58565b9050610ce3610cb1612f50565b8760000160c0016020810190610cc79190613f9a565b886000016080016020810190610cdd9190613f9a565b84613457565b85610200016020810190610cf79190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1685602001358373ffffffffffffffffffffffffffffffffffffffff167fad2b9da5ba4cd295855c53cb1028d30048449d24d2b20e0766210678f53fcfb1896101e00135604051610d5d9190614ace565b60405180910390a4505050505050565b6000610d77612e0e565b81600560006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b6000610dcb612e0e565b81600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060019050919050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d323c15f610e5b612f50565b8860800189806101400190610e70919061466a565b8a6080016020810190610e839190613f9a565b6040518663ffffffff1660e01b8152600401610ea3959493929190614839565b60206040518083038186803b158015610ebb57600080fd5b505afa158015610ecf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ef3919061489e565b506000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adb0ae1887898060000190610f45919061466a565b6040518463ffffffff1660e01b8152600401610f6393929190614991565b60206040518083038186803b158015610f7b57600080fd5b505afa158015610f8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610fb3919061489e565b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663285588f882888960000160208101906110089190613f9a565b8a602001356040518563ffffffff1660e01b815260040161102c9493929190614d17565b60006040518083038186803b15801561104457600080fd5b505afa158015611058573d6000803e3d6000fd5b50505050866101800160208101906110709190614f85565b1561112b578560000160208101906110889190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1663f242432a8760c00160208101906110b69190613f9a565b896101c00160208101906110ca9190613f9a565b89602001358b61016001356040518563ffffffff1660e01b81526004016110f49493929190614a76565b600060405180830381600087803b15801561110e57600080fd5b505af1158015611122573d6000803e3d6000fd5b505050506111d6565b85600001602081019061113e9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff166342842e0e8760c001602081019061116c9190613f9a565b896101c00160208101906111809190613f9a565b89602001356040518463ffffffff1660e01b81526004016111a393929190614fb2565b600060405180830381600087803b1580156111bd57600080fd5b505af11580156111d1573d6000803e3d6000fd5b505050505b600061122c6040518060800160405280898036038101906111f79190614c1d565b81526020018a610160013581526020018a60800180360381019061121b9190614cea565b815260200160001515815250612f58565b9050611265611239612f50565b8860c001602081019061124c9190613f9a565b89608001602081019061125f9190613f9a565b84613457565b60005b848490508160ff1610156118fd576000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adb0ae1889898560ff168181106112cc576112cb614fe9565b5b905060e002018c80604001906112e29190615018565b8660ff168181106112f6576112f5614fe9565b5b9050602002810190611308919061466a565b6040518463ffffffff1660e01b815260040161132693929190614991565b60206040518083038186803b15801561133e57600080fd5b505afa158015611352573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611376919061489e565b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663285588f8828a8a8660ff168181106113cd576113cc614fe9565b5b905060e0020189898760ff168181106113e9576113e8614fe9565b5b90506020028101906113fb919061507b565b600001602081019061140d9190613f9a565b8a8a8860ff1681811061142357611422614fe9565b5b9050602002810190611435919061507b565b602001356040518563ffffffff1660e01b81526004016114589493929190614d17565b60006040518083038186803b15801561147057600080fd5b505afa158015611484573d6000803e3d6000fd5b50505050600086868460ff168181106114a05761149f614fe9565b5b90506020028101906114b2919061507b565b60000160208101906114c49190613f9a565b73ffffffffffffffffffffffffffffffffffffffff16634f78a38f8c6101c00160208101906114f39190613f9a565b8d806101a0019061150491906150a3565b8760ff1681811061151857611517614fe9565b5b905060200201358a8a8860ff1681811061153557611534614fe9565b5b9050602002810190611547919061507b565b8f80606001906115579190615018565b8960ff1681811061156b5761156a614fe9565b5b905060200281019061157d919061466a565b6040518663ffffffff1660e01b815260040161159d959493929190614eaf565b602060405180830381600087803b1580156115b757600080fd5b505af11580156115cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115ef9190614f2c565b905086868460ff1681811061160757611606614fe9565b5b9050602002810190611619919061507b565b600001602081019061162b9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1663bd969c258c6101c001602081019061165a9190613f9a565b838e806101a0019061166c91906150a3565b8860ff168181106116805761167f614fe9565b5b905060200201358e600001602081019061169a9190613f9a565b8f602001356040518663ffffffff1660e01b81526004016116bf959493929190615106565b602060405180830381600087803b1580156116d957600080fd5b505af11580156116ed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611711919061516e565b5060006117a960405180608001604052808c8c8860ff1681811061173857611737614fe9565b5b905060e0020180360381019061174e9190614c1d565b81526020018e806101a0019061176491906150a3565b8860ff1681811061177857611777614fe9565b5b9050602002013581526020018e6080018036038101906117989190614cea565b815260200160011515815250612f58565b90506118186117b6612f50565b8b8b8760ff168181106117cc576117cb614fe9565b5b905060e0020160c00160208101906117e49190613f9a565b8c8c8860ff168181106117fa576117f9614fe9565b5b905060e0020160800160208101906118129190613f9a565b84613457565b8b6101c001602081019061182c9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1688888660ff1681811061185857611857614fe9565b5b905060200281019061186a919061507b565b602001358473ffffffffffffffffffffffffffffffffffffffff167fad2b9da5ba4cd295855c53cb1028d30048449d24d2b20e0766210678f53fcfb18f806101a001906118b791906150a3565b8960ff168181106118cb576118ca614fe9565b5b905060200201356040516118df9190614ace565b60405180910390a450505080806118f5906151d7565b915050611268565b505050505050505050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d323c15f61194e612f50565b896080018a806101400190611963919061466a565b8b60800160208101906119769190613f9a565b6040518663ffffffff1660e01b8152600401611996959493929190614839565b60206040518083038186803b1580156119ae57600080fd5b505afa1580156119c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119e6919061489e565b506000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adb0ae18888a8060000190611a38919061466a565b6040518463ffffffff1660e01b8152600401611a5693929190614991565b60206040518083038186803b158015611a6e57600080fd5b505afa158015611a82573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611aa6919061489e565b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663285588f88289896000016020810190611afb9190613f9a565b8a602001356040518563ffffffff1660e01b8152600401611b1f9493929190614d17565b60006040518083038186803b158015611b3757600080fd5b505afa158015611b4b573d6000803e3d6000fd5b50505050856000016020810190611b629190613f9a565b73ffffffffffffffffffffffffffffffffffffffff16639bfe7bb7896101c0016020810190611b919190613f9a565b888b8060200190611ba2919061466a565b6040518563ffffffff1660e01b8152600401611bc194939291906152a1565b602060405180830381600087803b158015611bdb57600080fd5b505af1158015611bef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c139190614f2c565b506000611c6a60405180608001604052808a803603810190611c359190614c1d565b81526020018b610160013581526020018b608001803603810190611c599190614cea565b815260200160001515815250612f58565b9050611ca3611c77612f50565b8960c0016020810190611c8a9190613f9a565b8a6080016020810190611c9d9190613f9a565b84613457565b60005b848490508160ff161015611dca576000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adb0ae1889898560ff16818110611d0a57611d09614fe9565b5b905060e002018d8060400190611d209190615018565b8660ff16818110611d3457611d33614fe9565b5b9050602002810190611d46919061466a565b6040518463ffffffff1660e01b8152600401611d6493929190614991565b60206040518083038186803b158015611d7c57600080fd5b505afa158015611d90573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611db4919061489e565b9050508080611dc2906151d7565b915050611ca6565b5060005b848490508160ff16101561227d57600085858360ff16818110611df457611df3614fe9565b5b9050602002810190611e06919061507b565b6000016020810190611e189190613f9a565b73ffffffffffffffffffffffffffffffffffffffff16634f78a38f8c6101c0016020810190611e479190613f9a565b8d806101a00190611e5891906150a3565b8660ff16818110611e6c57611e6b614fe9565b5b9050602002013589898760ff16818110611e8957611e88614fe9565b5b9050602002810190611e9b919061507b565b8f8060600190611eab9190615018565b8860ff16818110611ebf57611ebe614fe9565b5b9050602002810190611ed1919061466a565b6040518663ffffffff1660e01b8152600401611ef1959493929190614eaf565b602060405180830381600087803b158015611f0b57600080fd5b505af1158015611f1f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f439190614f2c565b905085858360ff16818110611f5b57611f5a614fe9565b5b9050602002810190611f6d919061507b565b6000016020810190611f7f9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1663bd969c258c6101c0016020810190611fae9190613f9a565b838e806101a00190611fc091906150a3565b8760ff16818110611fd457611fd3614fe9565b5b905060200201358d6000016020810190611fee9190613f9a565b8e602001356040518663ffffffff1660e01b8152600401612013959493929190615106565b602060405180830381600087803b15801561202d57600080fd5b505af1158015612041573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612065919061516e565b5060006120fd60405180608001604052808b8b8760ff1681811061208c5761208b614fe9565b5b905060e002018036038101906120a29190614c1d565b81526020018e806101a001906120b891906150a3565b8760ff168181106120cc576120cb614fe9565b5b9050602002013581526020018e6080018036038101906120ec9190614cea565b815260200160011515815250612f58565b905061216c61210a612f50565b8a8a8660ff168181106121205761211f614fe9565b5b905060e0020160c00160208101906121389190613f9a565b8b8b8760ff1681811061214e5761214d614fe9565b5b905060e0020160800160208101906121669190613f9a565b84613457565b8b6101c00160208101906121809190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1687878560ff168181106121ac576121ab614fe9565b5b90506020028101906121be919061507b565b602001358a8a8660ff168181106121d8576121d7614fe9565b5b905060e0020160c00160208101906121f09190613f9a565b73ffffffffffffffffffffffffffffffffffffffff167fad2b9da5ba4cd295855c53cb1028d30048449d24d2b20e0766210678f53fcfb18f806101a0019061223891906150a3565b8860ff1681811061224c5761224b614fe9565b5b905060200201356040516122609190614ace565b60405180910390a450508080612275906151d7565b915050611dce565b50505050505050505050565b600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663d323c15f6122cf612f50565b896080018a8061014001906122e4919061466a565b8b60800160208101906122f79190613f9a565b6040518663ffffffff1660e01b8152600401612317959493929190614839565b60206040518083038186803b15801561232f57600080fd5b505afa158015612343573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612367919061489e565b506000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adb0ae18888a80600001906123b9919061466a565b6040518463ffffffff1660e01b81526004016123d793929190614991565b60206040518083038186803b1580156123ef57600080fd5b505afa158015612403573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612427919061489e565b9050600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663285588f8828989600001602081019061247c9190613f9a565b8a602001356040518563ffffffff1660e01b81526004016124a09493929190614d17565b60006040518083038186803b1580156124b857600080fd5b505afa1580156124cc573d6000803e3d6000fd5b50505050876101800160208101906124e49190614f85565b156125ba578560000160208101906124fc9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff16631dca5f9b896101c001602081019061252b9190613f9a565b8a6101600135898c8060200190612542919061466a565b6040518663ffffffff1660e01b81526004016125629594939291906153a3565b602060405180830381600087803b15801561257c57600080fd5b505af1158015612590573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125b49190614f2c565b50612680565b8560000160208101906125cd9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff166386f7dfc3896101c00160208101906125fc9190613f9a565b888b806020019061260d919061466a565b6040518563ffffffff1660e01b815260040161262c949392919061540b565b602060405180830381600087803b15801561264657600080fd5b505af115801561265a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061267e9190614f2c565b505b60006126d660405180608001604052808a8036038101906126a19190614c1d565b81526020018b610160013581526020018b6080018036038101906126c59190614cea565b815260200160001515815250612f58565b905061270f6126e3612f50565b8960c00160208101906126f69190613f9a565b8a60800160208101906127099190613f9a565b84613457565b60005b848490508160ff161015612836576000600560009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663adb0ae1889898560ff1681811061277657612775614fe9565b5b905060e002018d806040019061278c9190615018565b8660ff168181106127a05761279f614fe9565b5b90506020028101906127b2919061466a565b6040518463ffffffff1660e01b81526004016127d093929190614991565b60206040518083038186803b1580156127e857600080fd5b505afa1580156127fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612820919061489e565b905050808061282e906151d7565b915050612712565b5060005b848490508160ff161015612ce957600085858360ff168181106128605761285f614fe9565b5b9050602002810190612872919061507b565b60000160208101906128849190613f9a565b73ffffffffffffffffffffffffffffffffffffffff16634f78a38f8c6101c00160208101906128b39190613f9a565b8d806101a001906128c491906150a3565b8660ff168181106128d8576128d7614fe9565b5b9050602002013589898760ff168181106128f5576128f4614fe9565b5b9050602002810190612907919061507b565b8f80606001906129179190615018565b8860ff1681811061292b5761292a614fe9565b5b905060200281019061293d919061466a565b6040518663ffffffff1660e01b815260040161295d959493929190614eaf565b602060405180830381600087803b15801561297757600080fd5b505af115801561298b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129af9190614f2c565b905085858360ff168181106129c7576129c6614fe9565b5b90506020028101906129d9919061507b565b60000160208101906129eb9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1663bd969c258c6101c0016020810190612a1a9190613f9a565b838e806101a00190612a2c91906150a3565b8760ff16818110612a4057612a3f614fe9565b5b905060200201358d6000016020810190612a5a9190613f9a565b8e602001356040518663ffffffff1660e01b8152600401612a7f959493929190615106565b602060405180830381600087803b158015612a9957600080fd5b505af1158015612aad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ad1919061516e565b506000612b6960405180608001604052808b8b8760ff16818110612af857612af7614fe9565b5b905060e00201803603810190612b0e9190614c1d565b81526020018e806101a00190612b2491906150a3565b8760ff16818110612b3857612b37614fe9565b5b9050602002013581526020018e608001803603810190612b589190614cea565b815260200160011515815250612f58565b9050612bd8612b76612f50565b8a8a8660ff16818110612b8c57612b8b614fe9565b5b905060e0020160c0016020810190612ba49190613f9a565b8b8b8760ff16818110612bba57612bb9614fe9565b5b905060e002016080016020810190612bd29190613f9a565b84613457565b8b6101c0016020810190612bec9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff1687878560ff16818110612c1857612c17614fe9565b5b9050602002810190612c2a919061507b565b602001358a8a8660ff16818110612c4457612c43614fe9565b5b905060e0020160c0016020810190612c5c9190613f9a565b73ffffffffffffffffffffffffffffffffffffffff167fad2b9da5ba4cd295855c53cb1028d30048449d24d2b20e0766210678f53fcfb18f806101a00190612ca491906150a3565b8860ff16818110612cb857612cb7614fe9565b5b90506020020135604051612ccc9190614ace565b60405180910390a450508080612ce1906151d7565b91505061283a565b50505050505050505050565b6000612cff612e0e565b81600060146101000a8154816bffffffffffffffffffffffff02191690836bffffffffffffffffffffffff1602179055507fd93dd360d98fc20e8a1fed3ac984811d257edb945d5612328d87c1123eb42de8600060149054906101000a90046bffffffffffffffffffffffff16604051612d799190613f7f565b60405180910390a160019050919050565b612d92612e0e565b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415612e02576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612df9906154c4565b60405180910390fd5b612e0b81612e8c565b50565b612e16612f50565b73ffffffffffffffffffffffffffffffffffffffff16612e34610476565b73ffffffffffffffffffffffffffffffffffffffff1614612e8a576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612e8190615530565b60405180910390fd5b565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600033905090565b612f60613d1a565b612710612fb4600060149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff16846000015160a001516bffffffffffffffffffffffff16613a7390919063ffffffff16565b1115612ff5576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401612fec9061559c565b60405180910390fd5b600061300d8360000151604001518460400151613a89565b905060008060008060009050600087602001518661302b91906155bc565b9050600061307e612710613070600060149054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff1685613b3b90919063ffffffff16565b613b5190919063ffffffff16565b90506000806130c06127106130b28d6000015160a001516bffffffffffffffffffffffff1687613b3b90919063ffffffff16565b613b5190919063ffffffff16565b905060006130e9826130db8688613b6790919063ffffffff16565b613b6790919063ffffffff16565b90508b60600151156131ce578b60200151600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ae6180c26040518163ffffffff1660e01b815260040160206040518083038186803b15801561316257600080fd5b505afa158015613176573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061319a9190614f2c565b6131a491906155bc565b9550858411156131c15785846131ba9190615616565b93506131c9565b839550600093505b613243565b61321d61271061320f600160009054906101000a90046bffffffffffffffffffffffff166bffffffffffffffffffffffff1687613b3b90919063ffffffff16565b613b5190919063ffffffff16565b92508284111561323a5782846132339190615616565b9350613242565b839250600093505b5b6132758c60000151600001517f2a55205a00000000000000000000000000000000000000000000000000000000613b7d565b1561331d578b600001516000015173ffffffffffffffffffffffffffffffffffffffff16632a55205a8d6000015160200151836040518363ffffffff1660e01b81526004016132c592919061564a565b604080518083038186803b1580156132dc57600080fd5b505afa1580156132f0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133149190615673565b80985081995050505b6133308782613b6790919063ffffffff16565b9850600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663901212b88d6000015160c001516040518263ffffffff1660e01b8152600401613395919061400c565b60206040518083038186803b1580156133ad57600080fd5b505afa1580156133c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133e5919061516e565b156133fd5781896133f691906156b3565b9850600091505b6040518060e001604052808581526020018381526020018a81526020018881526020018481526020018781526020018973ffffffffffffffffffffffffffffffffffffffff168152509a5050505050505050505050919050565b600082905060008260000151111561355e578073ffffffffffffffffffffffffffffffffffffffff166323b872dd866001600c9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685600001516040518463ffffffff1660e01b81526004016134cc93929190614fb2565b602060405180830381600087803b1580156134e657600080fd5b505af11580156134fa573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061351e919061516e565b61355d576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016135549061577b565b60405180910390fd5b5b600082602001511115613660578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685602001516040518463ffffffff1660e01b81526004016135ce93929190614fb2565b602060405180830381600087803b1580156135e857600080fd5b505af11580156135fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613620919061516e565b61365f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016136569061580d565b60405180910390fd5b5b600082606001511115613744578073ffffffffffffffffffffffffffffffffffffffff166323b872dd868460c0015185606001516040518463ffffffff1660e01b81526004016136b293929190614fb2565b602060405180830381600087803b1580156136cc57600080fd5b505af11580156136e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613704919061516e565b613743576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161373a9061589f565b60405180910390fd5b5b600082608001511115613846578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1685608001516040518463ffffffff1660e01b81526004016137b493929190614fb2565b602060405180830381600087803b1580156137ce57600080fd5b505af11580156137e2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613806919061516e565b613845576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161383c90615931565b60405180910390fd5b5b60008260a00151111561399a578073ffffffffffffffffffffffffffffffffffffffff166323b872dd86600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff168560a001516040518463ffffffff1660e01b81526004016138b693929190614fb2565b602060405180830381600087803b1580156138d057600080fd5b505af11580156138e4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613908919061516e565b613947576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161393e906159c3565b60405180910390fd5b8473ffffffffffffffffffffffffffffffffffffffff167f03960d319b25a13b07a295a42c9b06ee2f300ad873efc9e1c2ebf2a9692896c78360a001516040516139919190614ace565b60405180910390a25b8073ffffffffffffffffffffffffffffffffffffffff166323b872dd868685604001516040518463ffffffff1660e01b81526004016139db93929190614fb2565b602060405180830381600087803b1580156139f557600080fd5b505af1158015613a09573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613a2d919061516e565b613a6c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613a6390615a55565b60405180910390fd5b5050505050565b60008183613a8191906156b3565b905092915050565b60008082606001516bffffffffffffffffffffffff161415613aad57829050613b35565b600182606001516bffffffffffffffffffffffff161415613afa5781602001518260400151600a613ade9190615ba8565b84613ae991906155bc565b613af39190615c22565b9050613b35565b6040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401613b2c90615cc5565b60405180910390fd5b92915050565b60008183613b4991906155bc565b905092915050565b60008183613b5f9190615c22565b905092915050565b60008183613b759190615616565b905092915050565b6000613b8883613ba2565b8015613b9a5750613b998383613bef565b5b905092915050565b6000613bce827f01ffc9a700000000000000000000000000000000000000000000000000000000613bef565b8015613be85750613be68263ffffffff60e01b613bef565b155b9050919050565b6000806301ffc9a760e01b83604051602401613c0b9190613f3d565b604051602081830303815290604052907bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff838183161783525050505090506000808573ffffffffffffffffffffffffffffffffffffffff1661753084604051613c959190615d54565b6000604051808303818686fa925050503d8060008114613cd1576040519150601f19603f3d011682016040523d82523d6000602084013e613cd6565b606091505b5091509150602081511015613cf15760009350505050613d14565b818015613d0e575080806020019051810190613d0d919061516e565b5b93505050505b92915050565b6040518060e00160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600073ffffffffffffffffffffffffffffffffffffffff1681525090565b6000604051905090565b600080fd5b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000613dac82613d81565b9050919050565b613dbc81613da1565b8114613dc757600080fd5b50565b600081359050613dd981613db3565b92915050565b6000819050919050565b613df281613ddf565b8114613dfd57600080fd5b50565b600081359050613e0f81613de9565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112613e3a57613e39613e15565b5b8235905067ffffffffffffffff811115613e5757613e56613e1a565b5b602083019150836001820283011115613e7357613e72613e1f565b5b9250929050565b600080600080600060808688031215613e9657613e95613d77565b5b6000613ea488828901613dca565b9550506020613eb588828901613dca565b9450506040613ec688828901613e00565b935050606086013567ffffffffffffffff811115613ee757613ee6613d7c565b5b613ef388828901613e24565b92509250509295509295909350565b60007fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b613f3781613f02565b82525050565b6000602082019050613f526000830184613f2e565b92915050565b60006bffffffffffffffffffffffff82169050919050565b613f7981613f58565b82525050565b6000602082019050613f946000830184613f70565b92915050565b600060208284031215613fb057613faf613d77565b5b6000613fbe84828501613dca565b91505092915050565b60008115159050919050565b613fdc81613fc7565b82525050565b6000602082019050613ff76000830184613fd3565b92915050565b61400681613da1565b82525050565b60006020820190506140216000830184613ffd565b92915050565b600080fd5b6000610220828403121561404357614042614027565b5b81905092915050565b60006020828403121561406257614061613d77565b5b600082013567ffffffffffffffff8111156140805761407f613d7c565b5b61408c8482850161402c565b91505092915050565b61409e81613f58565b81146140a957600080fd5b50565b6000813590506140bb81614095565b92915050565b6000602082840312156140d7576140d6613d77565b5b60006140e5848285016140ac565b91505092915050565b600060a0828403121561410457614103614027565b5b81905092915050565b6000806000806060858703121561412757614126613d77565b5b600085013567ffffffffffffffff81111561414557614144613d7c565b5b6141518782880161402c565b945050602085013567ffffffffffffffff81111561417257614171613d7c565b5b61417e878288016140ee565b935050604085013567ffffffffffffffff81111561419f5761419e613d7c565b5b6141ab87828801613e24565b925092505092959194509250565b60006141c482613d81565b9050919050565b6141d4816141b9565b81146141df57600080fd5b50565b6000813590506141f1816141cb565b92915050565b60006020828403121561420d5761420c613d77565b5b600061421b848285016141e2565b91505092915050565b60006101e0828403121561423b5761423a614027565b5b81905092915050565b600060e0828403121561425a57614259614027565b5b81905092915050565b60008083601f84011261427957614278613e15565b5b8235905067ffffffffffffffff81111561429657614295613e1a565b5b6020830191508360e08202830111156142b2576142b1613e1f565b5b9250929050565b60008083601f8401126142cf576142ce613e15565b5b8235905067ffffffffffffffff8111156142ec576142eb613e1a565b5b60208301915083602082028301111561430857614307613e1f565b5b9250929050565b600080600080600080610140878903121561432d5761432c613d77565b5b600087013567ffffffffffffffff81111561434b5761434a613d7c565b5b61435789828a01614224565b965050602061436889828a01614244565b95505061010087013567ffffffffffffffff81111561438a57614389613d7c565b5b61439689828a01614263565b945094505061012087013567ffffffffffffffff8111156143ba576143b9613d7c565b5b6143c689828a016142b9565b92509250509295509295509295565b600060a082840312156143eb576143ea614027565b5b81905092915050565b6000806000806000806000610160888a03121561441457614413613d77565b5b600088013567ffffffffffffffff81111561443257614431613d7c565b5b61443e8a828b01614224565b975050602061444f8a828b01614244565b96505061010088013567ffffffffffffffff81111561447157614470613d7c565b5b61447d8a828b016143d5565b95505061012088013567ffffffffffffffff81111561449f5761449e613d7c565b5b6144ab8a828b01614263565b945094505061014088013567ffffffffffffffff8111156144cf576144ce613d7c565b5b6144db8a828b016142b9565b925092505092959891949750929550565b600060c0828403121561450257614501614027565b5b81905092915050565b6000806000806000806000610160888a03121561452b5761452a613d77565b5b600088013567ffffffffffffffff81111561454957614548613d7c565b5b6145558a828b01614224565b97505060206145668a828b01614244565b96505061010088013567ffffffffffffffff81111561458857614587613d7c565b5b6145948a828b016144ec565b95505061012088013567ffffffffffffffff8111156145b6576145b5613d7c565b5b6145c28a828b01614263565b945094505061014088013567ffffffffffffffff8111156145e6576145e5613d7c565b5b6145f28a828b016142b9565b925092505092959891949750929550565b600081905092915050565b82818337600083830152505050565b60006146298385614603565b935061463683858461460e565b82840190509392505050565b600061464f82848661461d565b91508190509392505050565b600080fd5b600080fd5b600080fd5b600080833560016020038436030381126146875761468661465b565b5b80840192508235915067ffffffffffffffff8211156146a9576146a8614660565b5b6020830192506001820236038313156146c5576146c4614665565b5b509250929050565b60006146dc6020840184613dca565b905092915050565b6146ed81613da1565b82525050565b60006147026020840184613e00565b905092915050565b61471381613ddf565b82525050565b600061472860208401846140ac565b905092915050565b61473981613f58565b82525050565b60c0820161475060008301836146cd565b61475d60008501826146e4565b5061476b60208301836146f3565b614778602085018261470a565b5061478660408301836146f3565b614793604085018261470a565b506147a16060830183614719565b6147ae6060850182614730565b506147bc60808301836146f3565b6147c9608085018261470a565b506147d760a08301836146cd565b6147e460a08501826146e4565b50505050565b600082825260208201905092915050565b6000601f19601f8301169050919050565b600061481883856147ea565b935061482583858461460e565b61482e836147fb565b840190509392505050565b60006101208201905061484f6000830188613ffd565b61485c602083018761473f565b81810360e083015261486f81858761480c565b905061487f610100830184613ffd565b9695505050505050565b60008151905061489881613db3565b92915050565b6000602082840312156148b4576148b3613d77565b5b60006148c284828501614889565b91505092915050565b60e082016148dc60008301836146cd565b6148e960008501826146e4565b506148f760208301836146f3565b614904602085018261470a565b5061491260408301836146f3565b61491f604085018261470a565b5061492d60608301836146f3565b61493a606085018261470a565b5061494860808301836146cd565b61495560808501826146e4565b5061496360a0830183614719565b61497060a0850182614730565b5061497e60c08301836146cd565b61498b60c08501826146e4565b50505050565b6000610100820190506149a760008301866148cb565b81810360e08301526149ba81848661480c565b9050949350505050565b600082825260208201905092915050565b7f496e76616c69642073656c6c6572206164647265737300000000000000000000600082015250565b6000614a0b6016836149c4565b9150614a16826149d5565b602082019050919050565b60006020820190508181036000830152614a3a816149fe565b9050919050565b614a4a81613ddf565b82525050565b50565b6000614a606000836147ea565b9150614a6b82614a50565b600082019050919050565b600060a082019050614a8b6000830187613ffd565b614a986020830186613ffd565b614aa56040830185614a41565b614ab26060830184614a41565b8181036080830152614ac381614a53565b905095945050505050565b6000602082019050614ae36000830184614a41565b92915050565b600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b614b26826147fb565b810181811067ffffffffffffffff82111715614b4557614b44614aee565b5b80604052505050565b6000614b58613d6d565b9050614b648282614b1d565b919050565b600060e08284031215614b7f57614b7e614ae9565b5b614b8960e0614b4e565b90506000614b9984828501613dca565b6000830152506020614bad84828501613e00565b6020830152506040614bc184828501613e00565b6040830152506060614bd584828501613e00565b6060830152506080614be984828501613dca565b60808301525060a0614bfd848285016140ac565b60a08301525060c0614c1184828501613dca565b60c08301525092915050565b600060e08284031215614c3357614c32613d77565b5b6000614c4184828501614b69565b91505092915050565b600060c08284031215614c6057614c5f614ae9565b5b614c6a60c0614b4e565b90506000614c7a84828501613dca565b6000830152506020614c8e84828501613e00565b6020830152506040614ca284828501613e00565b6040830152506060614cb6848285016140ac565b6060830152506080614cca84828501613e00565b60808301525060a0614cde84828501613dca565b60a08301525092915050565b600060c08284031215614d0057614cff613d77565b5b6000614d0e84828501614c4a565b91505092915050565b600061014082019050614d2d6000830187613ffd565b614d3a60208301866148cb565b614d48610100830185613ffd565b614d56610120830184614a41565b95945050505050565b600080fd5b600080fd5b600080fd5b60008083356001602003843603038112614d8b57614d8a614d69565b5b83810192508235915060208301925067ffffffffffffffff821115614db357614db2614d5f565b5b600182023603841315614dc957614dc8614d64565b5b509250929050565b600082825260208201905092915050565b6000614dee8385614dd1565b9350614dfb83858461460e565b614e04836147fb565b840190509392505050565b600060a08301614e2260008401846146cd565b614e2f60008601826146e4565b50614e3d60208401846146f3565b614e4a602086018261470a565b50614e5860408401846146f3565b614e65604086018261470a565b50614e736060840184614d6e565b8583036060870152614e86838284614de2565b92505050614e9760808401846146cd565b614ea460808601826146e4565b508091505092915050565b600060a082019050614ec46000830188613ffd565b614ed16020830187614a41565b8181036040830152614ee38186614e0f565b90508181036060830152614ef881848661480c565b90508181036080830152614f0b81614a53565b90509695505050505050565b600081519050614f2681613de9565b92915050565b600060208284031215614f4257614f41613d77565b5b6000614f5084828501614f17565b91505092915050565b614f6281613fc7565b8114614f6d57600080fd5b50565b600081359050614f7f81614f59565b92915050565b600060208284031215614f9b57614f9a613d77565b5b6000614fa984828501614f70565b91505092915050565b6000606082019050614fc76000830186613ffd565b614fd46020830185613ffd565b614fe16040830184614a41565b949350505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080833560016020038436030381126150355761503461465b565b5b80840192508235915067ffffffffffffffff82111561505757615056614660565b5b60208301925060208202360383131561507357615072614665565b5b509250929050565b60008235600160a0038336030381126150975761509661465b565b5b80830191505092915050565b600080833560016020038436030381126150c0576150bf61465b565b5b80840192508235915067ffffffffffffffff8211156150e2576150e1614660565b5b6020830192506020820236038313156150fe576150fd614665565b5b509250929050565b600060a08201905061511b6000830188613ffd565b6151286020830187614a41565b6151356040830186614a41565b6151426060830185613ffd565b61514f6080830184614a41565b9695505050505050565b60008151905061516881614f59565b92915050565b60006020828403121561518457615183613d77565b5b600061519284828501615159565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600060ff82169050919050565b60006151e2826151ca565b915060ff8214156151f6576151f561519b565b5b600182019050919050565b600060a0830161521460008401846146cd565b61522160008601826146e4565b5061522f60208401846146f3565b61523c602086018261470a565b5061524a6040840184614d6e565b858303604087015261525d838284614de2565b9250505061526e60608401846146cd565b61527b60608601826146e4565b506152896080840184614719565b6152966080860182614730565b508091505092915050565b60006060820190506152b66000830187613ffd565b81810360208301526152c88186615201565b905081810360408301526152dd81848661480c565b905095945050505050565b600060c083016152fb60008401846146cd565b61530860008601826146e4565b5061531660208401846146f3565b615323602086018261470a565b5061533160408401846146f3565b61533e604086018261470a565b5061534c6060840184614d6e565b858303606087015261535f838284614de2565b9250505061537060808401846146cd565b61537d60808601826146e4565b5061538b60a0840184614719565b61539860a0860182614730565b508091505092915050565b600060a0820190506153b86000830188613ffd565b6153c56020830187614a41565b81810360408301526153d781866152e8565b905081810360608301526153ec81848661480c565b905081810360808301526153ff81614a53565b90509695505050505050565b60006060820190506154206000830187613ffd565b818103602083015261543281866152e8565b9050818103604083015261544781848661480c565b905095945050505050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006154ae6026836149c4565b91506154b982615452565b604082019050919050565b600060208201905081810360008301526154dd816154a1565b9050919050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b600061551a6020836149c4565b9150615525826154e4565b602082019050919050565b600060208201905081810360008301526155498161550d565b9050919050565b7f496e76616c696420706c6174666f726d20666565206f72204e474f2066656500600082015250565b6000615586601f836149c4565b915061559182615550565b602082019050919050565b600060208201905081810360008301526155b581615579565b9050919050565b60006155c782613ddf565b91506155d283613ddf565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561560b5761560a61519b565b5b828202905092915050565b600061562182613ddf565b915061562c83613ddf565b92508282101561563f5761563e61519b565b5b828203905092915050565b600060408201905061565f6000830185614a41565b61566c6020830184614a41565b9392505050565b6000806040838503121561568a57615689613d77565b5b600061569885828601614889565b92505060206156a985828601614f17565b9150509250929050565b60006156be82613ddf565b91506156c983613ddf565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156156fe576156fd61519b565b5b828201905092915050565b7f6661696c757265207768696c65207472616e7366657272696e6720706c61746660008201527f6f726d2066656500000000000000000000000000000000000000000000000000602082015250565b60006157656027836149c4565b915061577082615709565b604082019050919050565b6000602082019050818103600083015261579481615758565b9050919050565b7f6661696c757265207768696c65207472616e7366657272696e67206e676f206660008201527f6565000000000000000000000000000000000000000000000000000000000000602082015250565b60006157f76022836149c4565b91506158028261579b565b604082019050919050565b60006020820190508181036000830152615826816157ea565b9050919050565b7f6661696c757265207768696c65207472616e7366657272696e6720726f79616c60008201527f7479206665650000000000000000000000000000000000000000000000000000602082015250565b60006158896026836149c4565b91506158948261582d565b604082019050919050565b600060208201905081810360008301526158b88161587c565b9050919050565b7f6661696c757265207768696c65207472616e7366657272696e6720726577617260008201527f6420666565000000000000000000000000000000000000000000000000000000602082015250565b600061591b6025836149c4565b9150615926826158bf565b604082019050919050565b6000602082019050818103600083015261594a8161590e565b9050919050565b7f6661696c757265207768696c65207472616e7366657272696e67206275726e2060008201527f616d6f756e740000000000000000000000000000000000000000000000000000602082015250565b60006159ad6026836149c4565b91506159b882615951565b604082019050919050565b600060208201905081810360008301526159dc816159a0565b9050919050565b7f6661696c757265207768696c65207472616e7366657272696e6720617373657460008201527f2066656500000000000000000000000000000000000000000000000000000000602082015250565b6000615a3f6024836149c4565b9150615a4a826159e3565b604082019050919050565b60006020820190508181036000830152615a6e81615a32565b9050919050565b60008160011c9050919050565b6000808291508390505b6001851115615acc57808604811115615aa857615aa761519b565b5b6001851615615ab75780820291505b8081029050615ac585615a75565b9450615a8c565b94509492505050565b600082615ae55760019050615ba1565b81615af35760009050615ba1565b8160018114615b095760028114615b1357615b42565b6001915050615ba1565b60ff841115615b2557615b2461519b565b5b8360020a915084821115615b3c57615b3b61519b565b5b50615ba1565b5060208310610133831016604e8410600b8410161715615b775782820a905083811115615b7257615b7161519b565b5b615ba1565b615b848484846001615a82565b92509050818404811115615b9b57615b9a61519b565b5b81810290505b9392505050565b6000615bb382613ddf565b9150615bbe83613ddf565b9250615beb7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8484615ad5565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000615c2d82613ddf565b9150615c3883613ddf565b925082615c4857615c47615bf3565b5b828204905092915050565b7f43757272656e637920696e76616c696420666f7220707269636520636f6e766560008201527f7273696f6e000000000000000000000000000000000000000000000000000000602082015250565b6000615caf6025836149c4565b9150615cba82615c53565b604082019050919050565b60006020820190508181036000830152615cde81615ca2565b9050919050565b600081519050919050565b60005b83811015615d0e578082015181840152602081019050615cf3565b83811115615d1d576000848401525b50505050565b6000615d2e82615ce5565b615d388185614603565b9350615d48818560208601615cf0565b80840191505092915050565b6000615d608284615d23565b91508190509291505056fea264697066735822122067b7132cc3d114155c586ac54d0ebad9786c0dabf024ca422d0cb4fef307084264736f6c63430008090033