Address Details
contract
0x8bF2CdE6C993596385Fa94E4ab85bc9f672A8488
- Contract Name
- AmaFansCore
- Creator
- 0xbb55dc–5f6262 at 0x3949ec–29df2a
- Balance
- 0 CELO ( )
- Locked CELO Balance
- 0.00 CELO
- Voting CELO Balance
- 0.00 CELO
- Pending Unlocked Gold
- 0.00 CELO
- Tokens
-
Fetching tokens...
- Transactions
- 0 Transactions
- Transfers
- 0 Transfers
- Gas Used
- Fetching gas used...
- Last Balance Update
- 13388081
This contract has been verified via Sourcify.
View contract in Sourcify repository
- Contract name:
- AmaFansCore
- Optimization enabled
- true
- Compiler version
- v0.8.7+commit.e28d00a7
- Optimization runs
- 200
- EVM Version
- london
- Verified at
- 2022-06-09T17:20:29.823678Z
AmaFansCore.sol
// SPDX-License-Identifier: Affero General Public License v3.0 pragma solidity ^0.8.0; import "./AmaFansCoreStorage.sol"; import "./ENS.sol"; import "./AmaFansLib.sol"; import "./AmaFansNFT.sol"; import "./AmaFansCoreEvents.sol"; import "@openzeppelin/contracts-upgradeable@v4.4.2/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable@v4.4.2/utils/AddressUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable@v4.4.2/access/AccessControlEnumerableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable@v4.4.2/security/PausableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable@v4.4.2/proxy/utils/Initializable.sol"; // import "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable@4.4.2/utils/CountersUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable@v4.4.2/metatx/ERC2771ContextUpgradeable.sol"; //_minimumBid: 5000000000000000 0.005 //_postMinimumBid: 100000000000000000 0.1 //0x0000000000000000000000000000000000000000 //adminAddress: 0xFfc3CFEDe3b7fEb052B4C1299Ba161d12AeDf135 contract AmaFansCore is AmaFansCoreEvents, Initializable, PausableUpgradeable, ERC2771ContextUpgradeable, AccessControlEnumerableUpgradeable, ReentrancyGuardUpgradeable, AmaFansCoreStorage{ using AmaFansLib for *; using Counters for Counters.Counter; function _msgSender() internal view virtual override(ContextUpgradeable, ERC2771ContextUpgradeable) returns (address sender) { //ERC2771ContextUpgradeable._msgSender(); return ERC2771ContextUpgradeable._msgSender(); } function _msgData() internal view virtual override(ContextUpgradeable, ERC2771ContextUpgradeable) returns (bytes calldata) { //ERC2771ContextUpgradeable._msgData(); return ERC2771ContextUpgradeable._msgData(); } function blockUser(address _address) external { // require(users[_msgSender()].accessList[_address] != AmaFansLib.AccessState.WHITELISTED, AmaFansLib.USER_WHITELISTED); require(_msgSender() != _address, AmaFansLib.USER_PARADOX); users[_msgSender()].accessList[_address] = AmaFansLib.AccessState.BLOCKED ; emit Blocked(_msgSender(), _address); } function unBlockUser(address _address) external { require(users[_msgSender()].accessList[_address] == AmaFansLib.AccessState.BLOCKED, AmaFansLib.USER_NOT_BLOCKED); users[_msgSender()].accessList[_address] = AmaFansLib.AccessState.ACTIVE ; emit UnBlock(_msgSender(), _address); } function whitelistUser(address _address) external { require(users[_msgSender()].accessList[_address] != AmaFansLib.AccessState.BLOCKED, AmaFansLib.USER_BLOCKED); users[_msgSender()].accessList[_address] = AmaFansLib.AccessState.WHITELISTED ; emit Whitelisted(_msgSender(), _address); } function unWhitelistUser(address _address) external { users[_msgSender()].accessList[_address] = AmaFansLib.AccessState.ACTIVE ; emit UnWhitelisted(_msgSender(), _address); } function followUser(address _address) external { users[_msgSender()].followersList[_address] = 1 ; emit Follow(_address, _msgSender()); } function unfollowUser(address _address) external { users[_msgSender()].followersList[_address] = 0 ; emit UnFollow(_address, _msgSender()); } function checkWhitelist(address _sender, address _recipient) public view returns (bool){ return users[_recipient].accessList[_sender] == AmaFansLib.AccessState.WHITELISTED ; } function checkBlocked(address _sender, address _recipient) public view returns (bool){ return users[_recipient].accessList[_sender] == AmaFansLib.AccessState.BLOCKED ; } modifier onlyValidMessageType(uint _messageType){ require(uint(AmaFansLib.MessageType.PRIVATE) >= _messageType, AmaFansLib.INVALID_MESSAGE_TYPE); _; } modifier onlyValidMessageResponseType(uint _responseType){ require(uint(AmaFansLib.ResponseType.BAD) >= _responseType, AmaFansLib.INVALID_MESSAGE_RESPONSE_TYPE); _; } modifier onlyMessageOwner(bytes32 _messagedId) { require (messages[_messagedId].createdBy == _msgSender(), AmaFansLib.INVALID_MESSAGE_OWNER); _ ; } modifier onlyValidMessageId(bytes32 _messagedId) { require(messages[_messagedId].createdBy != address(0), AmaFansLib.INVALID_MESSAGEID); _; } modifier onlyValidPostId(bytes32 postId_) { require(posts[postId_].createdBy != address(0), AmaFansLib.INVALID_POSTID); _; } modifier onlyValidTipId(bytes32 _tipId) { require(tips[_tipId].createdBy != address(0), AmaFansLib.INVALID_TIPID); _; } modifier onlyTipOwner(bytes32 _tipId) { require(tips[_tipId].createdBy == _msgSender(), AmaFansLib.INVALID_TIP_OWNER); _; } modifier onlyValidTimeLock(uint256 timeLock_) { //if (tips[_tipId].createdBy != _msgSender()) revert AmaFansLib.InValidTipOwner(_tipId); require(timeLock_ >= minTimeLock, AmaFansLib.INVALID_TIME_LOCK); _; } //Raises an error if minimumBid is not met function userMinimumBid(address _sender, address _recipient, uint _messageType) public view returns (uint256) { if(checkWhitelist(_sender, _recipient)) return 0; if(_messageType == uint(AmaFansLib.MessageType.PRIVATE)){ return _userPrivateMinimumBid(_recipient); } return _userPublicMinimumBid(_recipient); } //Raises an error if minimumBid is not met function minimumBid(uint _messageType) public view returns (uint256) { if(_messageType == uint(AmaFansLib.MessageType.PRIVATE)){ return privateMinimumBid; } return publicMinimumBid; } function _userPrivateMinimumBid( address _recipient) private view returns (uint256){ if (users[_recipient].privateMinimumBid == 0) return privateMinimumBid; return users[_recipient].privateMinimumBid; } function _userPublicMinimumBid(address _recipient) private view returns (uint256){ if (users[_recipient].publicMinimumBid == 0) return publicMinimumBid; return users[_recipient].publicMinimumBid; } //publicMinimumBid could be set to zero also function setUserMinimumBid(uint256 minimumBidByUser, AmaFansLib.MessageType _messageType) external { if(_messageType == AmaFansLib.MessageType.PRIVATE){ require( minimumBidByUser >= privateMinimumBid, AmaFansLib.INVALID_BID); users[_msgSender()].privateMinimumBid = minimumBidByUser; return; } users[_msgSender()].publicMinimumBid = minimumBidByUser; } //Raises an error if minimumBid is not met function setMinimumBid(uint256 _minimumBid, AmaFansLib.MessageType _messageType) external onlyRole(DEFAULT_ADMIN_ROLE) { if(_messageType == AmaFansLib.MessageType.PRIVATE){ require( _minimumBid >= recipientUpFront, AmaFansLib.INVALID_BID); privateMinimumBid = _minimumBid; recipientUpFront = _minimumBid/4; return; } publicMinimumBid = _minimumBid; } //Raises an error if minimumBid is not met function setPostMinimumBid(uint256 _postMinimumBid) external onlyRole(DEFAULT_ADMIN_ROLE) { postMinimumBid = _postMinimumBid; } //Raises an error if minimumBid is not met function setRecipientUpFront(uint256 _recipientUpFront) external onlyRole(DEFAULT_ADMIN_ROLE) { require(privateMinimumBid > _recipientUpFront*4, AmaFansLib.INVALID_UPFRONT); recipientUpFront = _recipientUpFront; } //Raises an error if minimumBid is not met function setThresholdFactorForSplit(uint256 _thresholdFactorForSplit) external onlyRole(DEFAULT_ADMIN_ROLE) { require(_thresholdFactorForSplit > 1, AmaFansLib.INVALID_THRESHOLD); thresholdFactorForSplit = _thresholdFactorForSplit; } function setNFTContract(address _address) external onlyRole(DEFAULT_ADMIN_ROLE) { require(address(nftContract) != address(0), AmaFansLib.INVALID_THRESHOLD); nftContract = AmaFansNFT(_address); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } function pause() public virtual { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "Must have DEFAULT_ADMIN_ROLE role to pause"); _pause(); } function unpause() public virtual { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "Must have DEFAULT_ADMIN_ROLE role to unpause"); _unpause(); } function initialize( uint256 _minimumBid, uint256 _postMinimumBid, uint256 _feeNumerator, address _nftContract, address _feeCollector, address _adminAddress, address trustedForwarder ) external initializer { require(_feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); recipientUpFront = _minimumBid/4; __AccessControlEnumerable_init(); __ReentrancyGuard_init(); __Pausable_init(); __ERC2771Context_init(trustedForwarder); publicMinimumBid = _minimumBid; privateMinimumBid = _minimumBid; postMinimumBid = _postMinimumBid; feeNumerator = _feeNumerator; nftContract = AmaFansNFT(_nftContract); feeCollector = _feeCollector; minTimeLock = 900; createNFT = false; thresholdFactorForSplit = 3; // _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); super._setupRole(DEFAULT_ADMIN_ROLE, _adminAddress); super._setupRole(GOVERNANCE_ROLE, _adminAddress); super._setRoleAdmin(GOVERNANCE_ROLE, DEFAULT_ADMIN_ROLE); } function setTrustedForwarder(address _forwarder) external onlyRole(DEFAULT_ADMIN_ROLE){ __ERC2771Context_init_unchained(_forwarder); } function createPost(string memory postLink_) external payable whenNotPaused() nonReentrant returns (bytes32){ require(msg.value >= postMinimumBid, AmaFansLib.MINIMUM_POST_BID_REQUIRED); bytes32[] memory _postTipIds = new bytes32[](0); bytes32 _postId = AmaFansLib.createMessageId(postLink_, _msgSender()); posts[_postId] = AmaFansLib.Post(postLink_, msg.value, 0, _msgSender(), _postTipIds, block.timestamp, 0); postIds.push(_postId); balances[feeCollector] += msg.value; emit PostCreated(_postId, _msgSender(), msg.value, postLink_); return _postId; } function createMessage(address recipient_, uint256 timelock_, uint messageType_, string memory messageLink_) external payable onlyValidTimeLock(timelock_) whenNotPaused() onlyValidMessageType(messageType_) nonReentrant returns (bytes32){ uint256 msgValue; AmaFansLib.AccessState accessListStatus = users[recipient_].accessList[_msgSender()]; require(accessListStatus != AmaFansLib.AccessState.BLOCKED, AmaFansLib.USER_BLOCKED); //Whitelisting only applies to the Private messages uint256 _userMinimumBid = userMinimumBid(_msgSender(), recipient_, messageType_); if(accessListStatus != AmaFansLib.AccessState.WHITELISTED) { if (messageType_ == uint(AmaFansLib.MessageType.PRIVATE)){ require(_userMinimumBid <= msg.value, AmaFansLib.MINIMUM_PRIVATE_BID_REQUIRED); msgValue = msg.value - recipientUpFront ; }else{ require(_userMinimumBid <= msg.value, AmaFansLib.MINIMUM_PUBLIC_BID_REQUIRED); msgValue = _userMinimumBid > recipientUpFront ? msg.value - recipientUpFront : msg.value; } } bytes32 messageId = _createMessage( _msgSender(), recipient_, msgValue, timelock_, messageType_, messageLink_); if (msgValue != 0 && (_userMinimumBid > recipientUpFront)) { Address.sendValue(payable(recipient_), recipientUpFront); } return messageId; } function _createMessage( address sender_, address recipient_, uint256 value_, uint256 timeLock_, uint messageType_, string memory messageLink_) internal returns (bytes32){ bytes32 _messageId = AmaFansLib.createMessageId(messageLink_, sender_); bytes32[] memory _tipIds = new bytes32[](0); uint256 expiryTime = block.timestamp + timeLock_; messages[_messageId] = AmaFansLib.Message(messageLink_, "", value_, value_, sender_, recipient_, _tipIds, block.timestamp, expiryTime, AmaFansLib.State.ACTIVE, 0, AmaFansLib.ResponseType.DEFAULT, messageType_); if (messageType_ == uint(AmaFansLib.MessageType.PUBLIC)) { publicMessageIds.push(_messageId); }else{ privateMessageIds.push(_messageId); } emit MessageCreated(recipient_, _messageId, sender_, value_, expiryTime, messageLink_, messageType_); return _messageId; } function createResponse( bytes32 messageId_, string memory answerLink_, string memory tokenURI_) external onlyValidMessageId(messageId_) { require(messages[messageId_].anweredBy == _msgSender(), AmaFansLib.INVALID_MESSAGE_OWNER); (uint256 _tokenId, uint256 value) = _createResponse(messageId_, answerLink_, tokenURI_); emit ResponseCreated( messageId_, messages[messageId_].createdBy, _msgSender(), answerLink_, _tokenId, value); } //and answer and claim the value attached. /// @dev Returns only a fixed number. /// @param messageId_ the id of the message /// @param answerLink_ the ipfs link of the answer /// @param tokenURI_ the storage metadata_uri on which the metadata is stored function _createResponse(bytes32 messageId_, string memory answerLink_, string memory tokenURI_) internal returns (uint256, uint256){ AmaFansLib.Message storage _message = messages[messageId_]; AmaFansLib.messageValidityForAnswer(_message); uint256 _tokenId; if (createNFT) { _tokenId = mintNFTforAnswer(_message.createdBy, tokenURI_); } AmaFansLib.messageChangesOnAnswer(_message, _tokenId, answerLink_); (uint256 tipsAfterDeduction, uint256 initialValueAfterDeduction) = _valueDeduction(_message.initialValue, _message.totalValue); // If the total value of the message (intial value +tips) exceed twice or thrice (thresholdFactorForSplit) // times the minimumBid set by the receiver (i.e It was a really good message), the sender // must be rewarded. In this case, the total value will be split between the sender and the receiver. if (_message.initialValue != 0 && ((_message.totalValue - _message.initialValue) >= thresholdFactorForSplit*userMinimumBid(_message.createdBy, _msgSender(), _message.messageType))){ uint256 _half = tipsAfterDeduction/2; balances[_msgSender()] += (_half + initialValueAfterDeduction); balances[_message.createdBy] += _half; emit AmountReceived(_msgSender(), (_half + initialValueAfterDeduction)); emit AmountReceived(_message.createdBy, _half); }else{ balances[_msgSender()] += (tipsAfterDeduction + initialValueAfterDeduction); emit AmountReceived(_msgSender(), (tipsAfterDeduction + initialValueAfterDeduction)); } return (_tokenId, (tipsAfterDeduction + initialValueAfterDeduction)); } function mintNFTforAnswer(address owner_, string memory tokenURI_) private returns(uint256){ try nftContract.mint(owner_, tokenURI_) returns (uint256 tokenId ) { return tokenId; } catch Error(string memory reason) { revert(reason); } } function markReponse(bytes32 messageId_, uint responseType_) external onlyValidMessageId(messageId_) onlyMessageOwner(messageId_) onlyValidMessageResponseType(responseType_) { require(messages[messageId_].state == AmaFansLib.State.ANSWERED, AmaFansLib.MESSAGE_ACTIVE); require(messages[messageId_].responseType == AmaFansLib.ResponseType.DEFAULT, AmaFansLib.RESPONSE_MARKED); messages[messageId_].responseType = AmaFansLib.ResponseType(responseType_); emit ResponseMarked(messageId_, messages[messageId_].createdBy, messages[messageId_].anweredBy, responseType_); } function createTip(bytes32 messageId_) external payable onlyValidMessageId(messageId_){ AmaFansLib.Message storage _message = messages[messageId_]; AmaFansLib.messageValidityForNewTip(_message); require (msg.value > 0, AmaFansLib.MINIMUM_TIP_REQUIRED); bytes32 tipId = AmaFansLib.newTip(tips, messageId_, _msgSender(), msg.value); AmaFansLib.messageChangesOnTip(_message, tipId, msg.value); // AmaFansLib.User storage user = users[_msgSender()]; // AmaFansLib.userChangesOnTip(user, tipId); tipIds.push(tipId); emit TipCreated(messageId_, tipId, _msgSender(), msg.value); } function createPostTip(bytes32 postId_) external payable onlyValidPostId(postId_){ AmaFansLib.Post storage _post = posts[postId_]; require (msg.value > 0, AmaFansLib.MINIMUM_TIP_REQUIRED); bytes32 postTipId = AmaFansLib.newPostTip(postTips, postId_, _msgSender(), msg.value); AmaFansLib.postChangesOnTip(_post, postTipId, msg.value); // AmaFansLib.User storage user = users[_msgSender()]; // AmaFansLib.userChangesOnTip(user, tipId); postTipIds.push(postTipId); balances[_post.createdBy] += msg.value; emit PostTipCreated(postId_, postTipId, _msgSender(), msg.value); } function claimBackMessageValue(bytes32 messageId_) external whenNotPaused() onlyValidMessageId(messageId_) onlyMessageOwner(messageId_) { AmaFansLib.Message storage _message = messages[messageId_]; AmaFansLib.claimBackMessageValue(_message); balances[_msgSender()] += _message.initialValue; emit AmountReceived(_msgSender(), _message.initialValue); emit MessageValueClaimed(messageId_, _msgSender(), _message.initialValue); } function claimBackTipValue(bytes32 tipId_) external whenNotPaused() onlyValidTipId(tipId_) onlyTipOwner(tipId_) { AmaFansLib.Tip storage _tip = tips[tipId_]; AmaFansLib.Message storage message = messages[_tip.messageId]; AmaFansLib.claimBackTipValue(_tip, message); balances[_msgSender()] += _tip.value; emit AmountReceived(_msgSender(), _tip.value); emit TipValueClaimed(_tip.messageId, tipId_, _msgSender(), _tip.value); } function _valueDeduction(uint256 initialValue, uint256 totalValue) private returns (uint256, uint256) { uint256 tipsDeduction = ((totalValue - initialValue)*feeNumerator)/ _feeDenominator(); uint256 initialValueDeduction = ((initialValue)*feeNumerator)/ _feeDenominator(); balances[feeCollector] += (tipsDeduction + initialValueDeduction); return ((totalValue - initialValue) - tipsDeduction, initialValue -initialValueDeduction); } function balance() external view onlyRole(DEFAULT_ADMIN_ROLE) returns (uint256){ return address(this).balance; } function userBalance() external view returns (uint256){ return balances[_msgSender()]; } function withdraw(uint256 _amount) external whenNotPaused() nonReentrant { require(_amount <= balances[_msgSender()], AmaFansLib.INSUFFICIENT_FUNDS); balances[_msgSender()] -= _amount; Address.sendValue(payable(_msgSender()), _amount); emit Withdraw(_msgSender(), _amount); } function transfer(uint256 amount_, address recipient_) external whenNotPaused() nonReentrant { require(amount_ <= balances[_msgSender()], AmaFansLib.INSUFFICIENT_FUNDS); balances[_msgSender()] -= amount_; Address.sendValue(payable(recipient_), amount_); emit Transfer(_msgSender(), recipient_, amount_); } function gePublicMessageIds(uint256 skip_, uint256 limit_) external view returns (bytes32[] memory, uint256){ return AmaFansLib.arrayChunk(skip_, limit_, publicMessageIds); } function getPrivateMessageIds(uint256 skip_, uint256 limit_) external view returns (bytes32[] memory, uint256){ return AmaFansLib.arrayChunk(skip_, limit_, privateMessageIds); } function getTipIdsOfMessage(bytes32 messageId_, uint256 skip_, uint256 limit_) external view onlyValidMessageId(messageId_) returns (bytes32[] memory, uint256){ return AmaFansLib.arrayChunk(skip_, limit_, messages[messageId_].tipIds); } function getTipIds(uint256 skip_, uint256 limit_) external view returns (bytes32[] memory, uint256){ return AmaFansLib.arrayChunk(skip_, limit_, tipIds); } function getPostTipIds(uint256 skip_, uint256 limit_) external view returns (bytes32[] memory, uint256){ return AmaFansLib.arrayChunk(skip_, limit_, postTipIds); } function getPostIds(uint256 skip_, uint256 limit_) external view returns (bytes32[] memory, uint256){ return AmaFansLib.arrayChunk(skip_, limit_, postIds); } function getTipIdsOfPost(bytes32 postId_, uint256 skip_, uint256 limit_) external view onlyValidPostId(postId_) returns (bytes32[] memory, uint256){ return AmaFansLib.arrayChunk(skip_, limit_, posts[postId_].postTipIds); } receive() external payable { emit AmountReceived(_msgSender(), msg.value); } }
/AmaFansCoreEvents.sol
// SPDX-License-Identifier: Affero General Public License v3.0 pragma solidity ^0.8.0; contract AmaFansCoreEvents { event AmountReceived(address indexed sender, uint256 value); event PostCreated(bytes32 indexed postId, address indexed createdBy, uint256 value, string link); event MessageCreated(address indexed recipient, bytes32 indexed messageId, address indexed createdBy, uint256 value, uint256 expiryTime, string link, uint messageType); event MessageValueClaimed( bytes32 indexed messageId, address indexed createdBy, uint256 value); event TipCreated(bytes32 indexed messageId, bytes32 indexed tipId, address indexed createdBy, uint256 value); event PostTipCreated(bytes32 indexed postId, bytes32 indexed postTipId, address indexed createdBy, uint256 value); event TipValueClaimed(bytes32 indexed messageId, bytes32 indexed tipId, address indexed createdBy, uint256 value); //NFT created for the reply received event ResponseCreated(bytes32 indexed messageId, address indexed owner, address indexed creator, string answerLink, uint256 tokenId, uint256 value); //When a user actually withdraws amount from the contract event Withdraw(address indexed user, uint256 value); event Transfer(address indexed sender, address indexed recipient, uint256 value); event Blocked(address indexed blocker , address indexed blocked); event UnBlock(address indexed unblocker , address indexed unblocked); event Whitelisted(address indexed whitelister , address indexed whitelisted); event UnWhitelisted(address indexed unwhitelister , address indexed unwhitelisted); event Follow(address indexed followed, address indexed follower); event UnFollow(address indexed unfollowed, address indexed unfollower); event ResponseMarked(bytes32 indexed messageId, address indexed owner, address indexed answerer, uint responseType); }
/AmaFansCoreStorage.sol
// SPDX-License-Identifier: Affero General Public License v3.0 pragma solidity ^0.8.0; import "./AmaFansLib.sol"; import "./AmaFansNFT.sol"; contract AmaFansCoreStorage{ using AmaFansLib for AmaFansLib.Message; using AmaFansLib for AmaFansLib.Tip; using AmaFansLib for AmaFansLib.User; bytes32 public constant GOVERNANCE_ROLE = keccak256("GOVERNANCE"); address public feeCollector; uint256 public publicMinimumBid; uint256 public privateMinimumBid; uint256 public postMinimumBid; uint256 public feeNumerator; /* The amount of fee charged by last post on the messages being published */ AmaFansNFT public nftContract ; bool internal createNFT; uint256 public minTimeLock; uint256 public recipientUpFront; uint256 public thresholdFactorForSplit; mapping(bytes32 => AmaFansLib.Message) public messages; mapping(bytes32 => AmaFansLib.Post) public posts; mapping(bytes32 => AmaFansLib.Tip) public tips; mapping(bytes32 => AmaFansLib.PostTip) public postTips; mapping(address => AmaFansLib.User) public users; mapping(address => uint256) internal balances; bytes32[] public publicMessageIds; //Public messages received by the user bytes32[] public privateMessageIds; //Private messages received by the user bytes32[] public postIds; //Array of IDs of all the posts created till now bytes32[] public tipIds; //Array of all the IDs of all Tips created till now bytes32[] public postTipIds; ////Array of IDs all the postTips created till now }
/AmaFansLib.sol
// SPDX-License-Identifier: Affero General Public License v3.0 pragma solidity ^0.8.0; pragma experimental ABIEncoderV2; library AmaFansLib { string constant MINIMUM_PRIVATE_BID_REQUIRED = "001009"; string constant MINIMUM_PUBLIC_BID_REQUIRED = "001010"; string constant MESSAGEID_EXISTS = "002001"; string constant INVALID_MESSAGE_OWNER = "002002"; string constant INVALID_MESSAGEID = "002003"; string constant ALREADY_ANSWERED = "002004"; string constant ALREADY_CLAIMED = "002005"; string constant MESSAGE_TIME_LIMIT_IN_EFFECT = "002006"; string constant INVALID_TIME_LOCK = "002007"; string constant MESSAGE_TIME_LIMIT_EXPIRED = "002008"; string constant MESSAGE_ACTIVE = "002009"; string constant INVALID_MESSAGE_TYPE = "002010"; string constant INVALID_MESSAGE_RESPONSE_TYPE = "002011"; string constant RESPONSE_MARKED = "002012"; string constant TIPID_EXISTS = "003001"; string constant INVALID_TIP_OWNER = "003002"; string constant INVALID_TIPID = "003003"; string constant TIP_ALREADY_CLAIMED = "003004"; string constant MINIMUM_TIP_REQUIRED = "003005"; string constant INVALID_POSTID = "004001"; string constant POSTTIP_ID_EXISTS = "004002"; string constant MINIMUM_POST_BID_REQUIRED = "004003"; string constant INSUFFICIENT_FUNDS = "009001"; string constant ADDRESS_BLOCKLISTED = "009002"; string constant INVALID_BID = "009003"; string constant DEACTIVATED = "009004"; string constant USER_EXISTS = "009005"; string constant USER_BLOCKED = "009006"; string constant INVALID_UPFRONT = "009007"; string constant INVALID_THRESHOLD = "009008"; string constant USER_WHITELISTED = "009009"; string constant USER_PARADOX = "009010"; string constant USER_NOT_BLOCKED = "009011"; bytes32 constant ZERO_BYTES32 = 0x0000000000000000000000000000000000000000000000000000000000000000; enum AccessState{ ACTIVE, BLOCKED, WHITELISTED } enum State{ACTIVE, CLAIMED, DELETED, ANSWERED} enum MessageType{ PUBLIC, PRIVATE } enum ResponseType{ DEFAULT, GOOD, BAD } // struct Session{ // uint256 minimumBid; // address createdBy; // bytes32[] messageIds; // uint256 startTime; // uint256 endTime; // uint256 createdTime; // StorageData storageData; // } // struct StorageData{ // string descriptionLink; // string titleLink; // string bannerImageLink; // } struct Message{ string messageLink; string answerLink; uint256 initialValue; uint256 totalValue; //Including the tips address createdBy; address anweredBy; bytes32[] tipIds; uint256 createdTime; uint256 expiryTime; State state; uint256 tokenId; ResponseType responseType; uint messageType; } struct Post{ string postLink; uint256 initialValue; uint256 tipsTotalValue; //Including the tips address createdBy; bytes32[] postTipIds; uint256 createdTime; uint256 tokenId; } struct Tip{ address createdBy; uint256 value; uint256 createdTime; bytes32 messageId; bool claimed; } struct PostTip{ address createdBy; uint256 value; uint256 createdTime; bytes32 postId; } struct User{ uint256 publicMinimumBid; uint256 privateMinimumBid; bytes verified; mapping(address => uint256) followersList; mapping(address => AccessState) accessList; } function createMessageId( string memory messageLink, address _createdBy) public view returns (bytes32){ // This has block.timestamp because a user can ask multiple messages on the same session return keccak256(abi.encodePacked(messageLink, _createdBy, block.timestamp)); } function createTipId( bytes32 _tipId, address _createdBy) public view returns (bytes32){ // This has block.timestamp because a user can send multiple tips to the same message return keccak256(abi.encodePacked(_tipId, _createdBy, block.timestamp)); } //CHeck if the message on which the tip is being made is in a valid state or not function messageValidityForNewTip(Message storage message ) public view { messageValidity(message); } //The changes that have to be made on message when a new tip has been made function messageChangesOnTip(Message storage message, bytes32 tipId, uint256 value ) public { message.totalValue += value; message.tipIds.push(tipId); } function postChangesOnTip(Post storage post, bytes32 postTipId, uint256 value ) public { post.tipsTotalValue += value; post.postTipIds.push(postTipId); } function newTip( mapping(bytes32 => Tip) storage tips, bytes32 messageId, address sender, uint256 value ) public returns (bytes32) { bytes32 tipId = createTipId( messageId, sender); // if (tips[_tipId].createdBy != address(0)) revert AmaFansLib.TipIdAlreadyExists(_tipId); require(tips[tipId].createdBy == address(0), TIPID_EXISTS); tips[tipId] = Tip(sender, value, block.timestamp, messageId, false); return tipId; } function newPostTip( mapping(bytes32 => PostTip) storage postTips, bytes32 postId, address sender, uint256 value ) public returns (bytes32) { bytes32 postTipId = createTipId( postId, sender); // if (tips[_tipId].createdBy != address(0)) revert AmaFansLib.TipIdAlreadyExists(_tipId); require(postTips[postTipId].createdBy == address(0), POSTTIP_ID_EXISTS); postTips[postTipId] = PostTip(sender, value, block.timestamp, postId); return postTipId; } //Whe the message has not been answered in the timeLock, The //value attached to the message can be claimed by the original sender. function claimBackMessageValue(Message storage message) public { _validClaim(message); _messageChangesOnClaimedBack(message); } function _validClaim(Message storage message) internal view{ _validMessageState(message); //uint256 _lock = message.createdTime + message.timeLock; require(block.timestamp > message.expiryTime, MESSAGE_TIME_LIMIT_IN_EFFECT); } //IN case the message value is being claimed or being answered. // The message state shouldnt be following, it shouldnt //al;ready have answered or shouldnt have already claimed function _validMessageState(Message storage message) private view{ require(message.state != State.CLAIMED, ALREADY_CLAIMED); require(message.state != State.ANSWERED, ALREADY_ANSWERED); } function _messageChangesOnClaimedBack(Message storage message) private { message.state = AmaFansLib.State.CLAIMED; } function claimBackTipValue(Tip storage tip, Message storage message ) public { // if(_message.state == AmaFansLib.State.ANSWERED) revert AmaFansLib.InValidmessageState(_tip.messageId); _validTipState(tip, message); tip.claimed = true; } function messageValidityForAnswer(Message storage message) public view { messageValidity(message); } function messageValidity(Message storage message) public view{ _validMessageState(message); // uint256 _lock = message.createdTime + message.timeLock; require(block.timestamp < message.expiryTime, MESSAGE_TIME_LIMIT_EXPIRED); } function _validTipState(Tip storage tip, Message storage message) private view{ require(message.state != State.ANSWERED, ALREADY_ANSWERED); require(message.state == State.CLAIMED, ALREADY_CLAIMED); require(tip.claimed != true, TIP_ALREADY_CLAIMED); } function messageChangesOnAnswer(Message storage message, uint256 tokenId, string memory answerLink) public { message.answerLink = answerLink; message.state = State.ANSWERED; // message.anweredBy = anweredBy; if (tokenId != 0){ message.tokenId = tokenId; } } function arrayChunk(uint256 skip_, uint256 limit_, bytes32[] storage array_) public view returns (bytes32[] memory values, uint256){ if (limit_ > array_.length - skip_) { limit_ = array_.length - skip_; } values = new bytes32[](limit_); for (uint256 i = 0; i < limit_; i++) { values[i] = array_[skip_ + i]; } return (values, skip_ + limit_); } }
/AmaFansNFT.sol
// SPDX-License-Identifier: Affero General Public License v3.0 pragma solidity ^0.8.0; import "@openzeppelin/contracts@v4.4.2/access/AccessControlEnumerable.sol"; import "@openzeppelin/contracts@v4.4.2/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts@v4.4.2/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts@v4.4.2/token/ERC721/extensions/ERC721Pausable.sol"; import "@openzeppelin/contracts@v4.4.2/utils/Counters.sol"; import "@openzeppelin/contracts@v4.4.2/token/ERC721/extensions/ERC721URIStorage.sol"; import "./ERC2981.sol"; contract AmaFansNFT is Context, AccessControlEnumerable, ERC2981, ERC721Enumerable, ERC721Pausable, ERC721URIStorage { using Counters for Counters.Counter; bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); Counters.Counter private _tokenIdTracker; string private _baseTokenURI; uint96 public royaltyValue = 500; //Makes it at 3% as feeDenominator in ERC2981 defaults //to 10000 so fees are expressed in basis points, /** * @dev Grants `DEFAULT_ADMIN_ROLE`, `MINTER_ROLE` and `PAUSER_ROLE` to the * account that deploys the contract. * * Token URIs will be autogenerated based on `baseURI` and their token IDs. * See {ERC721-tokenURI}. */ constructor() ERC721("ama.fans", "AMAF") { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); super._setRoleAdmin(MINTER_ROLE, DEFAULT_ADMIN_ROLE); super._setRoleAdmin(PAUSER_ROLE, DEFAULT_ADMIN_ROLE); _setupRole(MINTER_ROLE, _msgSender()); _setupRole(PAUSER_ROLE, _msgSender()); } function _baseURI() internal view override returns (string memory) { return _baseTokenURI; } function setRoyaltyValue(uint96 _royaltyValue) external onlyRole(DEFAULT_ADMIN_ROLE){ royaltyValue = _royaltyValue; } /** * @dev Creates a new token for `to`. Its token ID will be automatically * assigned (and available on the emitted {IERC721-Transfer} event), and the token * URI autogenerated based on the base URI passed at construction. * * See {ERC721-_mint}. * * Requirements: * * - the caller must have the `MINTER_ROLE`. */ function mint(address to, string memory _tokenURI) public whenNotPaused() returns(uint256) { require(hasRole(MINTER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have minter role to mint"); //We could have the totalSupply directly but then it would have // minted first token as id = 0, _tokenIdTracker.increment(); uint256 newNftTokenId = _tokenIdTracker.current(); // We cannot just use balanceOf to create the new tokenId because tokens // can be burned (destroyed), so we need a separate counter. _safeMint(to, newNftTokenId); _setTokenURI(newNftTokenId, _tokenURI); _setTokenRoyalty(newNftTokenId, to, royaltyValue); return newNftTokenId; } /** * @dev Pauses all token transfers. * * See {ERC721Pausable} and {Pausable-_pause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function pause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have pauser role to pause"); _pause(); } /** * @dev Unpauses all token transfers. * * See {ERC721Pausable} and {Pausable-_unpause}. * * Requirements: * * - the caller must have the `PAUSER_ROLE`. */ function unpause() public virtual { require(hasRole(PAUSER_ROLE, _msgSender()), "ERC721PresetMinterPauserAutoId: must have pauser role to unpause"); _unpause(); } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal override(ERC721, ERC721Enumerable, ERC721Pausable) { super._beforeTokenTransfer(from, to, tokenId); } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view override(AccessControlEnumerable, ERC2981, ERC721, ERC721Enumerable) returns (bool) { return super.supportsInterface(interfaceId); } function burn(uint256 tokenId) external { _burn(tokenId); } function _burn(uint256 tokenId) internal override(ERC721, ERC721URIStorage){ //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721Burnable: caller is not owner nor approved"); super._resetTokenRoyalty(tokenId); super._burn(tokenId); } function tokenURI(uint256 tokenId) public view override(ERC721, ERC721URIStorage) returns (string memory) { return super.tokenURI(tokenId); } }
/ENS.sol
// SPDX-License-Identifier: Affero General Public License v3.0 pragma solidity ^0.8.0; interface ENS { // Logged when the owner of a node assigns a new owner to a subnode. event NewOwner(bytes32 indexed node, bytes32 indexed label, address owner); // Logged when the owner of a node transfers ownership to a new account. event Transfer(bytes32 indexed node, address owner); // Logged when the resolver for a node changes. event NewResolver(bytes32 indexed node, address resolver); // Logged when the TTL of a node changes event NewTTL(bytes32 indexed node, uint64 ttl); // Logged when an operator is added or removed. event ApprovalForAll(address indexed owner, address indexed operator, bool approved); function setRecord(bytes32 _node, address _owner, address _resolver, uint64 _ttl) external ; function setSubnodeRecord(bytes32 _node, bytes32 _label, address _owner, address _resolver, uint64 _ttl) external; function setSubnodeOwner(bytes32 _node, bytes32 _label, address _owner) external returns(bytes32); function setResolver(bytes32 _node, address _resolver) external ; function setOwner(bytes32 _node, address _owner) external ; function setTTL(bytes32 _node, uint64 _ttl) external; function setApprovalForAll(address operator, bool approved) external; function owner(bytes32 node) external view returns (address); function resolver(bytes32 node) external view returns (address); function ttl(bytes32 node) external view returns (uint64); function recordExists(bytes32 node) external view returns (bool); function isApprovedForAll(address _owner, address _operator) external view returns (bool); }
/ERC2981.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.0 (token/common/ERC2981.sol) pragma solidity ^0.8.0; import "@openzeppelin/contracts@v4.4.2/utils/introspection/ERC165.sol"; import "@openzeppelin/contracts@v4.4.2/interfaces/IERC2981.sol"; // import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; /** * @dev Implementation of the NFT Royalty Standard, a standardized way to retrieve royalty payment information. * * Royalty information can be specified globally for all token ids via {_setDefaultRoyalty}, and/or individually for * specific token ids via {_setTokenRoyalty}. The latter takes precedence over the first. * * Royalty is specified as a fraction of sale price. {_feeDenominator} is overridable but defaults to 10000, meaning the * fee is specified in basis points by default. * * IMPORTANT: ERC-2981 only specifies a way to signal royalty information and does not enforce its payment. See * https://eips.ethereum.org/EIPS/eip-2981#optional-royalty-payments[Rationale] in the EIP. Marketplaces are expected to * voluntarily pay royalties together with sales, but note that this standard is not yet widely supported. * * _Available since v4.5._ */ abstract contract ERC2981 is IERC2981, ERC165 { struct RoyaltyInfo { address receiver; uint96 royaltyFraction; } RoyaltyInfo private _defaultRoyaltyInfo; mapping(uint256 => RoyaltyInfo) private _tokenRoyaltyInfo; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC165) returns (bool) { return interfaceId == type(IERC2981).interfaceId || super.supportsInterface(interfaceId); } /** * @inheritdoc IERC2981 */ function royaltyInfo(uint256 _tokenId, uint256 _salePrice) external view virtual override returns (address, uint256) { RoyaltyInfo memory royalty = _tokenRoyaltyInfo[_tokenId]; if (royalty.receiver == address(0)) { royalty = _defaultRoyaltyInfo; } uint256 royaltyAmount = (_salePrice * royalty.royaltyFraction) / _feeDenominator(); return (royalty.receiver, royaltyAmount); } /** * @dev The denominator with which to interpret the fee set in {_setTokenRoyalty} and {_setDefaultRoyalty} as a * fraction of the sale price. Defaults to 10000 so fees are expressed in basis points, but may be customized by an * override. */ function _feeDenominator() internal pure virtual returns (uint96) { return 10000; } /** * @dev Sets the royalty information that all ids in this contract will default to. * * Requirements: * * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setDefaultRoyalty(address receiver, uint96 feeNumerator) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: invalid receiver"); _defaultRoyaltyInfo = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Removes default royalty information. */ function _deleteDefaultRoyalty() internal virtual { delete _defaultRoyaltyInfo; } /** * @dev Sets the royalty information for a specific token id, overriding the global default. * * Requirements: * * - `tokenId` must be already minted. * - `receiver` cannot be the zero address. * - `feeNumerator` cannot be greater than the fee denominator. */ function _setTokenRoyalty( uint256 tokenId, address receiver, uint96 feeNumerator ) internal virtual { require(feeNumerator <= _feeDenominator(), "ERC2981: royalty fee will exceed salePrice"); require(receiver != address(0), "ERC2981: Invalid parameters"); _tokenRoyaltyInfo[tokenId] = RoyaltyInfo(receiver, feeNumerator); } /** * @dev Resets royalty information for the token id back to the global default. */ function _resetTokenRoyalty(uint256 tokenId) internal virtual { delete _tokenRoyaltyInfo[tokenId]; } }
/_openzeppelin/contracts-upgradeable_4.4.2/utils/CountersUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) 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; } }
/_openzeppelin/contracts-upgradeable_v4.4.2/access/AccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/AccessControlEnumerable.sol) 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 onlyInitializing { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); __AccessControlEnumerable_init_unchained(); } function __AccessControlEnumerable_init_unchained() internal onlyInitializing { } 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) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } uint256[49] private __gap; }
/_openzeppelin/contracts-upgradeable_v4.4.2/access/AccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControlUpgradeable.sol"; import "../utils/ContextUpgradeable.sol"; import "../utils/StringsUpgradeable.sol"; import "../utils/introspection/ERC165Upgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable { function __AccessControl_init() internal onlyInitializing { __Context_init_unchained(); __ERC165_init_unchained(); __AccessControl_init_unchained(); } function __AccessControl_init_unchained() internal onlyInitializing { } struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _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 revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } uint256[49] private __gap; }
/_openzeppelin/contracts-upgradeable_v4.4.2/access/IAccessControlEnumerableUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) 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); }
/_openzeppelin/contracts-upgradeable_v4.4.2/access/IAccessControlUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface 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; }
/_openzeppelin/contracts-upgradeable_v4.4.2/metatx/ERC2771ContextUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (metatx/ERC2771Context.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Context variant with ERC2771 support. */ abstract contract ERC2771ContextUpgradeable is Initializable, ContextUpgradeable { address private _trustedForwarder; function __ERC2771Context_init(address trustedForwarder) internal onlyInitializing { __Context_init_unchained(); __ERC2771Context_init_unchained(trustedForwarder); } function __ERC2771Context_init_unchained(address trustedForwarder) internal onlyInitializing { _trustedForwarder = trustedForwarder; } function isTrustedForwarder(address forwarder) public view virtual returns (bool) { return forwarder == _trustedForwarder; } function _msgSender() internal view virtual override returns (address sender) { if (isTrustedForwarder(msg.sender)) { // The assembly code is more direct than the Solidity version using `abi.decode`. assembly { sender := shr(96, calldataload(sub(calldatasize(), 20))) } } else { return super._msgSender(); } } function _msgData() internal view virtual override returns (bytes calldata) { if (isTrustedForwarder(msg.sender)) { return msg.data[:msg.data.length - 20]; } else { return super._msgData(); } } uint256[49] private __gap; }
/_openzeppelin/contracts-upgradeable_v4.4.2/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since 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. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ 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() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
/_openzeppelin/contracts-upgradeable_v4.4.2/security/PausableUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract PausableUpgradeable is Initializable, ContextUpgradeable { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ function __Pausable_init() internal onlyInitializing { __Context_init_unchained(); __Pausable_init_unchained(); } function __Pausable_init_unchained() internal onlyInitializing { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } uint256[49] private __gap; }
/_openzeppelin/contracts-upgradeable_v4.4.2/security/ReentrancyGuardUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } uint256[49] private __gap; }
/_openzeppelin/contracts-upgradeable_v4.4.2/utils/AddressUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) 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); } } } }
/_openzeppelin/contracts-upgradeable_v4.4.2/utils/ContextUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { __Context_init_unchained(); } function __Context_init_unchained() internal onlyInitializing { } function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } uint256[50] private __gap; }
/_openzeppelin/contracts-upgradeable_v4.4.2/utils/StringsUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) 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); } }
/_openzeppelin/contracts-upgradeable_v4.4.2/utils/introspection/ERC165Upgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165Upgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable { function __ERC165_init() internal onlyInitializing { __ERC165_init_unchained(); } function __ERC165_init_unchained() internal onlyInitializing { } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165Upgradeable).interfaceId; } uint256[50] private __gap; }
/_openzeppelin/contracts-upgradeable_v4.4.2/utils/introspection/IERC165Upgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface 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); }
/_openzeppelin/contracts-upgradeable_v4.4.2/utils/structs/EnumerableSetUpgradeable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library 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; } }
/_openzeppelin/contracts_v4.4.2/access/AccessControl.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view 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 ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
/_openzeppelin/contracts_v4.4.2/access/AccessControlEnumerable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/AccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControlEnumerable.sol"; import "./AccessControl.sol"; import "../utils/structs/EnumerableSet.sol"; /** * @dev Extension of {AccessControl} that allows enumerating the members of each role. */ abstract contract AccessControlEnumerable is IAccessControlEnumerable, AccessControl { using EnumerableSet for EnumerableSet.AddressSet; mapping(bytes32 => EnumerableSet.AddressSet) private _roleMembers; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControlEnumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) public view 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) internal virtual override { super._grantRole(role, account); _roleMembers[role].add(account); } /** * @dev Overload {_revokeRole} to track enumerable memberships */ function _revokeRole(bytes32 role, address account) internal virtual override { super._revokeRole(role, account); _roleMembers[role].remove(account); } }
/_openzeppelin/contracts_v4.4.2/access/IAccessControl.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
/_openzeppelin/contracts_v4.4.2/access/IAccessControlEnumerable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControlEnumerable.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; /** * @dev External interface of AccessControlEnumerable declared to support ERC165 detection. */ interface IAccessControlEnumerable is IAccessControl { /** * @dev Returns one of the accounts that have `role`. `index` must be a * value between 0 and {getRoleMemberCount}, non-inclusive. * * Role bearers are not sorted in any particular way, and their ordering may * change at any point. * * WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure * you perform all queries on the same block. See the following * https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] * for more information. */ function getRoleMember(bytes32 role, uint256 index) external view returns (address); /** * @dev Returns the number of accounts that have `role`. Can be used * together with {getRoleMember} to enumerate all bearers of a role. */ function getRoleMemberCount(bytes32 role) external view returns (uint256); }
/_openzeppelin/contracts_v4.4.2/interfaces/IERC165.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol";
/_openzeppelin/contracts_v4.4.2/interfaces/IERC2981.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC2981.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Interface for the NFT Royalty Standard */ interface IERC2981 is IERC165 { /** * @dev 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); }
/_openzeppelin/contracts_v4.4.2/security/Pausable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
/_openzeppelin/contracts_v4.4.2/token/ERC721/ERC721.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer 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(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
/_openzeppelin/contracts_v4.4.2/token/ERC721/IERC721.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
/_openzeppelin/contracts_v4.4.2/token/ERC721/IERC721Receiver.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
/_openzeppelin/contracts_v4.4.2/token/ERC721/extensions/ERC721Enumerable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } }
/_openzeppelin/contracts_v4.4.2/token/ERC721/extensions/ERC721Pausable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Pausable.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; import "../../../security/Pausable.sol"; /** * @dev ERC721 token with pausable token transfers, minting and burning. * * Useful for scenarios such as preventing trades until the end of an evaluation * period, or having an emergency switch for freezing all token transfers in the * event of a large bug. */ abstract contract ERC721Pausable is ERC721, Pausable { /** * @dev See {ERC721-_beforeTokenTransfer}. * * Requirements: * * - the contract must not be paused. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); require(!paused(), "ERC721Pausable: token transfer while paused"); } }
/_openzeppelin/contracts_v4.4.2/token/ERC721/extensions/ERC721URIStorage.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721URIStorage.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; /** * @dev ERC721 token with storage based token URI management. */ abstract contract ERC721URIStorage is ERC721 { using Strings for uint256; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = _baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } return super.tokenURI(tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } }
/_openzeppelin/contracts_v4.4.2/token/ERC721/extensions/IERC721Enumerable.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 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); }
/_openzeppelin/contracts_v4.4.2/token/ERC721/extensions/IERC721Metadata.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
/_openzeppelin/contracts_v4.4.2/utils/Address.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ 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 Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
/_openzeppelin/contracts_v4.4.2/utils/Context.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
/_openzeppelin/contracts_v4.4.2/utils/Counters.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) 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 Counters { 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; } }
/_openzeppelin/contracts_v4.4.2/utils/Strings.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
/_openzeppelin/contracts_v4.4.2/utils/introspection/ERC165.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
/_openzeppelin/contracts_v4.4.2/utils/introspection/IERC165.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
/_openzeppelin/contracts_v4.4.2/utils/structs/EnumerableSet.sol
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
Contract ABI
[{"type":"event","name":"AmountReceived","inputs":[{"type":"address","name":"sender","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Blocked","inputs":[{"type":"address","name":"blocker","internalType":"address","indexed":true},{"type":"address","name":"blocked","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Follow","inputs":[{"type":"address","name":"followed","internalType":"address","indexed":true},{"type":"address","name":"follower","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"MessageCreated","inputs":[{"type":"address","name":"recipient","internalType":"address","indexed":true},{"type":"bytes32","name":"messageId","internalType":"bytes32","indexed":true},{"type":"address","name":"createdBy","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false},{"type":"uint256","name":"expiryTime","internalType":"uint256","indexed":false},{"type":"string","name":"link","internalType":"string","indexed":false},{"type":"uint256","name":"messageType","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"MessageValueClaimed","inputs":[{"type":"bytes32","name":"messageId","internalType":"bytes32","indexed":true},{"type":"address","name":"createdBy","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"PostCreated","inputs":[{"type":"bytes32","name":"postId","internalType":"bytes32","indexed":true},{"type":"address","name":"createdBy","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false},{"type":"string","name":"link","internalType":"string","indexed":false}],"anonymous":false},{"type":"event","name":"PostTipCreated","inputs":[{"type":"bytes32","name":"postId","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"postTipId","internalType":"bytes32","indexed":true},{"type":"address","name":"createdBy","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ResponseCreated","inputs":[{"type":"bytes32","name":"messageId","internalType":"bytes32","indexed":true},{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"creator","internalType":"address","indexed":true},{"type":"string","name":"answerLink","internalType":"string","indexed":false},{"type":"uint256","name":"tokenId","internalType":"uint256","indexed":false},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"ResponseMarked","inputs":[{"type":"bytes32","name":"messageId","internalType":"bytes32","indexed":true},{"type":"address","name":"owner","internalType":"address","indexed":true},{"type":"address","name":"answerer","internalType":"address","indexed":true},{"type":"uint256","name":"responseType","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"previousAdminRole","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"newAdminRole","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"TipCreated","inputs":[{"type":"bytes32","name":"messageId","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"tipId","internalType":"bytes32","indexed":true},{"type":"address","name":"createdBy","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"TipValueClaimed","inputs":[{"type":"bytes32","name":"messageId","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"tipId","internalType":"bytes32","indexed":true},{"type":"address","name":"createdBy","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Transfer","inputs":[{"type":"address","name":"sender","internalType":"address","indexed":true},{"type":"address","name":"recipient","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"UnBlock","inputs":[{"type":"address","name":"unblocker","internalType":"address","indexed":true},{"type":"address","name":"unblocked","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"UnFollow","inputs":[{"type":"address","name":"unfollowed","internalType":"address","indexed":true},{"type":"address","name":"unfollower","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"UnWhitelisted","inputs":[{"type":"address","name":"unwhitelister","internalType":"address","indexed":true},{"type":"address","name":"unwhitelisted","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"Whitelisted","inputs":[{"type":"address","name":"whitelister","internalType":"address","indexed":true},{"type":"address","name":"whitelisted","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Withdraw","inputs":[{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint256","name":"value","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"GOVERNANCE_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"balance","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"blockUser","inputs":[{"type":"address","name":"_address","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"checkBlocked","inputs":[{"type":"address","name":"_sender","internalType":"address"},{"type":"address","name":"_recipient","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"checkWhitelist","inputs":[{"type":"address","name":"_sender","internalType":"address"},{"type":"address","name":"_recipient","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimBackMessageValue","inputs":[{"type":"bytes32","name":"messageId_","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"claimBackTipValue","inputs":[{"type":"bytes32","name":"tipId_","internalType":"bytes32"}]},{"type":"function","stateMutability":"payable","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"createMessage","inputs":[{"type":"address","name":"recipient_","internalType":"address"},{"type":"uint256","name":"timelock_","internalType":"uint256"},{"type":"uint256","name":"messageType_","internalType":"uint256"},{"type":"string","name":"messageLink_","internalType":"string"}]},{"type":"function","stateMutability":"payable","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"createPost","inputs":[{"type":"string","name":"postLink_","internalType":"string"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"createPostTip","inputs":[{"type":"bytes32","name":"postId_","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"createResponse","inputs":[{"type":"bytes32","name":"messageId_","internalType":"bytes32"},{"type":"string","name":"answerLink_","internalType":"string"},{"type":"string","name":"tokenURI_","internalType":"string"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"createTip","inputs":[{"type":"bytes32","name":"messageId_","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"feeCollector","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"feeNumerator","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"followUser","inputs":[{"type":"address","name":"_address","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32[]","name":"","internalType":"bytes32[]"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"gePublicMessageIds","inputs":[{"type":"uint256","name":"skip_","internalType":"uint256"},{"type":"uint256","name":"limit_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32[]","name":"","internalType":"bytes32[]"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getPostIds","inputs":[{"type":"uint256","name":"skip_","internalType":"uint256"},{"type":"uint256","name":"limit_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32[]","name":"","internalType":"bytes32[]"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getPostTipIds","inputs":[{"type":"uint256","name":"skip_","internalType":"uint256"},{"type":"uint256","name":"limit_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32[]","name":"","internalType":"bytes32[]"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getPrivateMessageIds","inputs":[{"type":"uint256","name":"skip_","internalType":"uint256"},{"type":"uint256","name":"limit_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getRoleMember","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getRoleMemberCount","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32[]","name":"","internalType":"bytes32[]"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTipIds","inputs":[{"type":"uint256","name":"skip_","internalType":"uint256"},{"type":"uint256","name":"limit_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32[]","name":"","internalType":"bytes32[]"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTipIdsOfMessage","inputs":[{"type":"bytes32","name":"messageId_","internalType":"bytes32"},{"type":"uint256","name":"skip_","internalType":"uint256"},{"type":"uint256","name":"limit_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32[]","name":"","internalType":"bytes32[]"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getTipIdsOfPost","inputs":[{"type":"bytes32","name":"postId_","internalType":"bytes32"},{"type":"uint256","name":"skip_","internalType":"uint256"},{"type":"uint256","name":"limit_","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"uint256","name":"_minimumBid","internalType":"uint256"},{"type":"uint256","name":"_postMinimumBid","internalType":"uint256"},{"type":"uint256","name":"_feeNumerator","internalType":"uint256"},{"type":"address","name":"_nftContract","internalType":"address"},{"type":"address","name":"_feeCollector","internalType":"address"},{"type":"address","name":"_adminAddress","internalType":"address"},{"type":"address","name":"trustedForwarder","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"isTrustedForwarder","inputs":[{"type":"address","name":"forwarder","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"markReponse","inputs":[{"type":"bytes32","name":"messageId_","internalType":"bytes32"},{"type":"uint256","name":"responseType_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"messageLink","internalType":"string"},{"type":"string","name":"answerLink","internalType":"string"},{"type":"uint256","name":"initialValue","internalType":"uint256"},{"type":"uint256","name":"totalValue","internalType":"uint256"},{"type":"address","name":"createdBy","internalType":"address"},{"type":"address","name":"anweredBy","internalType":"address"},{"type":"uint256","name":"createdTime","internalType":"uint256"},{"type":"uint256","name":"expiryTime","internalType":"uint256"},{"type":"uint8","name":"state","internalType":"enum AmaFansLib.State"},{"type":"uint256","name":"tokenId","internalType":"uint256"},{"type":"uint8","name":"responseType","internalType":"enum AmaFansLib.ResponseType"},{"type":"uint256","name":"messageType","internalType":"uint256"}],"name":"messages","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minTimeLock","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"minimumBid","inputs":[{"type":"uint256","name":"_messageType","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract AmaFansNFT"}],"name":"nftContract","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"postIds","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"postMinimumBid","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"postTipIds","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"createdBy","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"createdTime","internalType":"uint256"},{"type":"bytes32","name":"postId","internalType":"bytes32"}],"name":"postTips","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"string","name":"postLink","internalType":"string"},{"type":"uint256","name":"initialValue","internalType":"uint256"},{"type":"uint256","name":"tipsTotalValue","internalType":"uint256"},{"type":"address","name":"createdBy","internalType":"address"},{"type":"uint256","name":"createdTime","internalType":"uint256"},{"type":"uint256","name":"tokenId","internalType":"uint256"}],"name":"posts","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"privateMessageIds","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"privateMinimumBid","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"publicMessageIds","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"publicMinimumBid","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"recipientUpFront","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setMinimumBid","inputs":[{"type":"uint256","name":"_minimumBid","internalType":"uint256"},{"type":"uint8","name":"_messageType","internalType":"enum AmaFansLib.MessageType"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setNFTContract","inputs":[{"type":"address","name":"_address","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPostMinimumBid","inputs":[{"type":"uint256","name":"_postMinimumBid","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setRecipientUpFront","inputs":[{"type":"uint256","name":"_recipientUpFront","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setThresholdFactorForSplit","inputs":[{"type":"uint256","name":"_thresholdFactorForSplit","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTrustedForwarder","inputs":[{"type":"address","name":"_forwarder","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setUserMinimumBid","inputs":[{"type":"uint256","name":"minimumBidByUser","internalType":"uint256"},{"type":"uint8","name":"_messageType","internalType":"enum AmaFansLib.MessageType"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"thresholdFactorForSplit","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"tipIds","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"createdBy","internalType":"address"},{"type":"uint256","name":"value","internalType":"uint256"},{"type":"uint256","name":"createdTime","internalType":"uint256"},{"type":"bytes32","name":"messageId","internalType":"bytes32"},{"type":"bool","name":"claimed","internalType":"bool"}],"name":"tips","inputs":[{"type":"bytes32","name":"","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transfer","inputs":[{"type":"uint256","name":"amount_","internalType":"uint256"},{"type":"address","name":"recipient_","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unBlockUser","inputs":[{"type":"address","name":"_address","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unWhitelistUser","inputs":[{"type":"address","name":"_address","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unfollowUser","inputs":[{"type":"address","name":"_address","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"userBalance","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"userMinimumBid","inputs":[{"type":"address","name":"_sender","internalType":"address"},{"type":"address","name":"_recipient","internalType":"address"},{"type":"uint256","name":"_messageType","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"publicMinimumBid","internalType":"uint256"},{"type":"uint256","name":"privateMinimumBid","internalType":"uint256"},{"type":"bytes","name":"verified","internalType":"bytes"}],"name":"users","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"whitelistUser","inputs":[{"type":"address","name":"_address","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdraw","inputs":[{"type":"uint256","name":"_amount","internalType":"uint256"}]},{"type":"receive","stateMutability":"payable"}]
Contract Creation Code
0x608060405234801561001057600080fd5b50615558806100206000396000f3fe6080604052600436106104095760003560e01c806394a3404511610213578063c415b95c11610123578063da742228116100ab578063f107cfcb1161007a578063f107cfcb14610d23578063f1096c2114610d43578063f224aa4f14610d63578063f36c8f5c14610d83578063fea3260014610db757600080fd5b8063da74222814610c9a578063dc1a091114610cba578063dff72dec14610cda578063e86dea4a14610d0c57600080fd5b8063d00a818f116100f2578063d00a818f14610c02578063d3e15bda14610c19578063d547741f14610c39578063d56d229d14610c59578063d9fffc8214610c7a57600080fd5b8063c415b95c14610b8e578063c7303c6114610baf578063ca05249f14610bc2578063ca15c87314610be257600080fd5b8063a87430ba116101a6578063b1df738311610175578063b1df738314610b0d578063b69ef8a814610b2d578063b7760c8f14610b42578063bf15276514610b62578063c0ef21ee14610b7757600080fd5b8063a87430ba14610a94578063a9a3aa8314610ac3578063aafa306114610ad6578063b12ea2a314610aed57600080fd5b8063a217fddf116101e2578063a217fddf14610a2c578063a70806f714610a41578063a740d68e14610a61578063a7ccabdf14610a7457600080fd5b806394a34045146109ac57806396858061146109cc57806398f17c96146109ec578063a02f3c7814610a0c57600080fd5b80633f4ba83a116103195780635ad1c6e5116102a157806379ced7471161027057806379ced74714610908578063835791251461091f5780638456cb591461093f5780639010d07c1461095457806391d148541461098c57600080fd5b80635ad1c6e5146108245780635c975abb14610844578063602bf2271461085c57806365f898e1146108e857600080fd5b80634d1ccb62116102e85780634d1ccb62146107875780634d31a6ed146107a75780634f09c912146107be57806350cde8ef146107d5578063572b6c05146107f557600080fd5b80633f4ba83a1461071257806349e03502146107275780634a4c560d146107475780634b8e7a341461076757600080fd5b8063248a9ca31161039c5780632f2ff15d1161036b5780632f2ff15d1461067257806336568abe146106925780633da01325146106b25780633dc9979e146106d25780633e11b5dc146106f257600080fd5b8063248a9ca3146105ca5780632bbd59ca146105fa5780632c8d6fd6146106325780632e1a7d4d1461065257600080fd5b806310f5ff3e116103d857806310f5ff3e146104e4578063190c69a2146105125780631b1456d61461053257806320d4f41b146105a957600080fd5b806301ffc9a71461044d578063049c067a1461048257806309b82cfd146104a45780630fc65407146104c457600080fd5b3661044857610416610dd7565b6001600160a01b03166000805160206155038339815191523460405161043e91815260200190565b60405180910390a2005b600080fd5b34801561045957600080fd5b5061046d610468366004614e46565b610de6565b60405190151581526020015b60405180910390f35b34801561048e57600080fd5b506104a261049d366004614d36565b610e11565b005b3480156104b057600080fd5b506104a26104bf366004614ea5565b610e73565b3480156104d057600080fd5b506104a26104df366004614ed9565b610f06565b3480156104f057600080fd5b506105046104ff366004614df8565b611117565b604051610479929190615023565b34801561051e57600080fd5b506104a261052d366004614b95565b6111bf565b34801561053e57600080fd5b5061057f61054d366004614d36565b61016b6020526000908152604090208054600182015460028301546003909301546001600160a01b0390921692909184565b604080516001600160a01b0390951685526020850193909352918301526060820152608001610479565b6105bc6105b7366004614c1f565b611266565b604051908152602001610479565b3480156105d657600080fd5b506105bc6105e5366004614d36565b600090815260c9602052604090206001015490565b34801561060657600080fd5b5061061a610615366004614d36565b611515565b6040516104799c9b9a999897969594939291906150a8565b34801561063e57600080fd5b5061046d61064d366004614bb0565b611697565b34801561065e57600080fd5b506104a261066d366004614d36565b6116e3565b34801561067e57600080fd5b506104a261068d366004614d68565b611846565b34801561069e57600080fd5b506104a26106ad366004614d68565b61186e565b3480156106be57600080fd5b506104a26106cd366004614b95565b6118fc565b3480156106de57600080fd5b506105bc6106ed366004614d36565b6119fe565b3480156106fe57600080fd5b5061050461070d366004614e1a565b611a20565b34801561071e57600080fd5b506104a2611b36565b34801561073357600080fd5b50610504610742366004614df8565b611bae565b34801561075357600080fd5b506104a2610762366004614b95565b611bfb565b34801561077357600080fd5b506104a2610782366004614d36565b611d35565b34801561079357600080fd5b506104a26107a2366004614d36565b611d98565b3480156107b357600080fd5b506105bc6101605481565b3480156107ca57600080fd5b506105bc6101625481565b3480156107e157600080fd5b506105bc6107f0366004614d36565b611dad565b34801561080157600080fd5b5061046d610810366004614b95565b6065546001600160a01b0391821691161490565b34801561083057600080fd5b5061050461083f366004614df8565b611dbe565b34801561085057600080fd5b5060335460ff1661046d565b34801561086857600080fd5b506108b4610877366004614d36565b61016a60205260009081526040902080546001820154600283015460038401546004909401546001600160a01b0390931693919290919060ff1685565b604080516001600160a01b03909616865260208601949094529284019190915260608301521515608082015260a001610479565b3480156108f457600080fd5b506104a2610903366004614b95565b611e0b565b34801561091457600080fd5b506105bc6101615481565b34801561092b57600080fd5b506104a261093a366004614d36565b611f44565b34801561094b57600080fd5b506104a261217b565b34801561096057600080fd5b5061097461096f366004614df8565b6121ef565b6040516001600160a01b039091168152602001610479565b34801561099857600080fd5b5061046d6109a7366004614d68565b61220e565b3480156109b857600080fd5b506104a26109c7366004614ea5565b612239565b3480156109d857600080fd5b506104a26109e7366004614d8b565b6122f3565b3480156109f857600080fd5b506105bc610a07366004614d36565b61243f565b348015610a1857600080fd5b506105bc610a27366004614d36565b612450565b348015610a3857600080fd5b506105bc600081565b348015610a4d57600080fd5b506104a2610a5c366004614b95565b612461565b6104a2610a6f366004614d36565b6124ea565b348015610a8057600080fd5b506104a2610a8f366004614b95565b6127ac565b348015610aa057600080fd5b50610ab4610aaf366004614b95565b612827565b6040516104799392919061525f565b6104a2610ad1366004614d36565b6128d3565b348015610ae257600080fd5b506105bc6101675481565b348015610af957600080fd5b50610504610b08366004614e1a565b612b52565b348015610b1957600080fd5b506104a2610b28366004614df8565b612c0c565b348015610b3957600080fd5b506105bc612e98565b348015610b4e57600080fd5b506104a2610b5d366004614d68565b612eaf565b348015610b6e57600080fd5b506105bc613016565b348015610b8357600080fd5b506105bc6101665481565b348015610b9a57600080fd5b5061015f54610974906001600160a01b031681565b6105bc610bbd366004614e70565b61304b565b348015610bce57600080fd5b50610504610bdd366004614df8565b613318565b348015610bee57600080fd5b506105bc610bfd366004614d36565b613365565b348015610c0e57600080fd5b506105bc6101655481565b348015610c2557600080fd5b506105bc610c34366004614d36565b61337c565b348015610c4557600080fd5b506104a2610c54366004614d68565b61338d565b348015610c6557600080fd5b5061016454610974906001600160a01b031681565b348015610c8657600080fd5b506105bc610c95366004614be3565b6133b5565b348015610ca657600080fd5b506104a2610cb5366004614b95565b6133f8565b348015610cc657600080fd5b5061046d610cd5366004614bb0565b61340f565b348015610ce657600080fd5b50610cfa610cf5366004614d36565b613418565b6040516104799695949392919061516e565b348015610d1857600080fd5b506105bc6101635481565b348015610d2f57600080fd5b506104a2610d3e366004614b95565b6134df565b348015610d4f57600080fd5b50610504610d5e366004614df8565b613568565b348015610d6f57600080fd5b506104a2610d7e366004614d36565b6135b5565b348015610d8f57600080fd5b506105bc7f35a7846a2a701fff6f9d61a46ebff5da578c5dcee8bdf361c569f9ea4ee6477181565b348015610dc357600080fd5b506105bc610dd2366004614d36565b6137f9565b6000610de1613816565b905090565b60006001600160e01b03198216635a05180f60e01b1480610e0b5750610e0b82613841565b92915050565b6000610e2481610e1f610dd7565b613876565b60408051808201909152600681526506060726060760d31b602082015260018311610e6b5760405162461bcd60e51b8152600401610e62919061506b565b60405180910390fd5b505061016755565b6000610e8181610e1f610dd7565b6001826001811115610e9557610e95615405565b1415610efa57610166548310156040518060400160405280600681526020016530303930303360d01b81525090610edf5760405162461bcd60e51b8152600401610e62919061506b565b50610161839055610ef16004846152e8565b61016655505050565b6101608390555b505050565b600054610100900460ff16610f215760005460ff1615610f25565b303b155b610f885760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610e62565b600054610100900460ff16158015610faa576000805461ffff19166101011790555b61271086111561100f5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610e62565b61101a6004896152e8565b610166556110266138da565b61102e613921565b611036613950565b61103f82613987565b610160889055610161889055610162879055610163869055610164805461015f80546001600160a01b0319166001600160a01b03888116919091179091556103846101655587166001600160a81b03199091161790556003610167556110a66000846139c2565b6110d07f35a7846a2a701fff6f9d61a46ebff5da578c5dcee8bdf361c569f9ea4ee64771846139c2565b6110fb7f35a7846a2a701fff6f9d61a46ebff5da578c5dcee8bdf361c569f9ea4ee6477160006139cc565b801561110d576000805461ff00191690555b5050505050505050565b60405163074a590760e01b81526004810183905260248101829052610172604482015260609060009073967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063074a5907906064015b60006040518083038186803b15801561117857600080fd5b505af415801561118c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111b49190810190614c80565b915091509250929050565b600061016c60006111ce610dd7565b6001600160a01b03908116825260208083019390935260409182016000908120918616815260049091019092529020805460ff1916600183600281111561121757611217615405565b0217905550806001600160a01b031661122e610dd7565b6001600160a01b03167fdc9ec6c8ca20e67e0cbecb5536d5c021046dd6a9a43b1b03d2b10235767d450260405160405180910390a350565b600083610165548110156040518060400160405280600681526020016530303230303760d01b815250906112ad5760405162461bcd60e51b8152600401610e62919061506b565b5060335460ff16156112d15760405162461bcd60e51b8152600401610e62906151b3565b8380600110156040518060400160405280600681526020016503030323031360d41b815250906113145760405162461bcd60e51b8152600401610e62919061506b565b50600261012d5414156113395760405162461bcd60e51b8152600401610e6290615228565b600261012d556001600160a01b038716600090815261016c60205260408120819060040181611366610dd7565b6001600160a01b0316815260208101919091526040016000205460ff169050600181600281111561139957611399615405565b14156040518060400160405280600681526020016518181c98181b60d11b815250906113d85760405162461bcd60e51b8152600401610e62919061506b565b5060006113ed6113e6610dd7565b8b8a6133b5565b9050600282600281111561140357611403615405565b146114c55760018814156114655760408051808201909152600681526530303130303960d01b60208201523482111561144f5760405162461bcd60e51b8152600401610e62919061506b565b506101665461145e9034615329565b92506114c5565b60408051808201909152600681526503030313031360d41b6020820152348211156114a35760405162461bcd60e51b8152600401610e62919061506b565b506101665481116114b457346114c2565b610166546114c29034615329565b92505b60006114dc6114d2610dd7565b8c868d8d8d613a17565b905083158015906114ef57506101665482115b15611501576115018b61016654613d5f565b600161012d559a9950505050505050505050565b6101686020526000908152604090208054819061153190615387565b80601f016020809104026020016040519081016040528092919081815260200182805461155d90615387565b80156115aa5780601f1061157f576101008083540402835291602001916115aa565b820191906000526020600020905b81548152906001019060200180831161158d57829003601f168201915b5050505050908060010180546115bf90615387565b80601f01602080910402602001604051908101604052809291908181526020018280546115eb90615387565b80156116385780601f1061160d57610100808354040283529160200191611638565b820191906000526020600020905b81548152906001019060200180831161161b57829003601f168201915b50505060028401546003850154600486015460058701546007880154600889015460098a0154600a8b0154600b8c0154600c909c01549a9b979a9699506001600160a01b03958616985093909416959194909360ff908116939216908c565b600060015b6001600160a01b03808416600090815261016c60209081526040808320938816835260049093019052205460ff1660028111156116db576116db615405565b149392505050565b60335460ff16156117065760405162461bcd60e51b8152600401610e62906151b3565b600261012d54141561172a5760405162461bcd60e51b8152600401610e6290615228565b600261012d5561016d600061173d610dd7565b6001600160a01b03166001600160a01b03168152602001908152602001600020548111156040518060400160405280600681526020016530303930303160d01b8152509061179e5760405162461bcd60e51b8152600401610e62919061506b565b508061016d60006117ad610dd7565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008282546117dc9190615329565b909155506117f390506117ed610dd7565b82613d5f565b6117fb610dd7565b6001600160a01b03167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243648260405161183591815260200190565b60405180910390a250600161012d55565b600082815260c9602052604090206001015461186481610e1f610dd7565b610f018383613e78565b611876610dd7565b6001600160a01b0316816001600160a01b0316146118ee5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610e62565b6118f88282613e9a565b5050565b806001600160a01b031661190e610dd7565b6001600160a01b031614156040518060400160405280600681526020016503030393031360d41b815250906119565760405162461bcd60e51b8152600401610e62919061506b565b50600161016c6000611966610dd7565b6001600160a01b03908116825260208083019390935260409182016000908120918616815260049091019092529020805460ff191660018360028111156119af576119af615405565b0217905550806001600160a01b03166119c6610dd7565b6001600160a01b03167fc931b7e6f18c2a39bcd066690c46c7ba85186501c524faa844ac2c7213d1732560405160405180910390a350565b61016f8181548110611a0f57600080fd5b600091825260209091200154905081565b600083815261016960209081526040808320600301548151808301909252600682526530303430303160d01b92820192909252606092918691906001600160a01b0316611a805760405162461bcd60e51b8152600401610e62919061506b565b506000868152610169602052604090819020905163074a590760e01b8152600480820188905260248201879052909101604482015273967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063074a5907906064015b60006040518083038186803b158015611aed57600080fd5b505af4158015611b01573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b299190810190614c80565b9250925050935093915050565b611b4360006109a7610dd7565b611ba45760405162461bcd60e51b815260206004820152602c60248201527f4d75737420686176652044454641554c545f41444d494e5f524f4c4520726f6c60448201526b6520746f20756e706175736560a01b6064820152608401610e62565b611bac613ebc565b565b60405163074a590760e01b81526004810183905260248101829052610170604482015260609060009073967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063074a590790606401611160565b600161016c6000611c0a610dd7565b6001600160a01b039081168252602080830193909352604091820160009081209186168152600490910190925290205460ff166002811115611c4e57611c4e615405565b14156040518060400160405280600681526020016518181c98181b60d11b81525090611c8d5760405162461bcd60e51b8152600401610e62919061506b565b50600261016c6000611c9d610dd7565b6001600160a01b03908116825260208083019390935260409182016000908120918616815260049091019092529020805460ff19166001836002811115611ce657611ce6615405565b0217905550806001600160a01b0316611cfd610dd7565b6001600160a01b03167f6661a7108aecd07864384529117d96c319c1163e3010c01390f6b704726e07de60405160405180910390a350565b6000611d4381610e1f610dd7565b611d4e82600461530a565b61016154116040518060400160405280600681526020016530303930303760d01b81525090611d905760405162461bcd60e51b8152600401610e62919061506b565b505061016655565b6000611da681610e1f610dd7565b5061016255565b6101708181548110611a0f57600080fd5b60405163074a590760e01b8152600481018390526024810182905261016f604482015260609060009073967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063074a590790606401611160565b600161016c6000611e1a610dd7565b6001600160a01b039081168252602080830193909352604091820160009081209186168152600490910190925290205460ff166002811115611e5e57611e5e615405565b146040518060400160405280600681526020016530303930313160d01b81525090611e9c5760405162461bcd60e51b8152600401610e62919061506b565b50600061016c6000611eac610dd7565b6001600160a01b03908116825260208083019390935260409182016000908120918616815260049091019092529020805460ff19166001836002811115611ef557611ef5615405565b0217905550806001600160a01b0316611f0c610dd7565b6001600160a01b03167f35672c674c91f8b0025681a1c8d11a4ca6583e909553290ecfb3d6578faa8bce60405160405180910390a350565b60335460ff1615611f675760405162461bcd60e51b8152600401610e62906151b3565b60008181526101686020908152604091829020600401548251808401909352600683526530303230303360d01b918301919091528291906001600160a01b0316611fc45760405162461bcd60e51b8152600401610e62919061506b565b5081611fce610dd7565b60008281526101686020908152604091829020600401548251808401909352600683526518181918181960d11b9183019190915290916001600160a01b0391821691161461202f5760405162461bcd60e51b8152600401610e62919061506b565b506000838152610168602052604090819020905163dae5e84360e01b81526004810182905273967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063dae5e8439060240160006040518083038186803b15801561208b57600080fd5b505af415801561209f573d6000803e3d6000fd5b50505050806002015461016d60006120b5610dd7565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008282546120e491906152d0565b909155506120f29050610dd7565b6001600160a01b0316600080516020615503833981519152826002015460405161211e91815260200190565b60405180910390a261212e610dd7565b6001600160a01b0316847f205302058bf3afb5ece22c5535eab6ea487294c8339c2a194fc6476219badbcd836002015460405161216d91815260200190565b60405180910390a350505050565b61218860006109a7610dd7565b6121e75760405162461bcd60e51b815260206004820152602a60248201527f4d75737420686176652044454641554c545f41444d494e5f524f4c4520726f6c6044820152696520746f20706175736560b01b6064820152608401610e62565b611bac613f55565b600082815260fb602052604081206122079083613fae565b9392505050565b600091825260c9602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600181600181111561224d5761224d615405565b14156122c757610161548210156040518060400160405280600681526020016530303930303360d01b815250906122975760405162461bcd60e51b8152600401610e62919061506b565b508161016c60006122a6610dd7565b6001600160a01b031681526020810191909152604001600020600101555050565b8161016c60006122d5610dd7565b6001600160a01b031681526020810191909152604001600020555050565b60008381526101686020908152604091829020600401548251808401909352600683526530303230303360d01b918301919091528491906001600160a01b03166123505760405162461bcd60e51b8152600401610e62919061506b565b50612359610dd7565b60008581526101686020908152604091829020600501548251808401909352600683526518181918181960d11b9183019190915290916001600160a01b039182169116146123ba5760405162461bcd60e51b8152600401610e62919061506b565b506000806123c9868686613fba565b915091506123d5610dd7565b60008781526101686020526040908190206004015490516001600160a01b03928316929091169088907fff7a1ecaac27eed4c6bd348a8dd8d05ed71190db5b77e89f881fa74087429bc99061242f908a9088908890615149565b60405180910390a4505050505050565b6101728181548110611a0f57600080fd5b61016e8181548110611a0f57600080fd5b600161016c6000612470610dd7565b6001600160a01b03908116825260208083019390935260409182016000908120918616815260039091019092529020556124a8610dd7565b6001600160a01b0316816001600160a01b03167fbccc71dc7842b86291138666aa18e133ee6d41aa71e6d7c650debad1a057663560405160405180910390a350565b60008181526101686020908152604091829020600401548251808401909352600683526530303230303360d01b918301919091528291906001600160a01b03166125475760405162461bcd60e51b8152600401610e62919061506b565b50600082815261016860205260409081902090516301f2553b60e11b81526004810182905273967d0521f20a428d1fe0604f8fc2db88ab7fa1de906303e4aa769060240160006040518083038186803b1580156125a357600080fd5b505af41580156125b7573d6000803e3d6000fd5b50505050600034116040518060400160405280600681526020016530303330303560d01b815250906125fc5760405162461bcd60e51b8152600401610e62919061506b565b50600073967d0521f20a428d1fe0604f8fc2db88ab7fa1de63feac0f7061016a86612625610dd7565b6040516001600160e01b031960e086901b168152600481019390935260248301919091526001600160a01b0316604482015234606482015260840160206040518083038186803b15801561267857600080fd5b505af415801561268c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126b09190614d4f565b60405163aebe518360e01b8152600481018490526024810182905234604482015290915073967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063aebe51839060640160006040518083038186803b15801561270b57600080fd5b505af415801561271f573d6000803e3d6000fd5b505061017180546001810182556000919091527f42b680591beb20d1de0d4ca368d3f10acc6db07bc74b68a9681655fb351b903901839055506127629050610dd7565b6001600160a01b031681857fb8a61f3258608a2f1af184e4640b08e6cd69126e3c563d30b6348ebfb51558843460405161279e91815260200190565b60405180910390a450505050565b60006127ba81610e1f610dd7565b6101645460408051808201909152600681526506060726060760d31b6020820152906001600160a01b03166128025760405162461bcd60e51b8152600401610e62919061506b565b505061016480546001600160a01b0319166001600160a01b0392909216919091179055565b61016c602052600090815260409020805460018201546002830180549293919261285090615387565b80601f016020809104026020016040519081016040528092919081815260200182805461287c90615387565b80156128c95780601f1061289e576101008083540402835291602001916128c9565b820191906000526020600020905b8154815290600101906020018083116128ac57829003601f168201915b5050505050905083565b60008181526101696020908152604091829020600301548251808401909352600683526530303430303160d01b918301919091528291906001600160a01b03166129305760405162461bcd60e51b8152600401610e62919061506b565b50600082815261016960209081526040918290208251808401909352600683526530303330303560d01b9183019190915290346129805760405162461bcd60e51b8152600401610e62919061506b565b50600073967d0521f20a428d1fe0604f8fc2db88ab7fa1de63cdaea01361016b866129a9610dd7565b6040516001600160e01b031960e086901b168152600481019390935260248301919091526001600160a01b0316604482015234606482015260840160206040518083038186803b1580156129fc57600080fd5b505af4158015612a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a349190614d4f565b604051600162df932b60e01b03198152600481018490526024810182905234604482015290915073967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063ff206cd59060640160006040518083038186803b158015612a9257600080fd5b505af4158015612aa6573d6000803e3d6000fd5b50506101728054600181019091557fed95d52ae313e6be6d8c8f9945923a6497c37269ba35d5e3535b758e47227cfc01839055505060038201546001600160a01b0316600090815261016d602052604081208054349290612b089084906152d0565b90915550612b169050610dd7565b6001600160a01b031681857fa7b9de4cae04f62223d95aba2f4ecdd05879f655bab52b8505b696ecf05f72743460405161279e91815260200190565b600083815261016860209081526040808320600401548151808301909252600682526530303230303360d01b92820192909252606092918691906001600160a01b0316612bb25760405162461bcd60e51b8152600401610e62919061506b565b506000868152610168602052604090819020905163074a590760e01b815260048101879052602481018690526006909101604482015273967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063074a590790606401611ad5565b60008281526101686020908152604091829020600401548251808401909352600683526530303230303360d01b918301919091528391906001600160a01b0316612c695760405162461bcd60e51b8152600401610e62919061506b565b5082612c73610dd7565b60008281526101686020908152604091829020600401548251808401909352600683526518181918181960d11b9183019190915290916001600160a01b03918216911614612cd45760405162461bcd60e51b8152600401610e62919061506b565b508280600210156040518060400160405280600681526020016530303230313160d01b81525090612d185760405162461bcd60e51b8152600401610e62919061506b565b5060036000868152610168602052604090206009015460ff166003811115612d4257612d42615405565b146040518060400160405280600681526020016530303230303960d01b81525090612d805760405162461bcd60e51b8152600401610e62919061506b565b50600085815261016860205260408120600b015460ff166002811115612da857612da8615405565b146040518060400160405280600681526020016518181918189960d11b81525090612de65760405162461bcd60e51b8152600401610e62919061506b565b50836002811115612df957612df9615405565b600086815261016860205260409020600b01805460ff19166001836002811115612e2557612e25615405565b02179055506000858152610168602052604090819020600581015460049091015491516001600160a01b03918216929091169087907fba2e4b16cb7f6bbe19c7a1146539a78ed1db3efbb3dd80d6c65f0ba1d840345990612e899089815260200190565b60405180910390a45050505050565b600080612ea781610e1f610dd7565b4791505b5090565b60335460ff1615612ed25760405162461bcd60e51b8152600401610e62906151b3565b600261012d541415612ef65760405162461bcd60e51b8152600401610e6290615228565b600261012d5561016d6000612f09610dd7565b6001600160a01b03166001600160a01b03168152602001908152602001600020548211156040518060400160405280600681526020016530303930303160d01b81525090612f6a5760405162461bcd60e51b8152600401610e62919061506b565b508161016d6000612f79610dd7565b6001600160a01b03166001600160a01b031681526020019081526020016000206000828254612fa89190615329565b90915550612fb890508183613d5f565b806001600160a01b0316612fca610dd7565b6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161300491815260200190565b60405180910390a35050600161012d55565b600061016d6000613025610dd7565b6001600160a01b03166001600160a01b0316815260200190815260200160002054905090565b600061305960335460ff1690565b156130765760405162461bcd60e51b8152600401610e62906151b3565b600261012d54141561309a5760405162461bcd60e51b8152600401610e6290615228565b600261012d556101625460408051808201909152600681526530303430303360d01b6020820152903410156130e25760405162461bcd60e51b8152600401610e62919061506b565b50604080516000808252602082019092529073967d0521f20a428d1fe0604f8fc2db88ab7fa1de63b0b67fa885613117610dd7565b6040518363ffffffff1660e01b815260040161313492919061507e565b60206040518083038186803b15801561314c57600080fd5b505af4158015613160573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131849190614d4f565b90506040518060e00160405280858152602001348152602001600081526020016131ac610dd7565b6001600160a01b031681526020808201859052426040808401919091526000606090930183905284835261016982529091208251805191926131f392849290910190614a36565b5060208281015160018301556040830151600283015560608301516003830180546001600160a01b0319166001600160a01b03909216919091179055608083015180516132469260048501920190614ab6565b5060a0820151600582015560c0909101516006909101556101708054600181019091557f88e1afb22f13be7fec203799fd189c3b9471c5b75e2b22a6d5efec11c7f392550181905561015f546001600160a01b0316600090815261016d6020526040812080543492906132ba9084906152d0565b909155506132c89050610dd7565b6001600160a01b0316817f3c860076dbb2474109ea1afc5f287966581081acee08ee7ec1d39cfdd52a07403487604051613303929190615287565b60405180910390a3600161012d559392505050565b60405163074a590760e01b8152600481018390526024810182905261016e604482015260609060009073967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063074a590790606401611160565b600081815260fb60205260408120610e0b906142e6565b6101718181548110611a0f57600080fd5b600082815260c960205260409020600101546133ab81610e1f610dd7565b610f018383613e9a565b60006133c1848461340f565b156133ce57506000612207565b60018214156133e7576133e0836142f0565b9050612207565b6133f08361433a565b949350505050565b600061340681610e1f610dd7565b6118f88261437e565b6000600261169c565b6101696020526000908152604090208054819061343490615387565b80601f016020809104026020016040519081016040528092919081815260200182805461346090615387565b80156134ad5780601f10613482576101008083540402835291602001916134ad565b820191906000526020600020905b81548152906001019060200180831161349057829003601f168201915b5050506001840154600285015460038601546005870154600690970154959692959194506001600160a01b0316925086565b600061016c60006134ee610dd7565b6001600160a01b0390811682526020808301939093526040918201600090812091861681526003909101909252902055613526610dd7565b6001600160a01b0316816001600160a01b03167fe5dcccfe8e7890c6d4aa94d44c3b409fb6f023337f29c3308077c0c4068192c460405160405180910390a350565b60405163074a590760e01b81526004810183905260248101829052610171604482015260609060009073967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063074a590790606401611160565b60335460ff16156135d85760405162461bcd60e51b8152600401610e62906151b3565b600081815261016a6020908152604091829020548251808401909352600683526530303330303360d01b918301919091528291906001600160a01b03166136325760405162461bcd60e51b8152600401610e62919061506b565b508161363c610dd7565b600082815261016a6020908152604091829020548251808401909352600683526518181998181960d11b9183019190915290916001600160a01b0391821691161461369a5760405162461bcd60e51b8152600401610e62919061506b565b50600083815261016a60209081526040808320600381015484526101689092529182902091516318b5b06760e21b8152600481018290526024810183905290919073967d0521f20a428d1fe0604f8fc2db88ab7fa1de906362d6c19c9060440160006040518083038186803b15801561371257600080fd5b505af4158015613726573d6000803e3d6000fd5b50505050816001015461016d600061373c610dd7565b6001600160a01b03166001600160a01b03168152602001908152602001600020600082825461376b91906152d0565b909155506137799050610dd7565b6001600160a01b031660008051602061550383398151915283600101546040516137a591815260200190565b60405180910390a26137b5610dd7565b6001600160a01b03168583600301547f8827140ed7e0aee657f6d8ab3d65b02d30022ed333e284958313db49217e7c3e8560010154604051612e8991815260200190565b6000600182141561380d5750506101615490565b50506101605490565b6065546000906001600160a01b0316331415613839575060131936013560601c90565b503390565b90565b60006001600160e01b03198216637965db0b60e01b1480610e0b57506301ffc9a760e01b6001600160e01b0319831614610e0b565b613880828261220e565b6118f857613898816001600160a01b031660146143c7565b6138a38360206143c7565b6040516020016138b4929190614f8a565b60408051601f198184030181529082905262461bcd60e51b8252610e629160040161506b565b600054610100900460ff166139015760405162461bcd60e51b8152600401610e62906151dd565b613909614563565b613911614563565b613919614563565b611bac614563565b600054610100900460ff166139485760405162461bcd60e51b8152600401610e62906151dd565b611bac61458a565b600054610100900460ff166139775760405162461bcd60e51b8152600401610e62906151dd565b61397f614563565b611bac6145b9565b600054610100900460ff166139ae5760405162461bcd60e51b8152600401610e62906151dd565b6139b6614563565b6139bf8161437e565b50565b6118f88282613e78565b600082815260c96020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b60008073967d0521f20a428d1fe0604f8fc2db88ab7fa1de63b0b67fa8848a6040518363ffffffff1660e01b8152600401613a5392919061507e565b60206040518083038186803b158015613a6b57600080fd5b505af4158015613a7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613aa39190614d4f565b60408051600080825260208201909252919250613ac087426152d0565b9050604051806101a001604052808681526020016040518060200160405280600081525081526020018981526020018981526020018b6001600160a01b031681526020018a6001600160a01b0316815260200183815260200142815260200182815260200160006003811115613b3857613b38615405565b81526020016000815260200160006002811115613b5757613b57615405565b815260209081018890526000858152610168825260409020825180519192613b8492849290910190614a36565b506020828101518051613b9d9260018501920190614a36565b50604082015160028201556060820151600382015560808201516004820180546001600160a01b039283166001600160a01b03199182161790915560a084015160058401805491909316911617905560c08201518051613c07916006840191602090910190614ab6565b5060e08201516007820155610100820151600882015561012082015160098201805460ff19166001836003811115613c4157613c41615405565b0217905550610140820151600a820155610160820151600b8201805460ff19166001836002811115613c7557613c75615405565b02179055506101809190910151600c9091015585613cc85761016e80546001810182556000919091527ff82fbbf6ecba5c6bca8ffdb165c351ca78f1011f756f9b1202212482fd7d831301839055613cff565b61016f80546001810182556000919091527f47d2f800c57de5c44dff408e225b320f1ea140ca87907f0726fd6049ee5595d7018390555b896001600160a01b0316838a6001600160a01b03167fdda647d1e751b8df0a785cd75e0c734774777ff91018aa17aa79bf515f8511558b858a8c604051613d4994939291906152a0565b60405180910390a4509098975050505050505050565b80471015613daf5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610e62565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613dfc576040519150601f19603f3d011682016040523d82523d6000602084013e613e01565b606091505b5050905080610f015760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610e62565b613e8282826145ec565b600082815260fb60205260409020610f019082614673565b613ea48282614688565b600082815260fb60205260409020610f01908261470d565b60335460ff16613f055760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610e62565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa613f38610dd7565b6040516001600160a01b03909116815260200160405180910390a1565b60335460ff1615613f785760405162461bcd60e51b8152600401610e62906151b3565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613f38610dd7565b60006122078383614722565b60008381526101686020526040808220905163e7f8899d60e01b81526004810182905282919073967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063e7f8899d9060240160006040518083038186803b15801561401757600080fd5b505af415801561402b573d6000803e3d6000fd5b50506101645460009250600160a01b900460ff1615905061406157600482015461405e906001600160a01b03168661474c565b90505b604051633f46f90d60e21b815273967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063fd1be4349061409c90859085908b9060040161525f565b60006040518083038186803b1580156140b457600080fd5b505af41580156140c8573d6000803e3d6000fd5b505050506000806140e184600201548560030154614823565b91509150836002015460001415801561413e57506004840154614119906001600160a01b031661410f610dd7565b86600c01546133b5565b61016754614127919061530a565b8460020154856003015461413b9190615329565b10155b156142435760006141506002846152e8565b905061415c82826152d0565b61016d6000614169610dd7565b6001600160a01b03166001600160a01b03168152602001908152602001600020600082825461419891906152d0565b909155505060048501546001600160a01b0316600090815261016d6020526040812080548392906141ca9084906152d0565b909155506141d89050610dd7565b6001600160a01b03166000805160206155038339815191526141fa84846152d0565b60405190815260200160405180910390a260048501546040518281526001600160a01b03909116906000805160206155038339815191529060200160405180910390a2506142cb565b61424d81836152d0565b61016d600061425a610dd7565b6001600160a01b03166001600160a01b03168152602001908152602001600020600082825461428991906152d0565b909155506142979050610dd7565b6001600160a01b03166000805160206155038339815191526142b983856152d0565b60405190815260200160405180910390a25b826142d682846152d0565b9550955050505050935093915050565b6000610e0b825490565b6001600160a01b038116600090815261016c602052604081206001015461431a5750506101615490565b506001600160a01b0316600090815261016c602052604090206001015490565b6001600160a01b038116600090815261016c60205260408120546143615750506101605490565b506001600160a01b0316600090815261016c602052604090205490565b600054610100900460ff166143a55760405162461bcd60e51b8152600401610e62906151dd565b606580546001600160a01b0319166001600160a01b0392909216919091179055565b606060006143d683600261530a565b6143e19060026152d0565b67ffffffffffffffff8111156143f9576143f9615447565b6040519080825280601f01601f191660200182016040528015614423576020820181803683370190505b509050600360fc1b8160008151811061443e5761443e615431565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061446d5761446d615431565b60200101906001600160f81b031916908160001a905350600061449184600261530a565b61449c9060016152d0565b90505b6001811115614514576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106144d0576144d0615431565b1a60f81b8282815181106144e6576144e6615431565b60200101906001600160f81b031916908160001a90535060049490941c9361450d81615370565b905061449f565b5083156122075760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610e62565b600054610100900460ff16611bac5760405162461bcd60e51b8152600401610e62906151dd565b600054610100900460ff166145b15760405162461bcd60e51b8152600401610e62906151dd565b600161012d55565b600054610100900460ff166145e05760405162461bcd60e51b8152600401610e62906151dd565b6033805460ff19169055565b6145f6828261220e565b6118f857600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561462f610dd7565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000612207836001600160a01b0384166148f4565b614692828261220e565b156118f857600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff191690556146c9610dd7565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b6000612207836001600160a01b038416614943565b600082600001828154811061473957614739615431565b9060005260206000200154905092915050565b6101645460405163d0def52160e01b81526000916001600160a01b03169063d0def521906147809086908690600401614fff565b602060405180830381600087803b15801561479a57600080fd5b505af19250505080156147ca575060408051601f3d908101601f191682019092526147c791810190614d4f565b60015b61481c576147d661545d565b806308c379a0141561481057506147eb615478565b806147f65750614812565b8060405162461bcd60e51b8152600401610e62919061506b565b505b3d6000803e3d6000fd5b9050610e0b565b600080806127106bffffffffffffffffffffffff166101635486866148489190615329565b614852919061530a565b61485c91906152e8565b905060006127106bffffffffffffffffffffffff166101635487614880919061530a565b61488a91906152e8565b905061489681836152d0565b61015f546001600160a01b0316600090815261016d6020526040812080549091906148c29084906152d0565b909155508290506148d38787615329565b6148dd9190615329565b6148e78288615329565b9350935050509250929050565b600081815260018301602052604081205461493b57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610e0b565b506000610e0b565b60008181526001830160205260408120548015614a2c576000614967600183615329565b855490915060009061497b90600190615329565b90508181146149e057600086600001828154811061499b5761499b615431565b90600052602060002001549050808760000184815481106149be576149be615431565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806149f1576149f161541b565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610e0b565b6000915050610e0b565b828054614a4290615387565b90600052602060002090601f016020900481019282614a645760008555614aaa565b82601f10614a7d57805160ff1916838001178555614aaa565b82800160010185558215614aaa579182015b82811115614aaa578251825591602001919060010190614a8f565b50612eab929150614af0565b828054828255906000526020600020908101928215614aaa5791602002820182811115614aaa578251825591602001919060010190614a8f565b5b80821115612eab5760008155600101614af1565b80356001600160a01b0381168114614b1c57600080fd5b919050565b600082601f830112614b3257600080fd5b813567ffffffffffffffff811115614b4c57614b4c615447565b604051614b63601f8301601f1916602001826153c2565b818152846020838601011115614b7857600080fd5b816020850160208301376000918101602001919091529392505050565b600060208284031215614ba757600080fd5b61220782614b05565b60008060408385031215614bc357600080fd5b614bcc83614b05565b9150614bda60208401614b05565b90509250929050565b600080600060608486031215614bf857600080fd5b614c0184614b05565b9250614c0f60208501614b05565b9150604084013590509250925092565b60008060008060808587031215614c3557600080fd5b614c3e85614b05565b93506020850135925060408501359150606085013567ffffffffffffffff811115614c6857600080fd5b614c7487828801614b21565b91505092959194509250565b60008060408385031215614c9357600080fd5b825167ffffffffffffffff80821115614cab57600080fd5b818501915085601f830112614cbf57600080fd5b8151602082821115614cd357614cd3615447565b8160051b9250604051614ce8828501826153c2565b82815281810185830185870184018b1015614d0257600080fd5b600096505b84871015614d25578051825260019690960195908301908301614d07565b505096015195979596505050505050565b600060208284031215614d4857600080fd5b5035919050565b600060208284031215614d6157600080fd5b5051919050565b60008060408385031215614d7b57600080fd5b82359150614bda60208401614b05565b600080600060608486031215614da057600080fd5b83359250602084013567ffffffffffffffff80821115614dbf57600080fd5b614dcb87838801614b21565b93506040860135915080821115614de157600080fd5b50614dee86828701614b21565b9150509250925092565b60008060408385031215614e0b57600080fd5b50508035926020909101359150565b600080600060608486031215614e2f57600080fd5b505081359360208301359350604090920135919050565b600060208284031215614e5857600080fd5b81356001600160e01b03198116811461220757600080fd5b600060208284031215614e8257600080fd5b813567ffffffffffffffff811115614e9957600080fd5b6133f084828501614b21565b60008060408385031215614eb857600080fd5b82359150602083013560028110614ece57600080fd5b809150509250929050565b600080600080600080600060e0888a031215614ef457600080fd5b873596506020880135955060408801359450614f1260608901614b05565b9350614f2060808901614b05565b9250614f2e60a08901614b05565b9150614f3c60c08901614b05565b905092959891949750929550565b60008151808452614f62816020860160208601615340565b601f01601f19169290920160200192915050565b60038110614f8657614f86615405565b9052565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614fc2816017850160208801615340565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614ff3816028840160208801615340565b01602801949350505050565b6001600160a01b03831681526040602082018190526000906133f090830184614f4a565b604080825283519082018190526000906020906060840190828701845b8281101561505c57815184529284019290840190600101615040565b50505092019290925292915050565b6020815260006122076020830184614f4a565b6040815260006150916040830185614f4a565b905060018060a01b03831660208301529392505050565b610180815260006150bd61018083018f614f4a565b82810360208401526150cf818f614f4a565b604084018e9052606084018d90526001600160a01b038c811660808601528b1660a085015260c084018a905260e084018990529150506004861061511557615115615405565b8561010083015284610120830152615131610140830185614f76565b826101608301529d9c50505050505050505050505050565b60608152600061515c6060830186614f4a565b60208301949094525060400152919050565b60c08152600061518160c0830189614f4a565b60208301979097525060408101949094526001600160a01b03929092166060840152608083015260a090910152919050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b83815282602082015260606040820152600061527e6060830184614f4a565b95945050505050565b8281526040602082015260006133f06040830184614f4a565b8481528360208201526080604082015260006152bf6080830185614f4a565b905082606083015295945050505050565b600082198211156152e3576152e36153ef565b500190565b60008261530557634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615615324576153246153ef565b500290565b60008282101561533b5761533b6153ef565b500390565b60005b8381101561535b578181015183820152602001615343565b8381111561536a576000848401525b50505050565b60008161537f5761537f6153ef565b506000190190565b600181811c9082168061539b57607f821691505b602082108114156153bc57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8201601f1916810167ffffffffffffffff811182821017156153e8576153e8615447565b6040525050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600060033d111561383e5760046000803e5060005160e01c90565b600060443d10156154865790565b6040516003193d81016004833e81513d67ffffffffffffffff81602484011181841117156154b657505050505090565b82850191508151818111156154ce5750505050505090565b843d87010160208285010111156154e85750505050505090565b6154f7602082860101876153c2565b50909594505050505056fe0036624afd4ac14e2ebe9b68a6ec0c6e4f6bf5bde2999a61e1fec085ca86697da264697066735822122013c9c206e85f9ecc945384ea5320864ceebb42dc9c2274fe105274a540b245e164736f6c63430008070033
Deployed ByteCode
0x6080604052600436106104095760003560e01c806394a3404511610213578063c415b95c11610123578063da742228116100ab578063f107cfcb1161007a578063f107cfcb14610d23578063f1096c2114610d43578063f224aa4f14610d63578063f36c8f5c14610d83578063fea3260014610db757600080fd5b8063da74222814610c9a578063dc1a091114610cba578063dff72dec14610cda578063e86dea4a14610d0c57600080fd5b8063d00a818f116100f2578063d00a818f14610c02578063d3e15bda14610c19578063d547741f14610c39578063d56d229d14610c59578063d9fffc8214610c7a57600080fd5b8063c415b95c14610b8e578063c7303c6114610baf578063ca05249f14610bc2578063ca15c87314610be257600080fd5b8063a87430ba116101a6578063b1df738311610175578063b1df738314610b0d578063b69ef8a814610b2d578063b7760c8f14610b42578063bf15276514610b62578063c0ef21ee14610b7757600080fd5b8063a87430ba14610a94578063a9a3aa8314610ac3578063aafa306114610ad6578063b12ea2a314610aed57600080fd5b8063a217fddf116101e2578063a217fddf14610a2c578063a70806f714610a41578063a740d68e14610a61578063a7ccabdf14610a7457600080fd5b806394a34045146109ac57806396858061146109cc57806398f17c96146109ec578063a02f3c7814610a0c57600080fd5b80633f4ba83a116103195780635ad1c6e5116102a157806379ced7471161027057806379ced74714610908578063835791251461091f5780638456cb591461093f5780639010d07c1461095457806391d148541461098c57600080fd5b80635ad1c6e5146108245780635c975abb14610844578063602bf2271461085c57806365f898e1146108e857600080fd5b80634d1ccb62116102e85780634d1ccb62146107875780634d31a6ed146107a75780634f09c912146107be57806350cde8ef146107d5578063572b6c05146107f557600080fd5b80633f4ba83a1461071257806349e03502146107275780634a4c560d146107475780634b8e7a341461076757600080fd5b8063248a9ca31161039c5780632f2ff15d1161036b5780632f2ff15d1461067257806336568abe146106925780633da01325146106b25780633dc9979e146106d25780633e11b5dc146106f257600080fd5b8063248a9ca3146105ca5780632bbd59ca146105fa5780632c8d6fd6146106325780632e1a7d4d1461065257600080fd5b806310f5ff3e116103d857806310f5ff3e146104e4578063190c69a2146105125780631b1456d61461053257806320d4f41b146105a957600080fd5b806301ffc9a71461044d578063049c067a1461048257806309b82cfd146104a45780630fc65407146104c457600080fd5b3661044857610416610dd7565b6001600160a01b03166000805160206155038339815191523460405161043e91815260200190565b60405180910390a2005b600080fd5b34801561045957600080fd5b5061046d610468366004614e46565b610de6565b60405190151581526020015b60405180910390f35b34801561048e57600080fd5b506104a261049d366004614d36565b610e11565b005b3480156104b057600080fd5b506104a26104bf366004614ea5565b610e73565b3480156104d057600080fd5b506104a26104df366004614ed9565b610f06565b3480156104f057600080fd5b506105046104ff366004614df8565b611117565b604051610479929190615023565b34801561051e57600080fd5b506104a261052d366004614b95565b6111bf565b34801561053e57600080fd5b5061057f61054d366004614d36565b61016b6020526000908152604090208054600182015460028301546003909301546001600160a01b0390921692909184565b604080516001600160a01b0390951685526020850193909352918301526060820152608001610479565b6105bc6105b7366004614c1f565b611266565b604051908152602001610479565b3480156105d657600080fd5b506105bc6105e5366004614d36565b600090815260c9602052604090206001015490565b34801561060657600080fd5b5061061a610615366004614d36565b611515565b6040516104799c9b9a999897969594939291906150a8565b34801561063e57600080fd5b5061046d61064d366004614bb0565b611697565b34801561065e57600080fd5b506104a261066d366004614d36565b6116e3565b34801561067e57600080fd5b506104a261068d366004614d68565b611846565b34801561069e57600080fd5b506104a26106ad366004614d68565b61186e565b3480156106be57600080fd5b506104a26106cd366004614b95565b6118fc565b3480156106de57600080fd5b506105bc6106ed366004614d36565b6119fe565b3480156106fe57600080fd5b5061050461070d366004614e1a565b611a20565b34801561071e57600080fd5b506104a2611b36565b34801561073357600080fd5b50610504610742366004614df8565b611bae565b34801561075357600080fd5b506104a2610762366004614b95565b611bfb565b34801561077357600080fd5b506104a2610782366004614d36565b611d35565b34801561079357600080fd5b506104a26107a2366004614d36565b611d98565b3480156107b357600080fd5b506105bc6101605481565b3480156107ca57600080fd5b506105bc6101625481565b3480156107e157600080fd5b506105bc6107f0366004614d36565b611dad565b34801561080157600080fd5b5061046d610810366004614b95565b6065546001600160a01b0391821691161490565b34801561083057600080fd5b5061050461083f366004614df8565b611dbe565b34801561085057600080fd5b5060335460ff1661046d565b34801561086857600080fd5b506108b4610877366004614d36565b61016a60205260009081526040902080546001820154600283015460038401546004909401546001600160a01b0390931693919290919060ff1685565b604080516001600160a01b03909616865260208601949094529284019190915260608301521515608082015260a001610479565b3480156108f457600080fd5b506104a2610903366004614b95565b611e0b565b34801561091457600080fd5b506105bc6101615481565b34801561092b57600080fd5b506104a261093a366004614d36565b611f44565b34801561094b57600080fd5b506104a261217b565b34801561096057600080fd5b5061097461096f366004614df8565b6121ef565b6040516001600160a01b039091168152602001610479565b34801561099857600080fd5b5061046d6109a7366004614d68565b61220e565b3480156109b857600080fd5b506104a26109c7366004614ea5565b612239565b3480156109d857600080fd5b506104a26109e7366004614d8b565b6122f3565b3480156109f857600080fd5b506105bc610a07366004614d36565b61243f565b348015610a1857600080fd5b506105bc610a27366004614d36565b612450565b348015610a3857600080fd5b506105bc600081565b348015610a4d57600080fd5b506104a2610a5c366004614b95565b612461565b6104a2610a6f366004614d36565b6124ea565b348015610a8057600080fd5b506104a2610a8f366004614b95565b6127ac565b348015610aa057600080fd5b50610ab4610aaf366004614b95565b612827565b6040516104799392919061525f565b6104a2610ad1366004614d36565b6128d3565b348015610ae257600080fd5b506105bc6101675481565b348015610af957600080fd5b50610504610b08366004614e1a565b612b52565b348015610b1957600080fd5b506104a2610b28366004614df8565b612c0c565b348015610b3957600080fd5b506105bc612e98565b348015610b4e57600080fd5b506104a2610b5d366004614d68565b612eaf565b348015610b6e57600080fd5b506105bc613016565b348015610b8357600080fd5b506105bc6101665481565b348015610b9a57600080fd5b5061015f54610974906001600160a01b031681565b6105bc610bbd366004614e70565b61304b565b348015610bce57600080fd5b50610504610bdd366004614df8565b613318565b348015610bee57600080fd5b506105bc610bfd366004614d36565b613365565b348015610c0e57600080fd5b506105bc6101655481565b348015610c2557600080fd5b506105bc610c34366004614d36565b61337c565b348015610c4557600080fd5b506104a2610c54366004614d68565b61338d565b348015610c6557600080fd5b5061016454610974906001600160a01b031681565b348015610c8657600080fd5b506105bc610c95366004614be3565b6133b5565b348015610ca657600080fd5b506104a2610cb5366004614b95565b6133f8565b348015610cc657600080fd5b5061046d610cd5366004614bb0565b61340f565b348015610ce657600080fd5b50610cfa610cf5366004614d36565b613418565b6040516104799695949392919061516e565b348015610d1857600080fd5b506105bc6101635481565b348015610d2f57600080fd5b506104a2610d3e366004614b95565b6134df565b348015610d4f57600080fd5b50610504610d5e366004614df8565b613568565b348015610d6f57600080fd5b506104a2610d7e366004614d36565b6135b5565b348015610d8f57600080fd5b506105bc7f35a7846a2a701fff6f9d61a46ebff5da578c5dcee8bdf361c569f9ea4ee6477181565b348015610dc357600080fd5b506105bc610dd2366004614d36565b6137f9565b6000610de1613816565b905090565b60006001600160e01b03198216635a05180f60e01b1480610e0b5750610e0b82613841565b92915050565b6000610e2481610e1f610dd7565b613876565b60408051808201909152600681526506060726060760d31b602082015260018311610e6b5760405162461bcd60e51b8152600401610e62919061506b565b60405180910390fd5b505061016755565b6000610e8181610e1f610dd7565b6001826001811115610e9557610e95615405565b1415610efa57610166548310156040518060400160405280600681526020016530303930303360d01b81525090610edf5760405162461bcd60e51b8152600401610e62919061506b565b50610161839055610ef16004846152e8565b61016655505050565b6101608390555b505050565b600054610100900460ff16610f215760005460ff1615610f25565b303b155b610f885760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610e62565b600054610100900460ff16158015610faa576000805461ffff19166101011790555b61271086111561100f5760405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608401610e62565b61101a6004896152e8565b610166556110266138da565b61102e613921565b611036613950565b61103f82613987565b610160889055610161889055610162879055610163869055610164805461015f80546001600160a01b0319166001600160a01b03888116919091179091556103846101655587166001600160a81b03199091161790556003610167556110a66000846139c2565b6110d07f35a7846a2a701fff6f9d61a46ebff5da578c5dcee8bdf361c569f9ea4ee64771846139c2565b6110fb7f35a7846a2a701fff6f9d61a46ebff5da578c5dcee8bdf361c569f9ea4ee6477160006139cc565b801561110d576000805461ff00191690555b5050505050505050565b60405163074a590760e01b81526004810183905260248101829052610172604482015260609060009073967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063074a5907906064015b60006040518083038186803b15801561117857600080fd5b505af415801561118c573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526111b49190810190614c80565b915091509250929050565b600061016c60006111ce610dd7565b6001600160a01b03908116825260208083019390935260409182016000908120918616815260049091019092529020805460ff1916600183600281111561121757611217615405565b0217905550806001600160a01b031661122e610dd7565b6001600160a01b03167fdc9ec6c8ca20e67e0cbecb5536d5c021046dd6a9a43b1b03d2b10235767d450260405160405180910390a350565b600083610165548110156040518060400160405280600681526020016530303230303760d01b815250906112ad5760405162461bcd60e51b8152600401610e62919061506b565b5060335460ff16156112d15760405162461bcd60e51b8152600401610e62906151b3565b8380600110156040518060400160405280600681526020016503030323031360d41b815250906113145760405162461bcd60e51b8152600401610e62919061506b565b50600261012d5414156113395760405162461bcd60e51b8152600401610e6290615228565b600261012d556001600160a01b038716600090815261016c60205260408120819060040181611366610dd7565b6001600160a01b0316815260208101919091526040016000205460ff169050600181600281111561139957611399615405565b14156040518060400160405280600681526020016518181c98181b60d11b815250906113d85760405162461bcd60e51b8152600401610e62919061506b565b5060006113ed6113e6610dd7565b8b8a6133b5565b9050600282600281111561140357611403615405565b146114c55760018814156114655760408051808201909152600681526530303130303960d01b60208201523482111561144f5760405162461bcd60e51b8152600401610e62919061506b565b506101665461145e9034615329565b92506114c5565b60408051808201909152600681526503030313031360d41b6020820152348211156114a35760405162461bcd60e51b8152600401610e62919061506b565b506101665481116114b457346114c2565b610166546114c29034615329565b92505b60006114dc6114d2610dd7565b8c868d8d8d613a17565b905083158015906114ef57506101665482115b15611501576115018b61016654613d5f565b600161012d559a9950505050505050505050565b6101686020526000908152604090208054819061153190615387565b80601f016020809104026020016040519081016040528092919081815260200182805461155d90615387565b80156115aa5780601f1061157f576101008083540402835291602001916115aa565b820191906000526020600020905b81548152906001019060200180831161158d57829003601f168201915b5050505050908060010180546115bf90615387565b80601f01602080910402602001604051908101604052809291908181526020018280546115eb90615387565b80156116385780601f1061160d57610100808354040283529160200191611638565b820191906000526020600020905b81548152906001019060200180831161161b57829003601f168201915b50505060028401546003850154600486015460058701546007880154600889015460098a0154600a8b0154600b8c0154600c909c01549a9b979a9699506001600160a01b03958616985093909416959194909360ff908116939216908c565b600060015b6001600160a01b03808416600090815261016c60209081526040808320938816835260049093019052205460ff1660028111156116db576116db615405565b149392505050565b60335460ff16156117065760405162461bcd60e51b8152600401610e62906151b3565b600261012d54141561172a5760405162461bcd60e51b8152600401610e6290615228565b600261012d5561016d600061173d610dd7565b6001600160a01b03166001600160a01b03168152602001908152602001600020548111156040518060400160405280600681526020016530303930303160d01b8152509061179e5760405162461bcd60e51b8152600401610e62919061506b565b508061016d60006117ad610dd7565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008282546117dc9190615329565b909155506117f390506117ed610dd7565b82613d5f565b6117fb610dd7565b6001600160a01b03167f884edad9ce6fa2440d8a54cc123490eb96d2768479d49ff9c7366125a94243648260405161183591815260200190565b60405180910390a250600161012d55565b600082815260c9602052604090206001015461186481610e1f610dd7565b610f018383613e78565b611876610dd7565b6001600160a01b0316816001600160a01b0316146118ee5760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610e62565b6118f88282613e9a565b5050565b806001600160a01b031661190e610dd7565b6001600160a01b031614156040518060400160405280600681526020016503030393031360d41b815250906119565760405162461bcd60e51b8152600401610e62919061506b565b50600161016c6000611966610dd7565b6001600160a01b03908116825260208083019390935260409182016000908120918616815260049091019092529020805460ff191660018360028111156119af576119af615405565b0217905550806001600160a01b03166119c6610dd7565b6001600160a01b03167fc931b7e6f18c2a39bcd066690c46c7ba85186501c524faa844ac2c7213d1732560405160405180910390a350565b61016f8181548110611a0f57600080fd5b600091825260209091200154905081565b600083815261016960209081526040808320600301548151808301909252600682526530303430303160d01b92820192909252606092918691906001600160a01b0316611a805760405162461bcd60e51b8152600401610e62919061506b565b506000868152610169602052604090819020905163074a590760e01b8152600480820188905260248201879052909101604482015273967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063074a5907906064015b60006040518083038186803b158015611aed57600080fd5b505af4158015611b01573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611b299190810190614c80565b9250925050935093915050565b611b4360006109a7610dd7565b611ba45760405162461bcd60e51b815260206004820152602c60248201527f4d75737420686176652044454641554c545f41444d494e5f524f4c4520726f6c60448201526b6520746f20756e706175736560a01b6064820152608401610e62565b611bac613ebc565b565b60405163074a590760e01b81526004810183905260248101829052610170604482015260609060009073967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063074a590790606401611160565b600161016c6000611c0a610dd7565b6001600160a01b039081168252602080830193909352604091820160009081209186168152600490910190925290205460ff166002811115611c4e57611c4e615405565b14156040518060400160405280600681526020016518181c98181b60d11b81525090611c8d5760405162461bcd60e51b8152600401610e62919061506b565b50600261016c6000611c9d610dd7565b6001600160a01b03908116825260208083019390935260409182016000908120918616815260049091019092529020805460ff19166001836002811115611ce657611ce6615405565b0217905550806001600160a01b0316611cfd610dd7565b6001600160a01b03167f6661a7108aecd07864384529117d96c319c1163e3010c01390f6b704726e07de60405160405180910390a350565b6000611d4381610e1f610dd7565b611d4e82600461530a565b61016154116040518060400160405280600681526020016530303930303760d01b81525090611d905760405162461bcd60e51b8152600401610e62919061506b565b505061016655565b6000611da681610e1f610dd7565b5061016255565b6101708181548110611a0f57600080fd5b60405163074a590760e01b8152600481018390526024810182905261016f604482015260609060009073967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063074a590790606401611160565b600161016c6000611e1a610dd7565b6001600160a01b039081168252602080830193909352604091820160009081209186168152600490910190925290205460ff166002811115611e5e57611e5e615405565b146040518060400160405280600681526020016530303930313160d01b81525090611e9c5760405162461bcd60e51b8152600401610e62919061506b565b50600061016c6000611eac610dd7565b6001600160a01b03908116825260208083019390935260409182016000908120918616815260049091019092529020805460ff19166001836002811115611ef557611ef5615405565b0217905550806001600160a01b0316611f0c610dd7565b6001600160a01b03167f35672c674c91f8b0025681a1c8d11a4ca6583e909553290ecfb3d6578faa8bce60405160405180910390a350565b60335460ff1615611f675760405162461bcd60e51b8152600401610e62906151b3565b60008181526101686020908152604091829020600401548251808401909352600683526530303230303360d01b918301919091528291906001600160a01b0316611fc45760405162461bcd60e51b8152600401610e62919061506b565b5081611fce610dd7565b60008281526101686020908152604091829020600401548251808401909352600683526518181918181960d11b9183019190915290916001600160a01b0391821691161461202f5760405162461bcd60e51b8152600401610e62919061506b565b506000838152610168602052604090819020905163dae5e84360e01b81526004810182905273967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063dae5e8439060240160006040518083038186803b15801561208b57600080fd5b505af415801561209f573d6000803e3d6000fd5b50505050806002015461016d60006120b5610dd7565b6001600160a01b03166001600160a01b0316815260200190815260200160002060008282546120e491906152d0565b909155506120f29050610dd7565b6001600160a01b0316600080516020615503833981519152826002015460405161211e91815260200190565b60405180910390a261212e610dd7565b6001600160a01b0316847f205302058bf3afb5ece22c5535eab6ea487294c8339c2a194fc6476219badbcd836002015460405161216d91815260200190565b60405180910390a350505050565b61218860006109a7610dd7565b6121e75760405162461bcd60e51b815260206004820152602a60248201527f4d75737420686176652044454641554c545f41444d494e5f524f4c4520726f6c6044820152696520746f20706175736560b01b6064820152608401610e62565b611bac613f55565b600082815260fb602052604081206122079083613fae565b9392505050565b600091825260c9602090815260408084206001600160a01b0393909316845291905290205460ff1690565b600181600181111561224d5761224d615405565b14156122c757610161548210156040518060400160405280600681526020016530303930303360d01b815250906122975760405162461bcd60e51b8152600401610e62919061506b565b508161016c60006122a6610dd7565b6001600160a01b031681526020810191909152604001600020600101555050565b8161016c60006122d5610dd7565b6001600160a01b031681526020810191909152604001600020555050565b60008381526101686020908152604091829020600401548251808401909352600683526530303230303360d01b918301919091528491906001600160a01b03166123505760405162461bcd60e51b8152600401610e62919061506b565b50612359610dd7565b60008581526101686020908152604091829020600501548251808401909352600683526518181918181960d11b9183019190915290916001600160a01b039182169116146123ba5760405162461bcd60e51b8152600401610e62919061506b565b506000806123c9868686613fba565b915091506123d5610dd7565b60008781526101686020526040908190206004015490516001600160a01b03928316929091169088907fff7a1ecaac27eed4c6bd348a8dd8d05ed71190db5b77e89f881fa74087429bc99061242f908a9088908890615149565b60405180910390a4505050505050565b6101728181548110611a0f57600080fd5b61016e8181548110611a0f57600080fd5b600161016c6000612470610dd7565b6001600160a01b03908116825260208083019390935260409182016000908120918616815260039091019092529020556124a8610dd7565b6001600160a01b0316816001600160a01b03167fbccc71dc7842b86291138666aa18e133ee6d41aa71e6d7c650debad1a057663560405160405180910390a350565b60008181526101686020908152604091829020600401548251808401909352600683526530303230303360d01b918301919091528291906001600160a01b03166125475760405162461bcd60e51b8152600401610e62919061506b565b50600082815261016860205260409081902090516301f2553b60e11b81526004810182905273967d0521f20a428d1fe0604f8fc2db88ab7fa1de906303e4aa769060240160006040518083038186803b1580156125a357600080fd5b505af41580156125b7573d6000803e3d6000fd5b50505050600034116040518060400160405280600681526020016530303330303560d01b815250906125fc5760405162461bcd60e51b8152600401610e62919061506b565b50600073967d0521f20a428d1fe0604f8fc2db88ab7fa1de63feac0f7061016a86612625610dd7565b6040516001600160e01b031960e086901b168152600481019390935260248301919091526001600160a01b0316604482015234606482015260840160206040518083038186803b15801561267857600080fd5b505af415801561268c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126b09190614d4f565b60405163aebe518360e01b8152600481018490526024810182905234604482015290915073967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063aebe51839060640160006040518083038186803b15801561270b57600080fd5b505af415801561271f573d6000803e3d6000fd5b505061017180546001810182556000919091527f42b680591beb20d1de0d4ca368d3f10acc6db07bc74b68a9681655fb351b903901839055506127629050610dd7565b6001600160a01b031681857fb8a61f3258608a2f1af184e4640b08e6cd69126e3c563d30b6348ebfb51558843460405161279e91815260200190565b60405180910390a450505050565b60006127ba81610e1f610dd7565b6101645460408051808201909152600681526506060726060760d31b6020820152906001600160a01b03166128025760405162461bcd60e51b8152600401610e62919061506b565b505061016480546001600160a01b0319166001600160a01b0392909216919091179055565b61016c602052600090815260409020805460018201546002830180549293919261285090615387565b80601f016020809104026020016040519081016040528092919081815260200182805461287c90615387565b80156128c95780601f1061289e576101008083540402835291602001916128c9565b820191906000526020600020905b8154815290600101906020018083116128ac57829003601f168201915b5050505050905083565b60008181526101696020908152604091829020600301548251808401909352600683526530303430303160d01b918301919091528291906001600160a01b03166129305760405162461bcd60e51b8152600401610e62919061506b565b50600082815261016960209081526040918290208251808401909352600683526530303330303560d01b9183019190915290346129805760405162461bcd60e51b8152600401610e62919061506b565b50600073967d0521f20a428d1fe0604f8fc2db88ab7fa1de63cdaea01361016b866129a9610dd7565b6040516001600160e01b031960e086901b168152600481019390935260248301919091526001600160a01b0316604482015234606482015260840160206040518083038186803b1580156129fc57600080fd5b505af4158015612a10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a349190614d4f565b604051600162df932b60e01b03198152600481018490526024810182905234604482015290915073967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063ff206cd59060640160006040518083038186803b158015612a9257600080fd5b505af4158015612aa6573d6000803e3d6000fd5b50506101728054600181019091557fed95d52ae313e6be6d8c8f9945923a6497c37269ba35d5e3535b758e47227cfc01839055505060038201546001600160a01b0316600090815261016d602052604081208054349290612b089084906152d0565b90915550612b169050610dd7565b6001600160a01b031681857fa7b9de4cae04f62223d95aba2f4ecdd05879f655bab52b8505b696ecf05f72743460405161279e91815260200190565b600083815261016860209081526040808320600401548151808301909252600682526530303230303360d01b92820192909252606092918691906001600160a01b0316612bb25760405162461bcd60e51b8152600401610e62919061506b565b506000868152610168602052604090819020905163074a590760e01b815260048101879052602481018690526006909101604482015273967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063074a590790606401611ad5565b60008281526101686020908152604091829020600401548251808401909352600683526530303230303360d01b918301919091528391906001600160a01b0316612c695760405162461bcd60e51b8152600401610e62919061506b565b5082612c73610dd7565b60008281526101686020908152604091829020600401548251808401909352600683526518181918181960d11b9183019190915290916001600160a01b03918216911614612cd45760405162461bcd60e51b8152600401610e62919061506b565b508280600210156040518060400160405280600681526020016530303230313160d01b81525090612d185760405162461bcd60e51b8152600401610e62919061506b565b5060036000868152610168602052604090206009015460ff166003811115612d4257612d42615405565b146040518060400160405280600681526020016530303230303960d01b81525090612d805760405162461bcd60e51b8152600401610e62919061506b565b50600085815261016860205260408120600b015460ff166002811115612da857612da8615405565b146040518060400160405280600681526020016518181918189960d11b81525090612de65760405162461bcd60e51b8152600401610e62919061506b565b50836002811115612df957612df9615405565b600086815261016860205260409020600b01805460ff19166001836002811115612e2557612e25615405565b02179055506000858152610168602052604090819020600581015460049091015491516001600160a01b03918216929091169087907fba2e4b16cb7f6bbe19c7a1146539a78ed1db3efbb3dd80d6c65f0ba1d840345990612e899089815260200190565b60405180910390a45050505050565b600080612ea781610e1f610dd7565b4791505b5090565b60335460ff1615612ed25760405162461bcd60e51b8152600401610e62906151b3565b600261012d541415612ef65760405162461bcd60e51b8152600401610e6290615228565b600261012d5561016d6000612f09610dd7565b6001600160a01b03166001600160a01b03168152602001908152602001600020548211156040518060400160405280600681526020016530303930303160d01b81525090612f6a5760405162461bcd60e51b8152600401610e62919061506b565b508161016d6000612f79610dd7565b6001600160a01b03166001600160a01b031681526020019081526020016000206000828254612fa89190615329565b90915550612fb890508183613d5f565b806001600160a01b0316612fca610dd7565b6001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8460405161300491815260200190565b60405180910390a35050600161012d55565b600061016d6000613025610dd7565b6001600160a01b03166001600160a01b0316815260200190815260200160002054905090565b600061305960335460ff1690565b156130765760405162461bcd60e51b8152600401610e62906151b3565b600261012d54141561309a5760405162461bcd60e51b8152600401610e6290615228565b600261012d556101625460408051808201909152600681526530303430303360d01b6020820152903410156130e25760405162461bcd60e51b8152600401610e62919061506b565b50604080516000808252602082019092529073967d0521f20a428d1fe0604f8fc2db88ab7fa1de63b0b67fa885613117610dd7565b6040518363ffffffff1660e01b815260040161313492919061507e565b60206040518083038186803b15801561314c57600080fd5b505af4158015613160573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131849190614d4f565b90506040518060e00160405280858152602001348152602001600081526020016131ac610dd7565b6001600160a01b031681526020808201859052426040808401919091526000606090930183905284835261016982529091208251805191926131f392849290910190614a36565b5060208281015160018301556040830151600283015560608301516003830180546001600160a01b0319166001600160a01b03909216919091179055608083015180516132469260048501920190614ab6565b5060a0820151600582015560c0909101516006909101556101708054600181019091557f88e1afb22f13be7fec203799fd189c3b9471c5b75e2b22a6d5efec11c7f392550181905561015f546001600160a01b0316600090815261016d6020526040812080543492906132ba9084906152d0565b909155506132c89050610dd7565b6001600160a01b0316817f3c860076dbb2474109ea1afc5f287966581081acee08ee7ec1d39cfdd52a07403487604051613303929190615287565b60405180910390a3600161012d559392505050565b60405163074a590760e01b8152600481018390526024810182905261016e604482015260609060009073967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063074a590790606401611160565b600081815260fb60205260408120610e0b906142e6565b6101718181548110611a0f57600080fd5b600082815260c960205260409020600101546133ab81610e1f610dd7565b610f018383613e9a565b60006133c1848461340f565b156133ce57506000612207565b60018214156133e7576133e0836142f0565b9050612207565b6133f08361433a565b949350505050565b600061340681610e1f610dd7565b6118f88261437e565b6000600261169c565b6101696020526000908152604090208054819061343490615387565b80601f016020809104026020016040519081016040528092919081815260200182805461346090615387565b80156134ad5780601f10613482576101008083540402835291602001916134ad565b820191906000526020600020905b81548152906001019060200180831161349057829003601f168201915b5050506001840154600285015460038601546005870154600690970154959692959194506001600160a01b0316925086565b600061016c60006134ee610dd7565b6001600160a01b0390811682526020808301939093526040918201600090812091861681526003909101909252902055613526610dd7565b6001600160a01b0316816001600160a01b03167fe5dcccfe8e7890c6d4aa94d44c3b409fb6f023337f29c3308077c0c4068192c460405160405180910390a350565b60405163074a590760e01b81526004810183905260248101829052610171604482015260609060009073967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063074a590790606401611160565b60335460ff16156135d85760405162461bcd60e51b8152600401610e62906151b3565b600081815261016a6020908152604091829020548251808401909352600683526530303330303360d01b918301919091528291906001600160a01b03166136325760405162461bcd60e51b8152600401610e62919061506b565b508161363c610dd7565b600082815261016a6020908152604091829020548251808401909352600683526518181998181960d11b9183019190915290916001600160a01b0391821691161461369a5760405162461bcd60e51b8152600401610e62919061506b565b50600083815261016a60209081526040808320600381015484526101689092529182902091516318b5b06760e21b8152600481018290526024810183905290919073967d0521f20a428d1fe0604f8fc2db88ab7fa1de906362d6c19c9060440160006040518083038186803b15801561371257600080fd5b505af4158015613726573d6000803e3d6000fd5b50505050816001015461016d600061373c610dd7565b6001600160a01b03166001600160a01b03168152602001908152602001600020600082825461376b91906152d0565b909155506137799050610dd7565b6001600160a01b031660008051602061550383398151915283600101546040516137a591815260200190565b60405180910390a26137b5610dd7565b6001600160a01b03168583600301547f8827140ed7e0aee657f6d8ab3d65b02d30022ed333e284958313db49217e7c3e8560010154604051612e8991815260200190565b6000600182141561380d5750506101615490565b50506101605490565b6065546000906001600160a01b0316331415613839575060131936013560601c90565b503390565b90565b60006001600160e01b03198216637965db0b60e01b1480610e0b57506301ffc9a760e01b6001600160e01b0319831614610e0b565b613880828261220e565b6118f857613898816001600160a01b031660146143c7565b6138a38360206143c7565b6040516020016138b4929190614f8a565b60408051601f198184030181529082905262461bcd60e51b8252610e629160040161506b565b600054610100900460ff166139015760405162461bcd60e51b8152600401610e62906151dd565b613909614563565b613911614563565b613919614563565b611bac614563565b600054610100900460ff166139485760405162461bcd60e51b8152600401610e62906151dd565b611bac61458a565b600054610100900460ff166139775760405162461bcd60e51b8152600401610e62906151dd565b61397f614563565b611bac6145b9565b600054610100900460ff166139ae5760405162461bcd60e51b8152600401610e62906151dd565b6139b6614563565b6139bf8161437e565b50565b6118f88282613e78565b600082815260c96020526040808220600101805490849055905190918391839186917fbd79b86ffe0ab8e8776151514217cd7cacd52c909f66475c3af44e129f0b00ff9190a4505050565b60008073967d0521f20a428d1fe0604f8fc2db88ab7fa1de63b0b67fa8848a6040518363ffffffff1660e01b8152600401613a5392919061507e565b60206040518083038186803b158015613a6b57600080fd5b505af4158015613a7f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613aa39190614d4f565b60408051600080825260208201909252919250613ac087426152d0565b9050604051806101a001604052808681526020016040518060200160405280600081525081526020018981526020018981526020018b6001600160a01b031681526020018a6001600160a01b0316815260200183815260200142815260200182815260200160006003811115613b3857613b38615405565b81526020016000815260200160006002811115613b5757613b57615405565b815260209081018890526000858152610168825260409020825180519192613b8492849290910190614a36565b506020828101518051613b9d9260018501920190614a36565b50604082015160028201556060820151600382015560808201516004820180546001600160a01b039283166001600160a01b03199182161790915560a084015160058401805491909316911617905560c08201518051613c07916006840191602090910190614ab6565b5060e08201516007820155610100820151600882015561012082015160098201805460ff19166001836003811115613c4157613c41615405565b0217905550610140820151600a820155610160820151600b8201805460ff19166001836002811115613c7557613c75615405565b02179055506101809190910151600c9091015585613cc85761016e80546001810182556000919091527ff82fbbf6ecba5c6bca8ffdb165c351ca78f1011f756f9b1202212482fd7d831301839055613cff565b61016f80546001810182556000919091527f47d2f800c57de5c44dff408e225b320f1ea140ca87907f0726fd6049ee5595d7018390555b896001600160a01b0316838a6001600160a01b03167fdda647d1e751b8df0a785cd75e0c734774777ff91018aa17aa79bf515f8511558b858a8c604051613d4994939291906152a0565b60405180910390a4509098975050505050505050565b80471015613daf5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610e62565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613dfc576040519150601f19603f3d011682016040523d82523d6000602084013e613e01565b606091505b5050905080610f015760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610e62565b613e8282826145ec565b600082815260fb60205260409020610f019082614673565b613ea48282614688565b600082815260fb60205260409020610f01908261470d565b60335460ff16613f055760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610e62565b6033805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa613f38610dd7565b6040516001600160a01b03909116815260200160405180910390a1565b60335460ff1615613f785760405162461bcd60e51b8152600401610e62906151b3565b6033805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613f38610dd7565b60006122078383614722565b60008381526101686020526040808220905163e7f8899d60e01b81526004810182905282919073967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063e7f8899d9060240160006040518083038186803b15801561401757600080fd5b505af415801561402b573d6000803e3d6000fd5b50506101645460009250600160a01b900460ff1615905061406157600482015461405e906001600160a01b03168661474c565b90505b604051633f46f90d60e21b815273967d0521f20a428d1fe0604f8fc2db88ab7fa1de9063fd1be4349061409c90859085908b9060040161525f565b60006040518083038186803b1580156140b457600080fd5b505af41580156140c8573d6000803e3d6000fd5b505050506000806140e184600201548560030154614823565b91509150836002015460001415801561413e57506004840154614119906001600160a01b031661410f610dd7565b86600c01546133b5565b61016754614127919061530a565b8460020154856003015461413b9190615329565b10155b156142435760006141506002846152e8565b905061415c82826152d0565b61016d6000614169610dd7565b6001600160a01b03166001600160a01b03168152602001908152602001600020600082825461419891906152d0565b909155505060048501546001600160a01b0316600090815261016d6020526040812080548392906141ca9084906152d0565b909155506141d89050610dd7565b6001600160a01b03166000805160206155038339815191526141fa84846152d0565b60405190815260200160405180910390a260048501546040518281526001600160a01b03909116906000805160206155038339815191529060200160405180910390a2506142cb565b61424d81836152d0565b61016d600061425a610dd7565b6001600160a01b03166001600160a01b03168152602001908152602001600020600082825461428991906152d0565b909155506142979050610dd7565b6001600160a01b03166000805160206155038339815191526142b983856152d0565b60405190815260200160405180910390a25b826142d682846152d0565b9550955050505050935093915050565b6000610e0b825490565b6001600160a01b038116600090815261016c602052604081206001015461431a5750506101615490565b506001600160a01b0316600090815261016c602052604090206001015490565b6001600160a01b038116600090815261016c60205260408120546143615750506101605490565b506001600160a01b0316600090815261016c602052604090205490565b600054610100900460ff166143a55760405162461bcd60e51b8152600401610e62906151dd565b606580546001600160a01b0319166001600160a01b0392909216919091179055565b606060006143d683600261530a565b6143e19060026152d0565b67ffffffffffffffff8111156143f9576143f9615447565b6040519080825280601f01601f191660200182016040528015614423576020820181803683370190505b509050600360fc1b8160008151811061443e5761443e615431565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061446d5761446d615431565b60200101906001600160f81b031916908160001a905350600061449184600261530a565b61449c9060016152d0565b90505b6001811115614514576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106144d0576144d0615431565b1a60f81b8282815181106144e6576144e6615431565b60200101906001600160f81b031916908160001a90535060049490941c9361450d81615370565b905061449f565b5083156122075760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610e62565b600054610100900460ff16611bac5760405162461bcd60e51b8152600401610e62906151dd565b600054610100900460ff166145b15760405162461bcd60e51b8152600401610e62906151dd565b600161012d55565b600054610100900460ff166145e05760405162461bcd60e51b8152600401610e62906151dd565b6033805460ff19169055565b6145f6828261220e565b6118f857600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561462f610dd7565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000612207836001600160a01b0384166148f4565b614692828261220e565b156118f857600082815260c9602090815260408083206001600160a01b03851684529091529020805460ff191690556146c9610dd7565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b6000612207836001600160a01b038416614943565b600082600001828154811061473957614739615431565b9060005260206000200154905092915050565b6101645460405163d0def52160e01b81526000916001600160a01b03169063d0def521906147809086908690600401614fff565b602060405180830381600087803b15801561479a57600080fd5b505af19250505080156147ca575060408051601f3d908101601f191682019092526147c791810190614d4f565b60015b61481c576147d661545d565b806308c379a0141561481057506147eb615478565b806147f65750614812565b8060405162461bcd60e51b8152600401610e62919061506b565b505b3d6000803e3d6000fd5b9050610e0b565b600080806127106bffffffffffffffffffffffff166101635486866148489190615329565b614852919061530a565b61485c91906152e8565b905060006127106bffffffffffffffffffffffff166101635487614880919061530a565b61488a91906152e8565b905061489681836152d0565b61015f546001600160a01b0316600090815261016d6020526040812080549091906148c29084906152d0565b909155508290506148d38787615329565b6148dd9190615329565b6148e78288615329565b9350935050509250929050565b600081815260018301602052604081205461493b57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610e0b565b506000610e0b565b60008181526001830160205260408120548015614a2c576000614967600183615329565b855490915060009061497b90600190615329565b90508181146149e057600086600001828154811061499b5761499b615431565b90600052602060002001549050808760000184815481106149be576149be615431565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806149f1576149f161541b565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610e0b565b6000915050610e0b565b828054614a4290615387565b90600052602060002090601f016020900481019282614a645760008555614aaa565b82601f10614a7d57805160ff1916838001178555614aaa565b82800160010185558215614aaa579182015b82811115614aaa578251825591602001919060010190614a8f565b50612eab929150614af0565b828054828255906000526020600020908101928215614aaa5791602002820182811115614aaa578251825591602001919060010190614a8f565b5b80821115612eab5760008155600101614af1565b80356001600160a01b0381168114614b1c57600080fd5b919050565b600082601f830112614b3257600080fd5b813567ffffffffffffffff811115614b4c57614b4c615447565b604051614b63601f8301601f1916602001826153c2565b818152846020838601011115614b7857600080fd5b816020850160208301376000918101602001919091529392505050565b600060208284031215614ba757600080fd5b61220782614b05565b60008060408385031215614bc357600080fd5b614bcc83614b05565b9150614bda60208401614b05565b90509250929050565b600080600060608486031215614bf857600080fd5b614c0184614b05565b9250614c0f60208501614b05565b9150604084013590509250925092565b60008060008060808587031215614c3557600080fd5b614c3e85614b05565b93506020850135925060408501359150606085013567ffffffffffffffff811115614c6857600080fd5b614c7487828801614b21565b91505092959194509250565b60008060408385031215614c9357600080fd5b825167ffffffffffffffff80821115614cab57600080fd5b818501915085601f830112614cbf57600080fd5b8151602082821115614cd357614cd3615447565b8160051b9250604051614ce8828501826153c2565b82815281810185830185870184018b1015614d0257600080fd5b600096505b84871015614d25578051825260019690960195908301908301614d07565b505096015195979596505050505050565b600060208284031215614d4857600080fd5b5035919050565b600060208284031215614d6157600080fd5b5051919050565b60008060408385031215614d7b57600080fd5b82359150614bda60208401614b05565b600080600060608486031215614da057600080fd5b83359250602084013567ffffffffffffffff80821115614dbf57600080fd5b614dcb87838801614b21565b93506040860135915080821115614de157600080fd5b50614dee86828701614b21565b9150509250925092565b60008060408385031215614e0b57600080fd5b50508035926020909101359150565b600080600060608486031215614e2f57600080fd5b505081359360208301359350604090920135919050565b600060208284031215614e5857600080fd5b81356001600160e01b03198116811461220757600080fd5b600060208284031215614e8257600080fd5b813567ffffffffffffffff811115614e9957600080fd5b6133f084828501614b21565b60008060408385031215614eb857600080fd5b82359150602083013560028110614ece57600080fd5b809150509250929050565b600080600080600080600060e0888a031215614ef457600080fd5b873596506020880135955060408801359450614f1260608901614b05565b9350614f2060808901614b05565b9250614f2e60a08901614b05565b9150614f3c60c08901614b05565b905092959891949750929550565b60008151808452614f62816020860160208601615340565b601f01601f19169290920160200192915050565b60038110614f8657614f86615405565b9052565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351614fc2816017850160208801615340565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351614ff3816028840160208801615340565b01602801949350505050565b6001600160a01b03831681526040602082018190526000906133f090830184614f4a565b604080825283519082018190526000906020906060840190828701845b8281101561505c57815184529284019290840190600101615040565b50505092019290925292915050565b6020815260006122076020830184614f4a565b6040815260006150916040830185614f4a565b905060018060a01b03831660208301529392505050565b610180815260006150bd61018083018f614f4a565b82810360208401526150cf818f614f4a565b604084018e9052606084018d90526001600160a01b038c811660808601528b1660a085015260c084018a905260e084018990529150506004861061511557615115615405565b8561010083015284610120830152615131610140830185614f76565b826101608301529d9c50505050505050505050505050565b60608152600061515c6060830186614f4a565b60208301949094525060400152919050565b60c08152600061518160c0830189614f4a565b60208301979097525060408101949094526001600160a01b03929092166060840152608083015260a090910152919050565b60208082526010908201526f14185d5cd8589b194e881c185d5cd95960821b604082015260600190565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b83815282602082015260606040820152600061527e6060830184614f4a565b95945050505050565b8281526040602082015260006133f06040830184614f4a565b8481528360208201526080604082015260006152bf6080830185614f4a565b905082606083015295945050505050565b600082198211156152e3576152e36153ef565b500190565b60008261530557634e487b7160e01b600052601260045260246000fd5b500490565b6000816000190483118215151615615324576153246153ef565b500290565b60008282101561533b5761533b6153ef565b500390565b60005b8381101561535b578181015183820152602001615343565b8381111561536a576000848401525b50505050565b60008161537f5761537f6153ef565b506000190190565b600181811c9082168061539b57607f821691505b602082108114156153bc57634e487b7160e01b600052602260045260246000fd5b50919050565b601f8201601f1916810167ffffffffffffffff811182821017156153e8576153e8615447565b6040525050565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b600060033d111561383e5760046000803e5060005160e01c90565b600060443d10156154865790565b6040516003193d81016004833e81513d67ffffffffffffffff81602484011181841117156154b657505050505090565b82850191508151818111156154ce5750505050505090565b843d87010160208285010111156154e85750505050505090565b6154f7602082860101876153c2565b50909594505050505056fe0036624afd4ac14e2ebe9b68a6ec0c6e4f6bf5bde2999a61e1fec085ca86697da264697066735822122013c9c206e85f9ecc945384ea5320864ceebb42dc9c2274fe105274a540b245e164736f6c63430008070033