Contract Overview
Balance:
0 FTM
FTM Value:
$0.00
My Name Tag:
Not Available, login to update
Txn Hash | Method |
Block
|
From
|
To
|
Value | [Txn Fee] | |||
---|---|---|---|---|---|---|---|---|---|
0x62285bea18a6bdbdd9c046e727dafe2ee67679f176ada17e03f1998fa8aa7e2a | 0x60a06040 | 24698762 | 476 days 5 hrs ago | 0xe1a5136035a07e13fc78047af81287af7c86bb90 | IN | Create: HeroBlocks | 0 FTM | 0.69633615 |
[ Download CSV Export ]
Latest 1 internal transaction
Parent Txn Hash | Block | From | To | Value | |||
---|---|---|---|---|---|---|---|
0x62285bea18a6bdbdd9c046e727dafe2ee67679f176ada17e03f1998fa8aa7e2a | 24698762 | 476 days 5 hrs ago | 0xe1a5136035a07e13fc78047af81287af7c86bb90 | Contract Creation | 0 FTM |
[ Download CSV Export ]
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
HeroBlocks
Compiler Version
v0.8.10+commit.fc410830
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "./helpers/IHeroBlocksTokenURIProcessor.sol"; import "./operators/IUnitBlocksStatsOperator.sol"; import "./lib/UnitBlocksConstants.sol"; import "../CryptoBlocksERC721Upgradeable.sol"; /** @title HeroBlocks * @dev Unique unit blocks that are heroes */ contract HeroBlocks is Initializable, UUPSUpgradeable, CryptoBlocksERC721Upgradeable { /// @custom:oz-upgrades-unsafe-allow constructor constructor() initializer {} function initialize() initializer public { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); __ERC721_init_unchained("Cryptoblocks: Heroes", "HBLOCK"); __ERC721Burnable_init_unchained(); __ERC721Enumerable_init_unchained(); __CryptoBlocks_init_unchained(); __CryptoBlocksERC721_init_unchained(); __HeroBlocks_init_unchained(); } function __HeroBlocks_init_unchained() internal initializer {} function _authorizeUpgrade(address) internal override onlyRole(AccessControlConstants.ADMIN_ROLE) {} function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(_baseURI(), _tokenURI)); } return IHeroBlocksTokenURIProcessor(_addressMapping[CryptoBlocksConstants.ADDR_MAPPING_TOKEN_URI_PROCESSOR]).getHeroBlocksTokenURI(tokenId); } function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override { if(_attributes[tokenId][UnitBlocksConstants.UINT_WEAPON] > 0) { IUnitBlocksStatsOperator(_addressMapping[UnitBlocksConstants.ADDRESS_MAPPING_UNITBLOCKS_STATS_OPERATOR]).removeEquipFromUnit(_attributes[tokenId][UnitBlocksConstants.UINT_WEAPON]); } if(_attributes[tokenId][UnitBlocksConstants.UINT_SHIELD] > 0) { IUnitBlocksStatsOperator(_addressMapping[UnitBlocksConstants.ADDRESS_MAPPING_UNITBLOCKS_STATS_OPERATOR]).removeEquipFromUnit(_attributes[tokenId][UnitBlocksConstants.UINT_SHIELD]); } if(_attributes[tokenId][UnitBlocksConstants.UINT_HELMET] > 0) { IUnitBlocksStatsOperator(_addressMapping[UnitBlocksConstants.ADDRESS_MAPPING_UNITBLOCKS_STATS_OPERATOR]).removeEquipFromUnit(_attributes[tokenId][UnitBlocksConstants.UINT_HELMET]); } if(_attributes[tokenId][UnitBlocksConstants.UINT_ARMOR] > 0) { IUnitBlocksStatsOperator(_addressMapping[UnitBlocksConstants.ADDRESS_MAPPING_UNITBLOCKS_STATS_OPERATOR]).removeEquipFromUnit(_attributes[tokenId][UnitBlocksConstants.UINT_ARMOR]); } if(_attributes[tokenId][UnitBlocksConstants.UINT_BOOTS] > 0) { IUnitBlocksStatsOperator(_addressMapping[UnitBlocksConstants.ADDRESS_MAPPING_UNITBLOCKS_STATS_OPERATOR]).removeEquipFromUnit(_attributes[tokenId][UnitBlocksConstants.UINT_BOOTS]); } if(_attributes[tokenId][UnitBlocksConstants.UINT_NECKLACE] > 0) { IUnitBlocksStatsOperator(_addressMapping[UnitBlocksConstants.ADDRESS_MAPPING_UNITBLOCKS_STATS_OPERATOR]).removeEquipFromUnit(_attributes[tokenId][UnitBlocksConstants.UINT_NECKLACE]); } if(_attributes[tokenId][UnitBlocksConstants.UINT_RING] > 0) { IUnitBlocksStatsOperator(_addressMapping[UnitBlocksConstants.ADDRESS_MAPPING_UNITBLOCKS_STATS_OPERATOR]).removeEquipFromUnit(_attributes[tokenId][UnitBlocksConstants.UINT_RING]); } if(_attributes[tokenId][UnitBlocksConstants.UINT_ARTIFACT] > 0) { IUnitBlocksStatsOperator(_addressMapping[UnitBlocksConstants.ADDRESS_MAPPING_UNITBLOCKS_STATS_OPERATOR]).removeEquipFromUnit(_attributes[tokenId][UnitBlocksConstants.UINT_ARTIFACT]); } super._beforeTokenTransfer(from, to, tokenId); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IERC721BurnableUpgradeable { function burn(uint256) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IERC2981 { /// @notice Called with the sale price to determine how much royalty // is owed and to whom. /// @param _tokenId - the NFT asset queried for royalty information /// @param _salePrice - the sale price of the NFT asset specified by _tokenId /// @return receiver - address of who should be sent the royalty payment /// @return royaltyAmount - the royalty payment amount for _salePrice function royaltyInfo( uint256 _tokenId, uint256 _salePrice ) external view returns ( address receiver, uint256 royaltyAmount ); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; interface IUnitBlocksStatsOperator { function addUnitExp(uint256, uint256, address, uint256) external; function restoreUnitHp(uint256, uint256) external; function addEquipToUnit(uint256, uint256, uint256) external; function removeEquipFromUnit(uint256) external; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; library UnitBlocksConstants { /** * Attribute Integer IDs */ uint256 public constant UINT_VERSION = 1; // operators will check what version user has. if update is needed they have to go to update contract uint256 public constant UINT_CATEGORY = 2; uint256 public constant UINT_SUBCATEGORY = 3; uint256 public constant UINT_ORIGIN_TIME = 4; uint256 public constant UINT_DBID = 10; // 11-22 in CryptoBlocksConstants uint256 public constant UINT_EXP_TABLE = 79; // exp table id from UnitBlocksDb uint256 public constant UINT_LEVEL = 80; uint256 public constant UINT_EXP = 81; uint256 public constant UINT_AWAKENING_ID = 82; // awakening id uint256 public constant UINT_AWAKENING = 83; // awakening level out of 6 uint256 public constant UINT_PROMOTION_ID = 84; // not used uint256 public constant UINT_PROMOTION = 85; // promotion level out of 6 uint256 public constant UINT_ENHANCEMENT_ID = 86; // enhancement id uint256 public constant UINT_ENHANCEMENT = 87; // enhanced with same unit id + element uint256 public constant UINT_LAND_ID = 88; // land id unit is assigned to uint256 public constant UINT_GUILD_ID = 89; // guild id unit is assigned to uint256 public constant UINT_GENDER = 90; uint256 public constant UINT_RARITY = 91; // not needed uint256 public constant UINT_BADGE = 92; uint256 public constant UINT_ELEMENT = 93; uint256 public constant UINT_ELEMENT_2 = 94; // not used. may be implemented in future uint256 public constant UINT_HP_UV = 100; uint256 public constant UINT_ATK_UV = 101; uint256 public constant UINT_MATK_UV = 102; uint256 public constant UINT_DEF_UV = 103; uint256 public constant UINT_MDEF_UV = 104; uint256 public constant UINT_SPD_UV = 105; uint256 public constant UINT_ACC_UV = 106; uint256 public constant UINT_EVA_UV = 107; uint256 public constant UINT_CRIT_UV = 108; uint256 public constant UINT_CRIT_DMG_UV = 109; uint256 public constant UINT_CRIT_RES_UV = 110; uint256 public constant UINT_EFF_UV = 111; uint256 public constant UINT_RES_UV = 112; uint256 public constant UINT_STAMINA_UV = 113; uint256 public constant UINT_CP_UV = 115; uint256 public constant UINT_MAX_HP = 150; uint256 public constant UINT_HP = 151; uint256 public constant UINT_BOND = 164; // max of 10,000,000 uint256 public constant UINT_MAX_STAMINA = 165; // may not be used uint256 public constant UINT_STAMINA = 166; // not used uint256 public constant UINT_LAST_UPDATED_STAMINA = 167; // used for determining last time stamina was claimed uint256 public constant UINT_CP = 170; // not used uint256 public constant UINT_LAST_UPDATED_CP = 171; // may not be used - last updated cp uint256 public constant UINT_LOCKED = 180; // locked so unit doesn't get used for fodder uint256 public constant UINT_UNIT_SET = 300; // deprecated. release set of hero. used for special access privileges uint256 public constant UINT_FREE_MINT = 310; // minted with free ticket. limited attributes uint256 public constant UINT_BOND_REWARD_CLAIMED = 1000; // uint256 public constant UINT_ENHANCEMENT_REWARD_CLAIMED = 1010; // uint256 public constant UINT_DESTROY_REWARD_CLAIMED = 1020; // not used uint256 public constant UINT_WEAPON = 2000; uint256 public constant UINT_SHIELD = 2001; // can be artifact instead uint256 public constant UINT_HELMET = 2002; uint256 public constant UINT_ARMOR = 2003; uint256 public constant UINT_BOOTS = 2004; uint256 public constant UINT_NECKLACE = 2005; uint256 public constant UINT_RING = 2006; uint256 public constant UINT_ARTIFACT = 2010; uint256 public constant UINT_WEAPON_EQUIPPED = 2020; // deprecated. not used. 1 = has weapon equipped uint256 public constant UINT_SHIELD_EQUIPPED = 2021; // purpose was to deal with equip id 0 but easier to make id 0 unequippable uint256 public constant UINT_HELMET_EQUIPPED = 2022; uint256 public constant UINT_ARMOR_EQUIPPED = 2023; uint256 public constant UINT_BOOTS_EQUIPPED = 2024; uint256 public constant UINT_NECKLACE_EQUIPPED = 2025; uint256 public constant UINT_RING_EQUIPPED = 2026; uint256 public constant UINT_ARTIFACT_EQUIPPED = 2030; /** * Attribute Array IDs */ uint256 public constant ARRAY_AWAKENING_STATS = 20; uint256 public constant ARRAY_AWAKENING_STATS_VALUE = 21; uint256 public constant ARRAY_AWAKENING_ITEMS_QUANTITY = 22; uint256 public constant ARRAY_AWAKENING_ITEMS = 23; uint256 public constant ARRAY_ABILITIES = 24; uint256 public constant ARRAY_LEARNABLE_ABILITIES = 25; uint256 public constant ARRAY_SKILLS = 26; uint256 public constant ARRAY_LEARNABLE_SKILLS = 27; uint256 public constant ARRAY_ABILITY_STATES = 100; uint256 public constant ARRAY_EQUIPPED_ABILITIES = 101; uint256 public constant ARRAY_SKILL_STATES = 102; uint256 public constant ARRAY_EQUIPPED_SKILLS = 103; uint256 public constant ARRAY_BUFFS = 104; uint256 public constant ARRAY_EQUIPS = 105; uint256 public constant ARRAY_MARKS = 300; // grants access to certain content /** * Attribute Address IDs */ uint256 public constant ADDRESS_MINTER = 1; uint256 public constant ADDRESS_OWNER = 2; /** * Attribute String IDs */ uint256 public constant STRING_NAME = 1; /** * Address Mapping IDs */ uint256 public constant ADDRESS_MAPPING_UNITBLOCKS_STATS_OPERATOR = 100; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; interface IHeroBlocksTokenURIProcessor { function getHeroBlocksTokenURI(uint256) external view returns(string memory); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; library CryptoBlocksConstants { /** * Attribute Integer IDs */ uint256 public constant UINT_ID = 0; uint256 public constant UINT_VERSION = 1; // operators will check what version user has. if update is needed they have to go to update contract uint256 public constant UINT_CATEGORY = 2; uint256 public constant UINT_SUBCATEGORY = 3; uint256 public constant UINT_ORIGIN_TIME = 4; // 5, 6, 7, 8, 9 uint256 public constant UINT_RENEW_TIME = 5; uint256 public constant UINT_ORIGIN_CHAIN_ID = 6; uint256 public constant UINT_CHAIN_ID = 7; // current chain id uint256 public constant UINT_MASTER_ID = 8; // master id across all chains uint256 public constant UINT_BRIDGE_LOCKED = 9; // wrapped in bridge contract uint256 public constant UINT_DBID = 10; uint256 public constant UINT_TRANSFER_LOCK = 11; uint256 public constant UINT_BOUND = 12; uint256 public constant UINT_PRICE = 20; // for minting uint256 public constant UINT_MAX_SUPPLY = 21; // for minting currency uint256 public constant UINT_BUYABLE = 22; // default is 0 which is false /** * Address Data IDs */ uint256 public constant ADDR_DATA_WHITELIST = 11; /** * Address Mapping IDs */ uint256 public constant ADDR_MAPPING_ROYALTY_RECEIVER = 10; uint256 public constant ADDR_MAPPING_TOKEN_URI_PROCESSOR = 11; /** * Uint Mapping IDs */ uint256 public constant UINT_MAPPING_CHAIN_ID = 1; uint256 public constant UINT_MAPPING_ROYALTY_AMOUNT = 10; // royalties amount / 1000. ex: 1 = 0.1% }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; library AccessControlConstants { /** * Access Control Roles */ bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR"); // 523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c bytes32 public constant MINTER_ROLE = keccak256("MINTER"); // f0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9 bytes32 public constant ADMIN_ROLE = keccak256("ADMIN"); // df8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec42 bytes32 public constant WITHDRAW_ROLE = keccak256("WITHDRAW"); // 7a8dc26796a1e50e6e190b70259f58f6a4edd5b22280ceecc82b687b8e982869 }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; interface ICryptoBlocksToken { function getTokenIdCounterCurrent() external view returns(uint256); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; interface ICryptoBlocksMintable { function mint(address) external returns(uint256); function mintBridge(address, uint256, uint256) external returns(uint256); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; interface ICryptoBlocksCrossChain { function getMasterMappingTokenId(uint256, uint256) external view returns(uint256); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; interface ICryptoBlocksAttributes { function setBlockAttribute(uint256, uint256, uint256) external; function setBlockAttributeString(uint256, uint256, string calldata) external; function setBlockAttributeAddress(uint256, uint256, address) external; function setBlockAttributeArray(uint256, uint256, uint256[] calldata) external; function setBlockAttributeBytes(uint256, uint256, bytes32[] calldata) external; function setBlockTokenAddressData(uint256, address, uint256) external; function setBlockAddressData(uint256, address, uint256) external; function setBlockAddressMapping(uint256, address) external; function setBlockUintMapping(uint256, uint256) external; event SetBlockAttribute(uint256 indexed tokenId, uint256 indexed attributeId, uint256 attributeValue); event SetBlockAttributeString(uint256 indexed tokenId, uint256 indexed attributeId, string attributeStringValue); event SetBlockAttributeAddress(uint256 indexed tokenId, uint256 indexed attributeId, address attributeAddressValue); event SetBlockAttributeArray(uint256 indexed tokenId, uint256 indexed attributeId, uint256[] attributeArrayValue); event SetBlockAttributeBytes(uint256 indexed tokenId, uint256 indexed attributeId, bytes32[] attributeBytesValue); event SetBlockTokenAddressData(uint256 indexed tokenId, address indexed account, uint256 data); event SetBlockAddressData(uint256 indexed id, address indexed account, uint256 data); event SetBlockAddressMapping(uint256 indexed id, address account); event SetBlockUintMapping(uint256 indexed id, uint256 value); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; interface ICryptoBlocks { function getBlockAttribute(uint256, uint256) external view returns(uint256); function getBlockAttributeString(uint256, uint256) external view returns(string memory); function getBlockAttributeAddress(uint256, uint256) external view returns(address); function getBlockAttributeArray(uint256, uint256) external view returns(uint256[] memory); function getBlockAttributeBytes(uint256, uint256) external view returns(bytes32[] memory); function getBlockTokenAddressData(uint256, address) external view returns(uint256); function getBlockAddressData(uint256, address) external returns(uint256); function getBlockAddressMapping(uint256) external returns(address); function getBlockUintMapping(uint256) external returns(uint256); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/access/AccessControlEnumerableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; import "./lib/AccessControlConstants.sol"; import "./ICryptoBlocks.sol"; import "./ICryptoBlocksAttributes.sol"; import "./lib/CryptoBlocksConstants.sol"; abstract contract CryptoBlocksUpgradeable is Initializable, AccessControlEnumerableUpgradeable, ICryptoBlocksAttributes, ICryptoBlocks { using CountersUpgradeable for CountersUpgradeable.Counter; using StringsUpgradeable for uint256; CountersUpgradeable.Counter internal _tokenIdCounter; // id for this chain. Will be incremented with bridged tokens CountersUpgradeable.Counter internal _masterIdCounter; // master id for this chain. Will not be incremented with bridged tokens mapping(uint256 => string) internal _tokenURIs; // Optional mapping for token URIs mapping(uint256 => mapping(uint256 => uint256)) internal _attributes; // tokenId => attributeId => attributeValue mapping(uint256 => mapping(uint256 => string)) internal _attributesString; // tokenId => attributeId => attributeString mapping(uint256 => mapping(uint256 => address)) internal _attributesAddress; // tokenId => attributeId => attributeAddress mapping(uint256 => mapping(uint256 => uint256[])) internal _attributesArray; // tokenId => attributeId => attributeArray mapping(uint256 => mapping(uint256 => bytes32[])) internal _attributesBytes; // tokenId => attributeId => attributeBytes mapping(uint256 => mapping(uint256 => uint256)) internal _masterMapping; // chainId => masterId => tokenId mapping(uint256 => mapping(address => uint256)) internal _tokenAddressData; // tokenId => address => data mapping(uint256 => mapping(address => uint256)) internal _addressData; // id => address => data mapping(uint256 => address) internal _addressMapping; // id => stores contract addresses mapping(uint256 => uint256) internal _uintMapping; // id => uint256 value string public baseURI; function __CryptoBlocks_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); __CryptoBlocks_init_unchained(); } function __CryptoBlocks_init_unchained() internal initializer { _setupRole(AccessControlConstants.DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(AccessControlConstants.ADMIN_ROLE, _msgSender()); _setupRole(AccessControlConstants.OPERATOR_ROLE, _msgSender()); _setupRole(AccessControlConstants.MINTER_ROLE, _msgSender()); _uintMapping[CryptoBlocksConstants.UINT_MAPPING_CHAIN_ID] = block.chainid; } function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return super.supportsInterface(interfaceId) || interfaceId == type(ICryptoBlocksAttributes).interfaceId || interfaceId == type(ICryptoBlocks).interfaceId; } function setBaseURI(string calldata uri_) external virtual onlyRole(AccessControlConstants.ADMIN_ROLE) { baseURI = uri_; } /** * @dev Set specific attribute of block */ function setBlockAttribute(uint256 id_, uint256 attributeId_, uint256 attributeValue_) external virtual override onlyRole(AccessControlConstants.OPERATOR_ROLE) { _attributes[id_][attributeId_] = attributeValue_; // emit SetBlockAttribute(id_, attributeId_, attributeValue_); } /** * @dev Set specific attribute of block */ function setBlockAttributeString(uint256 id_, uint256 attributeId_, string calldata attributeValue_) external virtual override onlyRole(AccessControlConstants.OPERATOR_ROLE) { _attributesString[id_][attributeId_] = attributeValue_; // emit SetBlockAttributeString(id_, attributeId_, attributeValue_); } /** * @dev Set specific attributeAddress of block */ function setBlockAttributeAddress(uint256 id_, uint256 attributeId_, address attributeAddressValue_) external virtual override onlyRole(AccessControlConstants.OPERATOR_ROLE) { _attributesAddress[id_][attributeId_] = attributeAddressValue_; // emit SetBlockAttributeAddress(id_, attributeId_, attributeAddressValue_); } /** * @dev Set specific attributeArray of block */ function setBlockAttributeArray(uint256 id_, uint256 attributeId_, uint256[] calldata attributeArrayValue_) external virtual override onlyRole(AccessControlConstants.OPERATOR_ROLE) { _attributesArray[id_][attributeId_] = attributeArrayValue_; // emit SetBlockAttributeArray(id_, attributeId_, attributeArrayValue_); } /** * @dev Set specific attributeBytes of block */ function setBlockAttributeBytes(uint256 id_, uint256 attributeId_, bytes32[] calldata attributeBytesValue_) external virtual override onlyRole(AccessControlConstants.OPERATOR_ROLE) { _attributesBytes[id_][attributeId_] = attributeBytesValue_; // emit SetBlockAttributeBytes(id_, attributeId_, attributeBytesValue_); } /** * @dev Set specific data for addresses of block */ function setBlockTokenAddressData(uint256 id_, address address_, uint256 data_) external virtual override onlyRole(AccessControlConstants.OPERATOR_ROLE) { _tokenAddressData[id_][address_] = data_; // emit SetBlockTokenAddressData(id_, address_, data_); } /** * @dev Set specific data for addresses of id */ function setBlockAddressData(uint256 id_, address address_, uint256 data_) external virtual override onlyRole(AccessControlConstants.OPERATOR_ROLE) { _addressData[id_][address_] = data_; // emit SetBlockAddressData(id_, address_, data_); } /** * @dev Set specific addresses of id such as contract addresses */ function setBlockAddressMapping(uint256 id_, address address_) external virtual override onlyRole(AccessControlConstants.OPERATOR_ROLE) { _addressMapping[id_] = address_; // emit SetBlockAddressMapping(id_, address_); } /** * @dev Set specific uint of id such as royalty amount or chainId */ function setBlockUintMapping(uint256 id_, uint256 value_) external virtual override onlyRole(AccessControlConstants.OPERATOR_ROLE) { _uintMapping[id_] = value_; // emit SetBlockUintMapping(id_, value_); } function getBlockAttribute(uint256 id_, uint256 attributeId_) external virtual override view returns(uint256) { return _attributes[id_][attributeId_]; } function getBlockAttributeString(uint256 id_, uint256 attributeId_) external virtual override view returns(string memory) { return _attributesString[id_][attributeId_]; } function getBlockAttributeAddress(uint256 id_, uint256 attributeId_) external virtual override view returns(address) { return _attributesAddress[id_][attributeId_]; } function getBlockAttributeArray(uint256 id_, uint256 attributeId_) external virtual override view returns(uint256[] memory) { return _attributesArray[id_][attributeId_]; } function getBlockAttributeBytes(uint256 id_, uint256 attributeId_) external virtual override view returns(bytes32[] memory) { return _attributesBytes[id_][attributeId_]; } function getBlockTokenAddressData(uint256 id_, address address_) external virtual override view returns(uint256) { return _tokenAddressData[id_][address_]; } function getBlockAddressData(uint256 id_, address address_) external virtual override view returns(uint256) { return _addressData[id_][address_]; } function getBlockAddressMapping(uint256 id_) external virtual override view returns(address) { return _addressMapping[id_]; } function getBlockUintMapping(uint256 id_) external virtual override view returns(uint256) { return _uintMapping[id_]; } uint256[35] private __gap; }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.0; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721BurnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721EnumerableUpgradeable.sol"; import "../token/ERC721/extensions/IERC721BurnableUpgradeable.sol"; import "../token/ERC2981/IERC2981.sol"; import "./ICryptoBlocksCrossChain.sol"; import "./ICryptoBlocksMintable.sol"; import "./ICryptoBlocksToken.sol"; import "./CryptoBlocksUpgradeable.sol"; abstract contract CryptoBlocksERC721Upgradeable is Initializable, CryptoBlocksUpgradeable, IERC721BurnableUpgradeable, ERC721BurnableUpgradeable, ERC721EnumerableUpgradeable, IERC2981, ICryptoBlocksCrossChain, ICryptoBlocksMintable, ICryptoBlocksToken { using CountersUpgradeable for CountersUpgradeable.Counter; using StringsUpgradeable for uint256; function __CryptoBlocksERC721_init(string memory name_, string memory symbol_) internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721_init_unchained(name_, symbol_); __ERC721Burnable_init_unchained(); __ERC721Enumerable_init_unchained(); __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); __CryptoBlocks_init_unchained(); __CryptoBlocksERC721_init_unchained(); } function __CryptoBlocksERC721_init_unchained() internal initializer { _uintMapping[CryptoBlocksConstants.UINT_MAPPING_ROYALTY_AMOUNT] = 50; _addressMapping[CryptoBlocksConstants.ADDR_MAPPING_ROYALTY_RECEIVER] = _msgSender(); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Upgradeable, ERC721EnumerableUpgradeable, CryptoBlocksUpgradeable) returns (bool) { return super.supportsInterface(interfaceId) || interfaceId == type(IERC2981).interfaceId || interfaceId == type(ICryptoBlocksCrossChain).interfaceId || interfaceId == type(ICryptoBlocksMintable).interfaceId || interfaceId == type(ICryptoBlocksToken).interfaceId; } function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; // If there is no base URI, return the token URI. if (bytes(_baseURI()).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(_baseURI(), _tokenURI)); } return bytes(_baseURI()).length > 0 ? string(abi.encodePacked(_baseURI(), _attributes[tokenId][CryptoBlocksConstants.UINT_ORIGIN_CHAIN_ID].toString(), "/", _attributes[tokenId][CryptoBlocksConstants.UINT_MASTER_ID].toString())) : ""; } function setTokenURI(uint256 tokenId_, string calldata tokenURI_) external onlyRole(AccessControlConstants.ADMIN_ROLE) { require(_exists(tokenId_), "URI set of nonexistent token"); _tokenURIs[tokenId_] = tokenURI_; } function _baseURI() internal view override returns (string memory) { return baseURI; } function _beforeTokenTransfer(address from, address to, uint256 tokenId) internal virtual override(ERC721Upgradeable, ERC721EnumerableUpgradeable) { // transferLock or whiteListed and not bounded require((_attributes[tokenId][CryptoBlocksConstants.UINT_TRANSFER_LOCK] == 0 || _addressData[CryptoBlocksConstants.ADDR_DATA_WHITELIST][from] == 1 || _addressData[CryptoBlocksConstants.ADDR_DATA_WHITELIST][to] == 1) && _attributes[tokenId][CryptoBlocksConstants.UINT_BOUND] == 0, "TransferLock"); super._beforeTokenTransfer(from, to, tokenId); } function burn(uint256 tokenId) public override(IERC721BurnableUpgradeable, ERC721BurnableUpgradeable) onlyRole(AccessControlConstants.OPERATOR_ROLE) { _burn(tokenId); } function _burn(uint256 tokenId) internal override { super._burn(tokenId); if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } function _internalMint(address to_) internal returns(uint256) { uint256 id_ = _tokenIdCounter.current(); _safeMint(to_, id_); _attributes[id_][CryptoBlocksConstants.UINT_CHAIN_ID] = _uintMapping[CryptoBlocksConstants.UINT_MAPPING_CHAIN_ID]; _attributes[id_][CryptoBlocksConstants.UINT_ORIGIN_CHAIN_ID] = _uintMapping[CryptoBlocksConstants.UINT_MAPPING_CHAIN_ID]; _attributes[id_][CryptoBlocksConstants.UINT_MASTER_ID] = _masterIdCounter.current(); _masterMapping[_uintMapping[CryptoBlocksConstants.UINT_MAPPING_CHAIN_ID]][_masterIdCounter.current()] = id_; _tokenIdCounter.increment(); _masterIdCounter.increment(); return id_; } function mint(address to_) external override onlyRole(AccessControlConstants.MINTER_ROLE) returns(uint256) { return _internalMint(to_); } /** * @dev Mint but keep origin chain id and master id */ function mintBridge(address to_, uint256 chainId_, uint256 masterId_) external override onlyRole(AccessControlConstants.MINTER_ROLE) returns(uint256) { uint256 id_ = _tokenIdCounter.current(); _safeMint(to_, id_); _attributes[id_][CryptoBlocksConstants.UINT_CHAIN_ID] = _uintMapping[CryptoBlocksConstants.UINT_MAPPING_CHAIN_ID]; _attributes[id_][CryptoBlocksConstants.UINT_ORIGIN_CHAIN_ID] = chainId_; _attributes[id_][CryptoBlocksConstants.UINT_MASTER_ID] = masterId_; _masterMapping[chainId_][masterId_] = id_; _tokenIdCounter.increment(); return id_; } function royaltyInfo(uint256, uint256 salePrice_) external override view returns (address receiver, uint256 royaltyAmount) { uint256 royaltyOwed_ = (salePrice_ * _uintMapping[CryptoBlocksConstants.UINT_MAPPING_ROYALTY_AMOUNT]) / 1000; return(_addressMapping[CryptoBlocksConstants.ADDR_MAPPING_ROYALTY_RECEIVER], royaltyOwed_); } /** * @dev Get tokenId of this chain from masterId */ function getMasterMappingTokenId(uint256 chainId_, uint256 masterId_) external override view returns(uint256) { return _masterMapping[chainId_][masterId_]; } function getTokenIdCounterCurrent() external override view returns(uint256) { return _tokenIdCounter.current(); } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSetUpgradeable { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165Upgradeable { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal initializer { __ERC165_init_unchained(); } function __ERC165_init_unchained() internal initializer { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library StringsUpgradeable { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library CountersUpgradeable { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal initializer { __Context_init_unchained(); } function __Context_init_unchained() internal initializer { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 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 Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721MetadataUpgradeable is IERC721Upgradeable { /** * @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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721Upgradeable.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721EnumerableUpgradeable is IERC721Upgradeable { /** * @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 tokenId); /** * @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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721Upgradeable.sol"; import "./IERC721EnumerableUpgradeable.sol"; import "../../../proxy/utils/Initializable.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 ERC721EnumerableUpgradeable is Initializable, ERC721Upgradeable, IERC721EnumerableUpgradeable { function __ERC721Enumerable_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721Enumerable_init_unchained(); } function __ERC721Enumerable_init_unchained() internal initializer { } // 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(IERC165Upgradeable, ERC721Upgradeable) returns (bool) { return interfaceId == type(IERC721EnumerableUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721Upgradeable.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 < ERC721EnumerableUpgradeable.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 = ERC721Upgradeable.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 = ERC721Upgradeable.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(); } uint256[46] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721Upgradeable.sol"; import "../../../utils/ContextUpgradeable.sol"; import "../../../proxy/utils/Initializable.sol"; /** * @title ERC721 Burnable Token * @dev ERC721 Token that can be irreversibly burned (destroyed). */ abstract contract ERC721BurnableUpgradeable is Initializable, ContextUpgradeable, ERC721Upgradeable { function __ERC721Burnable_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721Burnable_init_unchained(); } function __ERC721Burnable_init_unchained() internal initializer { } /** * @dev Burns `tokenId`. See {ERC721-_burn}. * * Requirements: * * - The caller must own `tokenId` or be an approved operator. */ function burn(uint256 tokenId) public virtual { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved"); _burn(tokenId); } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165Upgradeable.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721Upgradeable is IERC165Upgradeable { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT 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 IERC721ReceiverUpgradeable { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721Upgradeable.sol"; import "./IERC721ReceiverUpgradeable.sol"; import "./extensions/IERC721MetadataUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/ContextUpgradeable.sol"; import "../../utils/StringsUpgradeable.sol"; import "../../utils/introspection/ERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.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 ERC721Upgradeable is Initializable, ContextUpgradeable, ERC165Upgradeable, IERC721Upgradeable, IERC721MetadataUpgradeable { using AddressUpgradeable for address; using StringsUpgradeable 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. */ function __ERC721_init(string memory name_, string memory symbol_) internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __ERC721_init_unchained(name_, symbol_); } function __ERC721_init_unchained(string memory name_, string memory symbol_) internal initializer { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Upgradeable, IERC165Upgradeable) returns (bool) { return interfaceId == type(IERC721Upgradeable).interfaceId || interfaceId == type(IERC721MetadataUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721Upgradeable.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721Upgradeable.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @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 = ERC721Upgradeable.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); } /** * @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(ERC721Upgradeable.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); 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); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721Upgradeable.ownerOf(tokenId), to, tokenId); } /** * @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 IERC721ReceiverUpgradeable(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721ReceiverUpgradeable.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} uint256[44] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal initializer { __ERC1967Upgrade_init_unchained(); __UUPSUpgradeable_init_unchained(); } function __UUPSUpgradeable_init_unchained() internal initializer { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallSecure(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallSecure(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { require(_initializing || !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967UpgradeUpgradeable is Initializable { function __ERC1967Upgrade_init() internal initializer { __ERC1967Upgrade_init_unchained(); } function __ERC1967Upgrade_init_unchained() internal initializer { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallSecure( address newImplementation, bytes memory data, bool forceCall ) internal { address oldImplementation = _getImplementation(); // Initial upgrade and setup call _setImplementation(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } // Perform rollback test if not already in progress StorageSlotUpgradeable.BooleanSlot storage rollbackTesting = StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT); if (!rollbackTesting.value) { // Trigger rollback using upgradeTo from the new implementation rollbackTesting.value = true; _functionDelegateCall( newImplementation, abi.encodeWithSignature("upgradeTo(address)", oldImplementation) ); rollbackTesting.value = false; // Check rollback was effective require(oldImplementation == _getImplementation(), "ERC1967Upgrade: upgrade breaks further upgrades"); // Finally reset to the new implementation and log the upgrade _upgradeTo(newImplementation); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) { require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } uint256[50] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControlUpgradeable { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerableUpgradeable is IAccessControlUpgradeable { /** * @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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); } function __AccessControl_init_unchained() internal initializer { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", StringsUpgradeable.toHexString(uint160(account), 20), " is missing role ", StringsUpgradeable.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== */ 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); } function _grantRole(bytes32 role, address account) private { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } function _revokeRole(bytes32 role, address account) private { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } uint256[49] private __gap; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IAccessControlEnumerableUpgradeable.sol"; import "./AccessControlUpgradeable.sol"; import "../utils/structs/EnumerableSetUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerableUpgradeable is Initializable, IAccessControlEnumerableUpgradeable, AccessControlUpgradeable { function __AccessControlEnumerable_init() internal initializer { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); } function __AccessControlEnumerable_init_unchained() internal initializer { } using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet; mapping(bytes32 => EnumerableSetUpgradeable.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerableUpgradeable).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 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 override returns (uint256) { return _roleMembers[role].length(); } /** * @dev Overload {grantRole} to track enumerable memberships */ function grantRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) { super.grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {revokeRole} to track enumerable memberships */ function revokeRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) { super.revokeRole(role, account); _roleMembers[role].remove(account); } /** * @dev Overload {renounceRole} to track enumerable memberships */ function renounceRole(bytes32 role, address account) public virtual override(AccessControlUpgradeable, IAccessControlUpgradeable) { super.renounceRole(role, account); _roleMembers[role].remove(account); } /** * @dev Overload {_setupRole} to track enumerable memberships */ function _setupRole(bytes32 role, address account) internal virtual override { super._setupRole(role, account); _roleMembers[role].add(account); } uint256[49] private __gap; }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "istanbul", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"data","type":"uint256"}],"name":"SetBlockAddressData","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"SetBlockAddressMapping","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"attributeId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"attributeValue","type":"uint256"}],"name":"SetBlockAttribute","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"attributeId","type":"uint256"},{"indexed":false,"internalType":"address","name":"attributeAddressValue","type":"address"}],"name":"SetBlockAttributeAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"attributeId","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"attributeArrayValue","type":"uint256[]"}],"name":"SetBlockAttributeArray","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"attributeId","type":"uint256"},{"indexed":false,"internalType":"bytes32[]","name":"attributeBytesValue","type":"bytes32[]"}],"name":"SetBlockAttributeBytes","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"attributeId","type":"uint256"},{"indexed":false,"internalType":"string","name":"attributeStringValue","type":"string"}],"name":"SetBlockAttributeString","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"data","type":"uint256"}],"name":"SetBlockTokenAddressData","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"SetBlockUintMapping","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"},{"internalType":"address","name":"address_","type":"address"}],"name":"getBlockAddressData","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"}],"name":"getBlockAddressMapping","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"},{"internalType":"uint256","name":"attributeId_","type":"uint256"}],"name":"getBlockAttribute","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"},{"internalType":"uint256","name":"attributeId_","type":"uint256"}],"name":"getBlockAttributeAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"},{"internalType":"uint256","name":"attributeId_","type":"uint256"}],"name":"getBlockAttributeArray","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"},{"internalType":"uint256","name":"attributeId_","type":"uint256"}],"name":"getBlockAttributeBytes","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"},{"internalType":"uint256","name":"attributeId_","type":"uint256"}],"name":"getBlockAttributeString","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"},{"internalType":"address","name":"address_","type":"address"}],"name":"getBlockTokenAddressData","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"}],"name":"getBlockUintMapping","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"chainId_","type":"uint256"},{"internalType":"uint256","name":"masterId_","type":"uint256"}],"name":"getMasterMappingTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getRoleMember","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleMemberCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokenIdCounterCurrent","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to_","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to_","type":"address"},{"internalType":"uint256","name":"chainId_","type":"uint256"},{"internalType":"uint256","name":"masterId_","type":"uint256"}],"name":"mintBridge","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"salePrice_","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri_","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"},{"internalType":"address","name":"address_","type":"address"},{"internalType":"uint256","name":"data_","type":"uint256"}],"name":"setBlockAddressData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"},{"internalType":"address","name":"address_","type":"address"}],"name":"setBlockAddressMapping","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"},{"internalType":"uint256","name":"attributeId_","type":"uint256"},{"internalType":"uint256","name":"attributeValue_","type":"uint256"}],"name":"setBlockAttribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"},{"internalType":"uint256","name":"attributeId_","type":"uint256"},{"internalType":"address","name":"attributeAddressValue_","type":"address"}],"name":"setBlockAttributeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"},{"internalType":"uint256","name":"attributeId_","type":"uint256"},{"internalType":"uint256[]","name":"attributeArrayValue_","type":"uint256[]"}],"name":"setBlockAttributeArray","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"},{"internalType":"uint256","name":"attributeId_","type":"uint256"},{"internalType":"bytes32[]","name":"attributeBytesValue_","type":"bytes32[]"}],"name":"setBlockAttributeBytes","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"},{"internalType":"uint256","name":"attributeId_","type":"uint256"},{"internalType":"string","name":"attributeValue_","type":"string"}],"name":"setBlockAttributeString","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"},{"internalType":"address","name":"address_","type":"address"},{"internalType":"uint256","name":"data_","type":"uint256"}],"name":"setBlockTokenAddressData","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id_","type":"uint256"},{"internalType":"uint256","name":"value_","type":"uint256"}],"name":"setBlockUintMapping","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId_","type":"uint256"},{"internalType":"string","name":"tokenURI_","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
60a0604052306080523480156200001557600080fd5b50600054610100900460ff168062000030575060005460ff16155b620000985760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b600054610100900460ff16158015620000bb576000805461ffff19166101011790555b8015620000ce576000805461ff00191690555b506080516146db6200010060003960008181611164015281816111a40152818161126e01526112ae01526146db6000f3fe6080604052600436106103345760003560e01c806356c1d9b0116101ab578063a22cb465116100f7578063d547741f11610095578063e985e9c51161006f578063e985e9c514610a4e578063eae4a08b14610a98578063f023feb714610ab8578063fbb0641814610ad857600080fd5b8063d547741f146109ee578063d712160014610a0e578063e12e6fed14610a2e57600080fd5b8063c87b56dd116100d1578063c87b56dd14610955578063ca15c87314610975578063cf8831db14610995578063d4a61aca146109b557600080fd5b8063a22cb465146108d3578063a40e5784146108f3578063b88d4fde1461093557600080fd5b8063795ad6121161016457806391d148541161013e57806391d148541461086957806395d89b41146108895780639acea9ef1461089e578063a217fddf146108be57600080fd5b8063795ad612146108145780638129fc1c146108345780639010d07c1461084957600080fd5b806356c1d9b01461073b5780636352211e1461075b5780636a6278421461077b5780636c0360eb1461079b5780636eccadc8146107b057806370a08231146107f457600080fd5b80632f2ff15d116102855780633a502bc0116102235780634f1ef286116101fd5780634f1ef286146106c85780634f6ccce7146106db5780634fb5c1b1146106fb57806355f804b31461071b57600080fd5b80633a502bc01461064457806342842e0e1461068857806342966c68146106a857600080fd5b806333f751b71161025f57806333f751b7146105ad57806334a3fa0c146105cd57806336568abe146106045780633659cfe61461062457600080fd5b80632f2ff15d1461054d5780632f745c591461056d578063317281fd1461058d57600080fd5b8063162094c4116102f25780631d97ae4a116102cc5780631d97ae4a146104a957806323b872dd146104be578063248a9ca3146104de5780632a55205a1461050e57600080fd5b8063162094c4146104375780631691f70a1461045757806318160ddd1461049357600080fd5b8062b659fc1461033957806301ffc9a71461035b57806306fdde0314610390578063081812fc146103b2578063095ea7b3146103ea57806311a779581461040a575b600080fd5b34801561034557600080fd5b50610359610354366004613c25565b610b11565b005b34801561036757600080fd5b5061037b610376366004613c8e565b610b57565b60405190151581526020015b60405180910390f35b34801561039c57600080fd5b506103a5610bd4565b6040516103879190613d03565b3480156103be57600080fd5b506103d26103cd366004613d16565b610c67565b6040516001600160a01b039091168152602001610387565b3480156103f657600080fd5b50610359610405366004613d4b565b610cf5565b34801561041657600080fd5b5061042a610425366004613d75565b610e0b565b6040516103879190613d97565b34801561044357600080fd5b50610359610452366004613e1d565b610e77565b34801561046357600080fd5b50610485610472366004613d16565b6000908152610139602052604090205490565b604051908152602001610387565b34801561049f57600080fd5b506101c454610485565b3480156104b557600080fd5b50610485610f06565b3480156104ca57600080fd5b506103596104d9366004613e69565b610f17565b3480156104ea57600080fd5b506104856104f9366004613d16565b600090815260c9602052604090206001015490565b34801561051a57600080fd5b5061052e610529366004613d75565b610f48565b604080516001600160a01b039093168352602083019190915201610387565b34801561055957600080fd5b50610359610568366004613ea5565b610fd6565b34801561057957600080fd5b50610485610588366004613d4b565b610ff8565b34801561059957600080fd5b5061042a6105a8366004613d75565b61108f565b3480156105b957600080fd5b506103596105c8366004613ed1565b6110f9565b3480156105d957600080fd5b506103d26105e8366004613d16565b600090815261013860205260409020546001600160a01b031690565b34801561061057600080fd5b5061035961061f366004613ea5565b611137565b34801561063057600080fd5b5061035961063f366004613f18565b611159565b34801561065057600080fd5b5061048561065f366004613ea5565b6000918252610137602090815260408084206001600160a01b0393909316845291905290205490565b34801561069457600080fd5b506103596106a3366004613e69565b611222565b3480156106b457600080fd5b506103596106c3366004613d16565b61123d565b6103596106d6366004613ff8565b611263565b3480156106e757600080fd5b506104856106f6366004613d16565b611319565b34801561070757600080fd5b50610359610716366004614046565b6113ae565b34801561072757600080fd5b5061035961073636600461407b565b611401565b34801561074757600080fd5b506104856107563660046140bd565b61142d565b34801561076757600080fd5b506103d2610776366004613d16565b6114ef565b34801561078757600080fd5b50610485610796366004613f18565b611567565b3480156107a757600080fd5b506103a56115a6565b3480156107bc57600080fd5b506104856107cb366004613ea5565b6000918252610136602090815260408084206001600160a01b0393909316845291905290205490565b34801561080057600080fd5b5061048561080f366004613f18565b611635565b34801561082057600080fd5b5061035961082f3660046140f0565b6116bd565b34801561084057600080fd5b506103596116fe565b34801561085557600080fd5b506103d2610864366004613d75565b611805565b34801561087557600080fd5b5061037b610884366004613ea5565b611824565b34801561089557600080fd5b506103a561184f565b3480156108aa57600080fd5b506103596108b9366004614115565b61185f565b3480156108ca57600080fd5b50610485600081565b3480156108df57600080fd5b506103596108ee366004614141565b611896565b3480156108ff57600080fd5b506103d261090e366004613d75565b6000918252610132602090815260408084209284529190529020546001600160a01b031690565b34801561094157600080fd5b5061035961095036600461417d565b61195c565b34801561096157600080fd5b506103a5610970366004613d16565b61198e565b34801561098157600080fd5b50610485610990366004613d16565b611b55565b3480156109a157600080fd5b506103596109b0366004613c25565b611b6c565b3480156109c157600080fd5b506104856109d0366004613d75565b60009182526101306020908152604080842092845291905290205490565b3480156109fa57600080fd5b50610359610a09366004613ea5565b611baa565b348015610a1a57600080fd5b50610359610a29366004613d75565b611bb4565b348015610a3a57600080fd5b50610359610a493660046140f0565b611be1565b348015610a5a57600080fd5b5061037b610a693660046141e5565b6001600160a01b0391821660009081526101636020908152604080832093909416825291909152205460ff1690565b348015610aa457600080fd5b506103a5610ab3366004613d75565b611c22565b348015610ac457600080fd5b50610359610ad3366004613ea5565b611cc7565b348015610ae457600080fd5b50610485610af3366004613d75565b60009182526101356020908152604080842092845291905290205490565b60008051602061463f833981519152610b2a8133611d10565b6000858152610134602090815260408083208784529091529020610b4f908484613a5f565b505050505050565b6000610b6282611d74565b80610b7d57506001600160e01b0319821663152a902d60e11b145b80610b9857506001600160e01b03198216631f760c8360e31b145b80610bb357506001600160e01b03198216631e51d0f960e11b145b80610bce57506001600160e01b03198216630ecbd72560e11b145b92915050565b606061015e8054610be49061420f565b80601f0160208091040260200160405190810160405280929190818152602001828054610c109061420f565b8015610c5d5780601f10610c3257610100808354040283529160200191610c5d565b820191906000526020600020905b815481529060010190602001808311610c4057829003601f168201915b5050505050905090565b6000610c7282611d99565b610cd85760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b60648201526084015b60405180910390fd5b50600090815261016260205260409020546001600160a01b031690565b6000610d00826114ef565b9050806001600160a01b0316836001600160a01b03161415610d6e5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610ccf565b336001600160a01b0382161480610d8a5750610d8a8133610a69565b610dfc5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f7760448201527f6e6572206e6f7220617070726f76656420666f7220616c6c00000000000000006064820152608401610ccf565b610e068383611db7565b505050565b600082815261013460209081526040808320848452825291829020805483518184028101840190945280845260609392830182828015610e6a57602002820191906000526020600020905b815481526020019060010190808311610e56575b5050505050905092915050565b600080516020614686833981519152610e908133611d10565b610e9984611d99565b610ee55760405162461bcd60e51b815260206004820152601c60248201527f55524920736574206f66206e6f6e6578697374656e7420746f6b656e000000006044820152606401610ccf565b600084815261012f60205260409020610eff908484613aaa565b5050505050565b6000610f1261012d5490565b905090565b610f213382611e26565b610f3d5760405162461bcd60e51b8152600401610ccf90614244565b610e06838383611f11565b600a60009081526101396020527f617bfb078f7e4a26c36fbe07098bfab7d8d8593e362ea2a3bb981722496fb75754819081906103e890610f8990866142ab565b610f9391906142ca565b600a6000526101386020527fb17d379a93820a1db6a6e78f234d680ec749598042e44d33f756356d9e94cea4546001600160a01b031693509150505b9250929050565b610fe082826120bf565b600082815260fb60205260409020610e0690826120e5565b600061100383611635565b82106110655760405162461bcd60e51b815260206004820152602b60248201527f455243373231456e756d657261626c653a206f776e657220696e646578206f7560448201526a74206f6620626f756e647360a81b6064820152608401610ccf565b506001600160a01b039190911660009081526101c260209081526040808320938352929052205490565b600082815261013360209081526040808320848452825291829020805483518184028101840190945280845260609392830182828015610e6a5760200282019190600052602060002090815481526020019060010190808311610e56575050505050905092915050565b60008051602061463f8339815191526111128133611d10565b6000858152610131602090815260408083208784529091529020610b4f908484613aaa565b61114182826120fa565b600082815260fb60205260409020610e069082612174565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156111a25760405162461bcd60e51b8152600401610ccf906142ec565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166111d4612189565b6001600160a01b0316146111fa5760405162461bcd60e51b8152600401610ccf90614338565b611203816121b7565b6040805160008082526020820190925261121f918391906121d0565b50565b610e068383836040518060200160405280600081525061195c565b60008051602061463f8339815191526112568133611d10565b61125f82612314565b5050565b306001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614156112ac5760405162461bcd60e51b8152600401610ccf906142ec565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166112de612189565b6001600160a01b0316146113045760405162461bcd60e51b8152600401610ccf90614338565b61130d826121b7565b61125f828260016121d0565b60006113256101c45490565b82106113885760405162461bcd60e51b815260206004820152602c60248201527f455243373231456e756d657261626c653a20676c6f62616c20696e646578206f60448201526b7574206f6620626f756e647360a01b6064820152608401610ccf565b6101c4828154811061139c5761139c614384565b90600052602060002001549050919050565b60008051602061463f8339815191526113c78133611d10565b50600092835261013260209081526040808520938552929052912080546001600160a01b0319166001600160a01b03909216919091179055565b60008051602061468683398151915261141a8133611d10565b61142761013a8484613aaa565b50505050565b60007ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc961145a8133611d10565b600061146661012d5490565b90506114728682612356565b7f5c580bbd45fcf14e0a101501236784fae32b1facf05f4830e3b2a932c2b8b8fc54600082815261013060209081526040808320600784528252808320939093556006825282822088905560088252828220879055878252610135815282822087835290522081905561012d805460010190555b95945050505050565b600081815261016060205260408120546001600160a01b031680610bce5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610ccf565b60007ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc96115948133611d10565b61159d83612370565b91505b50919050565b61013a80546115b49061420f565b80601f01602080910402602001604051908101604052809291908181526020018280546115e09061420f565b801561162d5780601f106116025761010080835404028352916020019161162d565b820191906000526020600020905b81548152906001019060200180831161161057829003601f168201915b505050505081565b60006001600160a01b0382166116a05760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610ccf565b506001600160a01b03166000908152610161602052604090205490565b60008051602061463f8339815191526116d68133611d10565b506000928352610137602090815260408085206001600160a01b039094168552929052912055565b600054610100900460ff1680611717575060005460ff16155b6117335760405162461bcd60e51b8152600401610ccf9061439a565b600054610100900460ff16158015611755576000805461ffff19166101011790555b61175d612414565b611765612414565b61176d612414565b611775612414565b6117c96040518060400160405280601481526020017343727970746f626c6f636b733a204865726f657360601b8152506040518060400160405280600681526020016548424c4f434b60d01b81525061247e565b6117d1612414565b6117d9612414565b6117e1612515565b6117e9612613565b6117f1612414565b801561121f576000805461ff001916905550565b600082815260fb6020526040812061181d90836126de565b9392505050565b600091825260c9602090815260408084206001600160a01b0393909316845291905290205460ff1690565b606061015f8054610be49061420f565b60008051602061463f8339815191526118788133611d10565b50600092835261013060209081526040808520938552929052912055565b6001600160a01b0382163314156118ef5760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610ccf565b336000818152610163602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6119663383611e26565b6119825760405162461bcd60e51b8152600401610ccf90614244565b611427848484846126ea565b606061199982611d99565b6119e55760405162461bcd60e51b815260206004820152601f60248201527f55524920717565727920666f72206e6f6e6578697374656e7420746f6b656e006044820152606401610ccf565b600082815261012f6020526040812080546119ff9061420f565b80601f0160208091040260200160405190810160405280929190818152602001828054611a2b9061420f565b8015611a785780601f10611a4d57610100808354040283529160200191611a78565b820191906000526020600020905b815481529060010190602001808311611a5b57829003601f168201915b50505050509050600081511115611aba57611a9161271d565b81604051602001611aa39291906143e8565b604051602081830303815290604052915050919050565b600b6000526101386020527fe2e9295eb198c77a2d2246fc305051d852a37b7f1dafbe565cbde8df0331af0d54604051630de3789b60e11b8152600481018590526001600160a01b0390911690631bc6f13690602401600060405180830381865afa158015611b2d573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261159d9190810190614417565b600081815260fb60205260408120610bce9061272d565b60008051602061463f833981519152611b858133611d10565b6000858152610133602090815260408083208784529091529020610b4f908484613a5f565b6111418282612737565b60008051602061463f833981519152611bcd8133611d10565b506000918252610139602052604090912055565b60008051602061463f833981519152611bfa8133611d10565b506000928352610136602090815260408085206001600160a01b039094168552929052912055565b6000828152610131602090815260408083208484529091529020805460609190611c4b9061420f565b80601f0160208091040260200160405190810160405280929190818152602001828054611c779061420f565b8015610e6a5780601f10611c9957610100808354040283529160200191610e6a565b820191906000526020600020905b815481529060010190602001808311611ca7575093979650505050505050565b60008051602061463f833981519152611ce08133611d10565b506000918252610138602052604090912080546001600160a01b0319166001600160a01b03909216919091179055565b611d1a8282611824565b61125f57611d32816001600160a01b0316601461275d565b611d3d83602061275d565b604051602001611d4e929190614485565b60408051601f198184030181529082905262461bcd60e51b8252610ccf91600401613d03565b60006001600160e01b0319821663780e9d6360e01b1480610bce5750610bce826128f9565b600090815261016060205260409020546001600160a01b0316151590565b60008181526101626020526040902080546001600160a01b0319166001600160a01b0384169081179091558190611ded826114ef565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000611e3182611d99565b611e925760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610ccf565b6000611e9d836114ef565b9050806001600160a01b0316846001600160a01b03161480611ed85750836001600160a01b0316611ecd84610c67565b6001600160a01b0316145b80611f0957506001600160a01b038082166000908152610163602090815260408083209388168352929052205460ff165b949350505050565b826001600160a01b0316611f24826114ef565b6001600160a01b031614611f8c5760405162461bcd60e51b815260206004820152602960248201527f4552433732313a207472616e73666572206f6620746f6b656e2074686174206960448201526839903737ba1037bbb760b91b6064820152608401610ccf565b6001600160a01b038216611fee5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610ccf565b611ff9838383612939565b612004600082611db7565b6001600160a01b03831660009081526101616020526040812080546001929061202e9084906144fa565b90915550506001600160a01b03821660009081526101616020526040812080546001929061205d908490614511565b90915550506000818152610160602052604080822080546001600160a01b0319166001600160a01b0386811691821790925591518493918716917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b600082815260c960205260409020600101546120db8133611d10565b610e068383612ed4565b600061181d836001600160a01b038416612f5a565b6001600160a01b038116331461216a5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610ccf565b61125f8282612fa9565b600061181d836001600160a01b038416613010565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc546001600160a01b031690565b60008051602061468683398151915261125f8133611d10565b60006121da612189565b90506121e584613103565b6000835111806121f25750815b156122035761220184846131a8565b505b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143805460ff16610eff57805460ff191660011781556040516001600160a01b038316602482015261228290869060440160408051601f198184030181529190526020810180516001600160e01b0316631b2ce7f360e11b1790526131a8565b50805460ff19168155612293612189565b6001600160a01b0316826001600160a01b03161461230b5760405162461bcd60e51b815260206004820152602f60248201527f45524331393637557067726164653a207570677261646520627265616b73206660448201526e75727468657220757067726164657360881b6064820152608401610ccf565b610eff8561328a565b61231d816132ca565b600081815261012f6020526040902080546123379061420f565b15905061121f57600081815261012f6020526040812061121f91613b1d565b61125f828260405180602001604052806000815250613373565b60008061237d61012d5490565b90506123898382612356565b7f5c580bbd45fcf14e0a101501236784fae32b1facf05f4830e3b2a932c2b8b8fc8054600083815261013060209081526040808320600784528252808320849055600683528083209390935561012e546008835283832081905593548252610135815282822093825292909252902081905561012d80546001019055610bce61012e80546001019055565b600054610100900460ff168061242d575060005460ff16155b6124495760405162461bcd60e51b8152600401610ccf9061439a565b600054610100900460ff161580156117f1576000805461ffff1916610101179055801561121f576000805461ff001916905550565b600054610100900460ff1680612497575060005460ff16155b6124b35760405162461bcd60e51b8152600401610ccf9061439a565b600054610100900460ff161580156124d5576000805461ffff19166101011790555b82516124e99061015e906020860190613b57565b5081516124fe9061015f906020850190613b57565b508015610e06576000805461ff0019169055505050565b600054610100900460ff168061252e575060005460ff16155b61254a5760405162461bcd60e51b8152600401610ccf9061439a565b600054610100900460ff1615801561256c576000805461ffff19166101011790555b6125776000336133a6565b61258f600080516020614686833981519152336133a6565b6125a760008051602061463f833981519152336133a6565b6125d17ff0887ba65ee2024ea881d91b74c2450ef19e1557f03bed3ea9f16b037cbe2dc9336133a6565b6001600052610139602052467f5c580bbd45fcf14e0a101501236784fae32b1facf05f4830e3b2a932c2b8b8fc55801561121f576000805461ff001916905550565b600054610100900460ff168061262c575060005460ff16155b6126485760405162461bcd60e51b8152600401610ccf9061439a565b600054610100900460ff1615801561266a576000805461ffff19166101011790555b600a60005260327f617bfb078f7e4a26c36fbe07098bfab7d8d8593e362ea2a3bb981722496fb757556101386020527fb17d379a93820a1db6a6e78f234d680ec749598042e44d33f756356d9e94cea480546001600160a01b03191633179055801561121f576000805461ff001916905550565b600061181d83836133b0565b6126f5848484611f11565b612701848484846133da565b6114275760405162461bcd60e51b8152600401610ccf90614529565b606061013a8054610be49061420f565b6000610bce825490565b600082815260c960205260409020600101546127538133611d10565b610e068383612fa9565b6060600061276c8360026142ab565b612777906002614511565b67ffffffffffffffff81111561278f5761278f613f33565b6040519080825280601f01601f1916602001820160405280156127b9576020820181803683370190505b509050600360fc1b816000815181106127d4576127d4614384565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061280357612803614384565b60200101906001600160f81b031916908160001a90535060006128278460026142ab565b612832906001614511565b90505b60018111156128aa576f181899199a1a9b1b9c1cb0b131b232b360811b85600f166010811061286657612866614384565b1a60f81b82828151811061287c5761287c614384565b60200101906001600160f81b031916908160001a90535060049490941c936128a38161457b565b9050612835565b50831561181d5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610ccf565b60006001600160e01b031982166380ac58cd60e01b148061292a57506001600160e01b03198216635b5e139f60e01b145b80610bce5750610bce826134d8565b6000818152610130602090815260408083206107d08452909152902054156129eb5760008051602061461f833981519152546000828152610130602090815260408083206107d084529091529081902054905163038edd2960e11b81526001600160a01b039092169163071dba52916129b89160040190815260200190565b600060405180830381600087803b1580156129d257600080fd5b505af11580156129e6573d6000803e3d6000fd5b505050505b6000818152610130602090815260408083206107d1845290915290205415612a9d5760008051602061461f833981519152546000828152610130602090815260408083206107d184529091529081902054905163038edd2960e11b81526001600160a01b039092169163071dba5291612a6a9160040190815260200190565b600060405180830381600087803b158015612a8457600080fd5b505af1158015612a98573d6000803e3d6000fd5b505050505b6000818152610130602090815260408083206107d2845290915290205415612b4f5760008051602061461f833981519152546000828152610130602090815260408083206107d284529091529081902054905163038edd2960e11b81526001600160a01b039092169163071dba5291612b1c9160040190815260200190565b600060405180830381600087803b158015612b3657600080fd5b505af1158015612b4a573d6000803e3d6000fd5b505050505b6000818152610130602090815260408083206107d3845290915290205415612c015760008051602061461f833981519152546000828152610130602090815260408083206107d384529091529081902054905163038edd2960e11b81526001600160a01b039092169163071dba5291612bce9160040190815260200190565b600060405180830381600087803b158015612be857600080fd5b505af1158015612bfc573d6000803e3d6000fd5b505050505b6000818152610130602090815260408083206107d4845290915290205415612cb35760008051602061461f833981519152546000828152610130602090815260408083206107d484529091529081902054905163038edd2960e11b81526001600160a01b039092169163071dba5291612c809160040190815260200190565b600060405180830381600087803b158015612c9a57600080fd5b505af1158015612cae573d6000803e3d6000fd5b505050505b6000818152610130602090815260408083206107d5845290915290205415612d655760008051602061461f833981519152546000828152610130602090815260408083206107d584529091529081902054905163038edd2960e11b81526001600160a01b039092169163071dba5291612d329160040190815260200190565b600060405180830381600087803b158015612d4c57600080fd5b505af1158015612d60573d6000803e3d6000fd5b505050505b6000818152610130602090815260408083206107d6845290915290205415612e175760008051602061461f833981519152546000828152610130602090815260408083206107d684529091529081902054905163038edd2960e11b81526001600160a01b039092169163071dba5291612de49160040190815260200190565b600060405180830381600087803b158015612dfe57600080fd5b505af1158015612e12573d6000803e3d6000fd5b505050505b6000818152610130602090815260408083206107da845290915290205415612ec95760008051602061461f833981519152546000828152610130602090815260408083206107da84529091529081902054905163038edd2960e11b81526001600160a01b039092169163071dba5291612e969160040190815260200190565b600060405180830381600087803b158015612eb057600080fd5b505af1158015612ec4573d6000803e3d6000fd5b505050505b610e0683838361351e565b612ede8282611824565b61125f57600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff19166001179055612f163390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000818152600183016020526040812054612fa157508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610bce565b506000610bce565b612fb38282611824565b1561125f57600082815260c9602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b600081815260018301602052604081205480156130f95760006130346001836144fa565b8554909150600090613048906001906144fa565b90508181146130ad57600086600001828154811061306857613068614384565b906000526020600020015490508087600001848154811061308b5761308b614384565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806130be576130be614592565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610bce565b6000915050610bce565b803b6131675760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610ccf565b7f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc80546001600160a01b0319166001600160a01b0392909216919091179055565b6060823b6132075760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610ccf565b600080846001600160a01b03168460405161322291906145a8565b600060405180830381855af49150503d806000811461325d576040519150601f19603f3d011682016040523d82523d6000602084013e613262565b606091505b50915091506114e6828260405180606001604052806027815260200161465f6027913961362a565b61329381613103565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60006132d5826114ef565b90506132e381600084612939565b6132ee600083611db7565b6001600160a01b0381166000908152610161602052604081208054600192906133189084906144fa565b90915550506000828152610160602052604080822080546001600160a01b0319169055518391906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b61337d8383613663565b61338a60008484846133da565b610e065760405162461bcd60e51b8152600401610ccf90614529565b610fe082826137a4565b60008260000182815481106133c7576133c7614384565b9060005260206000200154905092915050565b60006001600160a01b0384163b156134cd57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061341e9033908990889088906004016145c4565b6020604051808303816000875af1925050508015613459575060408051601f3d908101601f1916820190925261345691810190614601565b60015b6134b3573d808015613487576040519150601f19603f3d011682016040523d82523d6000602084013e61348c565b606091505b5080516134ab5760405162461bcd60e51b8152600401610ccf90614529565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611f09565b506001949350505050565b60006134e3826137ae565b806134fe57506001600160e01b03198216634b7b804360e11b145b80610bce57506001600160e01b0319821663661bcf3760e11b1492915050565b600081815261013060209081526040808320600b8452909152902054158061357d57506001600160a01b03831660009081527f0c21b0db0ee403f715267e786307660c0247fe66e97806152b2300e84662afb260205260409020546001145b806135bf57506001600160a01b03821660009081527f0c21b0db0ee403f715267e786307660c0247fe66e97806152b2300e84662afb260205260409020546001145b80156135e45750600081815261013060209081526040808320600c8452909152902054155b61361f5760405162461bcd60e51b815260206004820152600c60248201526b5472616e736665724c6f636b60a01b6044820152606401610ccf565b610e068383836137d3565b6060831561363957508161181d565b8251156136495782518084602001fd5b8160405162461bcd60e51b8152600401610ccf9190613d03565b6001600160a01b0382166136b95760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610ccf565b6136c281611d99565b1561370f5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610ccf565b61371b60008383612939565b6001600160a01b038216600090815261016160205260408120805460019290613745908490614511565b90915550506000818152610160602052604080822080546001600160a01b0319166001600160a01b03861690811790915590518392907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b61125f8282612ed4565b60006001600160e01b03198216635a05180f60e01b1480610bce5750610bce8261388d565b6001600160a01b0383166138305761382b816101c4805460008381526101c560205260408120829055600182018355919091527f5ac35dca7c3a7d5ae9d0add1efdc4aa02e10dd5cac0b90d2122cf0f0cc68317f0155565b613853565b816001600160a01b0316836001600160a01b0316146138535761385383826138c2565b6001600160a01b03821661386a57610e0681613964565b826001600160a01b0316826001600160a01b031614610e0657610e068282613a19565b60006001600160e01b03198216637965db0b60e01b1480610bce57506301ffc9a760e01b6001600160e01b0319831614610bce565b600060016138cf84611635565b6138d991906144fa565b60008381526101c3602052604090205490915080821461392f576001600160a01b03841660009081526101c26020908152604080832085845282528083205484845281842081905583526101c390915290208190555b5060009182526101c3602090815260408084208490556001600160a01b0390941683526101c281528383209183525290812055565b6101c454600090613977906001906144fa565b60008381526101c560205260408120546101c480549394509092849081106139a1576139a1614384565b90600052602060002001549050806101c483815481106139c3576139c3614384565b60009182526020808320909101929092558281526101c590915260408082208490558582528120556101c48054806139fd576139fd614592565b6001900381819060005260206000200160009055905550505050565b6000613a2483611635565b6001600160a01b0390931660009081526101c26020908152604080832086845282528083208590559382526101c39052919091209190915550565b828054828255906000526020600020908101928215613a9a579160200282015b82811115613a9a578235825591602001919060010190613a7f565b50613aa6929150613bcb565b5090565b828054613ab69061420f565b90600052602060002090601f016020900481019282613ad85760008555613a9a565b82601f10613af15782800160ff19823516178555613a9a565b82800160010185558215613a9a5791820182811115613a9a578235825591602001919060010190613a7f565b508054613b299061420f565b6000825580601f10613b39575050565b601f01602090049060005260206000209081019061121f9190613bcb565b828054613b639061420f565b90600052602060002090601f016020900481019282613b855760008555613a9a565b82601f10613b9e57805160ff1916838001178555613a9a565b82800160010185558215613a9a579182015b82811115613a9a578251825591602001919060010190613bb0565b5b80821115613aa65760008155600101613bcc565b60008083601f840112613bf257600080fd5b50813567ffffffffffffffff811115613c0a57600080fd5b6020830191508360208260051b8501011115610fcf57600080fd5b60008060008060608587031215613c3b57600080fd5b8435935060208501359250604085013567ffffffffffffffff811115613c6057600080fd5b613c6c87828801613be0565b95989497509550505050565b6001600160e01b03198116811461121f57600080fd5b600060208284031215613ca057600080fd5b813561181d81613c78565b60005b83811015613cc6578181015183820152602001613cae565b838111156114275750506000910152565b60008151808452613cef816020860160208601613cab565b601f01601f19169290920160200192915050565b60208152600061181d6020830184613cd7565b600060208284031215613d2857600080fd5b5035919050565b80356001600160a01b0381168114613d4657600080fd5b919050565b60008060408385031215613d5e57600080fd5b613d6783613d2f565b946020939093013593505050565b60008060408385031215613d8857600080fd5b50508035926020909101359150565b6020808252825182820181905260009190848201906040850190845b81811015613dcf57835183529284019291840191600101613db3565b50909695505050505050565b60008083601f840112613ded57600080fd5b50813567ffffffffffffffff811115613e0557600080fd5b602083019150836020828501011115610fcf57600080fd5b600080600060408486031215613e3257600080fd5b83359250602084013567ffffffffffffffff811115613e5057600080fd5b613e5c86828701613ddb565b9497909650939450505050565b600080600060608486031215613e7e57600080fd5b613e8784613d2f565b9250613e9560208501613d2f565b9150604084013590509250925092565b60008060408385031215613eb857600080fd5b82359150613ec860208401613d2f565b90509250929050565b60008060008060608587031215613ee757600080fd5b8435935060208501359250604085013567ffffffffffffffff811115613f0c57600080fd5b613c6c87828801613ddb565b600060208284031215613f2a57600080fd5b61181d82613d2f565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff81118282101715613f7257613f72613f33565b604052919050565b600067ffffffffffffffff821115613f9457613f94613f33565b50601f01601f191660200190565b600082601f830112613fb357600080fd5b8135613fc6613fc182613f7a565b613f49565b818152846020838601011115613fdb57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806040838503121561400b57600080fd5b61401483613d2f565b9150602083013567ffffffffffffffff81111561403057600080fd5b61403c85828601613fa2565b9150509250929050565b60008060006060848603121561405b57600080fd5b833592506020840135915061407260408501613d2f565b90509250925092565b6000806020838503121561408e57600080fd5b823567ffffffffffffffff8111156140a557600080fd5b6140b185828601613ddb565b90969095509350505050565b6000806000606084860312156140d257600080fd5b6140db84613d2f565b95602085013595506040909401359392505050565b60008060006060848603121561410557600080fd5b83359250613e9560208501613d2f565b60008060006060848603121561412a57600080fd5b505081359360208301359350604090920135919050565b6000806040838503121561415457600080fd5b61415d83613d2f565b91506020830135801515811461417257600080fd5b809150509250929050565b6000806000806080858703121561419357600080fd5b61419c85613d2f565b93506141aa60208601613d2f565b925060408501359150606085013567ffffffffffffffff8111156141cd57600080fd5b6141d987828801613fa2565b91505092959194509250565b600080604083850312156141f857600080fd5b61420183613d2f565b9150613ec860208401613d2f565b600181811c9082168061422357607f821691505b602082108114156115a057634e487b7160e01b600052602260045260246000fd5b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b60008160001904831182151516156142c5576142c5614295565b500290565b6000826142e757634e487b7160e01b600052601260045260246000fd5b500490565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b6020808252602e908201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160408201526d191e481a5b9a5d1a585b1a5e995960921b606082015260800190565b600083516143fa818460208801613cab565b83519083019061440e818360208801613cab565b01949350505050565b60006020828403121561442957600080fd5b815167ffffffffffffffff81111561444057600080fd5b8201601f8101841361445157600080fd5b805161445f613fc182613f7a565b81815285602083850101111561447457600080fd5b6114e6826020830160208601613cab565b7f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008152600083516144bd816017850160208801613cab565b7001034b99036b4b9b9b4b733903937b6329607d1b60179184019182015283516144ee816028840160208801613cab565b01602801949350505050565b60008282101561450c5761450c614295565b500390565b6000821982111561452457614524614295565b500190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60008161458a5761458a614295565b506000190190565b634e487b7160e01b600052603160045260246000fd5b600082516145ba818460208701613cab565b9190910192915050565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906145f790830184613cd7565b9695505050505050565b60006020828403121561461357600080fd5b815161181d81613c7856fe8723189d283a1dc22580de90fc8ad0f2a3955bc33dad6eeded3a75814f640230523a704056dcd17bcf83bed8b68c59416dac1119be77755efe3bde0a64e46e0c416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564df8b4c520ffe197c5343c6f5aec59570151ef9a492f2c624fd45ddde6135ec42a26469706673582212201718b85510bc809e05204ad74b10c2cbc446c4c6110d82c97fb048f835d2807f64736f6c634300080a0033
Age | Block | Fee Address | BC Fee Address | Voting Power | Jailed | Incoming |
---|
Validator ID :
0 FTM
Amount Staked
0
Amount Delegated
0
Staking Total
0
Staking Start Epoch
0
Staking Start Time
0
Proof of Importance
0
Origination Score
0
Validation Score
0
Active
0
Online
0
Downtime
0 s
Address | Amount | claimed Rewards | Created On Epoch | Created On |
---|
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.