Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Initialize | 15417528 | 907 days ago | IN | 0 ETH | 0.00321249 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
Ethbox
Compiler Version
v0.8.16+commit.07a7930e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: Unlicensed pragma solidity 0.8.16; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-upgradeable/proxy/utils/UUPSUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "./strings.sol"; import "./base64.sol"; import "./EthboxStructs.sol"; abstract contract EthboxMetadata { function buildMetadata( address owner, EthboxStructs.UnpackedMessage[] memory messages, uint256 ethboxSize, uint256 ethboxDrip ) public view virtual returns (string memory data); } contract Ethbox is ERC165, IERC721, IERC721Metadata, Initializable, OwnableUpgradeable, ReentrancyGuardUpgradeable, UUPSUpgradeable { using Strings for uint256; using strings for *; //--ERC721 Variables--// string private _name; string private _symbol; EthboxMetadata public metadata; /// @notice Mapping to keep track of whether an address has minted an ethbox. /// @dev Using a bool rather than number because an address can only mint one. mapping(address => bool) public minted; //--Messaging Variables--// /// @notice The default size an ethbox is set to at mint /// @dev This size can be increased for a fee, see { expandEthboxSize } uint256 public constant defaultEthboxSize = 3; /// @notice The default time it will take for a message to "expire". For example, /// someone sends a 1 ETH message, in four weeks all that ETH, minus our fee /// will be claimable by the ethbox owner. /// @dev This can be changed by ethbox owners, when their ethbox is empty. /// This change only affects their ethbox. See { changeEthboxDurationTime } uint256 public constant defaultDripTime = 4 weeks; /// @notice Max message length somebody can send, this will not change. uint256 public constant maxMessageLen = 141; /// @notice The initial cost of increasing ethbox size. /// @dev Settable by contract owner here { setSizeIncreaseFee } uint256 public sizeIncreaseFee; /// @notice The BPS increase in fee depending on how many slots the user /// already has /// @dev Settable by contract owner here { setSizeIncreaseFeeBPS } uint256 public sizeIncreaseFeeBPS; /// @notice The BPS fee charged by contract owner per message. /// @dev Settable by contract owner here { setMessageFeeBPS } uint256 public messageFeeBPS; /// @notice The recipient of these fees. /// @dev Settable by contract owner here { setMessageFeeRecipient } address public messageFeeRecipient; /// @notice Mapping to keep track of an address' messages. /// @dev See { EthboxStructs.Message } /// Note: address does not have to mint ethbox to recieve messages. /// An unminted ethbox with messages will claim all value upong minting. mapping(address => EthboxStructs.Message[]) public ethboxMessages; /// @notice Stores ethbox specific information in an address => uint256 mapping /// @dev Bits Layout: /// - [0..159] `payoutRecipient` /// - [160..223] `drip (timestamp)` /// - [224] `isLocked` /// - [225 - 232] `size` /// - [233..255] Currently unused /// See { packEthboxInfo } and { unpackEthboxInfo } for implementation. mapping(address => uint256) packedEthboxInfo; /// @notice Mapping to keep track of remaining eth to be claimed from bumped messages /// An unminted ethbox with messages will claim all value upong minting. mapping(address => uint256) public bumpedClaimValue; //--Packing Constants--// /// @dev Bit position of drip timestamp in { packedEthboxInfo } /// see { unpackEthboxDrip } uint256 private constant BITPOS_ETHBOX_DRIP_TIMESTAMP = 160; /// @dev Bit position of ethbox locked boolean in { packedEthboxInfo } /// see { unpackEthboxLocked } uint256 private constant BITPOS_ETHBOX_LOCKED = 224; /// @dev Bit position of ethbox size in { packedEthboxInfo } /// see { unpackEthboxSize } uint256 private constant BITPOS_ETHBOX_SIZE = 225; // Packed message data bit positions. See { EthboxStructs.Message.data } // See { packMessageData } and { unpackMessageData } for implementation. /// @dev Bit position of timestamp sent in EthboxStructs.Message.data /// See { unpackMessageTimestamp } uint256 private constant BITPOS_MESSAGE_TIMESTAMP = 160; /// @dev Bit position of message index in EthboxStructs.Message.data /// See { unpackMessageIndex } uint256 private constant BITPOS_MESSAGE_INDEX = 224; /// @dev Bit position of message fee BPS in EthboxStructs.Message.data /// See { unpackMessageFeeBPS } uint256 private constant BITPOS_MESSAGE_FEEBPS = 232; /// TODO: Currently not being used. uint256 private constant BITMASK_RECIPIENT = (1 << 160) - 1; function initialize() public initializer { __Ownable_init(); __ReentrancyGuard_init(); _name = "Ethbox"; _symbol = "ETHBOX"; sizeIncreaseFee = 0.05 ether; sizeIncreaseFeeBPS = 2500; messageFeeBPS = 250; messageFeeRecipient = 0x40543d76fb35c60ff578b648d723E14CcAb8b390; } function _authorizeUpgrade(address newImplementation) internal override onlyOwner {} //////////////////////////////////////// // ERC721 functions // //////////////////////////////////////// /// @dev See {ERC721-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); } /// @notice Returns ethbox balance. /// @dev Can only be 1 or 0. As ethboxes are soulbound, if the address /// has minted, we know their balance is 1. /// @param _owner The address to query. /// @return _balance uint256 function balanceOf(address _owner) public view override returns (uint256) { if (minted[_owner]) return 1; return 0; } /// @notice Returns owner of an ethox tokenId. /// @dev TokenId is a uint256 casting of an address, so is unique to that address. /// Here we re-cast the uint256 to an address to get the owner if minted. /// @param _tokenId the tokenId to query. function ownerOf(uint256 _tokenId) public view override returns (address) { address owner = address(uint160(_tokenId)); require(minted[owner], "ERC721: invalid token ID"); return owner; } /// @notice Returns the ethbox tokenId associated with a given address. /// @dev Like { ownerOf } only returns if minted. /// We cast the address to a uint256 to generate a unique tokenId. /// @param _owner the address to query. function ethboxOf(address _owner) public view returns (uint256) { require(minted[_owner], "address has not minted their ethbox"); return uint256(uint160(_owner)); } /// @dev See { ERC721-name }. function name() public view override returns (string memory) { return _name; } /// @dev See { ERC721-symbol }. function symbol() public view override returns (string memory) { return _symbol; } /// @notice Overridden version of { ERC721-tokenURI }. /// @dev First checks if the tokenId has been minted, then gets the owner's /// messages ordered by value and inbox size. Metadata contract uses these /// ordered messages and size to generate the SVG. See { EthboxMetadata }. function tokenURI(uint256 _tokenId) public view override returns (string memory) { require(minted[address(uint160(_tokenId))]); address owner = address(uint160(_tokenId)); EthboxStructs.UnpackedMessage[] memory messages = getOrderedMessages( owner ); uint256 eSize = unpackEthboxSize(owner); uint256 eDrip = unpackEthboxDrip(owner); return metadata.buildMetadata(owner, messages, eSize, eDrip); } /// @dev See { ERC721-getApproved }. function getApproved(uint256 _tokenId) public view override returns (address) { require(minted[address(uint160(_tokenId))]); return address(0); } /// @dev Always returns false as transferring is disabled. function isApprovedForAll(address, address) public pure override returns (bool) { return false; } /// @dev All the following functions are disabled to make ethboxes soulbound. function approve(address, uint256) public pure override { revert("disabled"); } function setApprovalForAll(address, bool) public pure override { revert("disabled"); } function transferFrom( address, address, uint256 ) public pure override { revert("disabled"); } function safeTransferFrom( address, address, uint256 ) public pure override { revert("disabled"); } function safeTransferFrom( address, address, uint256, bytes memory ) public pure override { revert("disabled"); } //////////////////////////////////// // Minting function // //////////////////////////////////// /// @notice Function to mint an ethbox to a given address. /// Only one per address, no max supply. /// @dev We pack the default ethbox info into the { packedEthboxInfo } mapping. /// This saves a lot of gas having to set these values in a struct, or various /// different mappings. function mintMyEthbox() external onlyProxy { address sender = msg.sender; require(!minted[sender], "ethbox already minted"); minted[sender] = true; packedEthboxInfo[sender] = packEthboxInfo( sender, defaultDripTime, defaultEthboxSize, false ); emit Transfer(address(0), sender, uint256(uint160(sender))); if (ethboxMessages[sender].length > 0) { claimAll(); } } ////////////////////////////////////// // Messaging Functions // ////////////////////////////////////// // @notice Set the base cost of increasing ethbox size. /// @param _sizeIncreaseFee The new base increase fee. function setSizeIncreaseFee(uint256 _sizeIncreaseFee) external onlyOwner { sizeIncreaseFee = _sizeIncreaseFee; } /// @notice Set the BPS increase in cost of increasing ethbox size depending /// on how many slots the ethbox has already bought. /// @param _sizeIncreaseFeeBPS The new BPS. function setSizeIncreaseFeeBPS(uint256 _sizeIncreaseFeeBPS) external onlyOwner { sizeIncreaseFeeBPS = _sizeIncreaseFeeBPS; } /// @notice Sets message fee in BPS taken by the messageFeeRecipient. /// @param _messageFeeBPS the new BPS. function setMessageFeeBPS(uint256 _messageFeeBPS) external onlyOwner { messageFeeBPS = _messageFeeBPS; } /// @notice Sets the recipient of the above fees. /// @param _messageFeeRecipient the new recipient. function setMessageFeeRecipient(address _messageFeeRecipient) external onlyOwner { messageFeeRecipient = _messageFeeRecipient; } /// @notice Sets the metadata contract that { tokenURI } points to. /// @dev We want this to be updatable for any future SVG changes or bugfixes. function setMetadataContract(address _metadata) external onlyOwner { metadata = EthboxMetadata(_metadata); } /// @notice Gets the claimable value of a message. /// @dev Using the timestamp the message was sent at, combined with the /// block.timestamp, we calculate how many seconds have elapesed since the /// message was sent. From there we can divide the elapsed seconds by the /// ethbox's duration (given elapsed seconds are smaller) to calculate the BPS. /// Finally we deduct fees from the orignal message value and multiply by BPS /// to get the claimable value of that message. /// @param _message The message struct to calculate value from. /// @param _drip The drip timestamp of the ethbox. function getClaimableValue( EthboxStructs.Message memory _message, uint256 _drip ) public view returns (uint256 _claimableValue) { uint256 elapsedSeconds = block.timestamp - unpackMessageTimestamp(_message.data); if (elapsedSeconds < 1) return 0; if (elapsedSeconds > _drip) return getRemainingOriginalValue(_message); uint256 bps = (elapsedSeconds * 100) / _drip; uint256 subValue = (getOriginalValueMinusFees(_message) * bps) / 100; return (subValue - _message.claimedValue); } /// @notice Deducts fees from the original message value. /// @dev Used in { getClaimableValue } and { getRemainingOriginalValue } /// @param _message The message struct to calculate value from. function getOriginalValueMinusFees(EthboxStructs.Message memory _message) private pure returns (uint256) { return ((_message.originalValue * (10000 - unpackMessageFeeBPS(_message.data))) / 10000); } /// @notice Used to refund message sender any remaining eth in their message /// if their message gets bumped out the inbox. /// @dev Used in { _refundSender } /// @param _message The message struct to calculate value from. function getRemainingOriginalValue(EthboxStructs.Message memory _message) private pure returns (uint256) { return (getOriginalValueMinusFees(_message) - _message.claimedValue); } /// @notice Function to send a message to an ethbox. /// @dev If the message has a high enough value, we bump out the lowest value /// message in the ethbox and replace it. But if the ethbox is not full, we /// just insert it. /// When bumping a message out of an ethbox, if that message has ETH left, /// we refund that ETH to the sender. /// @param _to The ethbox to send the message to. /// @param _message The message content. /// @param _drip The ethbox drip. function sendMessage(address _to, string calldata _message, uint256 _drip) public payable nonReentrant onlyProxy { require(bytes(_message).length < maxMessageLen, "message too long"); EthboxStructs.EthboxInfo memory ethboxInfo = unpackEthboxInfo(_to); uint256 compBoxSize = defaultEthboxSize; uint256 compDrip = defaultDripTime; if (ethboxInfo.size != 0) { compBoxSize = ethboxInfo.size; compDrip = ethboxInfo.drip; } require(!ethboxInfo.locked, "ethbox is locked"); require(msg.value > 10000 || msg.value == 0, "message value incorrect"); require(compDrip == _drip, "message drip incorrect"); EthboxStructs.Message[] memory toMessages = ethboxMessages[_to]; uint256 dynamicBoxSize = toMessages.length; if (dynamicBoxSize < compBoxSize) { _pushMessage( _to, msg.sender, _message, msg.value, dynamicBoxSize ); } else { (bool qualifies, uint256 indexToRemove) = _getIndexToReplace( toMessages, dynamicBoxSize, msg.value ); if (qualifies) { EthboxStructs.Message memory droppedMessage = toMessages[ indexToRemove ]; uint256 claimValue = getClaimableValue(droppedMessage, compDrip); droppedMessage.claimedValue += claimValue; bumpedClaimValue[_to] += claimValue; _refundSender(droppedMessage); _insertMessage( _to, msg.sender, _message, msg.value, indexToRemove ); } else { revert("message value too low"); } } _payFees(msg.value); } /// @notice Finds the index to replace with a new message. /// @dev Used in { sendMessage }. /// Also checks if the message even qualifies for replacement - meaning, is /// the value of the message larger than at least one of the existing messages. /// @param _toMessages The existing messages in the ethbox. /// @param _boxSize The size of the ethbox. Used to iterate through. /// @param _value The value of the new message. /// @return qualifies Does the message qualifiy for replacement. /// @return indexToRemove The index to remove and insert the new message into. function _getIndexToReplace( EthboxStructs.Message[] memory _toMessages, uint256 _boxSize, uint256 _value ) private pure returns (bool qualifies, uint256 indexToRemove) { uint256 lowIndex; uint256 lowValue = _toMessages[0].originalValue; uint256 dripedValue; for (uint256 i = 0; i < _boxSize; i++) { dripedValue = _toMessages[i].originalValue; if (dripedValue < lowValue) { lowIndex = i; lowValue = dripedValue; } if (qualifies == false && _value > dripedValue) { qualifies = true; } } return (qualifies, lowIndex); } /// @notice Pushes a message into an ethbox. Used if an ethbox is not full. /// @dev Used in { sendMessage }. /// Packs message data into a "data" field in the Message struct using /// { packMessageData } /// @param _to The ethbox the message is being sent to. /// @param _from The address sending the message. /// @param _message The message content. /// @param _value The value of the message. /// @param _index The index of the message in the ethbox. function _pushMessage( address _to, address _from, string calldata _message, uint256 _value, uint256 _index ) private { EthboxStructs.Message memory message; message.data = packMessageData( _from, block.timestamp, _index, messageFeeBPS ); message.message = _message; message.originalValue = _value; message.claimedValue = 0; ethboxMessages[_to].push(message); } /// @notice Inserts a message into an ethbox. Used if the ethbox is full. /// @dev Used in { sendMessage }. /// Packs message data just like { _pushMessage }. /// Instead of pushing, we insert the message at a given index. // @param _to The ethbox the message is being sent to. /// @param _from The address sending the message. /// @param _message The message content. /// @param _value The value of the message. /// @param _index The index to insert the message at and set in Message.data. function _insertMessage( address _to, address _from, string calldata _message, uint256 _value, uint256 _index ) private { EthboxStructs.Message memory message; message.data = packMessageData( _from, block.timestamp, _index, messageFeeBPS ); message.message = _message; message.originalValue = _value; message.claimedValue = 0; ethboxMessages[_to][_index] = message; } /// @notice Removes a message from an ethbox. /// @dev Used in { removeOne } /// Sets the message to remove to the end of the array and pops it. /// Updates the index of the message that assumes the old index of the message /// we are deleting. We have to unpack and pack here to do this. /// @param _to The ethbox to remove a message from. /// @param _index The index to remove. function _removeMessage(address _to, uint256 _index) private { EthboxStructs.Message[] memory messages = ethboxMessages[_to]; ethboxMessages[_to][_index] = messages[messages.length - 1]; EthboxStructs.MessageData memory messageData = unpackMessageData( ethboxMessages[_to][_index].data ); ethboxMessages[_to][_index].data = packMessageData( messageData.from, messageData.timestamp, _index, messageData.feeBPS ); ethboxMessages[_to].pop(); } /// @notice Removes multiple messages from an ethbox. /// @dev Used in { claimAll } /// Operates the same as { _removeMessage } but in a for loop. /// @param _to The ethbox to remove messages from. /// @param _indexes The indexes to remove. function _removeMessages(address _to, uint256[] memory _indexes) private { EthboxStructs.Message[] memory messages = ethboxMessages[_to]; for (uint256 i = _indexes.length; i > 0; i--) { if (i != messages.length) { EthboxStructs.MessageData memory messageData = unpackMessageData(messages[i].data); ethboxMessages[_to][_indexes[i - 1]] = messages[ messages.length - 1 ]; ethboxMessages[_to][_indexes[i - 1]].data = packMessageData( messageData.from, messageData.timestamp, _indexes[i - 1], messageData.feeBPS ); } ethboxMessages[_to].pop(); } } /// @notice Pays fees to the messageFeeRecipient. /// @dev Used in { sendMessage }. /// We take the value of the message and multiply by fee BPS to get the /// fee owed to the messageFeeRecipient. /// @param _value The value of the message. function _payFees(uint256 _value) private{ (bool successFees, ) = messageFeeRecipient.call{ value: (_value * messageFeeBPS) / 10000 }(""); require(successFees, "could not pay fees"); } /// @notice Pays an ethbox owner some value. /// @dev Used in { claimOne }, { claimAll }, { removeOne } and { removeAll }. /// We need to unpack the fee recipient of the ethbox. /// Sends the value to that recipient. /// @param _value The value of the message. /// @param _to The ethbox owner. function _payRecipient(address _to, uint256 _value) private{ address recipient = unpackEthboxAddress(_to); (bool successRecipient, ) = recipient.call{value: _value}(""); require(successRecipient, "could not pay recipient"); } /// @notice Refunds the sender of a message that has been bumped or removed. /// @dev Used in { removeAll }, { removeOne } and { sendMessage }. /// Need to unpack who sent the message from Message.data. /// @param _message The message used to calculate refundable value and who /// to send value to. function _refundSender(EthboxStructs.Message memory _message) private { uint256 refundValue = getRemainingOriginalValue(_message); address from = unpackMessageFrom(_message.data); (bool successRefund, ) = from.call{value: refundValue}(""); require(successRefund); } /// @notice Orders the messages in an ethbox by value. /// @dev Only used in { tokenURI } for metadata purposes. /// Unpacks the messages into an UnpackedMessage struct. /// See { EthboxStructs.UnpackedMessage }. /// @param _to Ethbox owner to query. /// @return _messages Ordered messages. function getOrderedMessages(address _to) public view returns (EthboxStructs.UnpackedMessage[] memory) { EthboxStructs.Message[] memory messages = ethboxMessages[_to]; for (uint256 i = 1; i < messages.length; i++) { for (uint256 j = 0; j < i; j++) { if (messages[i].originalValue > messages[j].originalValue) { EthboxStructs.Message memory x = messages[i]; messages[i] = messages[j]; messages[j] = x; } } } EthboxStructs.UnpackedMessage[] memory unpackedMessages = new EthboxStructs.UnpackedMessage[]( messages.length ); EthboxStructs.MessageData memory unpackedData; for (uint256 k = 0; k < messages.length; k++) { EthboxStructs.UnpackedMessage memory newMessage; unpackedData = unpackMessageData(messages[k].data); newMessage.message = messages[k].message; newMessage.originalValue = messages[k].originalValue; newMessage.claimedValue = messages[k].claimedValue; newMessage.from = unpackedData.from; newMessage.timestamp = unpackedData.timestamp; newMessage.index = unpackedData.index; newMessage.feeBPS = unpackedData.feeBPS; unpackedMessages[k] = newMessage; } return unpackedMessages; } /// @dev Mimics { getOrderedMessages } without unpacking. function getOrderedPackedMessages(address _to) public view returns (EthboxStructs.Message[] memory) { EthboxStructs.Message[] memory messages = ethboxMessages[_to]; for (uint256 i = 1; i < messages.length; i++) { for (uint256 j = 0; j < i; j++) { if (messages[i].originalValue > messages[j].originalValue) { EthboxStructs.Message memory x = messages[i]; messages[i] = messages[j]; messages[j] = x; } } } return messages; } /// @notice Sets the locked state of an ethbox. If an ethbox is locked it /// cannot recieve messages. /// @dev We unpack and repack the sender's ethbox info with the new value. /// @param _isLocked The locked value to set their ethbox to. function changeEthboxLocked(bool _isLocked) external { EthboxStructs.EthboxInfo memory ethboxInfo = unpackEthboxInfo( msg.sender ); require(ethboxInfo.size != 0, "ethbox needs to be minted"); packedEthboxInfo[msg.sender] = packEthboxInfo( ethboxInfo.recipient, ethboxInfo.drip, ethboxInfo.size, _isLocked ); } /// @notice Sets the payout recipient of the ethbox. Allows people to have /// their ethbox in cold storage, but get paid into a hot wallet. /// @dev We unpack and repack the sender's ethbox info with the new value. /// @param _recipient The new recipient of ethbox funds. function changeEthboxPayoutRecipient(address _recipient) external { EthboxStructs.EthboxInfo memory ethboxInfo = unpackEthboxInfo( msg.sender ); require(ethboxInfo.size != 0, "ethbox needs to be minted"); packedEthboxInfo[msg.sender] = packEthboxInfo( _recipient, ethboxInfo.drip, ethboxInfo.size, ethboxInfo.locked ); } /// @notice Sets the drip time in an ethbox. This can only be done when the /// ethbox is locked and empty. /// @dev We unpack and repack the sender's ethbox info with the new value. /// @param _dripTime The new drip time of the ethbox's messages. function changeEthboxDripTime(uint256 _dripTime) external { EthboxStructs.EthboxInfo memory ethboxInfo = unpackEthboxInfo( msg.sender ); require(ethboxInfo.size != 0, "ethbox needs to be minted"); require( ethboxMessages[msg.sender].length == 0, "ethbox needs to be empty" ); packedEthboxInfo[msg.sender] = packEthboxInfo( ethboxInfo.recipient, _dripTime, ethboxInfo.size, ethboxInfo.locked ); } /// @notice Expands the ethbox size of the sender. /// @dev Sender must have minted. /// See { calculateSizeIncreaseCost } for how size increase is calculated. /// @param _size New ethbox size. function changeEthboxSize(uint256 _size) external payable { EthboxStructs.EthboxInfo memory ethboxInfo = unpackEthboxInfo( msg.sender ); require(ethboxInfo.size != 0, "ethbox needs to be minted"); uint256 total = calculateSizeIncreaseCost(_size, ethboxInfo.size); require(total == msg.value, total.toString()); packedEthboxInfo[msg.sender] = packEthboxInfo( ethboxInfo.recipient, ethboxInfo.drip, _size, ethboxInfo.locked ); (bool successFees, ) = messageFeeRecipient.call{value: msg.value}(""); require(successFees); } /// @notice Calculates the cost of increasing ethbox size to a given value. /// @dev Used in { expandEthboxSize }. /// Uses { sizeIncreaseFee } and { sizeIncreaseFeeBPS } in calculation. /// @param _size The desired ethbox size. /// @param _currentSize The current size of the ethbox. /// @return total Cost of increasing inbox to desired size. function calculateSizeIncreaseCost(uint256 _size, uint256 _currentSize) public view returns (uint256 total) { require(_size > _currentSize, "new size should be larger"); total = 0; for (uint256 i = _currentSize; i < _size; i++) { if (i == defaultEthboxSize) { total += sizeIncreaseFee; } else { total += (sizeIncreaseFee * ((sizeIncreaseFeeBPS + 10000) ** (i - defaultEthboxSize))) / (10000**(i - defaultEthboxSize)); } } return total; } /// @notice Removes all messages from an ethbox. /// @dev An ethbox owner may call this so they can change the drip of their /// box. This calculates how much each message sender is owed and refunds them. /// The ethbox owner claims the remaining ETH. function removeAll() external nonReentrant { require(minted[msg.sender], "ethbox needs to be minted"); uint256 claimValue = 0; uint256 totalValue = 0; EthboxStructs.Message[] memory messages = ethboxMessages[msg.sender]; uint256 boxSize = messages.length; for (uint256 i = 0; i < boxSize; i++) { claimValue = getClaimableValue( messages[i], unpackEthboxDrip(msg.sender) ); totalValue += claimValue; ethboxMessages[msg.sender][i].claimedValue += claimValue; _refundSender(ethboxMessages[msg.sender][i]); } delete ethboxMessages[msg.sender]; _payRecipient(msg.sender, totalValue); } /// @notice Removes one of the messages in the ethbox. /// @dev An ethbox owner may not like a message they have recieved, they can /// use this to delete it. Like { removeAll } this calculates how much they /// can claim, and how much must be refunded. /// We are using the combination of these 3 parameters to guarantee that the ethbox /// owner will remove only the message they really intend to, without running the /// risk of being front-run by a sendMessage transaction. /// @param _index The index of the message to delete. /// @param _messageValue the original value of the message to delete /// @param _from the sender of the message to delete function removeOne(uint256 _index, uint256 _messageValue, address _from) external nonReentrant { require(minted[msg.sender], "ethbox needs to be minted"); EthboxStructs.Message memory message = ethboxMessages[msg.sender][_index]; require(_messageValue == message.originalValue, "message at index does not match value"); EthboxStructs.MessageData memory messageData = unpackMessageData(message.data); require(_from == messageData.from, "message at index does not match sender address"); uint256 claimValue = getClaimableValue( message, unpackEthboxDrip(msg.sender) ); message.claimedValue += claimValue; ethboxMessages[msg.sender][_index] = message; _removeMessage(msg.sender, _index); _refundSender(message); _payRecipient(msg.sender, claimValue); } /// @notice Function to claim all of the ETH owed to the sender's ethbox. /// @dev Calculates how much they are owed for each message and the claims /// the ETH. We update the claimed value of the message in the Message struct /// so that the owner cannot double claim. function claimAll() public nonReentrant { require(minted[msg.sender], "ethbox needs to be minted"); uint256 claimValue = 0; uint256 totalValue = 0; EthboxStructs.Message[] memory messages = ethboxMessages[msg.sender]; uint256 boxSize = messages.length; uint256[] memory removalIndexes = new uint256[](boxSize); uint256 removalCount = 0; uint256 dripTime = unpackEthboxDrip(msg.sender); for (uint256 i = 0; i < boxSize; i++) { EthboxStructs.Message memory message = messages[i]; claimValue = getClaimableValue(message, dripTime); totalValue += claimValue; ethboxMessages[msg.sender][i].claimedValue += claimValue; if ( (unpackMessageTimestamp(message.data) + dripTime) < block.timestamp ) { removalIndexes[removalCount] = i; removalCount++; } } uint256[] memory trimmedIndexes = new uint256[](removalCount); for (uint256 j = 0; j < trimmedIndexes.length; j++) { trimmedIndexes[j] = removalIndexes[j]; } totalValue += bumpedClaimValue[msg.sender]; bumpedClaimValue[msg.sender] = 0; _removeMessages(msg.sender, trimmedIndexes); _payRecipient(msg.sender, totalValue); } /// @notice Allows sender to claim ETH from one of their messages. /// @dev Uses { getClaimable value } on the message struct with the ethbox's /// drip to calculate. /// /// We are using the combination of these 3 parameters to guarantee that the ethbox /// owner will clalim only the message they really intend to, without running the /// risk of being front-run by a sendMessage transaction. /// @param _index Index to claim ETH on. /// @param _messageValue the original value of the message to delete /// @param _from the sender of the message to delete function claimOne(uint256 _index, uint256 _messageValue, address _from) external nonReentrant { EthboxStructs.EthboxInfo memory ethboxInfo = unpackEthboxInfo(msg.sender); require(ethboxInfo.size != 0, "ethbox needs to be minted"); EthboxStructs.Message memory message = ethboxMessages[msg.sender][_index]; require(_messageValue == message.originalValue, "message at index does not match value"); EthboxStructs.MessageData memory messageData = unpackMessageData(message.data); require(_from == messageData.from, "message at index does not match sender address"); uint256 claimValue = getClaimableValue( message, unpackEthboxDrip(msg.sender) ); if (messageData.timestamp + ethboxInfo.drip < block.timestamp){ _removeMessage(msg.sender, messageData.index); }else { ethboxMessages[msg.sender][_index].claimedValue += claimValue; } _payRecipient(msg.sender, claimValue); } /// @notice A view function for external use in app or elsewhere. /// @dev Mimics how { claimAll } works, without making any payments. /// @param _ethboxAddress The ethbox address to query. /// @return value The claimable value of the ethbox. function getClaimableValueOfEthbox(address _ethboxAddress) public view returns (uint256) { EthboxStructs.Message[] memory messages = ethboxMessages[ _ethboxAddress ]; EthboxStructs.EthboxInfo memory ethboxInfo = unpackEthboxInfo(_ethboxAddress); uint256 boxSize = messages.length; uint256 claimValue = 0; uint256 totalValue = 0; uint256 realDrip = ethboxInfo.size == 0 ? defaultDripTime : ethboxInfo.drip; for (uint256 i = 0; i < boxSize; i++) { claimValue = getClaimableValue( messages[i], realDrip ); totalValue += claimValue; } totalValue += bumpedClaimValue[_ethboxAddress]; return totalValue; } ////////////////////////////////////// ////////////////////////////////////// // Packing & Unpacking Functions // ////////////////////////////////////// ////////////////////////////////////// /// @dev Unpacks the recipient in the packedEthboxInfo uint256. /// Used in { _payRecipient } /// @param _address The ethbox to query. /// @return recipient The payout recipient of the ethbox. function unpackEthboxAddress(address _address) private view returns (address) { return address(uint160(packedEthboxInfo[_address])); } /// @dev Unpacks the drip in the packedEthboxInfo uint256. /// Used in { claimOne }, { getClaimableValueOfEthbox }, { claimAll }, /// { removeOne } and { removeAll } /// @param _address The ethbox to query. /// @return timestamp The drip timestamp of the ethbox. function unpackEthboxDrip(address _address) private view returns (uint64) { return uint64(packedEthboxInfo[_address] >> BITPOS_ETHBOX_DRIP_TIMESTAMP); } /// @dev Unpacks the size in the packedEthboxInfo uint256. /// Used in { tokenURI } /// @param _address The ethbox to query. /// @return size The size of the ethbox. function unpackEthboxSize(address _address) private view returns (uint8) { return uint8(packedEthboxInfo[_address] >> BITPOS_ETHBOX_SIZE); } /// @dev Unpacks the locked state in the packedEthboxInfo uint256. /// Not being used currently. /// @param _address The ethbox to query. /// @return isLocked Boolean reflecting whether the ethbox is locked or not. function unpackEthboxLocked(address _address) private view returns (bool) { uint256 flag = (packedEthboxInfo[_address] >> BITPOS_ETHBOX_LOCKED) & uint256(1); return flag != 0; } /// @dev Unpacks the entire packedEthboxInfo uint256 into an EthboxInfo struct. /// See { EthboxStructs.EthboxInfo }. /// Used in { expandEthboxSize }, { changeEthboxDurationTime }, /// { changeEthboxPayoutRecipient }, { setEthboxIsLocked } and { sendMessage }. /// @param _address Address to unpack the ethbox of. /// @return ethbox The ethbox's info. function unpackEthboxInfo(address _address) public view returns (EthboxStructs.EthboxInfo memory ethbox) { uint256 packedEthbox = packedEthboxInfo[_address]; ethbox.recipient = address(uint160(packedEthbox)); ethbox.drip = uint64(packedEthbox >> BITPOS_ETHBOX_DRIP_TIMESTAMP); ethbox.size = uint8(packedEthbox >> BITPOS_ETHBOX_SIZE); ethbox.locked = ((packedEthbox >> BITPOS_ETHBOX_LOCKED) & uint256(1)) != 0; } /// @dev Packs an ethbox's info. /// Does this by casting each input to a specific part of a uint256. /// Used in all the same functions as { unpackEthboxInfo } and used by /// { mintMyEthbox }. /// @param _recipient Payout recipient of the ethbox. /// @param _drip Drip timestamp of the ethbox. /// @param _size Size of the ethbox. /// @param _locked Locked state of the ethbox. /// @return packed The packed ethbox info. function packEthboxInfo( address _recipient, uint256 _drip, uint256 _size, bool _locked ) private pure returns (uint256) { uint256 packedEthbox = uint256(uint160(_recipient)); packedEthbox |= (_drip << BITPOS_ETHBOX_DRIP_TIMESTAMP) | (boolToUint(_locked) << BITPOS_ETHBOX_LOCKED) | (_size << BITPOS_ETHBOX_SIZE); return packedEthbox; } /// @dev Casts a boolean value to a uint256. True -> 1, False -> 0. /// Helper used in { packEthboxInfo } function boolToUint(bool _b) private pure returns (uint256) { uint256 _bInt; assembly { // SAFETY: Simple bool-to-int cast. _bInt := _b } return _bInt; } /// @dev Packs part of the Message struct into a "data" field. /// Used in { _removeMessage/s }, { _insertMessage } and { _pushMessage }. /// Using the same method as { packEthboxInfo }, we cast each input to a /// specific part of the uint256 we return. /// @param _from The from address of the message. /// @param _timestamp The timestamp the message was sent at. /// @param _index The index of the message in the ethbox. /// @param _feeBPS The global feeBPS at the time of the message being sent. /// @return packed The packed message data. function packMessageData( address _from, uint256 _timestamp, uint256 _index, uint256 _feeBPS ) private pure returns (uint256) { uint256 packedEthbox = uint256(uint160(_from)); packedEthbox |= (_timestamp << BITPOS_MESSAGE_TIMESTAMP) | (_index << BITPOS_MESSAGE_INDEX) | (_feeBPS << BITPOS_MESSAGE_FEEBPS); return packedEthbox; } /// @dev Unpacks the message data into a MessageData stuct. /// See { EthboxStructs.MessageData }. /// Used in { _removeMessage/s }. /// Using the same method as { unpackEthboxInfo } we shift bits back to /// where they once were, and apply appropriate data types. /// @param _data Message data to unpack. /// @return messageData Unpacked message data. function unpackMessageData(uint256 _data) private pure returns (EthboxStructs.MessageData memory messageData) { messageData.from = address(uint160(_data)); messageData.timestamp = uint64(_data >> BITPOS_MESSAGE_TIMESTAMP); messageData.index = uint8(_data >> BITPOS_MESSAGE_INDEX); messageData.feeBPS = uint24(_data >> BITPOS_MESSAGE_FEEBPS); } /// @dev Unpacks the sent timestamp in packed message data. /// Used in { claimAll } and { getClaimableValue }. /// @param _data Data to unpack. /// @return timestamp Timestamp the message was sent at. function unpackMessageTimestamp(uint256 _data) private pure returns (uint64) { return uint64(_data >> BITPOS_MESSAGE_TIMESTAMP); } /// @dev Unpacks the feeBPS in packed message data. /// Used in { getOriginalValueMinusFees } /// @param _data Data to unpack. /// @return feeBPS FeeBPS when the message was sent. function unpackMessageFeeBPS(uint256 _data) private pure returns (uint24) { return uint24(_data >> BITPOS_MESSAGE_FEEBPS); } /// @dev Unpacks the index in packed message data. /// Currently not being used. /// @param _data Data to unpack. /// @return index Index of the message in the ethbox. function unpackMessageIndex(uint256 _data) private pure returns (uint8) { return uint8(_data >> BITPOS_MESSAGE_INDEX); } /// @dev Unpacks the message sender in packed message data. /// Used in { _refundSender } /// @param _data Data to unpack. /// @return sender Sender of the message. function unpackMessageFrom(uint256 _data) private pure returns (address) { return address(uint160(_data)); } //--External Unpacking Functions for Use In App and Elsewhere--// /// @dev These do the same as the above functions, but are just external. /// Please refer back to the documentation for { unpackEthboxInfo }. function ethboxDripTime(address _owner) external view returns (uint256) { if (minted[_owner]) return unpackEthboxInfo(_owner).drip; return defaultDripTime; } function ethboxPayoutRecipient(address _owner) external view returns (address) { if (minted[_owner]) return unpackEthboxInfo(_owner).recipient; return _owner; } function ethboxSize(address _owner) external view returns (uint256) { if (minted[_owner]) return unpackEthboxInfo(_owner).size; return defaultEthboxSize; } function ethboxLocked(address _owner) external view returns (bool) { if (minted[_owner]) return unpackEthboxInfo(_owner).locked; return false; } }
// SPDX-License-Identifier: Unlicensed pragma solidity 0.8.16; library EthboxStructs { struct Message { string message; uint256 originalValue; uint256 claimedValue; uint256 data; } struct MessageData { address from; uint64 timestamp; uint8 index; uint24 feeBPS; } struct UnpackedMessage { string message; uint256 originalValue; uint256 claimedValue; address from; uint64 timestamp; uint8 index; uint24 feeBPS; } struct MessageInfo { address to; string visibility; UnpackedMessage message; uint256 index; uint256 maxSize; } struct EthboxInfo { address recipient; uint8 size; bool locked; uint64 drip; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library Base64 { string internal constant TABLE_ENCODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; bytes internal constant TABLE_DECODE = hex"0000000000000000000000000000000000000000000000000000000000000000" hex"00000000000000000000003e0000003f3435363738393a3b3c3d000000000000" hex"00000102030405060708090a0b0c0d0e0f101112131415161718190000000000" hex"001a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132330000000000"; function encode(bytes memory data) internal pure returns (string memory) { if (data.length == 0) return ''; // load the table into memory string memory table = TABLE_ENCODE; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((data.length + 2) / 3); // add some extra buffer at the end required for the writing string memory result = new string(encodedLen + 32); assembly { // set the actual output length mstore(result, encodedLen) // prepare the lookup table let tablePtr := add(table, 1) // input ptr let dataPtr := data let endPtr := add(dataPtr, mload(data)) // result ptr, jump over length let resultPtr := add(result, 32) // run over the input, 3 bytes at a time for {} lt(dataPtr, endPtr) {} { // read 3 bytes dataPtr := add(dataPtr, 3) let input := mload(dataPtr) // write 4 characters mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and(shr( 6, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and( input, 0x3F)))) resultPtr := add(resultPtr, 1) } // padding with '=' switch mod(mload(data), 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } } return result; } function decode(string memory _data) internal pure returns (bytes memory) { bytes memory data = bytes(_data); if (data.length == 0) return new bytes(0); require(data.length % 4 == 0, "invalid base64 decoder input"); // load the table into memory bytes memory table = TABLE_DECODE; // every 4 characters represent 3 bytes uint256 decodedLen = (data.length / 4) * 3; // add some extra buffer at the end required for the writing bytes memory result = new bytes(decodedLen + 32); assembly { // padding with '=' let lastBytes := mload(add(data, mload(data))) if eq(and(lastBytes, 0xFF), 0x3d) { decodedLen := sub(decodedLen, 1) if eq(and(lastBytes, 0xFFFF), 0x3d3d) { decodedLen := sub(decodedLen, 1) } } // set the actual output length mstore(result, decodedLen) // prepare the lookup table let tablePtr := add(table, 1) // input ptr let dataPtr := data let endPtr := add(dataPtr, mload(data)) // result ptr, jump over length let resultPtr := add(result, 32) // run over the input, 4 characters at a time for {} lt(dataPtr, endPtr) {} { // read 4 characters dataPtr := add(dataPtr, 4) let input := mload(dataPtr) // write 3 bytes let output := add( add( shl(18, and(mload(add(tablePtr, and(shr(24, input), 0xFF))), 0xFF)), shl(12, and(mload(add(tablePtr, and(shr(16, input), 0xFF))), 0xFF))), add( shl( 6, and(mload(add(tablePtr, and(shr( 8, input), 0xFF))), 0xFF)), and(mload(add(tablePtr, and( input , 0xFF))), 0xFF) ) ) mstore(resultPtr, shl(232, output)) resultPtr := add(resultPtr, 3) } } return result; } }
/* * @title String & slice utility library for Solidity contracts. * @author Nick Johnson <[email protected]> * * @dev Functionality in this library is largely implemented using an * abstraction called a 'slice'. A slice represents a part of a string - * anything from the entire string to a single character, or even no * characters at all (a 0-length slice). Since a slice only has to specify * an offset and a length, copying and manipulating slices is a lot less * expensive than copying and manipulating the strings they reference. * * To further reduce gas costs, most functions on slice that need to return * a slice modify the original one instead of allocating a new one; for * instance, `s.split(".")` will return the text up to the first '.', * modifying s to only contain the remainder of the string after the '.'. * In situations where you do not want to modify the original slice, you * can make a copy first with `.copy()`, for example: * `s.copy().split(".")`. Try and avoid using this idiom in loops; since * Solidity has no memory management, it will result in allocating many * short-lived slices that are later discarded. * * Functions that return two slices come in two versions: a non-allocating * version that takes the second slice as an argument, modifying it in * place, and an allocating version that allocates and returns the second * slice; see `nextRune` for example. * * Functions that have to copy string data will return strings rather than * slices; these can be cast back to slices for further processing if * required. * * For convenience, some functions are provided with non-modifying * variants that create a new slice and return both; for instance, * `s.splitNew('.')` leaves s unmodified, and returns two values * corresponding to the left and right parts of the string. */ // SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library strings { struct slice { uint256 _len; uint256 _ptr; } function memcpy( uint256 dest, uint256 src, uint256 length ) private pure { // Copy word-length chunks while possible for (; length >= 32; length -= 32) { assembly { mstore(dest, mload(src)) } dest += 32; src += 32; } // Copy remaining bytes uint256 mask = type(uint256).max; if (length > 0) { mask = 256**(32 - length) - 1; } assembly { let srcpart := and(mload(src), not(mask)) let destpart := and(mload(dest), mask) mstore(dest, or(destpart, srcpart)) } } /* * @dev Returns a slice containing the entire string. * @param self The string to make a slice from. * @return A newly allocated slice containing the entire string. */ function toSlice(string memory self) internal pure returns (slice memory) { uint256 ptr; assembly { ptr := add(self, 0x20) } return slice(bytes(self).length, ptr); } /* * @dev Returns the length of a null-terminated bytes32 string. * @param self The value to find the length of. * @return The length of the string, from 0 to 32. */ function len(bytes32 self) internal pure returns (uint256) { uint256 ret; if (self == 0) return 0; if (uint256(self) & type(uint128).max == 0) { ret += 16; self = bytes32(uint256(self) / 0x100000000000000000000000000000000); } if (uint256(self) & type(uint64).max == 0) { ret += 8; self = bytes32(uint256(self) / 0x10000000000000000); } if (uint256(self) & type(uint32).max == 0) { ret += 4; self = bytes32(uint256(self) / 0x100000000); } if (uint256(self) & type(uint16).max == 0) { ret += 2; self = bytes32(uint256(self) / 0x10000); } if (uint256(self) & type(uint8).max == 0) { ret += 1; } return 32 - ret; } /* * @dev Returns a slice containing the entire bytes32, interpreted as a * null-terminated utf-8 string. * @param self The bytes32 value to convert to a slice. * @return A new slice containing the value of the input argument up to the * first null. */ function toSliceB32(bytes32 self) internal pure returns (slice memory ret) { // Allocate space for `self` in memory, copy it there, and point ret at it assembly { let ptr := mload(0x40) mstore(0x40, add(ptr, 0x20)) mstore(ptr, self) mstore(add(ret, 0x20), ptr) } ret._len = len(self); } /* * @dev Returns a new slice containing the same data as the current slice. * @param self The slice to copy. * @return A new slice containing the same data as `self`. */ function copy(slice memory self) internal pure returns (slice memory) { return slice(self._len, self._ptr); } /* * @dev Copies a slice to a new string. * @param self The slice to copy. * @return A newly allocated string containing the slice's text. */ function toString(slice memory self) internal pure returns (string memory) { string memory ret = new string(self._len); uint256 retptr; assembly { retptr := add(ret, 32) } memcpy(retptr, self._ptr, self._len); return ret; } /* * @dev Returns the length in runes of the slice. Note that this operation * takes time proportional to the length of the slice; avoid using it * in loops, and call `slice.empty()` if you only need to know whether * the slice is empty or not. * @param self The slice to operate on. * @return The length of the slice in runes. */ function len(slice memory self) internal pure returns (uint256 l) { // Starting at ptr-31 means the LSB will be the byte we care about uint256 ptr = self._ptr - 31; uint256 end = ptr + self._len; for (l = 0; ptr < end; l++) { uint8 b; assembly { b := and(mload(ptr), 0xFF) } if (b < 0x80) { ptr += 1; } else if (b < 0xE0) { ptr += 2; } else if (b < 0xF0) { ptr += 3; } else if (b < 0xF8) { ptr += 4; } else if (b < 0xFC) { ptr += 5; } else { ptr += 6; } } } /* * @dev Returns true if the slice is empty (has a length of 0). * @param self The slice to operate on. * @return True if the slice is empty, False otherwise. */ function empty(slice memory self) internal pure returns (bool) { return self._len == 0; } /* * @dev Returns a positive number if `other` comes lexicographically after * `self`, a negative number if it comes before, or zero if the * contents of the two slices are equal. Comparison is done per-rune, * on unicode codepoints. * @param self The first slice to compare. * @param other The second slice to compare. * @return The result of the comparison. */ function compare(slice memory self, slice memory other) internal pure returns (int256) { uint256 shortest = self._len; if (other._len < self._len) shortest = other._len; uint256 selfptr = self._ptr; uint256 otherptr = other._ptr; for (uint256 idx = 0; idx < shortest; idx += 32) { uint256 a; uint256 b; assembly { a := mload(selfptr) b := mload(otherptr) } if (a != b) { // Mask out irrelevant bytes and check again uint256 mask = type(uint256).max; // 0xffff... if (shortest < 32) { mask = ~(2**(8 * (32 - shortest + idx)) - 1); } unchecked { uint256 diff = (a & mask) - (b & mask); if (diff != 0) return int256(diff); } } selfptr += 32; otherptr += 32; } return int256(self._len) - int256(other._len); } /* * @dev Returns true if the two slices contain the same text. * @param self The first slice to compare. * @param self The second slice to compare. * @return True if the slices are equal, false otherwise. */ function equals(slice memory self, slice memory other) internal pure returns (bool) { return compare(self, other) == 0; } /* * @dev Extracts the first rune in the slice into `rune`, advancing the * slice to point to the next rune and returning `self`. * @param self The slice to operate on. * @param rune The slice that will contain the first rune. * @return `rune`. */ function nextRune(slice memory self, slice memory rune) internal pure returns (slice memory) { rune._ptr = self._ptr; if (self._len == 0) { rune._len = 0; return rune; } uint256 l; uint256 b; // Load the first byte of the rune into the LSBs of b assembly { b := and(mload(sub(mload(add(self, 32)), 31)), 0xFF) } if (b < 0x80) { l = 1; } else if (b < 0xE0) { l = 2; } else if (b < 0xF0) { l = 3; } else { l = 4; } // Check for truncated codepoints if (l > self._len) { rune._len = self._len; self._ptr += self._len; self._len = 0; return rune; } self._ptr += l; self._len -= l; rune._len = l; return rune; } /* * @dev Returns the first rune in the slice, advancing the slice to point * to the next rune. * @param self The slice to operate on. * @return A slice containing only the first rune from `self`. */ function nextRune(slice memory self) internal pure returns (slice memory ret) { nextRune(self, ret); } /* * @dev Returns the number of the first codepoint in the slice. * @param self The slice to operate on. * @return The number of the first codepoint in the slice. */ function ord(slice memory self) internal pure returns (uint256 ret) { if (self._len == 0) { return 0; } uint256 word; uint256 length; uint256 divisor = 2**248; // Load the rune into the MSBs of b assembly { word := mload(mload(add(self, 32))) } uint256 b = word / divisor; if (b < 0x80) { ret = b; length = 1; } else if (b < 0xE0) { ret = b & 0x1F; length = 2; } else if (b < 0xF0) { ret = b & 0x0F; length = 3; } else { ret = b & 0x07; length = 4; } // Check for truncated codepoints if (length > self._len) { return 0; } for (uint256 i = 1; i < length; i++) { divisor = divisor / 256; b = (word / divisor) & 0xFF; if (b & 0xC0 != 0x80) { // Invalid UTF-8 sequence return 0; } ret = (ret * 64) | (b & 0x3F); } return ret; } /* * @dev Returns the keccak-256 hash of the slice. * @param self The slice to hash. * @return The hash of the slice. */ function keccak(slice memory self) internal pure returns (bytes32 ret) { assembly { ret := keccak256(mload(add(self, 32)), mload(self)) } } /* * @dev Returns true if `self` starts with `needle`. * @param self The slice to operate on. * @param needle The slice to search for. * @return True if the slice starts with the provided text, false otherwise. */ function startsWith(slice memory self, slice memory needle) internal pure returns (bool) { if (self._len < needle._len) { return false; } if (self._ptr == needle._ptr) { return true; } bool equal; assembly { let length := mload(needle) let selfptr := mload(add(self, 0x20)) let needleptr := mload(add(needle, 0x20)) equal := eq( keccak256(selfptr, length), keccak256(needleptr, length) ) } return equal; } /* * @dev If `self` starts with `needle`, `needle` is removed from the * beginning of `self`. Otherwise, `self` is unmodified. * @param self The slice to operate on. * @param needle The slice to search for. * @return `self` */ function beyond(slice memory self, slice memory needle) internal pure returns (slice memory) { if (self._len < needle._len) { return self; } bool equal = true; if (self._ptr != needle._ptr) { assembly { let length := mload(needle) let selfptr := mload(add(self, 0x20)) let needleptr := mload(add(needle, 0x20)) equal := eq( keccak256(selfptr, length), keccak256(needleptr, length) ) } } if (equal) { self._len -= needle._len; self._ptr += needle._len; } return self; } /* * @dev Returns true if the slice ends with `needle`. * @param self The slice to operate on. * @param needle The slice to search for. * @return True if the slice starts with the provided text, false otherwise. */ function endsWith(slice memory self, slice memory needle) internal pure returns (bool) { if (self._len < needle._len) { return false; } uint256 selfptr = self._ptr + self._len - needle._len; if (selfptr == needle._ptr) { return true; } bool equal; assembly { let length := mload(needle) let needleptr := mload(add(needle, 0x20)) equal := eq( keccak256(selfptr, length), keccak256(needleptr, length) ) } return equal; } /* * @dev If `self` ends with `needle`, `needle` is removed from the * end of `self`. Otherwise, `self` is unmodified. * @param self The slice to operate on. * @param needle The slice to search for. * @return `self` */ function until(slice memory self, slice memory needle) internal pure returns (slice memory) { if (self._len < needle._len) { return self; } uint256 selfptr = self._ptr + self._len - needle._len; bool equal = true; if (selfptr != needle._ptr) { assembly { let length := mload(needle) let needleptr := mload(add(needle, 0x20)) equal := eq( keccak256(selfptr, length), keccak256(needleptr, length) ) } } if (equal) { self._len -= needle._len; } return self; } // Returns the memory address of the first byte of the first occurrence of // `needle` in `self`, or the first byte after `self` if not found. function findPtr( uint256 selflen, uint256 selfptr, uint256 needlelen, uint256 needleptr ) private pure returns (uint256) { uint256 ptr = selfptr; uint256 idx; if (needlelen <= selflen) { if (needlelen <= 32) { bytes32 mask; if (needlelen > 0) { mask = bytes32(~(2**(8 * (32 - needlelen)) - 1)); } bytes32 needledata; assembly { needledata := and(mload(needleptr), mask) } uint256 end = selfptr + selflen - needlelen; bytes32 ptrdata; assembly { ptrdata := and(mload(ptr), mask) } while (ptrdata != needledata) { if (ptr >= end) return selfptr + selflen; ptr++; assembly { ptrdata := and(mload(ptr), mask) } } return ptr; } else { // For long needles, use hashing bytes32 hash; assembly { hash := keccak256(needleptr, needlelen) } for (idx = 0; idx <= selflen - needlelen; idx++) { bytes32 testHash; assembly { testHash := keccak256(ptr, needlelen) } if (hash == testHash) return ptr; ptr += 1; } } } return selfptr + selflen; } // Returns the memory address of the first byte after the last occurrence of // `needle` in `self`, or the address of `self` if not found. function rfindPtr( uint256 selflen, uint256 selfptr, uint256 needlelen, uint256 needleptr ) private pure returns (uint256) { uint256 ptr; if (needlelen <= selflen) { if (needlelen <= 32) { bytes32 mask; if (needlelen > 0) { mask = bytes32(~(2**(8 * (32 - needlelen)) - 1)); } bytes32 needledata; assembly { needledata := and(mload(needleptr), mask) } ptr = selfptr + selflen - needlelen; bytes32 ptrdata; assembly { ptrdata := and(mload(ptr), mask) } while (ptrdata != needledata) { if (ptr <= selfptr) return selfptr; ptr--; assembly { ptrdata := and(mload(ptr), mask) } } return ptr + needlelen; } else { // For long needles, use hashing bytes32 hash; assembly { hash := keccak256(needleptr, needlelen) } ptr = selfptr + (selflen - needlelen); while (ptr >= selfptr) { bytes32 testHash; assembly { testHash := keccak256(ptr, needlelen) } if (hash == testHash) return ptr + needlelen; ptr -= 1; } } } return selfptr; } /* * @dev Modifies `self` to contain everything from the first occurrence of * `needle` to the end of the slice. `self` is set to the empty slice * if `needle` is not found. * @param self The slice to search and modify. * @param needle The text to search for. * @return `self`. */ function find(slice memory self, slice memory needle) internal pure returns (slice memory) { uint256 ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr); self._len -= ptr - self._ptr; self._ptr = ptr; return self; } /* * @dev Modifies `self` to contain the part of the string from the start of * `self` to the end of the first occurrence of `needle`. If `needle` * is not found, `self` is set to the empty slice. * @param self The slice to search and modify. * @param needle The text to search for. * @return `self`. */ function rfind(slice memory self, slice memory needle) internal pure returns (slice memory) { uint256 ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr); self._len = ptr - self._ptr; return self; } /* * @dev Splits the slice, setting `self` to everything after the first * occurrence of `needle`, and `token` to everything before it. If * `needle` does not occur in `self`, `self` is set to the empty slice, * and `token` is set to the entirety of `self`. * @param self The slice to split. * @param needle The text to search for in `self`. * @param token An output parameter to which the first token is written. * @return `token`. */ function split( slice memory self, slice memory needle, slice memory token ) internal pure returns (slice memory) { uint256 ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr); token._ptr = self._ptr; token._len = ptr - self._ptr; if (ptr == self._ptr + self._len) { // Not found self._len = 0; } else { self._len -= token._len + needle._len; self._ptr = ptr + needle._len; } return token; } /* * @dev Splits the slice, setting `self` to everything after the first * occurrence of `needle`, and returning everything before it. If * `needle` does not occur in `self`, `self` is set to the empty slice, * and the entirety of `self` is returned. * @param self The slice to split. * @param needle The text to search for in `self`. * @return The part of `self` up to the first occurrence of `delim`. */ function split(slice memory self, slice memory needle) internal pure returns (slice memory token) { split(self, needle, token); } /* * @dev Splits the slice, setting `self` to everything before the last * occurrence of `needle`, and `token` to everything after it. If * `needle` does not occur in `self`, `self` is set to the empty slice, * and `token` is set to the entirety of `self`. * @param self The slice to split. * @param needle The text to search for in `self`. * @param token An output parameter to which the first token is written. * @return `token`. */ function rsplit( slice memory self, slice memory needle, slice memory token ) internal pure returns (slice memory) { uint256 ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr); token._ptr = ptr; token._len = self._len - (ptr - self._ptr); if (ptr == self._ptr) { // Not found self._len = 0; } else { self._len -= token._len + needle._len; } return token; } /* * @dev Splits the slice, setting `self` to everything before the last * occurrence of `needle`, and returning everything after it. If * `needle` does not occur in `self`, `self` is set to the empty slice, * and the entirety of `self` is returned. * @param self The slice to split. * @param needle The text to search for in `self`. * @return The part of `self` after the last occurrence of `delim`. */ function rsplit(slice memory self, slice memory needle) internal pure returns (slice memory token) { rsplit(self, needle, token); } /* * @dev Counts the number of nonoverlapping occurrences of `needle` in `self`. * @param self The slice to search. * @param needle The text to search for in `self`. * @return The number of occurrences of `needle` found in `self`. */ function count(slice memory self, slice memory needle) internal pure returns (uint256 cnt) { uint256 ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len; while (ptr <= self._ptr + self._len) { cnt++; ptr = findPtr( self._len - (ptr - self._ptr), ptr, needle._len, needle._ptr ) + needle._len; } } /* * @dev Returns True if `self` contains `needle`. * @param self The slice to search. * @param needle The text to search for in `self`. * @return True if `needle` is found in `self`, false otherwise. */ function contains(slice memory self, slice memory needle) internal pure returns (bool) { return rfindPtr(self._len, self._ptr, needle._len, needle._ptr) != self._ptr; } /* * @dev Returns a newly allocated string containing the concatenation of * `self` and `other`. * @param self The first slice to concatenate. * @param other The second slice to concatenate. * @return The concatenation of the two strings. */ function concat(slice memory self, slice memory other) internal pure returns (string memory) { string memory ret = new string(self._len + other._len); uint256 retptr; assembly { retptr := add(ret, 32) } memcpy(retptr, self._ptr, self._len); memcpy(retptr + self._len, other._ptr, other._len); return ret; } /* * @dev Joins an array of slices, using `self` as a delimiter, returning a * newly allocated string. * @param self The delimiter to use. * @param parts A list of slices to join. * @return A newly allocated string containing all the slices in `parts`, * joined with `self`. */ function join(slice memory self, slice[] memory parts) internal pure returns (string memory) { if (parts.length == 0) return ""; uint256 length = self._len * (parts.length - 1); for (uint256 i = 0; i < parts.length; i++) length += parts[i]._len; string memory ret = new string(length); uint256 retptr; assembly { retptr := add(ret, 32) } for (uint256 i = 0; i < parts.length; i++) { memcpy(retptr, parts[i]._ptr, parts[i]._len); retptr += parts[i]._len; if (i < parts.length - 1) { memcpy(retptr, self._ptr, self._len); retptr += self._len; } } return ret; } }
// 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; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract OwnableUpgradeable is Initializable, ContextUpgradeable { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ function __Ownable_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Ownable_init_unchained() internal onlyInitializing { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[49] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/UUPSUpgradeable.sol) pragma solidity ^0.8.0; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../ERC1967/ERC1967UpgradeUpgradeable.sol"; import "./Initializable.sol"; /** * @dev An upgradeability mechanism designed for UUPS proxies. The functions included here can perform an upgrade of an * {ERC1967Proxy}, when this contract is set as the implementation behind such a proxy. * * A security mechanism ensures that an upgrade does not turn off upgradeability accidentally, although this risk is * reinstated if the upgrade retains upgradeability but removes the security mechanism, e.g. by replacing * `UUPSUpgradeable` with a custom implementation of upgrades. * * The {_authorizeUpgrade} function must be overridden to include access restriction to the upgrade mechanism. * * _Available since v4.1._ */ abstract contract UUPSUpgradeable is Initializable, IERC1822ProxiableUpgradeable, ERC1967UpgradeUpgradeable { function __UUPSUpgradeable_init() internal onlyInitializing { } function __UUPSUpgradeable_init_unchained() internal onlyInitializing { } /// @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment address private immutable __self = address(this); /** * @dev Check that the execution is being performed through a delegatecall call and that the execution context is * a proxy contract with an implementation (as defined in ERC1967) pointing to self. This should only be the case * for UUPS and transparent proxies that are using the current contract as their implementation. Execution of a * function through ERC1167 minimal proxies (clones) would not normally pass this test, but is not guaranteed to * fail. */ modifier onlyProxy() { require(address(this) != __self, "Function must be called through delegatecall"); require(_getImplementation() == __self, "Function must be called through active proxy"); _; } /** * @dev Check that the execution is not being performed through a delegate call. This allows a function to be * callable on the implementing contract but not through proxies. */ modifier notDelegated() { require(address(this) == __self, "UUPSUpgradeable: must not be called through delegatecall"); _; } /** * @dev Implementation of the ERC1822 {proxiableUUID} function. This returns the storage slot used by the * implementation. It is used to validate that the this implementation remains valid after an upgrade. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. This is guaranteed by the `notDelegated` modifier. */ function proxiableUUID() external view virtual override notDelegated returns (bytes32) { return _IMPLEMENTATION_SLOT; } /** * @dev Upgrade the implementation of the proxy to `newImplementation`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeTo(address newImplementation) external virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, new bytes(0), false); } /** * @dev Upgrade the implementation of the proxy to `newImplementation`, and subsequently execute the function call * encoded in `data`. * * Calls {_authorizeUpgrade}. * * Emits an {Upgraded} event. */ function upgradeToAndCall(address newImplementation, bytes memory data) external payable virtual onlyProxy { _authorizeUpgrade(newImplementation); _upgradeToAndCallUUPS(newImplementation, data, true); } /** * @dev Function that should revert when `msg.sender` is not authorized to upgrade the contract. Called by * {upgradeTo} and {upgradeToAndCall}. * * Normally, this function will use an xref:access.adoc[access control] modifier such as {Ownable-onlyOwner}. * * ```solidity * function _authorizeUpgrade(address) internal override onlyOwner {} * ``` */ function _authorizeUpgrade(address newImplementation) internal virtual; /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; 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 proxied contracts do not make use of 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. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * 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 prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } }
// 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must 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 Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// 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; } }
// 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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol) pragma solidity ^0.8.2; import "../beacon/IBeaconUpgradeable.sol"; import "../../interfaces/draft-IERC1822Upgradeable.sol"; import "../../utils/AddressUpgradeable.sol"; import "../../utils/StorageSlotUpgradeable.sol"; import "../utils/Initializable.sol"; /** * @dev This abstract contract provides getters and event emitting update functions for * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots. * * _Available since v4.1._ * * @custom:oz-upgrades-unsafe-allow delegatecall */ abstract contract ERC1967UpgradeUpgradeable is Initializable { function __ERC1967Upgrade_init() internal onlyInitializing { } function __ERC1967Upgrade_init_unchained() internal onlyInitializing { } // This is the keccak-256 hash of "eip1967.proxy.rollback" subtracted by 1 bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143; /** * @dev Storage slot with the address of the current implementation. * This is the keccak-256 hash of "eip1967.proxy.implementation" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; /** * @dev Emitted when the implementation is upgraded. */ event Upgraded(address indexed implementation); /** * @dev Returns the current implementation address. */ function _getImplementation() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value; } /** * @dev Stores a new address in the EIP1967 implementation slot. */ function _setImplementation(address newImplementation) private { require(AddressUpgradeable.isContract(newImplementation), "ERC1967: new implementation is not a contract"); StorageSlotUpgradeable.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; } /** * @dev Perform implementation upgrade * * Emits an {Upgraded} event. */ function _upgradeTo(address newImplementation) internal { _setImplementation(newImplementation); emit Upgraded(newImplementation); } /** * @dev Perform implementation upgrade with additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCall( address newImplementation, bytes memory data, bool forceCall ) internal { _upgradeTo(newImplementation); if (data.length > 0 || forceCall) { _functionDelegateCall(newImplementation, data); } } /** * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call. * * Emits an {Upgraded} event. */ function _upgradeToAndCallUUPS( address newImplementation, bytes memory data, bool forceCall ) internal { // Upgrades from old implementations will perform a rollback test. This test requires the new // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing // this special case will break upgrade paths from old UUPS implementation to new ones. if (StorageSlotUpgradeable.getBooleanSlot(_ROLLBACK_SLOT).value) { _setImplementation(newImplementation); } else { try IERC1822ProxiableUpgradeable(newImplementation).proxiableUUID() returns (bytes32 slot) { require(slot == _IMPLEMENTATION_SLOT, "ERC1967Upgrade: unsupported proxiableUUID"); } catch { revert("ERC1967Upgrade: new implementation is not UUPS"); } _upgradeToAndCall(newImplementation, data, forceCall); } } /** * @dev Storage slot with the admin of the contract. * This is the keccak-256 hash of "eip1967.proxy.admin" subtracted by 1, and is * validated in the constructor. */ bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103; /** * @dev Emitted when the admin account has changed. */ event AdminChanged(address previousAdmin, address newAdmin); /** * @dev Returns the current admin. */ function _getAdmin() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value; } /** * @dev Stores a new address in the EIP1967 admin slot. */ function _setAdmin(address newAdmin) private { require(newAdmin != address(0), "ERC1967: new admin is the zero address"); StorageSlotUpgradeable.getAddressSlot(_ADMIN_SLOT).value = newAdmin; } /** * @dev Changes the admin of the proxy. * * Emits an {AdminChanged} event. */ function _changeAdmin(address newAdmin) internal { emit AdminChanged(_getAdmin(), newAdmin); _setAdmin(newAdmin); } /** * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy. * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor. */ bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50; /** * @dev Emitted when the beacon is upgraded. */ event BeaconUpgraded(address indexed beacon); /** * @dev Returns the current beacon. */ function _getBeacon() internal view returns (address) { return StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value; } /** * @dev Stores a new beacon in the EIP1967 beacon slot. */ function _setBeacon(address newBeacon) private { require(AddressUpgradeable.isContract(newBeacon), "ERC1967: new beacon is not a contract"); require( AddressUpgradeable.isContract(IBeaconUpgradeable(newBeacon).implementation()), "ERC1967: beacon implementation is not a contract" ); StorageSlotUpgradeable.getAddressSlot(_BEACON_SLOT).value = newBeacon; } /** * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that). * * Emits a {BeaconUpgraded} event. */ function _upgradeBeaconToAndCall( address newBeacon, bytes memory data, bool forceCall ) internal { _setBeacon(newBeacon); emit BeaconUpgraded(newBeacon); if (data.length > 0 || forceCall) { _functionDelegateCall(IBeaconUpgradeable(newBeacon).implementation(), data); } } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function _functionDelegateCall(address target, bytes memory data) private returns (bytes memory) { require(AddressUpgradeable.isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return AddressUpgradeable.verifyCallResult(success, returndata, "Address: low-level delegate call failed"); } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol) pragma solidity ^0.8.0; /** * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified * proxy whose upgrades are fully controlled by the current implementation. */ interface IERC1822ProxiableUpgradeable { /** * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation * address. * * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this * function revert if invoked through a proxy. */ function proxiableUUID() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library 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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// 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 { } 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; } /** * @dev This empty reserved space is put in place to allow future versions to add new * variables without shifting down storage in the inheritance chain. * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps */ uint256[50] private __gap; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol) pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ``` * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._ */ library StorageSlotUpgradeable { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol) pragma solidity ^0.8.0; /** * @dev This is the interface that {BeaconProxy} expects of its beacon. */ interface IBeaconUpgradeable { /** * @dev Must return an address that can be used as a delegate call target. * * {BeaconProxy} will check that this address is a contract. */ function implementation() external view returns (address); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"previousAdmin","type":"address"},{"indexed":false,"internalType":"address","name":"newAdmin","type":"address"}],"name":"AdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"beacon","type":"address"}],"name":"BeaconUpgraded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"implementation","type":"address"}],"name":"Upgraded","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"bumpedClaimValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_size","type":"uint256"},{"internalType":"uint256","name":"_currentSize","type":"uint256"}],"name":"calculateSizeIncreaseCost","outputs":[{"internalType":"uint256","name":"total","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_dripTime","type":"uint256"}],"name":"changeEthboxDripTime","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_isLocked","type":"bool"}],"name":"changeEthboxLocked","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_recipient","type":"address"}],"name":"changeEthboxPayoutRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_size","type":"uint256"}],"name":"changeEthboxSize","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"claimAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"},{"internalType":"uint256","name":"_messageValue","type":"uint256"},{"internalType":"address","name":"_from","type":"address"}],"name":"claimOne","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"defaultDripTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultEthboxSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"ethboxDripTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"ethboxLocked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"ethboxMessages","outputs":[{"internalType":"string","name":"message","type":"string"},{"internalType":"uint256","name":"originalValue","type":"uint256"},{"internalType":"uint256","name":"claimedValue","type":"uint256"},{"internalType":"uint256","name":"data","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"ethboxOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"ethboxPayoutRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"ethboxSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"message","type":"string"},{"internalType":"uint256","name":"originalValue","type":"uint256"},{"internalType":"uint256","name":"claimedValue","type":"uint256"},{"internalType":"uint256","name":"data","type":"uint256"}],"internalType":"struct EthboxStructs.Message","name":"_message","type":"tuple"},{"internalType":"uint256","name":"_drip","type":"uint256"}],"name":"getClaimableValue","outputs":[{"internalType":"uint256","name":"_claimableValue","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_ethboxAddress","type":"address"}],"name":"getClaimableValueOfEthbox","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"getOrderedMessages","outputs":[{"components":[{"internalType":"string","name":"message","type":"string"},{"internalType":"uint256","name":"originalValue","type":"uint256"},{"internalType":"uint256","name":"claimedValue","type":"uint256"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint64","name":"timestamp","type":"uint64"},{"internalType":"uint8","name":"index","type":"uint8"},{"internalType":"uint24","name":"feeBPS","type":"uint24"}],"internalType":"struct EthboxStructs.UnpackedMessage[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"getOrderedPackedMessages","outputs":[{"components":[{"internalType":"string","name":"message","type":"string"},{"internalType":"uint256","name":"originalValue","type":"uint256"},{"internalType":"uint256","name":"claimedValue","type":"uint256"},{"internalType":"uint256","name":"data","type":"uint256"}],"internalType":"struct EthboxStructs.Message[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"maxMessageLen","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"messageFeeBPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"messageFeeRecipient","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"metadata","outputs":[{"internalType":"contract EthboxMetadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintMyEthbox","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"minted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxiableUUID","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"removeAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_index","type":"uint256"},{"internalType":"uint256","name":"_messageValue","type":"uint256"},{"internalType":"address","name":"_from","type":"address"}],"name":"removeOne","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"string","name":"_message","type":"string"},{"internalType":"uint256","name":"_drip","type":"uint256"}],"name":"sendMessage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bool","name":"","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_messageFeeBPS","type":"uint256"}],"name":"setMessageFeeBPS","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_messageFeeRecipient","type":"address"}],"name":"setMessageFeeRecipient","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_metadata","type":"address"}],"name":"setMetadataContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_sizeIncreaseFee","type":"uint256"}],"name":"setSizeIncreaseFee","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_sizeIncreaseFeeBPS","type":"uint256"}],"name":"setSizeIncreaseFeeBPS","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sizeIncreaseFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sizeIncreaseFeeBPS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_address","type":"address"}],"name":"unpackEthboxInfo","outputs":[{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint8","name":"size","type":"uint8"},{"internalType":"bool","name":"locked","type":"bool"},{"internalType":"uint64","name":"drip","type":"uint64"}],"internalType":"struct EthboxStructs.EthboxInfo","name":"ethbox","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"}],"name":"upgradeTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newImplementation","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"upgradeToAndCall","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
60a06040523060805234801561001457600080fd5b506080516152236100686000396000818161103f0152818161107f01528181611551015281816115910152818161160d01528181612939015281816129790152818161315f015261319f01526152236000f3fe6080604052600436106103765760003560e01c80637fc1b37d116101d1578063b88d4fde11610102578063e2671c41116100a0578063e985e9c51161006f578063e985e9c514610a18578063f1cda9a514610a3b578063f2fde38b14610a5b578063fad6722414610a7b57600080fd5b8063e2671c411461098b578063e5187f43146109b8578063e68f51ee146109d8578063e7c6a7ed146109f857600080fd5b8063d2b46f73116100dc578063d2b46f731461092e578063d5743ff814610943578063dcf58c2c14610958578063e2235c581461097857600080fd5b8063b88d4fde146108de578063c87b56dd146108f9578063d1058e591461091957600080fd5b8063998cc7fd1161016f578063a1cb345911610149578063a1cb345914610880578063a22cb46514610897578063b2df9221146108b2578063b6f585c0146108c957600080fd5b8063998cc7fd1461082d5780639d83e0271461084d578063a0b1eec11461086d57600080fd5b806387f46ece116101ab57806387f46ece146107c45780638da5cb5b146107da5780638f568221146107f857806395d89b411461081857600080fd5b80637fc1b37d1461076f5780637fc5f4c81461078f5780638129fc1c146107af57600080fd5b80632e510ec9116102ab5780634f1ef286116102495780636de7d45b116102235780636de7d45b146106ea57806370a082311461071a578063715018a61461073a57806372488fe41461074f57600080fd5b80634f1ef286146106a257806352d1902d146106b55780636352211e146106ca57600080fd5b80633d27f77a116102855780633d27f77a1461063e578063426492be1461065e57806342842e0e146105a257806347c9c76d1461067557600080fd5b80632e510ec9146105de5780633659cfe6146105fe578063392f37e91461061e57600080fd5b806315751142116103185780631e7269c5116102f25780631e7269c5146105525780631ef89d6c1461058257806323b872dd146105a257806328d47af6146105bd57600080fd5b806315751142146104e45780631c2ade52146105045780631c9d87d61461052457600080fd5b8063081812fc11610354578063081812fc1461043c578063095ea7b3146104745780630f5a175414610496578063122bf446146104c457600080fd5b806301ffc9a71461037b5780630658d738146103b057806306fdde031461041a575b600080fd5b34801561038757600080fd5b5061039b610396366004614501565b610a90565b60405190151581526020015b60405180910390f35b3480156103bc57600080fd5b506103d06103cb366004614547565b610ae2565b6040516103a7919081516001600160a01b0316815260208083015160ff16908201526040808301511515908201526060918201516001600160401b03169181019190915260800190565b34801561042657600080fd5b5061042f610b4d565b6040516103a791906145b2565b34801561044857600080fd5b5061045c6104573660046145c5565b610bdf565b6040516001600160a01b0390911681526020016103a7565b34801561048057600080fd5b5061049461048f3660046145de565b610c0c565b005b3480156104a257600080fd5b506104b66104b1366004614547565b610c44565b6040519081526020016103a7565b3480156104d057600080fd5b506104946104df366004614608565b610c83565b3480156104f057600080fd5b506104946104ff36600461464d565b610ef2565b34801561051057600080fd5b506104b661051f366004614547565b610f5f565b34801561053057600080fd5b506104b661053f366004614547565b6101056020526000908152604090205481565b34801561055e57600080fd5b5061039b61056d366004614547565b60fe6020526000908152604090205460ff1681565b34801561058e57600080fd5b5061049461059d3660046145c5565b610fe0565b3480156105ae57600080fd5b5061049461048f366004614668565b3480156105c957600080fd5b506101025461045c906001600160a01b031681565b3480156105ea57600080fd5b506104b66105f9366004614547565b610fee565b34801561060a57600080fd5b50610494610619366004614547565b611035565b34801561062a57600080fd5b5060fd5461045c906001600160a01b031681565b34801561064a57600080fd5b50610494610659366004614547565b6110fd565b34801561066a57600080fd5b506104b66101005481565b34801561068157600080fd5b50610695610690366004614547565b611128565b6040516103a7919061475b565b6104946106b0366004614861565b611547565b3480156106c157600080fd5b506104b6611600565b3480156106d657600080fd5b5061045c6106e53660046145c5565b6116b3565b3480156106f657600080fd5b5061070a6107053660046145de565b61171d565b6040516103a794939291906148ae565b34801561072657600080fd5b506104b6610735366004614547565b6117f3565b34801561074657600080fd5b5061049461181c565b34801561075b57600080fd5b5061049461076a3660046145c5565b611830565b34801561077b57600080fd5b5061049461078a366004614608565b61183e565b34801561079b57600080fd5b506104946107aa3660046145c5565b611a9d565b3480156107bb57600080fd5b50610494611b4a565b3480156107d057600080fd5b506104b660ff5481565b3480156107e657600080fd5b506033546001600160a01b031661045c565b34801561080457600080fd5b506104b66108133660046148dd565b611cf7565b34801561082457600080fd5b5061042f611dea565b34801561083957600080fd5b5061045c610848366004614547565b611df9565b34801561085957600080fd5b506104b6610868366004614547565b611e2e565b61049461087b3660046145c5565b61200a565b34801561088c57600080fd5b506104b66101015481565b3480156108a357600080fd5b5061049461048f3660046148ff565b3480156108be57600080fd5b506104b66224ea0081565b3480156108d557600080fd5b506104b6600381565b3480156108ea57600080fd5b5061049461048f366004614932565b34801561090557600080fd5b5061042f6109143660046145c5565b61211f565b34801561092557600080fd5b5061049461221b565b34801561093a57600080fd5b506104b6608d81565b34801561094f57600080fd5b506104946125ca565b34801561096457600080fd5b506104946109733660046145c5565b6128fb565b610494610986366004614999565b612908565b34801561099757600080fd5b506109ab6109a6366004614547565b612d76565b6040516103a79190614a21565b3480156109c457600080fd5b506104946109d3366004614547565b612f89565b3480156109e457600080fd5b506104946109f3366004614547565b612fb3565b348015610a0457600080fd5b506104b6610a13366004614aac565b61300b565b348015610a2457600080fd5b5061039b610a33366004614b57565b600092915050565b348015610a4757600080fd5b5061039b610a56366004614547565b6130ab565b348015610a6757600080fd5b50610494610a76366004614547565b6130df565b348015610a8757600080fd5b50610494613155565b60006001600160e01b031982166380ac58cd60e01b1480610ac157506001600160e01b03198216635b5e139f60e01b145b80610adc57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6040805160808101825260008082526020808301828152838501838152606085018481526001600160a01b039788168552610104909352949092205494851683526001600160401b0360a086901c16905260ff60e185901c16905260e09290921c6001161515905290565b606060fb8054610b5c90614b81565b80601f0160208091040260200160405190810160405280929190818152602001828054610b8890614b81565b8015610bd55780601f10610baa57610100808354040283529160200191610bd5565b820191906000526020600020905b815481529060010190602001808311610bb857829003601f168201915b5050505050905090565b6001600160a01b038116600090815260fe602052604081205460ff16610c0457600080fd5b506000919050565b60405162461bcd60e51b8152602060048201526008602482015267191a5cd8589b195960c21b60448201526064015b60405180910390fd5b6001600160a01b038116600090815260fe602052604081205460ff1615610c7b57610c6e82610ae2565b6020015160ff1692915050565b506003919050565b600260655403610ca55760405162461bcd60e51b8152600401610c3b90614bbb565b600260655533600090815260fe602052604090205460ff16610cd95760405162461bcd60e51b8152600401610c3b90614bf2565b33600090815261010360205260408120805485908110610cfb57610cfb614c29565b9060005260206000209060040201604051806080016040529081600082018054610d2490614b81565b80601f0160208091040260200160405190810160405280929190818152602001828054610d5090614b81565b8015610d9d5780601f10610d7257610100808354040283529160200191610d9d565b820191906000526020600020905b815481529060010190602001808311610d8057829003601f168201915b505050505081526020016001820154815260200160028201548152602001600382015481525050905080602001518314610de95760405162461bcd60e51b8152600401610c3b90614c3f565b6000610df882606001516132f3565b905080600001516001600160a01b0316836001600160a01b031614610e2f5760405162461bcd60e51b8152600401610c3b90614c84565b6000610e4c83610e3e33613339565b6001600160401b031661300b565b90508083604001818151610e609190614ce8565b90525033600090815261010360205260409020805484919088908110610e8857610e88614c29565b600091825260209091208251600490920201908190610ea79082614d49565b506020820151600182015560408201516002820155606090910151600390910155610ed23387613358565b610edb83613645565b610ee53382613676565b5050600160655550505050565b6000610efd33610ae2565b9050806020015160ff16600003610f265760405162461bcd60e51b8152600401610c3b90614bf2565b610f4a816000015182606001516001600160401b0316836020015160ff1685613729565b33600090815261010460205260409020555050565b6001600160a01b038116600090815260fe602052604081205460ff16610fd35760405162461bcd60e51b815260206004820152602360248201527f6164647265737320686173206e6f74206d696e746564207468656972206574686044820152620c4def60eb1b6064820152608401610c3b565b506001600160a01b031690565b610fe861374d565b61010155565b6001600160a01b038116600090815260fe602052604081205460ff161561102b5761101882610ae2565b606001516001600160401b031692915050565b506224ea00919050565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361107d5760405162461bcd60e51b8152600401610c3b90614e08565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166110af6137a7565b6001600160a01b0316146110d55760405162461bcd60e51b8152600401610c3b90614e54565b6110de816137c3565b604080516000808252602082019092526110fa918391906137cb565b50565b61110561374d565b61010280546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815261010360209081526040808320805482518185028101850190935280835260609493849084015b82821015611240578382906000526020600020906004020160405180608001604052908160008201805461119190614b81565b80601f01602080910402602001604051908101604052809291908181526020018280546111bd90614b81565b801561120a5780601f106111df5761010080835404028352916020019161120a565b820191906000526020600020905b8154815290600101906020018083116111ed57829003601f168201915b5050505050815260200160018201548152602001600282015481526020016003820154815250508152602001906001019061115e565b509293506001925050505b815181101561133b5760005b818110156113285782818151811061127157611271614c29565b60200260200101516020015183838151811061128f5761128f614c29565b60200260200101516020015111156113165760008383815181106112b5576112b5614c29565b602002602001015190508382815181106112d1576112d1614c29565b60200260200101518484815181106112eb576112eb614c29565b60200260200101819052508084838151811061130957611309614c29565b6020026020010181905250505b8061132081614ea0565b915050611257565b508061133381614ea0565b91505061124b565b50600081516001600160401b038111156113575761135761476e565b6040519080825280602002602001820160405280156113bf57816020015b6040805160e0810182526060808252600060208084018290529383018190529082018190526080820181905260a0820181905260c082015282526000199092019101816113755790505b5090506113ec60408051608081018252600080825260208201819052918101829052606081019190915290565b60005b835181101561153d576040805160e081018252606080825260006020830181905292820183905281018290526080810182905260a0810182905260c081019190915261145785838151811061144657611446614c29565b6020026020010151606001516132f3565b925084828151811061146b5761146b614c29565b6020908102919091010151518152845185908390811061148d5761148d614c29565b6020026020010151602001518160200181815250508482815181106114b4576114b4614c29565b6020908102919091018101516040908101518382015284516001600160a01b0316606080850191909152918501516001600160401b0316608084015284015160ff1660a083015283015162ffffff1660c08201528351819085908490811061151e5761151e614c29565b602002602001018190525050808061153590614ea0565b9150506113ef565b5090949350505050565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361158f5760405162461bcd60e51b8152600401610c3b90614e08565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166115c16137a7565b6001600160a01b0316146115e75760405162461bcd60e51b8152600401610c3b90614e54565b6115f0826137c3565b6115fc828260016137cb565b5050565b6000306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146116a05760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610c3b565b506000805160206151a783398151915290565b6001600160a01b038116600090815260fe6020526040812054829060ff16610adc5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610c3b565b610103602052816000526040600020818154811061173a57600080fd5b90600052602060002090600402016000915091505080600001805461175e90614b81565b80601f016020809104026020016040519081016040528092919081815260200182805461178a90614b81565b80156117d75780601f106117ac576101008083540402835291602001916117d7565b820191906000526020600020905b8154815290600101906020018083116117ba57829003601f168201915b5050505050908060010154908060020154908060030154905084565b6001600160a01b038116600090815260fe602052604081205460ff1615610c0457506001919050565b61182461374d565b61182e600061393b565b565b61183861374d565b61010055565b6002606554036118605760405162461bcd60e51b8152600401610c3b90614bbb565b6002606555600061187033610ae2565b9050806020015160ff166000036118995760405162461bcd60e51b8152600401610c3b90614bf2565b336000908152610103602052604081208054869081106118bb576118bb614c29565b90600052602060002090600402016040518060800160405290816000820180546118e490614b81565b80601f016020809104026020016040519081016040528092919081815260200182805461191090614b81565b801561195d5780601f106119325761010080835404028352916020019161195d565b820191906000526020600020905b81548152906001019060200180831161194057829003601f168201915b5050505050815260200160018201548152602001600282015481526020016003820154815250509050806020015184146119a95760405162461bcd60e51b8152600401610c3b90614c3f565b60006119b882606001516132f3565b905080600001516001600160a01b0316846001600160a01b0316146119ef5760405162461bcd60e51b8152600401610c3b90614c84565b60006119fe83610e3e33613339565b90504284606001518360200151611a159190614eb9565b6001600160401b03161015611a3a57611a3533836040015160ff16613358565b611a85565b33600090815261010360205260409020805482919089908110611a5f57611a5f614c29565b90600052602060002090600402016002016000828254611a7f9190614ce8565b90915550505b611a8f3382613676565b505060016065555050505050565b6000611aa833610ae2565b9050806020015160ff16600003611ad15760405162461bcd60e51b8152600401610c3b90614bf2565b336000908152610103602052604090205415611b2f5760405162461bcd60e51b815260206004820152601860248201527f657468626f78206e6565647320746f20626520656d70747900000000000000006044820152606401610c3b565b610f4a816000015183836020015160ff168460400151613729565b600054610100900460ff1615808015611b6a5750600054600160ff909116105b80611b845750303b158015611b84575060005460ff166001145b611be75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c3b565b6000805460ff191660011790558015611c0a576000805461ff0019166101001790555b611c1261398d565b611c1a6139bc565b60408051808201909152600681526508ae8d0c4def60d31b602082015260fb90611c449082614d49565b5060408051808201909152600681526508aa890849eb60d31b602082015260fc90611c6f9082614d49565b5066b1a2bc2ec5000060ff556109c46101005560fa6101015561010280546001600160a01b0319167340543d76fb35c60ff578b648d723e14ccab8b39017905580156110fa576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6000818311611d485760405162461bcd60e51b815260206004820152601960248201527f6e65772073697a652073686f756c64206265206c6172676572000000000000006044820152606401610c3b565b506000815b83811015611de35760038103611d715760ff54611d6a9083614ce8565b9150611dd1565b611d7c600382614ed9565b611d8890612710614fd0565b611d93600383614ed9565b61010054611da390612710614ce8565b611dad9190614fd0565b60ff54611dba9190614fdc565b611dc49190615011565b611dce9083614ce8565b91505b80611ddb81614ea0565b915050611d4d565b5092915050565b606060fc8054610b5c90614b81565b6001600160a01b038116600090815260fe602052604081205460ff1615611e2a57611e2382610ae2565b5192915050565b5090565b6001600160a01b03811660009081526101036020908152604080832080548251818502810185019093528083528493849084015b82821015611f445783829060005260206000209060040201604051806080016040529081600082018054611e9590614b81565b80601f0160208091040260200160405190810160405280929190818152602001828054611ec190614b81565b8015611f0e5780601f10611ee357610100808354040283529160200191611f0e565b820191906000526020600020905b815481529060010190602001808311611ef157829003601f168201915b50505050508152602001600182015481526020016002820154815260200160038201548152505081526020019060010190611e62565b5050505090506000611f5584610ae2565b90506000825190506000806000846020015160ff16600014611f845784606001516001600160401b0316611f89565b6224ea005b905060005b84811015611fd957611fb9878281518110611fab57611fab614c29565b60200260200101518361300b565b9350611fc58484614ce8565b925080611fd181614ea0565b915050611f8e565b506001600160a01b03881660009081526101056020526040902054611ffe9083614ce8565b98975050505050505050565b600061201533610ae2565b9050806020015160ff1660000361203e5760405162461bcd60e51b8152600401610c3b90614bf2565b600061205183836020015160ff16611cf7565b905034811461205f826139eb565b9061207d5760405162461bcd60e51b8152600401610c3b91906145b2565b5061209f826000015183606001516001600160401b0316858560400151613729565b33600090815261010460205260408082209290925561010254915190916001600160a01b03169034905b60006040518083038185875af1925050503d8060008114612106576040519150601f19603f3d011682016040523d82523d6000602084013e61210b565b606091505b505090508061211957600080fd5b50505050565b6001600160a01b038116600090815260fe602052604090205460609060ff1661214757600080fd5b81600061215382611128565b9050600061217a836001600160a01b03166000908152610104602052604090205460e11c90565b60ff169050600061218a84613339565b60fd54604051633a36a46560e01b81526001600160401b039290921692506001600160a01b031690633a36a465906121cc908790879087908790600401615025565b600060405180830381865afa1580156121e9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612211919081019061505c565b9695505050505050565b60026065540361223d5760405162461bcd60e51b8152600401610c3b90614bbb565b600260655533600090815260fe602052604090205460ff166122715760405162461bcd60e51b8152600401610c3b90614bf2565b33600090815261010360209081526040808320805482518185028101850190935280835284938493929190849084015b8282101561238357838290600052602060002090600402016040518060800160405290816000820180546122d490614b81565b80601f016020809104026020016040519081016040528092919081815260200182805461230090614b81565b801561234d5780601f106123225761010080835404028352916020019161234d565b820191906000526020600020905b81548152906001019060200180831161233057829003601f168201915b505050505081526020016001820154815260200160028201548152602001600382015481525050815260200190600101906122a1565b5050505090506000815190506000816001600160401b038111156123a9576123a961476e565b6040519080825280602002602001820160405280156123d2578160200160208202803683370190505b5090506000806123e133613339565b6001600160401b0316905060005b848110156124db57600086828151811061240b5761240b614c29565b6020026020010151905061241f818461300b565b985061242b8989614ce8565b3360009081526101036020526040902080549199508a918490811061245257612452614c29565b906000526020600020906004020160020160008282546124729190614ce8565b909155505060608101514290849060a01c6001600160401b03166124969190614ce8565b10156124c857818585815181106124af576124af614c29565b6020908102919091010152836124c481614ea0565b9450505b50806124d381614ea0565b9150506123ef565b506000826001600160401b038111156124f6576124f661476e565b60405190808252806020026020018201604052801561251f578160200160208202803683370190505b50905060005b81518110156125775784818151811061254057612540614c29565b602002602001015182828151811061255a5761255a614c29565b60209081029190910101528061256f81614ea0565b915050612525565b5033600090815261010560205260409020546125939088614ce8565b33600081815261010560205260408120559097506125b19082613af3565b6125bb3388613676565b50506001606555505050505050565b6002606554036125ec5760405162461bcd60e51b8152600401610c3b90614bbb565b600260655533600090815260fe602052604090205460ff166126205760405162461bcd60e51b8152600401610c3b90614bf2565b33600090815261010360209081526040808320805482518185028101850190935280835284938493929190849084015b82821015612732578382906000526020600020906004020160405180608001604052908160008201805461268390614b81565b80601f01602080910402602001604051908101604052809291908181526020018280546126af90614b81565b80156126fc5780601f106126d1576101008083540402835291602001916126fc565b820191906000526020600020905b8154815290600101906020018083116126df57829003601f168201915b50505050508152602001600182015481526020016002820154815260200160038201548152505081526020019060010190612650565b5050825192935060009150505b818110156128cc5761276d83828151811061275c5761275c614c29565b6020026020010151610e3e33613339565b94506127798585614ce8565b3360009081526101036020526040902080549195508691839081106127a0576127a0614c29565b906000526020600020906004020160020160008282546127c09190614ce8565b90915550503360009081526101036020526040902080546128ba9190839081106127ec576127ec614c29565b906000526020600020906004020160405180608001604052908160008201805461281590614b81565b80601f016020809104026020016040519081016040528092919081815260200182805461284190614b81565b801561288e5780601f106128635761010080835404028352916020019161288e565b820191906000526020600020905b81548152906001019060200180831161287157829003601f168201915b505050505081526020016001820154815260200160028201548152602001600382015481525050613645565b806128c481614ea0565b91505061273f565b50336000908152610103602052604081206128e69161445f565b6128f03384613676565b505060016065555050565b61290361374d565b60ff55565b60026065540361292a5760405162461bcd60e51b8152600401610c3b90614bbb565b60026065556001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001630036129775760405162461bcd60e51b8152600401610c3b90614e08565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166129a96137a7565b6001600160a01b0316146129cf5760405162461bcd60e51b8152600401610c3b90614e54565b608d8210612a125760405162461bcd60e51b815260206004820152601060248201526f6d65737361676520746f6f206c6f6e6760801b6044820152606401610c3b565b6000612a1d85610ae2565b60208101519091506003906224ea009060ff1615612a5057826020015160ff16915082606001516001600160401b031690505b826040015115612a955760405162461bcd60e51b815260206004820152601060248201526f195d1a189bde081a5cc81b1bd8dad95960821b6044820152606401610c3b565b612710341180612aa3575034155b612aef5760405162461bcd60e51b815260206004820152601760248201527f6d6573736167652076616c756520696e636f72726563740000000000000000006044820152606401610c3b565b838114612b375760405162461bcd60e51b81526020600482015260166024820152751b595cdcd859d948191c9a5c081a5b98dbdc9c9958dd60521b6044820152606401610c3b565b6001600160a01b03871660009081526101036020908152604080832080548251818502810185019093528083529192909190849084015b82821015612c505783829060005260206000209060040201604051806080016040529081600082018054612ba190614b81565b80601f0160208091040260200160405190810160405280929190818152602001828054612bcd90614b81565b8015612c1a5780601f10612bef57610100808354040283529160200191612c1a565b820191906000526020600020905b815481529060010190602001808311612bfd57829003601f168201915b50505050508152602001600182015481526020016002820154815260200160038201548152505081526020019060010190612b6e565b50508251929350505083811015612c7457612c6f89338a8a3486613e23565b612d5d565b600080612c82848434613f09565b915091508115612d1a576000848281518110612ca057612ca0614c29565b602002602001015190506000612cb6828861300b565b90508082604001818151612cca9190614ce8565b9052506001600160a01b038d166000908152610105602052604081208054839290612cf6908490614ce8565b90915550612d05905082613645565b612d138d338e8e3488613fa6565b5050612d5a565b60405162461bcd60e51b81526020600482015260156024820152746d6573736167652076616c756520746f6f206c6f7760581b6044820152606401610c3b565b50505b612d663461409d565b5050600160655550505050505050565b6001600160a01b038116600090815261010360209081526040808320805482518185028101850190935280835260609493849084015b82821015612e8e5783829060005260206000209060040201604051806080016040529081600082018054612ddf90614b81565b80601f0160208091040260200160405190810160405280929190818152602001828054612e0b90614b81565b8015612e585780601f10612e2d57610100808354040283529160200191612e58565b820191906000526020600020905b815481529060010190602001808311612e3b57829003601f168201915b50505050508152602001600182015481526020016002820154815260200160038201548152505081526020019060010190612dac565b509293506001925050505b8151811015611de35760005b81811015612f7657828181518110612ebf57612ebf614c29565b602002602001015160200151838381518110612edd57612edd614c29565b6020026020010151602001511115612f64576000838381518110612f0357612f03614c29565b60200260200101519050838281518110612f1f57612f1f614c29565b6020026020010151848481518110612f3957612f39614c29565b602002602001018190525080848381518110612f5757612f57614c29565b6020026020010181905250505b80612f6e81614ea0565b915050612ea5565b5080612f8181614ea0565b915050612e99565b612f9161374d565b60fd80546001600160a01b0319166001600160a01b0392909216919091179055565b6000612fbe33610ae2565b9050806020015160ff16600003612fe75760405162461bcd60e51b8152600401610c3b90614bf2565b610f4a8282606001516001600160401b0316836020015160ff168460400151613729565b60008061301c846060015160a01c90565b61302f906001600160401b031642614ed9565b90506001811015613044576000915050610adc565b8281111561305d5761305584614151565b915050610adc565b60008361306b836064614fdc565b6130759190615011565b905060006064826130858861416b565b61308f9190614fdc565b6130999190615011565b90508560400151816122119190614ed9565b6001600160a01b038116600090815260fe602052604081205460ff1615610c04576130d582610ae2565b6040015192915050565b6130e761374d565b6001600160a01b03811661314c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c3b565b6110fa8161393b565b6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016300361319d5760405162461bcd60e51b8152600401610c3b90614e08565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166131cf6137a7565b6001600160a01b0316146131f55760405162461bcd60e51b8152600401610c3b90614e54565b33600081815260fe602052604090205460ff161561324d5760405162461bcd60e51b8152602060048201526015602482015274195d1a189bde08185b1c9958591e481b5a5b9d1959605a1b6044820152606401610c3b565b6001600160a01b038116600090815260fe60205260408120805460ff191660011790556132839082906224ea0090600390613729565b6001600160a01b03821660008181526101046020526040808220939093559151909182917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46001600160a01b03811660009081526101036020526040902054156110fa576110fa61221b565b604080516080810182526001600160a01b038316815260a083901c6001600160401b0316602082015260e083901c60ff169181019190915260e89190911c606082015290565b6001600160a01b03166000908152610104602052604090205460a01c90565b6001600160a01b03821660009081526101036020908152604080832080548251818502810185019093528083529192909190849084015b8282101561347157838290600052602060002090600402016040518060800160405290816000820180546133c290614b81565b80601f01602080910402602001604051908101604052809291908181526020018280546133ee90614b81565b801561343b5780601f106134105761010080835404028352916020019161343b565b820191906000526020600020905b81548152906001019060200180831161341e57829003601f168201915b5050505050815260200160018201548152602001600282015481526020016003820154815250508152602001906001019061338f565b50505050905080600182516134869190614ed9565b8151811061349657613496614c29565b60200260200101516101036000856001600160a01b03166001600160a01b0316815260200190815260200160002083815481106134d5576134d5614c29565b6000918252602090912082516004909202019081906134f49082614d49565b5060208201518160010155604082015181600201556060820151816003015590505060006135696101036000866001600160a01b03166001600160a01b03168152602001908152602001600020848154811061355257613552614c29565b9060005260206000209060040201600301546132f3565b9050613591816000015182602001516001600160401b031685846060015162ffffff166141a8565b6001600160a01b0385166000908152610103602052604090208054859081106135bc576135bc614c29565b9060005260206000209060040201600301819055506101036000856001600160a01b03166001600160a01b03168152602001908152602001600020805480613606576136066150c9565b600082815260208120600019909201916004830201906136268282614480565b5060006001820181905560028201819055600390910155905550505050565b600061365082614151565b9050600061365f836060015190565b90506000816001600160a01b0316836040516120c9565b6001600160a01b0382811660009081526101046020526040808220549051909283169084908381818185875af1925050503d80600081146136d3576040519150601f19603f3d011682016040523d82523d6000602084013e6136d8565b606091505b50509050806121195760405162461bcd60e51b815260206004820152601760248201527f636f756c64206e6f742070617920726563697069656e740000000000000000006044820152606401610c3b565b60e01b60a09290921b9190911760e19190911b176001600160a01b03919091161790565b6033546001600160a01b0316331461182e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c3b565b6000805160206151a7833981519152546001600160a01b031690565b6110fa61374d565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615613803576137fe836141cc565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561385d575060408051601f3d908101601f1916820190925261385a918101906150df565b60015b6138c05760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610c3b565b6000805160206151a7833981519152811461392f5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610c3b565b506137fe838383614268565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166139b45760405162461bcd60e51b8152600401610c3b906150f8565b61182e61428d565b600054610100900460ff166139e35760405162461bcd60e51b8152600401610c3b906150f8565b61182e6142bd565b606081600003613a125750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613a3c5780613a2681614ea0565b9150613a359050600a83615011565b9150613a16565b6000816001600160401b03811115613a5657613a5661476e565b6040519080825280601f01601f191660200182016040528015613a80576020820181803683370190505b5090505b8415613aeb57613a95600183614ed9565b9150613aa2600a86615143565b613aad906030614ce8565b60f81b818381518110613ac257613ac2614c29565b60200101906001600160f81b031916908160001a905350613ae4600a86615011565b9450613a84565b949350505050565b6001600160a01b03821660009081526101036020908152604080832080548251818502810185019093528083529192909190849084015b82821015613c0c5783829060005260206000209060040201604051806080016040529081600082018054613b5d90614b81565b80601f0160208091040260200160405190810160405280929190818152602001828054613b8990614b81565b8015613bd65780601f10613bab57610100808354040283529160200191613bd6565b820191906000526020600020905b815481529060010190602001808311613bb957829003601f168201915b50505050508152602001600182015481526020016002820154815260200160038201548152505081526020019060010190613b2a565b5050845192935050505b80156121195781518114613db0576000613c3b83838151811061144657611446614c29565b90508260018451613c4c9190614ed9565b81518110613c5c57613c5c614c29565b60200260200101516101036000876001600160a01b03166001600160a01b0316815260200190815260200160002085600185613c989190614ed9565b81518110613ca857613ca8614c29565b602002602001015181548110613cc057613cc0614c29565b600091825260209091208251600490920201908190613cdf9082614d49565b50602082015181600101556040820151816002015560608201518160030155905050613d4c816000015182602001516001600160401b031686600186613d259190614ed9565b81518110613d3557613d35614c29565b6020026020010151846060015162ffffff166141a8565b6001600160a01b03861660009081526101036020526040902085613d71600186614ed9565b81518110613d8157613d81614c29565b602002602001015181548110613d9957613d99614c29565b906000526020600020906004020160030181905550505b6001600160a01b038416600090815261010360205260409020805480613dd857613dd86150c9565b60008281526020812060001990920191600483020190613df88282614480565b5060006001820181905560028201819055600390910155905580613e1b81615157565b915050613c16565b613e4e6040518060800160405280606081526020016000815260200160008152602001600081525090565b613e5d864284610101546141a8565b6060820152604080516020601f87018190048102820181019092528581529086908690819084018382808284376000920182905250938552505050602080830185905260408084018390526001600160a01b038a168352610103825282208054600181018255908352912082518392600402909101908190613edf9082614d49565b50602082015181600101556040820151816002015560608201518160030155505050505050505050565b60008060008086600081518110613f2257613f22614c29565b6020026020010151602001519050600080600090505b87811015613f9857888181518110613f5257613f52614c29565b602002602001015160200151915082821015613f6f578093508192505b85158015613f7c57508187115b15613f8657600195505b80613f9081614ea0565b915050613f38565b509192505050935093915050565b613fd16040518060800160405280606081526020016000815260200160008152602001600081525090565b613fe0864284610101546141a8565b6060820152604080516020601f87018190048102820181019092528581529086908690819084018382808284376000920182905250938552505050602080830185905260408084018390526001600160a01b038a168352610103909152902080548291908490811061405457614054614c29565b6000918252602090912082516004909202019081906140739082614d49565b50602082015160018201556040820151600282015560609091015160039091015550505050505050565b61010254610101546000916001600160a01b031690612710906140c09085614fdc565b6140ca9190615011565b604051600081818185875af1925050503d8060008114614106576040519150601f19603f3d011682016040523d82523d6000602084013e61410b565b606091505b50509050806115fc5760405162461bcd60e51b8152602060048201526012602482015271636f756c64206e6f7420706179206665657360701b6044820152606401610c3b565b600081604001516141618361416b565b610adc9190614ed9565b600061271061417e836060015160e81c90565b61418a9061271061516e565b62ffffff16836020015161419e9190614fdc565b610adc9190615011565b60a083901b60e083901b1760e882901b176001600160a01b03851617949350505050565b6001600160a01b0381163b6142395760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610c3b565b6000805160206151a783398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b614271836142eb565b60008251118061427e5750805b156137fe57612119838361432b565b600054610100900460ff166142b45760405162461bcd60e51b8152600401610c3b906150f8565b61182e3361393b565b600054610100900460ff166142e45760405162461bcd60e51b8152600401610c3b906150f8565b6001606555565b6142f4816141cc565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6143935760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610c3b565b600080846001600160a01b0316846040516143ae919061518a565b600060405180830381855af49150503d80600081146143e9576040519150601f19603f3d011682016040523d82523d6000602084013e6143ee565b606091505b509150915061441682826040518060600160405280602781526020016151c76027913961441f565b95945050505050565b6060831561442e575081614458565b82511561443e5782518084602001fd5b8160405162461bcd60e51b8152600401610c3b91906145b2565b9392505050565b50805460008255600402906000526020600020908101906110fa91906144ba565b50805461448c90614b81565b6000825580601f1061449c575050565b601f0160209004906000526020600020908101906110fa91906144ec565b80821115611e2a5760006144ce8282614480565b506000600182018190556002820181905560038201556004016144ba565b5b80821115611e2a57600081556001016144ed565b60006020828403121561451357600080fd5b81356001600160e01b03198116811461445857600080fd5b80356001600160a01b038116811461454257600080fd5b919050565b60006020828403121561455957600080fd5b6144588261452b565b60005b8381101561457d578181015183820152602001614565565b50506000910152565b6000815180845261459e816020860160208601614562565b601f01601f19169290920160200192915050565b6020815260006144586020830184614586565b6000602082840312156145d757600080fd5b5035919050565b600080604083850312156145f157600080fd5b6145fa8361452b565b946020939093013593505050565b60008060006060848603121561461d57600080fd5b83359250602084013591506146346040850161452b565b90509250925092565b8035801515811461454257600080fd5b60006020828403121561465f57600080fd5b6144588261463d565b60008060006060848603121561467d57600080fd5b6146868461452b565b92506146946020850161452b565b9150604084013590509250925092565b600081518084526020808501808196508360051b8101915082860160005b8581101561474e578284038952815160e081518187526146e482880182614586565b83890151888a0152604080850151908901526060808501516001600160a01b0316908901526080808501516001600160401b03169089015260a08085015160ff169089015260c09384015162ffffff169390970192909252505097840197908401906001016146c2565b5091979650505050505050565b60208152600061445860208301846146a4565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b03811182821017156147a6576147a661476e565b60405290565b604051601f8201601f191681016001600160401b03811182821017156147d4576147d461476e565b604052919050565b60006001600160401b038211156147f5576147f561476e565b50601f01601f191660200190565b6000614816614811846147dc565b6147ac565b905082815283838301111561482a57600080fd5b828260208301376000602084830101529392505050565b600082601f83011261485257600080fd5b61445883833560208501614803565b6000806040838503121561487457600080fd5b61487d8361452b565b915060208301356001600160401b0381111561489857600080fd5b6148a485828601614841565b9150509250929050565b6080815260006148c16080830187614586565b6020830195909552506040810192909252606090910152919050565b600080604083850312156148f057600080fd5b50508035926020909101359150565b6000806040838503121561491257600080fd5b61491b8361452b565b91506149296020840161463d565b90509250929050565b6000806000806080858703121561494857600080fd5b6149518561452b565b935061495f6020860161452b565b92506040850135915060608501356001600160401b0381111561498157600080fd5b61498d87828801614841565b91505092959194509250565b600080600080606085870312156149af57600080fd5b6149b88561452b565b935060208501356001600160401b03808211156149d457600080fd5b818701915087601f8301126149e857600080fd5b8135818111156149f757600080fd5b886020828501011115614a0957600080fd5b95986020929092019750949560400135945092505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015614a9e57603f19898403018552815160808151818652614a6e82870182614586565b838b0151878c0152898401518a880152606093840151939096019290925250509386019390860190600101614a48565b509098975050505050505050565b60008060408385031215614abf57600080fd5b82356001600160401b0380821115614ad657600080fd5b9084019060808287031215614aea57600080fd5b614af2614784565b823582811115614b0157600080fd5b83019150601f82018713614b1457600080fd5b614b2387833560208501614803565b8152602083013560208201526040830135604082015260608301356060820152809450505050602083013590509250929050565b60008060408385031215614b6a57600080fd5b614b738361452b565b91506149296020840161452b565b600181811c90821680614b9557607f821691505b602082108103614bb557634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526019908201527f657468626f78206e6565647320746f206265206d696e74656400000000000000604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60208082526025908201527f6d65737361676520617420696e64657820646f6573206e6f74206d617463682060408201526476616c756560d81b606082015260800190565b6020808252602e908201527f6d65737361676520617420696e64657820646f6573206e6f74206d617463682060408201526d73656e646572206164647265737360901b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610adc57610adc614cd2565b601f8211156137fe57600081815260208120601f850160051c81016020861015614d225750805b601f850160051c820191505b81811015614d4157828155600101614d2e565b505050505050565b81516001600160401b03811115614d6257614d6261476e565b614d7681614d708454614b81565b84614cfb565b602080601f831160018114614dab5760008415614d935750858301515b600019600386901b1c1916600185901b178555614d41565b600085815260208120601f198616915b82811015614dda57888601518255948401946001909101908401614dbb565b5085821015614df85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b600060018201614eb257614eb2614cd2565b5060010190565b6001600160401b03818116838216019080821115611de357611de3614cd2565b81810381811115610adc57610adc614cd2565b600181815b80851115614f27578160001904821115614f0d57614f0d614cd2565b80851615614f1a57918102915b93841c9390800290614ef1565b509250929050565b600082614f3e57506001610adc565b81614f4b57506000610adc565b8160018114614f615760028114614f6b57614f87565b6001915050610adc565b60ff841115614f7c57614f7c614cd2565b50506001821b610adc565b5060208310610133831016604e8410600b8410161715614faa575081810a610adc565b614fb48383614eec565b8060001904821115614fc857614fc8614cd2565b029392505050565b60006144588383614f2f565b6000816000190483118215151615614ff657614ff6614cd2565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261502057615020614ffb565b500490565b6001600160a01b0385168152608060208201819052600090615049908301866146a4565b6040830194909452506060015292915050565b60006020828403121561506e57600080fd5b81516001600160401b0381111561508457600080fd5b8201601f8101841361509557600080fd5b80516150a3614811826147dc565b8181528560208385010111156150b857600080fd5b614416826020830160208601614562565b634e487b7160e01b600052603160045260246000fd5b6000602082840312156150f157600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008261515257615152614ffb565b500690565b60008161516657615166614cd2565b506000190190565b62ffffff828116828216039080821115611de357611de3614cd2565b6000825161519c818460208701614562565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122088e3f79c11adc123271cc7b366853b0f501707b0f6ea545d7c615726f605740b64736f6c63430008100033
Deployed Bytecode
0x6080604052600436106103765760003560e01c80637fc1b37d116101d1578063b88d4fde11610102578063e2671c41116100a0578063e985e9c51161006f578063e985e9c514610a18578063f1cda9a514610a3b578063f2fde38b14610a5b578063fad6722414610a7b57600080fd5b8063e2671c411461098b578063e5187f43146109b8578063e68f51ee146109d8578063e7c6a7ed146109f857600080fd5b8063d2b46f73116100dc578063d2b46f731461092e578063d5743ff814610943578063dcf58c2c14610958578063e2235c581461097857600080fd5b8063b88d4fde146108de578063c87b56dd146108f9578063d1058e591461091957600080fd5b8063998cc7fd1161016f578063a1cb345911610149578063a1cb345914610880578063a22cb46514610897578063b2df9221146108b2578063b6f585c0146108c957600080fd5b8063998cc7fd1461082d5780639d83e0271461084d578063a0b1eec11461086d57600080fd5b806387f46ece116101ab57806387f46ece146107c45780638da5cb5b146107da5780638f568221146107f857806395d89b411461081857600080fd5b80637fc1b37d1461076f5780637fc5f4c81461078f5780638129fc1c146107af57600080fd5b80632e510ec9116102ab5780634f1ef286116102495780636de7d45b116102235780636de7d45b146106ea57806370a082311461071a578063715018a61461073a57806372488fe41461074f57600080fd5b80634f1ef286146106a257806352d1902d146106b55780636352211e146106ca57600080fd5b80633d27f77a116102855780633d27f77a1461063e578063426492be1461065e57806342842e0e146105a257806347c9c76d1461067557600080fd5b80632e510ec9146105de5780633659cfe6146105fe578063392f37e91461061e57600080fd5b806315751142116103185780631e7269c5116102f25780631e7269c5146105525780631ef89d6c1461058257806323b872dd146105a257806328d47af6146105bd57600080fd5b806315751142146104e45780631c2ade52146105045780631c9d87d61461052457600080fd5b8063081812fc11610354578063081812fc1461043c578063095ea7b3146104745780630f5a175414610496578063122bf446146104c457600080fd5b806301ffc9a71461037b5780630658d738146103b057806306fdde031461041a575b600080fd5b34801561038757600080fd5b5061039b610396366004614501565b610a90565b60405190151581526020015b60405180910390f35b3480156103bc57600080fd5b506103d06103cb366004614547565b610ae2565b6040516103a7919081516001600160a01b0316815260208083015160ff16908201526040808301511515908201526060918201516001600160401b03169181019190915260800190565b34801561042657600080fd5b5061042f610b4d565b6040516103a791906145b2565b34801561044857600080fd5b5061045c6104573660046145c5565b610bdf565b6040516001600160a01b0390911681526020016103a7565b34801561048057600080fd5b5061049461048f3660046145de565b610c0c565b005b3480156104a257600080fd5b506104b66104b1366004614547565b610c44565b6040519081526020016103a7565b3480156104d057600080fd5b506104946104df366004614608565b610c83565b3480156104f057600080fd5b506104946104ff36600461464d565b610ef2565b34801561051057600080fd5b506104b661051f366004614547565b610f5f565b34801561053057600080fd5b506104b661053f366004614547565b6101056020526000908152604090205481565b34801561055e57600080fd5b5061039b61056d366004614547565b60fe6020526000908152604090205460ff1681565b34801561058e57600080fd5b5061049461059d3660046145c5565b610fe0565b3480156105ae57600080fd5b5061049461048f366004614668565b3480156105c957600080fd5b506101025461045c906001600160a01b031681565b3480156105ea57600080fd5b506104b66105f9366004614547565b610fee565b34801561060a57600080fd5b50610494610619366004614547565b611035565b34801561062a57600080fd5b5060fd5461045c906001600160a01b031681565b34801561064a57600080fd5b50610494610659366004614547565b6110fd565b34801561066a57600080fd5b506104b66101005481565b34801561068157600080fd5b50610695610690366004614547565b611128565b6040516103a7919061475b565b6104946106b0366004614861565b611547565b3480156106c157600080fd5b506104b6611600565b3480156106d657600080fd5b5061045c6106e53660046145c5565b6116b3565b3480156106f657600080fd5b5061070a6107053660046145de565b61171d565b6040516103a794939291906148ae565b34801561072657600080fd5b506104b6610735366004614547565b6117f3565b34801561074657600080fd5b5061049461181c565b34801561075b57600080fd5b5061049461076a3660046145c5565b611830565b34801561077b57600080fd5b5061049461078a366004614608565b61183e565b34801561079b57600080fd5b506104946107aa3660046145c5565b611a9d565b3480156107bb57600080fd5b50610494611b4a565b3480156107d057600080fd5b506104b660ff5481565b3480156107e657600080fd5b506033546001600160a01b031661045c565b34801561080457600080fd5b506104b66108133660046148dd565b611cf7565b34801561082457600080fd5b5061042f611dea565b34801561083957600080fd5b5061045c610848366004614547565b611df9565b34801561085957600080fd5b506104b6610868366004614547565b611e2e565b61049461087b3660046145c5565b61200a565b34801561088c57600080fd5b506104b66101015481565b3480156108a357600080fd5b5061049461048f3660046148ff565b3480156108be57600080fd5b506104b66224ea0081565b3480156108d557600080fd5b506104b6600381565b3480156108ea57600080fd5b5061049461048f366004614932565b34801561090557600080fd5b5061042f6109143660046145c5565b61211f565b34801561092557600080fd5b5061049461221b565b34801561093a57600080fd5b506104b6608d81565b34801561094f57600080fd5b506104946125ca565b34801561096457600080fd5b506104946109733660046145c5565b6128fb565b610494610986366004614999565b612908565b34801561099757600080fd5b506109ab6109a6366004614547565b612d76565b6040516103a79190614a21565b3480156109c457600080fd5b506104946109d3366004614547565b612f89565b3480156109e457600080fd5b506104946109f3366004614547565b612fb3565b348015610a0457600080fd5b506104b6610a13366004614aac565b61300b565b348015610a2457600080fd5b5061039b610a33366004614b57565b600092915050565b348015610a4757600080fd5b5061039b610a56366004614547565b6130ab565b348015610a6757600080fd5b50610494610a76366004614547565b6130df565b348015610a8757600080fd5b50610494613155565b60006001600160e01b031982166380ac58cd60e01b1480610ac157506001600160e01b03198216635b5e139f60e01b145b80610adc57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6040805160808101825260008082526020808301828152838501838152606085018481526001600160a01b039788168552610104909352949092205494851683526001600160401b0360a086901c16905260ff60e185901c16905260e09290921c6001161515905290565b606060fb8054610b5c90614b81565b80601f0160208091040260200160405190810160405280929190818152602001828054610b8890614b81565b8015610bd55780601f10610baa57610100808354040283529160200191610bd5565b820191906000526020600020905b815481529060010190602001808311610bb857829003601f168201915b5050505050905090565b6001600160a01b038116600090815260fe602052604081205460ff16610c0457600080fd5b506000919050565b60405162461bcd60e51b8152602060048201526008602482015267191a5cd8589b195960c21b60448201526064015b60405180910390fd5b6001600160a01b038116600090815260fe602052604081205460ff1615610c7b57610c6e82610ae2565b6020015160ff1692915050565b506003919050565b600260655403610ca55760405162461bcd60e51b8152600401610c3b90614bbb565b600260655533600090815260fe602052604090205460ff16610cd95760405162461bcd60e51b8152600401610c3b90614bf2565b33600090815261010360205260408120805485908110610cfb57610cfb614c29565b9060005260206000209060040201604051806080016040529081600082018054610d2490614b81565b80601f0160208091040260200160405190810160405280929190818152602001828054610d5090614b81565b8015610d9d5780601f10610d7257610100808354040283529160200191610d9d565b820191906000526020600020905b815481529060010190602001808311610d8057829003601f168201915b505050505081526020016001820154815260200160028201548152602001600382015481525050905080602001518314610de95760405162461bcd60e51b8152600401610c3b90614c3f565b6000610df882606001516132f3565b905080600001516001600160a01b0316836001600160a01b031614610e2f5760405162461bcd60e51b8152600401610c3b90614c84565b6000610e4c83610e3e33613339565b6001600160401b031661300b565b90508083604001818151610e609190614ce8565b90525033600090815261010360205260409020805484919088908110610e8857610e88614c29565b600091825260209091208251600490920201908190610ea79082614d49565b506020820151600182015560408201516002820155606090910151600390910155610ed23387613358565b610edb83613645565b610ee53382613676565b5050600160655550505050565b6000610efd33610ae2565b9050806020015160ff16600003610f265760405162461bcd60e51b8152600401610c3b90614bf2565b610f4a816000015182606001516001600160401b0316836020015160ff1685613729565b33600090815261010460205260409020555050565b6001600160a01b038116600090815260fe602052604081205460ff16610fd35760405162461bcd60e51b815260206004820152602360248201527f6164647265737320686173206e6f74206d696e746564207468656972206574686044820152620c4def60eb1b6064820152608401610c3b565b506001600160a01b031690565b610fe861374d565b61010155565b6001600160a01b038116600090815260fe602052604081205460ff161561102b5761101882610ae2565b606001516001600160401b031692915050565b506224ea00919050565b6001600160a01b037f00000000000000000000000059b3ff8c7946c54efb7ae43f1670a6b98865904a16300361107d5760405162461bcd60e51b8152600401610c3b90614e08565b7f00000000000000000000000059b3ff8c7946c54efb7ae43f1670a6b98865904a6001600160a01b03166110af6137a7565b6001600160a01b0316146110d55760405162461bcd60e51b8152600401610c3b90614e54565b6110de816137c3565b604080516000808252602082019092526110fa918391906137cb565b50565b61110561374d565b61010280546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815261010360209081526040808320805482518185028101850190935280835260609493849084015b82821015611240578382906000526020600020906004020160405180608001604052908160008201805461119190614b81565b80601f01602080910402602001604051908101604052809291908181526020018280546111bd90614b81565b801561120a5780601f106111df5761010080835404028352916020019161120a565b820191906000526020600020905b8154815290600101906020018083116111ed57829003601f168201915b5050505050815260200160018201548152602001600282015481526020016003820154815250508152602001906001019061115e565b509293506001925050505b815181101561133b5760005b818110156113285782818151811061127157611271614c29565b60200260200101516020015183838151811061128f5761128f614c29565b60200260200101516020015111156113165760008383815181106112b5576112b5614c29565b602002602001015190508382815181106112d1576112d1614c29565b60200260200101518484815181106112eb576112eb614c29565b60200260200101819052508084838151811061130957611309614c29565b6020026020010181905250505b8061132081614ea0565b915050611257565b508061133381614ea0565b91505061124b565b50600081516001600160401b038111156113575761135761476e565b6040519080825280602002602001820160405280156113bf57816020015b6040805160e0810182526060808252600060208084018290529383018190529082018190526080820181905260a0820181905260c082015282526000199092019101816113755790505b5090506113ec60408051608081018252600080825260208201819052918101829052606081019190915290565b60005b835181101561153d576040805160e081018252606080825260006020830181905292820183905281018290526080810182905260a0810182905260c081019190915261145785838151811061144657611446614c29565b6020026020010151606001516132f3565b925084828151811061146b5761146b614c29565b6020908102919091010151518152845185908390811061148d5761148d614c29565b6020026020010151602001518160200181815250508482815181106114b4576114b4614c29565b6020908102919091018101516040908101518382015284516001600160a01b0316606080850191909152918501516001600160401b0316608084015284015160ff1660a083015283015162ffffff1660c08201528351819085908490811061151e5761151e614c29565b602002602001018190525050808061153590614ea0565b9150506113ef565b5090949350505050565b6001600160a01b037f00000000000000000000000059b3ff8c7946c54efb7ae43f1670a6b98865904a16300361158f5760405162461bcd60e51b8152600401610c3b90614e08565b7f00000000000000000000000059b3ff8c7946c54efb7ae43f1670a6b98865904a6001600160a01b03166115c16137a7565b6001600160a01b0316146115e75760405162461bcd60e51b8152600401610c3b90614e54565b6115f0826137c3565b6115fc828260016137cb565b5050565b6000306001600160a01b037f00000000000000000000000059b3ff8c7946c54efb7ae43f1670a6b98865904a16146116a05760405162461bcd60e51b815260206004820152603860248201527f555550535570677261646561626c653a206d757374206e6f742062652063616c60448201527f6c6564207468726f7567682064656c656761746563616c6c00000000000000006064820152608401610c3b565b506000805160206151a783398151915290565b6001600160a01b038116600090815260fe6020526040812054829060ff16610adc5760405162461bcd60e51b815260206004820152601860248201527f4552433732313a20696e76616c696420746f6b656e20494400000000000000006044820152606401610c3b565b610103602052816000526040600020818154811061173a57600080fd5b90600052602060002090600402016000915091505080600001805461175e90614b81565b80601f016020809104026020016040519081016040528092919081815260200182805461178a90614b81565b80156117d75780601f106117ac576101008083540402835291602001916117d7565b820191906000526020600020905b8154815290600101906020018083116117ba57829003601f168201915b5050505050908060010154908060020154908060030154905084565b6001600160a01b038116600090815260fe602052604081205460ff1615610c0457506001919050565b61182461374d565b61182e600061393b565b565b61183861374d565b61010055565b6002606554036118605760405162461bcd60e51b8152600401610c3b90614bbb565b6002606555600061187033610ae2565b9050806020015160ff166000036118995760405162461bcd60e51b8152600401610c3b90614bf2565b336000908152610103602052604081208054869081106118bb576118bb614c29565b90600052602060002090600402016040518060800160405290816000820180546118e490614b81565b80601f016020809104026020016040519081016040528092919081815260200182805461191090614b81565b801561195d5780601f106119325761010080835404028352916020019161195d565b820191906000526020600020905b81548152906001019060200180831161194057829003601f168201915b5050505050815260200160018201548152602001600282015481526020016003820154815250509050806020015184146119a95760405162461bcd60e51b8152600401610c3b90614c3f565b60006119b882606001516132f3565b905080600001516001600160a01b0316846001600160a01b0316146119ef5760405162461bcd60e51b8152600401610c3b90614c84565b60006119fe83610e3e33613339565b90504284606001518360200151611a159190614eb9565b6001600160401b03161015611a3a57611a3533836040015160ff16613358565b611a85565b33600090815261010360205260409020805482919089908110611a5f57611a5f614c29565b90600052602060002090600402016002016000828254611a7f9190614ce8565b90915550505b611a8f3382613676565b505060016065555050505050565b6000611aa833610ae2565b9050806020015160ff16600003611ad15760405162461bcd60e51b8152600401610c3b90614bf2565b336000908152610103602052604090205415611b2f5760405162461bcd60e51b815260206004820152601860248201527f657468626f78206e6565647320746f20626520656d70747900000000000000006044820152606401610c3b565b610f4a816000015183836020015160ff168460400151613729565b600054610100900460ff1615808015611b6a5750600054600160ff909116105b80611b845750303b158015611b84575060005460ff166001145b611be75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610c3b565b6000805460ff191660011790558015611c0a576000805461ff0019166101001790555b611c1261398d565b611c1a6139bc565b60408051808201909152600681526508ae8d0c4def60d31b602082015260fb90611c449082614d49565b5060408051808201909152600681526508aa890849eb60d31b602082015260fc90611c6f9082614d49565b5066b1a2bc2ec5000060ff556109c46101005560fa6101015561010280546001600160a01b0319167340543d76fb35c60ff578b648d723e14ccab8b39017905580156110fa576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150565b6000818311611d485760405162461bcd60e51b815260206004820152601960248201527f6e65772073697a652073686f756c64206265206c6172676572000000000000006044820152606401610c3b565b506000815b83811015611de35760038103611d715760ff54611d6a9083614ce8565b9150611dd1565b611d7c600382614ed9565b611d8890612710614fd0565b611d93600383614ed9565b61010054611da390612710614ce8565b611dad9190614fd0565b60ff54611dba9190614fdc565b611dc49190615011565b611dce9083614ce8565b91505b80611ddb81614ea0565b915050611d4d565b5092915050565b606060fc8054610b5c90614b81565b6001600160a01b038116600090815260fe602052604081205460ff1615611e2a57611e2382610ae2565b5192915050565b5090565b6001600160a01b03811660009081526101036020908152604080832080548251818502810185019093528083528493849084015b82821015611f445783829060005260206000209060040201604051806080016040529081600082018054611e9590614b81565b80601f0160208091040260200160405190810160405280929190818152602001828054611ec190614b81565b8015611f0e5780601f10611ee357610100808354040283529160200191611f0e565b820191906000526020600020905b815481529060010190602001808311611ef157829003601f168201915b50505050508152602001600182015481526020016002820154815260200160038201548152505081526020019060010190611e62565b5050505090506000611f5584610ae2565b90506000825190506000806000846020015160ff16600014611f845784606001516001600160401b0316611f89565b6224ea005b905060005b84811015611fd957611fb9878281518110611fab57611fab614c29565b60200260200101518361300b565b9350611fc58484614ce8565b925080611fd181614ea0565b915050611f8e565b506001600160a01b03881660009081526101056020526040902054611ffe9083614ce8565b98975050505050505050565b600061201533610ae2565b9050806020015160ff1660000361203e5760405162461bcd60e51b8152600401610c3b90614bf2565b600061205183836020015160ff16611cf7565b905034811461205f826139eb565b9061207d5760405162461bcd60e51b8152600401610c3b91906145b2565b5061209f826000015183606001516001600160401b0316858560400151613729565b33600090815261010460205260408082209290925561010254915190916001600160a01b03169034905b60006040518083038185875af1925050503d8060008114612106576040519150601f19603f3d011682016040523d82523d6000602084013e61210b565b606091505b505090508061211957600080fd5b50505050565b6001600160a01b038116600090815260fe602052604090205460609060ff1661214757600080fd5b81600061215382611128565b9050600061217a836001600160a01b03166000908152610104602052604090205460e11c90565b60ff169050600061218a84613339565b60fd54604051633a36a46560e01b81526001600160401b039290921692506001600160a01b031690633a36a465906121cc908790879087908790600401615025565b600060405180830381865afa1580156121e9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052612211919081019061505c565b9695505050505050565b60026065540361223d5760405162461bcd60e51b8152600401610c3b90614bbb565b600260655533600090815260fe602052604090205460ff166122715760405162461bcd60e51b8152600401610c3b90614bf2565b33600090815261010360209081526040808320805482518185028101850190935280835284938493929190849084015b8282101561238357838290600052602060002090600402016040518060800160405290816000820180546122d490614b81565b80601f016020809104026020016040519081016040528092919081815260200182805461230090614b81565b801561234d5780601f106123225761010080835404028352916020019161234d565b820191906000526020600020905b81548152906001019060200180831161233057829003601f168201915b505050505081526020016001820154815260200160028201548152602001600382015481525050815260200190600101906122a1565b5050505090506000815190506000816001600160401b038111156123a9576123a961476e565b6040519080825280602002602001820160405280156123d2578160200160208202803683370190505b5090506000806123e133613339565b6001600160401b0316905060005b848110156124db57600086828151811061240b5761240b614c29565b6020026020010151905061241f818461300b565b985061242b8989614ce8565b3360009081526101036020526040902080549199508a918490811061245257612452614c29565b906000526020600020906004020160020160008282546124729190614ce8565b909155505060608101514290849060a01c6001600160401b03166124969190614ce8565b10156124c857818585815181106124af576124af614c29565b6020908102919091010152836124c481614ea0565b9450505b50806124d381614ea0565b9150506123ef565b506000826001600160401b038111156124f6576124f661476e565b60405190808252806020026020018201604052801561251f578160200160208202803683370190505b50905060005b81518110156125775784818151811061254057612540614c29565b602002602001015182828151811061255a5761255a614c29565b60209081029190910101528061256f81614ea0565b915050612525565b5033600090815261010560205260409020546125939088614ce8565b33600081815261010560205260408120559097506125b19082613af3565b6125bb3388613676565b50506001606555505050505050565b6002606554036125ec5760405162461bcd60e51b8152600401610c3b90614bbb565b600260655533600090815260fe602052604090205460ff166126205760405162461bcd60e51b8152600401610c3b90614bf2565b33600090815261010360209081526040808320805482518185028101850190935280835284938493929190849084015b82821015612732578382906000526020600020906004020160405180608001604052908160008201805461268390614b81565b80601f01602080910402602001604051908101604052809291908181526020018280546126af90614b81565b80156126fc5780601f106126d1576101008083540402835291602001916126fc565b820191906000526020600020905b8154815290600101906020018083116126df57829003601f168201915b50505050508152602001600182015481526020016002820154815260200160038201548152505081526020019060010190612650565b5050825192935060009150505b818110156128cc5761276d83828151811061275c5761275c614c29565b6020026020010151610e3e33613339565b94506127798585614ce8565b3360009081526101036020526040902080549195508691839081106127a0576127a0614c29565b906000526020600020906004020160020160008282546127c09190614ce8565b90915550503360009081526101036020526040902080546128ba9190839081106127ec576127ec614c29565b906000526020600020906004020160405180608001604052908160008201805461281590614b81565b80601f016020809104026020016040519081016040528092919081815260200182805461284190614b81565b801561288e5780601f106128635761010080835404028352916020019161288e565b820191906000526020600020905b81548152906001019060200180831161287157829003601f168201915b505050505081526020016001820154815260200160028201548152602001600382015481525050613645565b806128c481614ea0565b91505061273f565b50336000908152610103602052604081206128e69161445f565b6128f03384613676565b505060016065555050565b61290361374d565b60ff55565b60026065540361292a5760405162461bcd60e51b8152600401610c3b90614bbb565b60026065556001600160a01b037f00000000000000000000000059b3ff8c7946c54efb7ae43f1670a6b98865904a1630036129775760405162461bcd60e51b8152600401610c3b90614e08565b7f00000000000000000000000059b3ff8c7946c54efb7ae43f1670a6b98865904a6001600160a01b03166129a96137a7565b6001600160a01b0316146129cf5760405162461bcd60e51b8152600401610c3b90614e54565b608d8210612a125760405162461bcd60e51b815260206004820152601060248201526f6d65737361676520746f6f206c6f6e6760801b6044820152606401610c3b565b6000612a1d85610ae2565b60208101519091506003906224ea009060ff1615612a5057826020015160ff16915082606001516001600160401b031690505b826040015115612a955760405162461bcd60e51b815260206004820152601060248201526f195d1a189bde081a5cc81b1bd8dad95960821b6044820152606401610c3b565b612710341180612aa3575034155b612aef5760405162461bcd60e51b815260206004820152601760248201527f6d6573736167652076616c756520696e636f72726563740000000000000000006044820152606401610c3b565b838114612b375760405162461bcd60e51b81526020600482015260166024820152751b595cdcd859d948191c9a5c081a5b98dbdc9c9958dd60521b6044820152606401610c3b565b6001600160a01b03871660009081526101036020908152604080832080548251818502810185019093528083529192909190849084015b82821015612c505783829060005260206000209060040201604051806080016040529081600082018054612ba190614b81565b80601f0160208091040260200160405190810160405280929190818152602001828054612bcd90614b81565b8015612c1a5780601f10612bef57610100808354040283529160200191612c1a565b820191906000526020600020905b815481529060010190602001808311612bfd57829003601f168201915b50505050508152602001600182015481526020016002820154815260200160038201548152505081526020019060010190612b6e565b50508251929350505083811015612c7457612c6f89338a8a3486613e23565b612d5d565b600080612c82848434613f09565b915091508115612d1a576000848281518110612ca057612ca0614c29565b602002602001015190506000612cb6828861300b565b90508082604001818151612cca9190614ce8565b9052506001600160a01b038d166000908152610105602052604081208054839290612cf6908490614ce8565b90915550612d05905082613645565b612d138d338e8e3488613fa6565b5050612d5a565b60405162461bcd60e51b81526020600482015260156024820152746d6573736167652076616c756520746f6f206c6f7760581b6044820152606401610c3b565b50505b612d663461409d565b5050600160655550505050505050565b6001600160a01b038116600090815261010360209081526040808320805482518185028101850190935280835260609493849084015b82821015612e8e5783829060005260206000209060040201604051806080016040529081600082018054612ddf90614b81565b80601f0160208091040260200160405190810160405280929190818152602001828054612e0b90614b81565b8015612e585780601f10612e2d57610100808354040283529160200191612e58565b820191906000526020600020905b815481529060010190602001808311612e3b57829003601f168201915b50505050508152602001600182015481526020016002820154815260200160038201548152505081526020019060010190612dac565b509293506001925050505b8151811015611de35760005b81811015612f7657828181518110612ebf57612ebf614c29565b602002602001015160200151838381518110612edd57612edd614c29565b6020026020010151602001511115612f64576000838381518110612f0357612f03614c29565b60200260200101519050838281518110612f1f57612f1f614c29565b6020026020010151848481518110612f3957612f39614c29565b602002602001018190525080848381518110612f5757612f57614c29565b6020026020010181905250505b80612f6e81614ea0565b915050612ea5565b5080612f8181614ea0565b915050612e99565b612f9161374d565b60fd80546001600160a01b0319166001600160a01b0392909216919091179055565b6000612fbe33610ae2565b9050806020015160ff16600003612fe75760405162461bcd60e51b8152600401610c3b90614bf2565b610f4a8282606001516001600160401b0316836020015160ff168460400151613729565b60008061301c846060015160a01c90565b61302f906001600160401b031642614ed9565b90506001811015613044576000915050610adc565b8281111561305d5761305584614151565b915050610adc565b60008361306b836064614fdc565b6130759190615011565b905060006064826130858861416b565b61308f9190614fdc565b6130999190615011565b90508560400151816122119190614ed9565b6001600160a01b038116600090815260fe602052604081205460ff1615610c04576130d582610ae2565b6040015192915050565b6130e761374d565b6001600160a01b03811661314c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c3b565b6110fa8161393b565b6001600160a01b037f00000000000000000000000059b3ff8c7946c54efb7ae43f1670a6b98865904a16300361319d5760405162461bcd60e51b8152600401610c3b90614e08565b7f00000000000000000000000059b3ff8c7946c54efb7ae43f1670a6b98865904a6001600160a01b03166131cf6137a7565b6001600160a01b0316146131f55760405162461bcd60e51b8152600401610c3b90614e54565b33600081815260fe602052604090205460ff161561324d5760405162461bcd60e51b8152602060048201526015602482015274195d1a189bde08185b1c9958591e481b5a5b9d1959605a1b6044820152606401610c3b565b6001600160a01b038116600090815260fe60205260408120805460ff191660011790556132839082906224ea0090600390613729565b6001600160a01b03821660008181526101046020526040808220939093559151909182917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46001600160a01b03811660009081526101036020526040902054156110fa576110fa61221b565b604080516080810182526001600160a01b038316815260a083901c6001600160401b0316602082015260e083901c60ff169181019190915260e89190911c606082015290565b6001600160a01b03166000908152610104602052604090205460a01c90565b6001600160a01b03821660009081526101036020908152604080832080548251818502810185019093528083529192909190849084015b8282101561347157838290600052602060002090600402016040518060800160405290816000820180546133c290614b81565b80601f01602080910402602001604051908101604052809291908181526020018280546133ee90614b81565b801561343b5780601f106134105761010080835404028352916020019161343b565b820191906000526020600020905b81548152906001019060200180831161341e57829003601f168201915b5050505050815260200160018201548152602001600282015481526020016003820154815250508152602001906001019061338f565b50505050905080600182516134869190614ed9565b8151811061349657613496614c29565b60200260200101516101036000856001600160a01b03166001600160a01b0316815260200190815260200160002083815481106134d5576134d5614c29565b6000918252602090912082516004909202019081906134f49082614d49565b5060208201518160010155604082015181600201556060820151816003015590505060006135696101036000866001600160a01b03166001600160a01b03168152602001908152602001600020848154811061355257613552614c29565b9060005260206000209060040201600301546132f3565b9050613591816000015182602001516001600160401b031685846060015162ffffff166141a8565b6001600160a01b0385166000908152610103602052604090208054859081106135bc576135bc614c29565b9060005260206000209060040201600301819055506101036000856001600160a01b03166001600160a01b03168152602001908152602001600020805480613606576136066150c9565b600082815260208120600019909201916004830201906136268282614480565b5060006001820181905560028201819055600390910155905550505050565b600061365082614151565b9050600061365f836060015190565b90506000816001600160a01b0316836040516120c9565b6001600160a01b0382811660009081526101046020526040808220549051909283169084908381818185875af1925050503d80600081146136d3576040519150601f19603f3d011682016040523d82523d6000602084013e6136d8565b606091505b50509050806121195760405162461bcd60e51b815260206004820152601760248201527f636f756c64206e6f742070617920726563697069656e740000000000000000006044820152606401610c3b565b60e01b60a09290921b9190911760e19190911b176001600160a01b03919091161790565b6033546001600160a01b0316331461182e5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610c3b565b6000805160206151a7833981519152546001600160a01b031690565b6110fa61374d565b7f4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd91435460ff1615613803576137fe836141cc565b505050565b826001600160a01b03166352d1902d6040518163ffffffff1660e01b8152600401602060405180830381865afa92505050801561385d575060408051601f3d908101601f1916820190925261385a918101906150df565b60015b6138c05760405162461bcd60e51b815260206004820152602e60248201527f45524331393637557067726164653a206e657720696d706c656d656e7461746960448201526d6f6e206973206e6f74205555505360901b6064820152608401610c3b565b6000805160206151a7833981519152811461392f5760405162461bcd60e51b815260206004820152602960248201527f45524331393637557067726164653a20756e737570706f727465642070726f786044820152681a58589b195555525160ba1b6064820152608401610c3b565b506137fe838383614268565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166139b45760405162461bcd60e51b8152600401610c3b906150f8565b61182e61428d565b600054610100900460ff166139e35760405162461bcd60e51b8152600401610c3b906150f8565b61182e6142bd565b606081600003613a125750506040805180820190915260018152600360fc1b602082015290565b8160005b8115613a3c5780613a2681614ea0565b9150613a359050600a83615011565b9150613a16565b6000816001600160401b03811115613a5657613a5661476e565b6040519080825280601f01601f191660200182016040528015613a80576020820181803683370190505b5090505b8415613aeb57613a95600183614ed9565b9150613aa2600a86615143565b613aad906030614ce8565b60f81b818381518110613ac257613ac2614c29565b60200101906001600160f81b031916908160001a905350613ae4600a86615011565b9450613a84565b949350505050565b6001600160a01b03821660009081526101036020908152604080832080548251818502810185019093528083529192909190849084015b82821015613c0c5783829060005260206000209060040201604051806080016040529081600082018054613b5d90614b81565b80601f0160208091040260200160405190810160405280929190818152602001828054613b8990614b81565b8015613bd65780601f10613bab57610100808354040283529160200191613bd6565b820191906000526020600020905b815481529060010190602001808311613bb957829003601f168201915b50505050508152602001600182015481526020016002820154815260200160038201548152505081526020019060010190613b2a565b5050845192935050505b80156121195781518114613db0576000613c3b83838151811061144657611446614c29565b90508260018451613c4c9190614ed9565b81518110613c5c57613c5c614c29565b60200260200101516101036000876001600160a01b03166001600160a01b0316815260200190815260200160002085600185613c989190614ed9565b81518110613ca857613ca8614c29565b602002602001015181548110613cc057613cc0614c29565b600091825260209091208251600490920201908190613cdf9082614d49565b50602082015181600101556040820151816002015560608201518160030155905050613d4c816000015182602001516001600160401b031686600186613d259190614ed9565b81518110613d3557613d35614c29565b6020026020010151846060015162ffffff166141a8565b6001600160a01b03861660009081526101036020526040902085613d71600186614ed9565b81518110613d8157613d81614c29565b602002602001015181548110613d9957613d99614c29565b906000526020600020906004020160030181905550505b6001600160a01b038416600090815261010360205260409020805480613dd857613dd86150c9565b60008281526020812060001990920191600483020190613df88282614480565b5060006001820181905560028201819055600390910155905580613e1b81615157565b915050613c16565b613e4e6040518060800160405280606081526020016000815260200160008152602001600081525090565b613e5d864284610101546141a8565b6060820152604080516020601f87018190048102820181019092528581529086908690819084018382808284376000920182905250938552505050602080830185905260408084018390526001600160a01b038a168352610103825282208054600181018255908352912082518392600402909101908190613edf9082614d49565b50602082015181600101556040820151816002015560608201518160030155505050505050505050565b60008060008086600081518110613f2257613f22614c29565b6020026020010151602001519050600080600090505b87811015613f9857888181518110613f5257613f52614c29565b602002602001015160200151915082821015613f6f578093508192505b85158015613f7c57508187115b15613f8657600195505b80613f9081614ea0565b915050613f38565b509192505050935093915050565b613fd16040518060800160405280606081526020016000815260200160008152602001600081525090565b613fe0864284610101546141a8565b6060820152604080516020601f87018190048102820181019092528581529086908690819084018382808284376000920182905250938552505050602080830185905260408084018390526001600160a01b038a168352610103909152902080548291908490811061405457614054614c29565b6000918252602090912082516004909202019081906140739082614d49565b50602082015160018201556040820151600282015560609091015160039091015550505050505050565b61010254610101546000916001600160a01b031690612710906140c09085614fdc565b6140ca9190615011565b604051600081818185875af1925050503d8060008114614106576040519150601f19603f3d011682016040523d82523d6000602084013e61410b565b606091505b50509050806115fc5760405162461bcd60e51b8152602060048201526012602482015271636f756c64206e6f7420706179206665657360701b6044820152606401610c3b565b600081604001516141618361416b565b610adc9190614ed9565b600061271061417e836060015160e81c90565b61418a9061271061516e565b62ffffff16836020015161419e9190614fdc565b610adc9190615011565b60a083901b60e083901b1760e882901b176001600160a01b03851617949350505050565b6001600160a01b0381163b6142395760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b6064820152608401610c3b565b6000805160206151a783398151915280546001600160a01b0319166001600160a01b0392909216919091179055565b614271836142eb565b60008251118061427e5750805b156137fe57612119838361432b565b600054610100900460ff166142b45760405162461bcd60e51b8152600401610c3b906150f8565b61182e3361393b565b600054610100900460ff166142e45760405162461bcd60e51b8152600401610c3b906150f8565b6001606555565b6142f4816141cc565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606001600160a01b0383163b6143935760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b6064820152608401610c3b565b600080846001600160a01b0316846040516143ae919061518a565b600060405180830381855af49150503d80600081146143e9576040519150601f19603f3d011682016040523d82523d6000602084013e6143ee565b606091505b509150915061441682826040518060600160405280602781526020016151c76027913961441f565b95945050505050565b6060831561442e575081614458565b82511561443e5782518084602001fd5b8160405162461bcd60e51b8152600401610c3b91906145b2565b9392505050565b50805460008255600402906000526020600020908101906110fa91906144ba565b50805461448c90614b81565b6000825580601f1061449c575050565b601f0160209004906000526020600020908101906110fa91906144ec565b80821115611e2a5760006144ce8282614480565b506000600182018190556002820181905560038201556004016144ba565b5b80821115611e2a57600081556001016144ed565b60006020828403121561451357600080fd5b81356001600160e01b03198116811461445857600080fd5b80356001600160a01b038116811461454257600080fd5b919050565b60006020828403121561455957600080fd5b6144588261452b565b60005b8381101561457d578181015183820152602001614565565b50506000910152565b6000815180845261459e816020860160208601614562565b601f01601f19169290920160200192915050565b6020815260006144586020830184614586565b6000602082840312156145d757600080fd5b5035919050565b600080604083850312156145f157600080fd5b6145fa8361452b565b946020939093013593505050565b60008060006060848603121561461d57600080fd5b83359250602084013591506146346040850161452b565b90509250925092565b8035801515811461454257600080fd5b60006020828403121561465f57600080fd5b6144588261463d565b60008060006060848603121561467d57600080fd5b6146868461452b565b92506146946020850161452b565b9150604084013590509250925092565b600081518084526020808501808196508360051b8101915082860160005b8581101561474e578284038952815160e081518187526146e482880182614586565b83890151888a0152604080850151908901526060808501516001600160a01b0316908901526080808501516001600160401b03169089015260a08085015160ff169089015260c09384015162ffffff169390970192909252505097840197908401906001016146c2565b5091979650505050505050565b60208152600061445860208301846146a4565b634e487b7160e01b600052604160045260246000fd5b604051608081016001600160401b03811182821017156147a6576147a661476e565b60405290565b604051601f8201601f191681016001600160401b03811182821017156147d4576147d461476e565b604052919050565b60006001600160401b038211156147f5576147f561476e565b50601f01601f191660200190565b6000614816614811846147dc565b6147ac565b905082815283838301111561482a57600080fd5b828260208301376000602084830101529392505050565b600082601f83011261485257600080fd5b61445883833560208501614803565b6000806040838503121561487457600080fd5b61487d8361452b565b915060208301356001600160401b0381111561489857600080fd5b6148a485828601614841565b9150509250929050565b6080815260006148c16080830187614586565b6020830195909552506040810192909252606090910152919050565b600080604083850312156148f057600080fd5b50508035926020909101359150565b6000806040838503121561491257600080fd5b61491b8361452b565b91506149296020840161463d565b90509250929050565b6000806000806080858703121561494857600080fd5b6149518561452b565b935061495f6020860161452b565b92506040850135915060608501356001600160401b0381111561498157600080fd5b61498d87828801614841565b91505092959194509250565b600080600080606085870312156149af57600080fd5b6149b88561452b565b935060208501356001600160401b03808211156149d457600080fd5b818701915087601f8301126149e857600080fd5b8135818111156149f757600080fd5b886020828501011115614a0957600080fd5b95986020929092019750949560400135945092505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b83811015614a9e57603f19898403018552815160808151818652614a6e82870182614586565b838b0151878c0152898401518a880152606093840151939096019290925250509386019390860190600101614a48565b509098975050505050505050565b60008060408385031215614abf57600080fd5b82356001600160401b0380821115614ad657600080fd5b9084019060808287031215614aea57600080fd5b614af2614784565b823582811115614b0157600080fd5b83019150601f82018713614b1457600080fd5b614b2387833560208501614803565b8152602083013560208201526040830135604082015260608301356060820152809450505050602083013590509250929050565b60008060408385031215614b6a57600080fd5b614b738361452b565b91506149296020840161452b565b600181811c90821680614b9557607f821691505b602082108103614bb557634e487b7160e01b600052602260045260246000fd5b50919050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60208082526019908201527f657468626f78206e6565647320746f206265206d696e74656400000000000000604082015260600190565b634e487b7160e01b600052603260045260246000fd5b60208082526025908201527f6d65737361676520617420696e64657820646f6573206e6f74206d617463682060408201526476616c756560d81b606082015260800190565b6020808252602e908201527f6d65737361676520617420696e64657820646f6573206e6f74206d617463682060408201526d73656e646572206164647265737360901b606082015260800190565b634e487b7160e01b600052601160045260246000fd5b80820180821115610adc57610adc614cd2565b601f8211156137fe57600081815260208120601f850160051c81016020861015614d225750805b601f850160051c820191505b81811015614d4157828155600101614d2e565b505050505050565b81516001600160401b03811115614d6257614d6261476e565b614d7681614d708454614b81565b84614cfb565b602080601f831160018114614dab5760008415614d935750858301515b600019600386901b1c1916600185901b178555614d41565b600085815260208120601f198616915b82811015614dda57888601518255948401946001909101908401614dbb565b5085821015614df85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b19195b1959d85d1958d85b1b60a21b606082015260800190565b6020808252602c908201527f46756e6374696f6e206d7573742062652063616c6c6564207468726f7567682060408201526b6163746976652070726f787960a01b606082015260800190565b600060018201614eb257614eb2614cd2565b5060010190565b6001600160401b03818116838216019080821115611de357611de3614cd2565b81810381811115610adc57610adc614cd2565b600181815b80851115614f27578160001904821115614f0d57614f0d614cd2565b80851615614f1a57918102915b93841c9390800290614ef1565b509250929050565b600082614f3e57506001610adc565b81614f4b57506000610adc565b8160018114614f615760028114614f6b57614f87565b6001915050610adc565b60ff841115614f7c57614f7c614cd2565b50506001821b610adc565b5060208310610133831016604e8410600b8410161715614faa575081810a610adc565b614fb48383614eec565b8060001904821115614fc857614fc8614cd2565b029392505050565b60006144588383614f2f565b6000816000190483118215151615614ff657614ff6614cd2565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261502057615020614ffb565b500490565b6001600160a01b0385168152608060208201819052600090615049908301866146a4565b6040830194909452506060015292915050565b60006020828403121561506e57600080fd5b81516001600160401b0381111561508457600080fd5b8201601f8101841361509557600080fd5b80516150a3614811826147dc565b8181528560208385010111156150b857600080fd5b614416826020830160208601614562565b634e487b7160e01b600052603160045260246000fd5b6000602082840312156150f157600080fd5b5051919050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008261515257615152614ffb565b500690565b60008161516657615166614cd2565b506000190190565b62ffffff828116828216039080821115611de357611de3614cd2565b6000825161519c818460208701614562565b919091019291505056fe360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122088e3f79c11adc123271cc7b366853b0f501707b0f6ea545d7c615726f605740b64736f6c63430008100033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 31 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.