Source Code
Overview
ETH Balance
0 ETH
More Info
ContractCreator
Multichain Info
N/A
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
Chamber
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 888888 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT // Loreum Chamber v1 pragma solidity 0.8.24; import { IChamber } from "src/interfaces/IChamber.sol"; import { IGuard } from "src/interfaces/IGuard.sol"; import { Common, IERC721, IERC20, ECDSA, SafeERC20 } from "src/Common.sol"; contract Chamber is IChamber, Common { /// @notice memberToken The ERC721 contract used for membership. address public memberToken; /// @notice govToken The ERC20 contract used for staking. address public govToken; /// @notice leaderboard ff members based on total delegation. /// @dev Limited to top 5 leaders requiring 3 approvals uint256[] public leaderboard; /// @notice Counter to track the nonce for each proposal uint256 public nonce; /// @notice totalDelegation Tracks the amount of govToken delegated to a given NFT ID. /// @dev 1st element -> NFT tokenID, 2nd element -> amountDelegated. mapping(uint256 => uint256) public totalDelegation; /// @notice accountDelegation Tracks a given address's delegatation balance of govToken for a given NFT ID. /// @dev 1st element -> user address, 2nd element -> NFT tokenID, 3rd element -> amountDelegated. mapping(address => mapping(uint256 => uint256)) public accountDelegation; /// @notice proposals Mapping of the Proposals. /// @dev 1st element -> index, 2nd element -> Proposal struct mapping(uint256 => Proposal) private proposals; /// @inheritdoc IChamber function proposal(uint256 proposalId) public view returns(uint256 approvals, State state){ return (proposals[proposalId].approvals, proposals[proposalId].state); } /// @notice vtoed Tracks which tokenIds have voted on proposals /// @dev 1st element -> proposalId, 2nd element -> tokenId, 3rd element-> voted boolean mapping(uint256 => mapping(uint256 => bool)) public voted; /// @notice contrcutor disables initialize function on deployment of base implementation. constructor() { _disableInitializers(); } /// @inheritdoc IChamber function initialize(address _memberToken, address _govToken) external initializer { require(_memberToken != address(0),"The address is zero"); require(_govToken != address(0),"The address is zero"); memberToken = _memberToken; govToken = _govToken; } /// @inheritdoc IChamber function getLeaderboard() external view returns (uint256[] memory, uint256[] memory) { uint256[] memory _leaderboard = leaderboard; uint256[] memory _delegations = new uint256[](_leaderboard.length); for (uint256 i = 0; i < _leaderboard.length; i++) { _delegations[i] = totalDelegation[_leaderboard[i]]; } return (_leaderboard, _delegations); } /// @inheritdoc IChamber function create(address[] memory targets, uint256[] memory values, bytes[] memory datas) external { if(IERC721(memberToken).balanceOf(_msgSender()) < 1) revert insufficientBalance(); uint256[5] memory topFiveLeader; for (uint256 i=0; i<5; i++){ topFiveLeader[i] = leaderboard[i]; } nonce++; proposals[nonce] = Proposal({ target: targets, value: values, data: datas, voters: topFiveLeader, approvals: 0, nonce: nonce, state: State.Initialized }); emit CreatedProposal(nonce, targets, values, datas, topFiveLeader, nonce); } /// @inheritdoc IChamber function approve(uint256 proposalId, uint256 tokenId, bytes memory signature) external { if(_msgSender() != IERC721(memberToken).ownerOf(tokenId)) revert invalidApproval("Sender isn't NFT owner"); if(proposals[proposalId].state != State.Initialized) revert invalidApproval("Proposal isn't Initialized"); if(voted[proposalId][tokenId]) revert invalidApproval("TokenID already voted"); require(verifySignature(proposalId, tokenId, signature), "Invalid signature"); uint256[5] memory voters = proposals[proposalId].voters; bool onVoterList = false; for (uint i = 0; i < voters.length; i++) { if (tokenId == voters[i]) onVoterList = true; } if (!onVoterList) revert invalidApproval("TokenId not on voter list"); voted[proposalId][tokenId] = true; proposals[proposalId].approvals += 1; emit ApprovedProposal(proposalId, tokenId, proposals[proposalId].approvals); } /// @inheritdoc IChamber function promote(uint256 amount, uint256 tokenId) public nonReentrant { if(amount == 0 && tokenId == 0) revert invalidPromotion(); totalDelegation[tokenId] += amount; accountDelegation[_msgSender()][tokenId] += amount; _updateLeaderboard(tokenId); SafeERC20.safeIncreaseAllowance(IERC20(govToken), address(this), amount); SafeERC20.safeTransferFrom(IERC20(govToken), _msgSender(), address(this), amount); emit Promotion(_msgSender(), amount, tokenId); } /// @inheritdoc IChamber function demote(uint256 amount, uint256 tokenId) public nonReentrant { if(amount == 0 && tokenId == 0) revert invalidDemotion(); if(accountDelegation[_msgSender()][tokenId] < amount) revert invalidDemotion(); totalDelegation[tokenId] -= amount; accountDelegation[_msgSender()][tokenId] -= amount; if (totalDelegation[tokenId]== 0){ _removeFromLeaderboard(tokenId); } else { _updateLeaderboard(tokenId); } SafeERC20.safeTransfer(IERC20(govToken), _msgSender(), amount); SafeERC20.safeDecreaseAllowance(IERC20(govToken), address(this), amount); emit Demotion(_msgSender(), amount, tokenId); } /// @inheritdoc IChamber function execute(uint256 proposalId, uint256 tokenId, bytes memory signature) public noReentrancy{ // TODO Implement Gas handling and Optimizations if( proposalId > 1 && !(_isCancellationProposal(proposalId)) ){ require((proposals[proposalId-1].state == State.Executed || proposals[proposalId-1].state == State.Canceled), "Previous proposal must be resolved."); } require(proposals[proposalId].approvals >= 3, "Not enough approvals"); // TODO: Make quorum dynamic require(verifySignature(proposalId, tokenId, signature), "Invalid signature"); bool validVoter = false; for (uint256 i = 0 ; i < 5; i++){ if (tokenId == proposals[proposalId].voters[i]){ validVoter = true; } } require(validVoter, "Not a voter"); if(proposals[proposalId].state != State.Initialized) revert invalidProposalState(); Proposal memory proposalData = proposals[proposalId]; proposals[proposalId].state = State.Executed; address guard = getGuard(); if (guard != address (0)){ IGuard(guard).checkTransaction( proposals[proposalId].target, proposals[proposalId].value, proposals[proposalId].data, proposals[proposalId].voters, proposals[proposalId].state, signature, msg.sender, proposalId, tokenId ); } bool finalSuccess = false; for (uint256 i = 0; i < proposalData.data.length; i++) { (bool success,) = proposalData.target[i].call{value: proposalData.value[i]}(proposalData.data[i]); finalSuccess = success; if(!success) revert executionFailed(); } { if (guard != address(0)) { IGuard(guard).checkAfterExecution(constructMessageHash(proposalId, tokenId), finalSuccess); } } emit ExecutedProposal(proposalId); } /// @notice Checks if the proposal corresponds to a cancellation request. /// @param _proposalId The ID of the proposal to check. /// @return Whether the proposal is a cancellation request or not. function _isCancellationProposal(uint256 _proposalId) private view returns (bool) { bytes4 data = bytes4(proposals[_proposalId].data[0]); for (uint i = 0 ; i < 4; i++){ if (data[i] != CANCEL_PROPOSAL_SELECTOR[i]){ return false; } } return true; } //// @inheritdoc IChamber function cancel(uint256 proposalId) external authorized { require(proposals[proposalId].state == State.Initialized, "Proposal is not initialized"); proposals[proposalId].target = new address[](1); proposals[proposalId].value = new uint256[](1); proposals[proposalId].data = new bytes[](1); proposals[proposalId].state = State.Canceled; emit CanceledProposal(proposalId); } /// @notice _updateLeaderboard Updates the leaderboard array /// @param _tokenId The ID of the NFT to update. function _updateLeaderboard(uint256 _tokenId) private { bool tokenIdExists = false; uint256 leaderboardLength = leaderboard.length; for (uint256 i = 0; i < leaderboardLength; i++) { if (leaderboard[i] == _tokenId) { tokenIdExists = true; break; } } if (tokenIdExists) { _bubbleSort(); } else { leaderboard.push(_tokenId); _bubbleSort(); } } /// @notice _bubbleSort Updates the leaderboard with bubble sort function _bubbleSort() private { bool swapped; uint256 leaderboardLength = leaderboard.length; for (uint256 i = 0; i < leaderboardLength; i++) { swapped = false; for (uint256 j = 0; j < leaderboard.length - i - 1; j++) { if (totalDelegation[leaderboard[j]] < totalDelegation[leaderboard[j + 1]]) { (leaderboard[j], leaderboard[j + 1]) = (leaderboard[j + 1], leaderboard[j]); swapped = true; } } if (!swapped) { break; } } } /// @notice _removeFromLeaderboard Removes the Token ID /// @param _tokenId The ID of the NFT to remove. function _removeFromLeaderboard(uint256 _tokenId) private { for (uint256 i = 0; i < leaderboard.length; i++) { if (leaderboard[i] == _tokenId) { for (uint256 j = i; j < leaderboard.length - 1; j++) { leaderboard[j] = leaderboard[j + 1]; } leaderboard.pop(); break; } } } /// @inheritdoc IChamber function verifySignature( uint256 proposalId, uint256 tokenId, bytes memory signature ) public view returns (bool) { bytes32 messageHash = constructMessageHash(proposalId, tokenId); address signer = ECDSA.recover(messageHash, signature); return signer == IERC721(memberToken).ownerOf(tokenId); } /// @inheritdoc IChamber function domainSeparator() public view returns (bytes32) { uint256 chainId; assembly { chainId := chainid() } return keccak256(abi.encode(DOMAIN_SEPARATOR_TYPEHASH, chainId, this)); } function encodeData( address[] memory to, uint256[] memory value, bytes[] memory data, uint256[5] memory voters, uint256 approvals, uint256 _nonce, State state, uint256 proposalId, uint256 tokenId )internal view returns(bytes memory){ bytes32 txHash = keccak256( abi.encode( to, value, data, voters, approvals, _nonce, state, proposalId, tokenId ) ); return abi.encodePacked(bytes1(0x19), bytes1(0x01), domainSeparator(), txHash); } /// @inheritdoc IChamber function constructMessageHash( uint256 proposalId, uint256 tokenId ) public view returns (bytes32) { return keccak256( encodeData( proposals[proposalId].target, proposals[proposalId].value, proposals[proposalId].data, proposals[proposalId].voters, proposals[proposalId].approvals, proposals[proposalId].nonce, proposals[proposalId].state, proposalId, tokenId ) ); } fallback() external payable { if (msg.value > 0) emit ReceivedEther(_msgSender(), msg.value); } receive() external payable { if (msg.value > 0) emit ReceivedFallback(msg.sender, msg.value); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.24; import "src/interfaces/IGuardManager.sol"; interface IChamber is IGuardManager{ /************************************************** State **************************************************/ /// @notice The State of a proposal enum State { Null, Initialized, Executed, Canceled } /// @notice The structue of a proposal struct Proposal { address[] target; uint256[] value; bytes[] data; uint256[5] voters; uint256 approvals; uint256 nonce; State state; } /************************************************** Events **************************************************/ /// @notice Emitted upon promote() /// @param promoter The address of the promoter /// @param amt The amount of "govToken" delegated /// @param tokenId The ID of the NFT that tokens will be promoted against event Promotion(address promoter, uint256 amt, uint256 tokenId); /// @notice Emitted upon demote() /// @param demoter The address of the demoter /// @param amt The amount of "govToken" demoted /// @param tokenId The ID of the NFT that tokens were demoted against event Demotion(address demoter, uint256 amt, uint256 tokenId); /// @notice Emitted when a proposal is approved /// @param proposalId The unique identifier of the approved proposal /// @param tokenId The tokenId that the proposal was associated with /// @param approvals The total number of approvals that the proposal received event ApprovedProposal(uint256 proposalId, uint256 tokenId, uint256 approvals); /// @notice Emitted when a proposal is created /// @param proposalId The unique identifier of the created proposal /// @param target The array of addresses that the proposal targets /// @param value The array of monetary values associated with each target /// @param data The array of data payloads associated with each target /// @param voters The array of voters associated with each target /// @param nonce The nonce associated with the created proposal event CreatedProposal(uint256 proposalId, address[] target, uint256[] value, bytes[] data, uint256[5] voters, uint256 nonce); /// @notice Emitted when a proposal is executed /// @param proposalId The unique identifier of the executed proposal event ExecutedProposal(uint256 proposalId); /// @notice Emitted when a proposal is canceled /// @param proposalId The unique identifier of the executed proposal event CanceledProposal(uint256 proposalId); /// @notice Emitted when Ether is received /// @param sender The address of the sender of the Ether /// @param value The amount of Ether received event ReceivedEther(address indexed sender, uint256 value); /// @notice Emitted when Payable received /// @param sender The address of Asset sender /// @param value The amount received event ReceivedFallback(address indexed sender, uint256 value); /************************************************** Functions **************************************************/ /// @notice Initializes a new version of Chamber /// @param memberToken The address of the ERC721 contract used for membership. /// @param govToken The address of the ERC20 contract used for delegation. function initialize(address memberToken, address govToken) external; /// @notice Returns the amount of govToken delegated against a given tokenId by an account /// @param account The address of the account to query /// @param tokenId The ID of the NFT to query function accountDelegation(address account, uint256 tokenId) external view returns (uint256); /// @notice Returns the total amount of govToken delegated against a given tokenId /// @param tokenId The ID of the NFT to query function totalDelegation(uint256 tokenId) external view returns (uint256); /// @notice Returns the total number of proposals function nonce() external view returns (uint256); /// @notice Returns the number of approvals and the state of a proposal /// @param proposalId The ID of the proposal to query function proposal(uint256 proposalId) external view returns (uint256 approvals, State state); /// @notice Returns two arrays, the leaders and their delegations function getLeaderboard() external view returns (uint256[] memory, uint256[] memory); /// @notice approve transaction proposal function /// @param proposalId The ID of the proposal to approve /// @param tokenId The ID of the NFT to vote /// @param signature The cryptographic signature to be verified function approve(uint256 proposalId, uint256 tokenId,bytes memory signature) external; /// @notice execute transaction proposal function /// @param proposalId The ID of the proposal to approve /// @param tokenId The ID of the NFT to vote /// @param signature The cryptographic signature to be verified function execute(uint256 proposalId, uint256 tokenId, bytes memory signature) external; /// @notice cancel transaction proposal function /// @param proposalId The ID of the proposal to cancel function cancel(uint256 proposalId) external; /// @notice create transaction proposal function /// @param target The address of contract to send transaction /// @param value The uint256 amount of ETH to send with transaction /// @param data The bytes[] of transaction data function create(address[] memory target, uint256[] memory value, bytes[] memory data) external; /// @notice Promotes an amount of govToken against a provided memberToken Id /// @param amount The amount of govToken for promotion /// @param tokenId The Id of the memberToken to promote function promote(uint256 amount, uint256 tokenId) external; /// @notice Demotes an amount of govToken from the provided memberToken Id /// @param amount The amount of govToken for demotion /// @param tokenId The Id of the memberToken to demote from function demote(uint256 amount, uint256 tokenId) external; /// @notice Returns the domain separator for this contract, as defined in the EIP-712 standard. /// @return bytes32 The domain separator hash. function domainSeparator() external view returns (bytes32); /// @notice verify Signature function /// @param proposalId The ID of the proposal to approve /// @param tokenId The ID of the NFT to vote /// @param signature The cryptographic signature to be verified function verifySignature(uint256 proposalId, uint256 tokenId, bytes memory signature) external view returns (bool); /// @notice construct Message Hash function /// @param proposalId The ID of the proposal to approve /// @param tokenId The ID of the NFT to vote function constructMessageHash(uint256 proposalId, uint256 tokenId) external view returns (bytes32); /************************************************** Errors **************************************************/ error invalidDemotion(); error invalidPromotion(); error invalidTokenOwner(); error invalidProposalState(); error invalidVote(); error executionFailed(); error insufficientBalance(); error invalidApproval(string message); error invalidChangeAmount(); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.24; import { IERC165 } from "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol"; import { IChamber } from "src/interfaces/IChamber.sol"; interface IGuard is IERC165 { /// @notice Checks the transaction details. /// @dev The function needs to implement transaction validation logic. /// @param to The addresses to which the transaction is intended. /// @param value The values of the transaction in Wei. /// @param data The transaction data. /// @param voters The voters eligible to vote . /// @param state The State of a proposal. /// @param signature The signatures of the transaction. /// @param executor The address of the message sender. /// @param proposalId The unique identifier of the approved proposal /// @param tokenId The ID of the NFT that tokens will be promoted against function checkTransaction( address[] memory to, uint256[] memory value, bytes[] memory data, uint256[5] memory voters, IChamber.State state, bytes memory signature, address executor, uint256 proposalId, uint256 tokenId )external; /// @notice Checks after execution of transaction. /// @dev The function needs to implement a check after the execution of the transaction. /// @param txHash The hash of the transaction. /// @param success The status of the transaction execution. function checkAfterExecution(bytes32 txHash, bool success) external; }
// SPDX-License-Identifier: MIT // Loreum Chamber v1 pragma solidity 0.8.24; import { Context } from "lib/openzeppelin-contracts/contracts/utils/Context.sol"; import { ECDSA } from "lib/openzeppelin-contracts/contracts/utils/cryptography/ECDSA.sol"; import { ERC1155Holder } from "lib/openzeppelin-contracts/contracts/token/ERC1155/utils/ERC1155Holder.sol"; import { ERC721Holder } from "lib/openzeppelin-contracts/contracts/token/ERC721/utils/ERC721Holder.sol"; import { GuardManager } from "src/guards/GuardManager.sol"; import { IERC165 } from "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol"; import { IERC20 } from "lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol"; import { IERC721 } from "lib/openzeppelin-contracts/contracts/interfaces/IERC721.sol"; import { Initializable } from "lib/openzeppelin-contracts/contracts/proxy/utils/Initializable.sol"; import { ReentrancyGuard } from "lib/openzeppelin-contracts/contracts/security/ReentrancyGuard.sol"; import { SafeERC20 } from "lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol"; abstract contract Common is Initializable, ReentrancyGuard, Context, ERC721Holder, ERC1155Holder, GuardManager { using ECDSA for bytes32; /// @notice Flag to indicate contract locking status bool public locked; /// @notice Modifier to prevent reentrancy attacks modifier noReentrancy() { require(!locked, "No reentrancy"); locked = true; _; locked = false; } // keccak256("EIP712Domain(uint256 chainId,address verifyingContract)"); bytes32 internal constant DOMAIN_SEPARATOR_TYPEHASH= 0x47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218; // Function signature for the cancelProposal function. bytes4 internal constant CANCEL_PROPOSAL_SELECTOR = bytes4(abi.encodeWithSignature("cancel(uint256)")); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.24; /// @title IGuardManager - A contract interface managing transaction guards which perform pre and post-checks on transactions. interface IGuardManager { /// @notice Emitted when the Transaction Guard is changed. event ChangedGuard(address indexed guard); /// @notice Set Transaction Guard `guard` for the chamber. Make sure you trust the guard. /// @param guard The address of the guard to be used or the 0 address to disable the guard function setGuard(address guard) external; }
// 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 v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol) pragma solidity ^0.8.0; import "./ERC1155Receiver.sol"; /** * Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens. * * IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be * stuck. * * @dev _Available since v3.1._ */ contract ERC1155Holder is ERC1155Receiver { function onERC1155Received( address, address, uint256, uint256, bytes memory ) public virtual override returns (bytes4) { return this.onERC1155Received.selector; } function onERC1155BatchReceived( address, address, uint256[] memory, uint256[] memory, bytes memory ) public virtual override returns (bytes4) { return this.onERC1155BatchReceived.selector; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol) pragma solidity ^0.8.0; import "../IERC721Receiver.sol"; /** * @dev Implementation of the {IERC721Receiver} interface. * * Accepts all token transfers. * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}. */ contract ERC721Holder is IERC721Receiver { /** * @dev See {IERC721Receiver-onERC721Received}. * * Always returns `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) { return this.onERC721Received.selector; } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.24; import { IGuardManager } from "src/interfaces/IGuardManager.sol"; import { SelfAuthorized } from "src/proxy/SelfAuthorized.sol"; import { IGuard } from "src/interfaces/IGuard.sol"; /// @title Guard Manager - A contract managing transaction guards which perform pre and post-checks on transactions. contract GuardManager is SelfAuthorized, IGuardManager { // keccak256("guard_manager.guard.address") bytes32 internal constant GUARD_STORAGE_SLOT = 0x4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8; /// @inheritdoc IGuardManager function setGuard(address guard) external authorized{ bytes32 slot = GUARD_STORAGE_SLOT; // solhint-disable no-inline-assembly assembly { sstore(slot, guard) } emit ChangedGuard(guard); } /// @return guard The address of the guard function getGuard() internal view returns (address guard){ bytes32 slot = GUARD_STORAGE_SLOT; // solhint-disable no-inline-assembly assembly { guard := sload(slot) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol) pragma solidity ^0.8.0; import "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC721.sol) pragma solidity ^0.8.0; import "../token/ERC721/IERC721.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/Address.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] * ```solidity * 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. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!Address.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. * * 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. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * 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. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ 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. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized != type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @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 ReentrancyGuard { // 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; constructor() { _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() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @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] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol) pragma solidity ^0.8.0; import "../IERC1155Receiver.sol"; import "../../../utils/introspection/ERC165.sol"; /** * @dev _Available since v3.1._ */ abstract contract ERC1155Receiver is ERC165, IERC1155Receiver { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.24; contract SelfAuthorized { function requireSelfCall() private view{ require (msg.sender == address(this), "Method can only be called form this contract"); } modifier authorized { // Modifiers are copied around during compilation. This is a function call as it minimized the bytecode size requireSelfCall(); _; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * 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 (last updated v4.9.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 * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [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://consensys.net/diligence/blog/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.8.0/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 functionCallWithValue(target, data, 0, "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"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, 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) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or 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 { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // 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 (last updated v4.9.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev _Available since v3.1._ */ interface IERC1155Receiver is IERC165 { /** * @dev Handles the receipt of a single ERC1155 token type. This function is * called at the end of a `safeTransferFrom` after the balance has been updated. * * NOTE: To accept the transfer, this must return * `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` * (i.e. 0xf23a6e61, or its own function selector). * * @param operator The address which initiated the transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param id The ID of the token being transferred * @param value The amount of tokens being transferred * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed */ function onERC1155Received( address operator, address from, uint256 id, uint256 value, bytes calldata data ) external returns (bytes4); /** * @dev Handles the receipt of a multiple ERC1155 token types. This function * is called at the end of a `safeBatchTransferFrom` after the balances have * been updated. * * NOTE: To accept the transfer(s), this must return * `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` * (i.e. 0xbc197c81, or its own function selector). * * @param operator The address which initiated the batch transfer (i.e. msg.sender) * @param from The address which previously owned the token * @param ids An array containing ids of each token being transferred (order and length must match values array) * @param values An array containing amounts of each token being transferred (order and length must match ids array) * @param data Additional data with no specified format * @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed */ function onERC1155BatchReceived( address operator, address from, uint256[] calldata ids, uint256[] calldata values, bytes calldata data ) external returns (bytes4); }
// 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; } }
{ "remappings": [ "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/", "@openzeppelin/contracts/=lib/contract-utils/lib/open-zeppelin/contracts/", "contract-utils/=lib/contract-utils/src/", "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/", "loreum-nft/=lib/loreum-nft/src/", "loreum-token/=lib/loreum-token/src/", "open-zeppelin/contracts/=lib/contract-utils/lib/open-zeppelin/contracts/", "openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/", "solmate/=lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 888888 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} }
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"executionFailed","type":"error"},{"inputs":[],"name":"insufficientBalance","type":"error"},{"inputs":[{"internalType":"string","name":"message","type":"string"}],"name":"invalidApproval","type":"error"},{"inputs":[],"name":"invalidChangeAmount","type":"error"},{"inputs":[],"name":"invalidDemotion","type":"error"},{"inputs":[],"name":"invalidPromotion","type":"error"},{"inputs":[],"name":"invalidProposalState","type":"error"},{"inputs":[],"name":"invalidTokenOwner","type":"error"},{"inputs":[],"name":"invalidVote","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"proposalId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"approvals","type":"uint256"}],"name":"ApprovedProposal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"CanceledProposal","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"guard","type":"address"}],"name":"ChangedGuard","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"proposalId","type":"uint256"},{"indexed":false,"internalType":"address[]","name":"target","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"value","type":"uint256[]"},{"indexed":false,"internalType":"bytes[]","name":"data","type":"bytes[]"},{"indexed":false,"internalType":"uint256[5]","name":"voters","type":"uint256[5]"},{"indexed":false,"internalType":"uint256","name":"nonce","type":"uint256"}],"name":"CreatedProposal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"demoter","type":"address"},{"indexed":false,"internalType":"uint256","name":"amt","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Demotion","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"ExecutedProposal","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"promoter","type":"address"},{"indexed":false,"internalType":"uint256","name":"amt","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Promotion","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"ReceivedEther","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"ReceivedFallback","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"accountDelegation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"cancel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"constructMessageHash","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"targets","type":"address[]"},{"internalType":"uint256[]","name":"values","type":"uint256[]"},{"internalType":"bytes[]","name":"datas","type":"bytes[]"}],"name":"create","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"demote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"domainSeparator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"execute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getLeaderboard","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"govToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_memberToken","type":"address"},{"internalType":"address","name":"_govToken","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"leaderboard","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"locked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"memberToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nonce","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155BatchReceived","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC1155Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"promote","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"}],"name":"proposal","outputs":[{"internalType":"uint256","name":"approvals","type":"uint256"},{"internalType":"enum IChamber.State","name":"state","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"guard","type":"address"}],"name":"setGuard","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"totalDelegation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"proposalId","type":"uint256"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"}],"name":"verifySignature","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"voted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
60806040523480156200001157600080fd5b50600180556200002062000026565b620000e7565b600054610100900460ff1615620000935760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b606482015260840160405180910390fd5b60005460ff90811614620000e5576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b6145d180620000f76000396000f3fe60806040526004361061019a5760003560e01c80636d763a6e116100e1578063c0f4e66f1161008a578063e19a9dd911610064578063e19a9dd9146105d4578063f23a6e61146105f4578063f698da2514610639578063ff72ccf1146106a3576101de565b8063c0f4e66f1461057a578063cf3090121461059a578063e0f86f4a146105b4576101de565b8063affed0e0116100bb578063affed0e0146104ff578063bc197c8114610515578063bf3683991461055a576101de565b80636d763a6e1461048f57806374dcb927146104b2578063a2743296146104df576101de565b806340e58ee5116101435780635cb543841161011d5780635cb54384146104025780635f287cf2146104345780635fa2d69a1461046f576101de565b806340e58ee51461037c578063485cc9551461039c57806358f47f37146103bc576101de565b806330326c171161017457806330326c17146102ee57806331c781ed1461033c57806336eef9691461035c576101de565b806301ffc9a71461021657806305268cff1461024b578063150b7a021461029d576101de565b366101de5734156101dc5760405134815233907f78c972371203d575d4b76368a154d92bfb45d32a57696487f3334fbbe5042c14906020015b60405180910390a25b005b34156101dc5760405134815233907fa419615bc8fda4c87663805ee2a3597a6d71c1d476911d9892f340d965bc7bf1906020016101d3565b34801561022257600080fd5b5061023661023136600461367c565b6106c3565b60405190151581526020015b60405180910390f35b34801561025757600080fd5b506003546102789073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610242565b3480156102a957600080fd5b506102bd6102b83660046137ec565b61075c565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610242565b3480156102fa57600080fd5b5061032e610309366004613858565b600090815260086020819052604090912090810154600a90910154909160ff90911690565b6040516102429291906138db565b34801561034857600080fd5b506101dc6103573660046138ef565b610786565b34801561036857600080fd5b506101dc61037736600461393f565b610bdc565b34801561038857600080fd5b506101dc610397366004613858565b610d31565b3480156103a857600080fd5b506101dc6103b7366004613961565b610f10565b3480156103c857600080fd5b506103f46103d736600461399a565b600760209081526000928352604080842090915290825290205481565b604051908152602001610242565b34801561040e57600080fd5b5060025461027890610100900473ffffffffffffffffffffffffffffffffffffffff1681565b34801561044057600080fd5b5061023661044f36600461393f565b600960209081526000928352604080842090915290825290205460ff1681565b34801561047b57600080fd5b5061023661048a3660046138ef565b611211565b34801561049b57600080fd5b506104a46112ff565b604051610242929190613a02565b3480156104be57600080fd5b506103f46104cd366004613858565b60066020526000908152604090205481565b3480156104eb57600080fd5b506101dc6104fa36600461393f565b611407565b34801561050b57600080fd5b506103f460055481565b34801561052157600080fd5b506102bd610530366004613ac3565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561056657600080fd5b506103f4610575366004613858565b611593565b34801561058657600080fd5b506101dc610595366004613bf1565b6115b4565b3480156105a657600080fd5b506002546102369060ff1681565b3480156105c057600080fd5b506103f46105cf36600461393f565b611869565b3480156105e057600080fd5b506101dc6105ef366004613ccd565b611a8e565b34801561060057600080fd5b506102bd61060f366004613cea565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b34801561064557600080fd5b506103f4604080517f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218602082015246918101829052306060820152600091906080016040516020818303038152906040528051906020012091505090565b3480156106af57600080fd5b506101dc6106be3660046138ef565b611aff565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e000000000000000000000000000000000000000000000000000000000148061075657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b7f150b7a02000000000000000000000000000000000000000000000000000000005b949350505050565b6002546040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810184905261010090910473ffffffffffffffffffffffffffffffffffffffff1690636352211e90602401602060405180830381865afa1580156107f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081d9190613d53565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108b6576040517f4566432500000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f53656e6465722069736e2774204e4654206f776e65720000000000000000000060448201526064015b60405180910390fd5b60016000848152600860205260409020600a015460ff1660038111156108de576108de613871565b14610945576040517f4566432500000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f50726f706f73616c2069736e277420496e697469616c697a656400000000000060448201526064016108ad565b600083815260096020908152604080832085845290915290205460ff16156109c9576040517f4566432500000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f546f6b656e494420616c726561647920766f746564000000000000000000000060448201526064016108ad565b6109d4838383611211565b610a3a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064016108ad565b600083815260086020526040808220815160a0810190925260030160058282826020028201915b815481526020019060010190808311610a6157505050505090506000805b6005811015610ab257828160058110610a9a57610a9a613d70565b60200201518503610aaa57600191505b600101610a7f565b5080610b1a576040517f4566432500000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f546f6b656e4964206e6f74206f6e20766f746572206c6973740000000000000060448201526064016108ad565b6000858152600960209081526040808320878452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155888452600892839052908320909101805491929091610b7f908490613dce565b90915550506000858152600860208181526040928390209091015482518881529182018790528183015290517fd9d17adaf04c2a5459b44bf7e5250b33016df98b449a4fd79210847265a8f2b09181900360600190a15050505050565b610be4612485565b81158015610bf0575080155b15610c27576040517f3cceffed00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526006602052604081208054849290610c45908490613dce565b909155505033600090815260076020908152604080832084845290915281208054849290610c74908490613dce565b90915550610c839050816124f8565b600354610ca79073ffffffffffffffffffffffffffffffffffffffff163084612589565b600354610ccc9073ffffffffffffffffffffffffffffffffffffffff16333085612706565b7f64fa200f914c74a3af5f67325350feb87255cd47f71220ab02558ee1f0efc08d335b6040805173ffffffffffffffffffffffffffffffffffffffff909216825260208201859052810183905260600160405180910390a1610d2d60018055565b5050565b610d39612764565b60016000828152600860205260409020600a015460ff166003811115610d6157610d61613871565b14610dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f50726f706f73616c206973206e6f7420696e697469616c697a6564000000000060448201526064016108ad565b604080516001808252818301909252906020808301908036833750505060008281526008602090815260409091208251610e0893919291909101906134ae565b50604080516001808252818301909252906020808301908036833750505060008281526008602090815260409091208251610e4d936001909201929190910190613538565b5060408051600180825281830190925290816020015b6060815260200190600190039081610e6357505060008281526008602090815260409091208251610e9e936002909201929190910190613573565b50600081815260086020908152604091829020600a0180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600317905590518281527f2f2dfa6b2c0b2a02c860ce19e1752876298d1dc5e5f801c84161e19e48153a9d910160405180910390a150565b600054610100900460ff1615808015610f305750600054600160ff909116105b80610f4a5750303b158015610f4a575060005460ff166001145b610fd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016108ad565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561103457600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff83166110b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5468652061646472657373206973207a65726f0000000000000000000000000060448201526064016108ad565b73ffffffffffffffffffffffffffffffffffffffff821661112e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5468652061646472657373206973207a65726f0000000000000000000000000060448201526064016108ad565b600280547fffffffffffffffffffffff0000000000000000000000000000000000000000ff1661010073ffffffffffffffffffffffffffffffffffffffff8681169190910291909117909155600380547fffffffffffffffffffffffff000000000000000000000000000000000000000016918416919091179055801561120c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60008061121e8585611869565b9050600061122c82856127f5565b6002546040517f6352211e00000000000000000000000000000000000000000000000000000000815260048101889052919250610100900473ffffffffffffffffffffffffffffffffffffffff1690636352211e90602401602060405180830381865afa1580156112a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c59190613d53565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614925050505b9392505050565b6060806000600480548060200260200160405190810160405280929190818152602001828054801561135057602002820191906000526020600020905b81548152602001906001019080831161133c575b505050505090506000815167ffffffffffffffff811115611373576113736136e0565b60405190808252806020026020018201604052801561139c578160200160208202803683370190505b50905060005b82518110156113fd57600660008483815181106113c1576113c1613d70565b60200260200101518152602001908152602001600020548282815181106113ea576113ea613d70565b60209081029190910101526001016113a2565b5090939092509050565b61140f612485565b8115801561141b575080155b15611452576040517f6f547c9400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526007602090815260408083208484529091529020548211156114a6576040517f6f547c9400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600081815260066020526040812080548492906114c4908490613de1565b9091555050336000908152600760209081526040808320848452909152812080548492906114f3908490613de1565b9091555050600081815260066020526040812054900361151b5761151681612819565b611524565b611524816124f8565b6003546115489073ffffffffffffffffffffffffffffffffffffffff1633846128e5565b60035461156c9073ffffffffffffffffffffffffffffffffffffffff16308461293b565b7f0d5b0a4b93dc2a1651f13c19976bcb31319f1ebed62d531cc9d02f5d6a1953f233610cef565b600481815481106115a357600080fd5b600091825260209091200154905081565b600254600190610100900473ffffffffffffffffffffffffffffffffffffffff166370a08231336040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602401602060405180830381865afa158015611644573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116689190613df4565b10156116a0576040517f47108e3e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6116a86135c5565b60005b60058110156116f157600481815481106116c7576116c7613d70565b90600052602060002001548282600581106116e4576116e4613d70565b60200201526001016116ab565b506005805490600061170283613e0d565b91905055506040518060e001604052808581526020018481526020018381526020018281526020016000815260200160055481526020016001600381111561174c5761174c613871565b90526005546000908152600860209081526040909120825180519192611777928492909101906134ae565b5060208281015180516117909260018501920190613538565b50604082015180516117ac916002840191602090910190613573565b5060608201516117c290600383019060056135e3565b506080820151600882015560a0820151600982015560c0820151600a820180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600183600381111561181857611818613871565b0217905550506005546040517f3e02129af6dcfbd25daef8658185a25f8f5093fb38eca9ec3bf016600bfb16a1925061185b919087908790879087908590613f95565b60405180910390a150505050565b60008281526008602090815260408083208054825181850281018501909352808352611a7f938301828280156118d557602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116118aa575b5050506000878152600860209081526040918290206001018054835181840281018401909452808452929450925083018282801561193257602002820191906000526020600020905b81548152602001906001019080831161191e575b505050600088815260086020908152604080832060020180548251818502810185019093528083529195509350919084015b82821015611a1057838290600052602060002001805461198390613ff9565b80601f01602080910402602001604051908101604052809291908181526020018280546119af90613ff9565b80156119fc5780601f106119d1576101008083540402835291602001916119fc565b820191906000526020600020905b8154815290600101906020018083116119df57829003601f168201915b505050505081526020019060010190611964565b50505060008881526008602052604090819020815160a081019283905292506003019060059082845b815481526020019060010190808311611a395750505060008a8152600860208190526040909120908101546009820154600a9092015490935090915060ff168a8a612abe565b80519060200120905092915050565b611a96612764565b7f4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c881815560405173ffffffffffffffffffffffffffffffffffffffff8316907f1151116914515bc0891ff9047a6cb32cf902546f83066499bcf8ba33d2353fa290600090a25050565b60025460ff1615611b6c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f4e6f207265656e7472616e63790000000000000000000000000000000000000060448201526064016108ad565b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915583118015611bae5750611bac83612c1d565b155b15611cba57600260086000611bc4600187613de1565b81526020810191909152604001600020600a015460ff166003811115611bec57611bec613871565b1480611c2e5750600360086000611c04600187613de1565b81526020810191909152604001600020600a015460ff166003811115611c2c57611c2c613871565b145b611cba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f50726576696f75732070726f706f73616c206d757374206265207265736f6c7660448201527f65642e000000000000000000000000000000000000000000000000000000000060648201526084016108ad565b6000838152600860208190526040909120015460031115611d37576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4e6f7420656e6f75676820617070726f76616c7300000000000000000000000060448201526064016108ad565b611d42838383611211565b611da8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064016108ad565b6000805b6005811015611dec5760008581526008602052604090206003018160058110611dd757611dd7613d70565b01548403611de457600191505b600101611dac565b5080611e54576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f4e6f74206120766f74657200000000000000000000000000000000000000000060448201526064016108ad565b60016000858152600860205260409020600a015460ff166003811115611e7c57611e7c613871565b14611eb3576040517fff83c80d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000848152600860209081526040808320815181546101009481028201850190935260e08101838152909391928492849190840182828015611f2b57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611f00575b5050505050815260200160018201805480602002602001604051908101604052809291908181526020018280548015611f8357602002820191906000526020600020905b815481526020019060010190808311611f6f575b5050505050815260200160028201805480602002602001604051908101604052809291908181526020016000905b8282101561205d578382906000526020600020018054611fd090613ff9565b80601f0160208091040260200160405190810160405280929190818152602001828054611ffc90613ff9565b80156120495780601f1061201e57610100808354040283529160200191612049565b820191906000526020600020905b81548152906001019060200180831161202c57829003601f168201915b505050505081526020019060010190611fb1565b505050908252506040805160a081019182905260209092019190600384019060059082845b8154815260200190600101908083116120825750505091835250506008820154602082015260098201546040820152600a82015460609091019060ff1660038111156120d0576120d0613871565b60038111156120e1576120e1613871565b9052506000868152600860205260408120600a0180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660021790557f4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8549192505073ffffffffffffffffffffffffffffffffffffffff811615612253578073ffffffffffffffffffffffffffffffffffffffff1663d70cb05160086000898152602001908152602001600020600001600860008a8152602001908152602001600020600101600860008b8152602001908152602001600020600201600860008c8152602001908152602001600020600301600860008d8152602001908152602001600020600a0160009054906101000a900460ff168a338e8e6040518a63ffffffff1660e01b8152600401612220999897969594939291906141a6565b600060405180830381600087803b15801561223a57600080fd5b505af115801561224e573d6000803e3d6000fd5b505050505b6000805b83604001515181101561236c5760008460000151828151811061227c5761227c613d70565b602002602001015173ffffffffffffffffffffffffffffffffffffffff16856020015183815181106122b0576122b0613d70565b6020026020010151866040015184815181106122ce576122ce613d70565b60200260200101516040516122e39190614293565b60006040518083038185875af1925050503d8060008114612320576040519150601f19603f3d011682016040523d82523d6000602084013e612325565b606091505b5050905080925080612363576040517f6a4a8e5300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50600101612257565b5073ffffffffffffffffffffffffffffffffffffffff821615612421578173ffffffffffffffffffffffffffffffffffffffff1663932713686123af8989611869565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815260048101919091528315156024820152604401600060405180830381600087803b15801561240857600080fd5b505af115801561241c573d6000803e3d6000fd5b505050505b6040518781527fd8ae6466d9e43add7523f7d881b37597d4691cbfeb414d8d033f0241a7bf5bf19060200160405180910390a15050600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555050505050565b6002600154036124f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108ad565b6002600155565b600454600090815b8181101561253d57836004828154811061251c5761251c613d70565b906000526020600020015403612535576001925061253d565b600101612500565b50811561254c5761120c612d52565b600480546001810182556000919091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0183905561120c612d52565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa1580156125ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126239190613df4565b9050612700847f095ea7b300000000000000000000000000000000000000000000000000000000856126558686613dce565b60405173ffffffffffffffffffffffffffffffffffffffff909216602483015260448201526064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612eae565b50505050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526127009085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161267e565b3330146127f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d6574686f642063616e206f6e6c792062652063616c6c656420666f726d207460448201527f68697320636f6e7472616374000000000000000000000000000000000000000060648201526084016108ad565b565b60008060006128048585612fbd565b9150915061281181613002565b509392505050565b60005b600454811015610d2d57816004828154811061283a5761283a613d70565b9060005260206000200154036128dd57805b60045461285b90600190613de1565b8110156128b157600461286f826001613dce565b8154811061287f5761287f613d70565b90600052602060002001546004828154811061289d5761289d613d70565b60009182526020909120015560010161284c565b5060048054806128c3576128c36142af565b600190038181906000526020600020016000905590555050565b60010161281c565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261120c9084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161267e565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa1580156129b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129d59190613df4565b905081811015612a67576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f000000000000000000000000000000000000000000000060648201526084016108ad565b60405173ffffffffffffffffffffffffffffffffffffffff8416602482015282820360448201526127009085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161267e565b606060008a8a8a8a8a8a8a8a8a604051602001612ae3999897969594939291906142de565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052805160209091012090507f19000000000000000000000000000000000000000000000000000000000000007f0100000000000000000000000000000000000000000000000000000000000000612bba604080517f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218602082015246918101829052306060820152600091906080016040516020818303038152906040528051906020012091505090565b6040517fff0000000000000000000000000000000000000000000000000000000000000093841660208201529290911660218301526022820152604281018290526062016040516020818303038152906040529150509998505050505050505050565b600081815260086020526040812060020180548291908290612c4157612c41613d70565b90600052602060002001612c5490614346565b905060005b6004811015612d48576040805160048152602481019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f40e58ee500000000000000000000000000000000000000000000000000000000179052612cc2906143b0565b8160048110612cd357612cd3613d70565b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916828260048110612d0b57612d0b613d70565b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612d40575060009392505050565b600101612c59565b5060019392505050565b600454600090815b8181101561120c576000925060005b600454600190612d7a908490613de1565b612d849190613de1565b811015612e9f57600660006004612d9c846001613dce565b81548110612dac57612dac613d70565b90600052602060002001548152602001908152602001600020546006600060048481548110612ddd57612ddd613d70565b90600052602060002001548152602001908152602001600020541015612e97576004612e0a826001613dce565b81548110612e1a57612e1a613d70565b906000526020600020015460048281548110612e3857612e38613d70565b906000526020600020015460048381548110612e5657612e56613d70565b60009182526020822001906004612e6e866001613dce565b81548110612e7e57612e7e613d70565b6000918252602090912001929092559190915550600193505b600101612d69565b50821561120c57600101612d5a565b6000612f10826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166131b89092919063ffffffff16565b9050805160001480612f31575080806020019051810190612f3191906143fc565b61120c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016108ad565b6000808251604103612ff35760208301516040840151606085015160001a612fe7878285856131c7565b94509450505050612ffb565b506000905060025b9250929050565b600081600481111561301657613016613871565b0361301e5750565b600181600481111561303257613032613871565b03613099576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016108ad565b60028160048111156130ad576130ad613871565b03613114576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016108ad565b600381600481111561312857613128613871565b036131b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016108ad565b50565b606061077e84846000856132b6565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156131fe57506000905060036132ad565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613252573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166132a6576000600192509250506132ad565b9150600090505b94509492505050565b606082471015613348576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016108ad565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516133719190614293565b60006040518083038185875af1925050503d80600081146133ae576040519150601f19603f3d011682016040523d82523d6000602084013e6133b3565b606091505b50915091506133c4878383876133cf565b979650505050505050565b6060831561346557825160000361345e5773ffffffffffffffffffffffffffffffffffffffff85163b61345e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108ad565b508161077e565b61077e838381511561347a5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108ad919061441e565b828054828255906000526020600020908101928215613528579160200282015b8281111561352857825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9091161782556020909201916001909101906134ce565b50613534929150613610565b5090565b828054828255906000526020600020908101928215613528579160200282015b82811115613528578251825591602001919060010190613558565b8280548282559060005260206000209081019282156135b9579160200282015b828111156135b957825182906135a99082614481565b5091602001919060010190613593565b50613534929150613625565b6040518060a001604052806005906020820280368337509192915050565b82600581019282156135285791602002820182811115613528578251825591602001919060010190613558565b5b808211156135345760008155600101613611565b808211156135345760006136398282613642565b50600101613625565b50805461364e90613ff9565b6000825580601f1061365e575050565b601f0160209004906000526020600020908101906131b59190613610565b60006020828403121561368e57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146112f857600080fd5b73ffffffffffffffffffffffffffffffffffffffff811681146131b557600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613756576137566136e0565b604052919050565b600082601f83011261376f57600080fd5b813567ffffffffffffffff811115613789576137896136e0565b6137ba60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160161370f565b8181528460208386010111156137cf57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561380257600080fd5b843561380d816136be565b9350602085013561381d816136be565b925060408501359150606085013567ffffffffffffffff81111561384057600080fd5b61384c8782880161375e565b91505092959194509250565b60006020828403121561386a57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600481106138d7577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b828152604081016112f860208301846138a0565b60008060006060848603121561390457600080fd5b8335925060208401359150604084013567ffffffffffffffff81111561392957600080fd5b6139358682870161375e565b9150509250925092565b6000806040838503121561395257600080fd5b50508035926020909101359150565b6000806040838503121561397457600080fd5b823561397f816136be565b9150602083013561398f816136be565b809150509250929050565b600080604083850312156139ad57600080fd5b82356139b8816136be565b946020939093013593505050565b60008151808452602080850194506020840160005b838110156139f7578151875295820195908201906001016139db565b509495945050505050565b604081526000613a1560408301856139c6565b8281036020840152613a2781856139c6565b95945050505050565b600067ffffffffffffffff821115613a4a57613a4a6136e0565b5060051b60200190565b600082601f830112613a6557600080fd5b81356020613a7a613a7583613a30565b61370f565b8083825260208201915060208460051b870101935086841115613a9c57600080fd5b602086015b84811015613ab85780358352918301918301613aa1565b509695505050505050565b600080600080600060a08688031215613adb57600080fd5b8535613ae6816136be565b94506020860135613af6816136be565b9350604086013567ffffffffffffffff80821115613b1357600080fd5b613b1f89838a01613a54565b94506060880135915080821115613b3557600080fd5b613b4189838a01613a54565b93506080880135915080821115613b5757600080fd5b50613b648882890161375e565b9150509295509295909350565b600082601f830112613b8257600080fd5b81356020613b92613a7583613a30565b82815260059290921b84018101918181019086841115613bb157600080fd5b8286015b84811015613ab857803567ffffffffffffffff811115613bd55760008081fd5b613be38986838b010161375e565b845250918301918301613bb5565b600080600060608486031215613c0657600080fd5b833567ffffffffffffffff80821115613c1e57600080fd5b818601915086601f830112613c3257600080fd5b81356020613c42613a7583613a30565b82815260059290921b8401810191818101908a841115613c6157600080fd5b948201945b83861015613c88578535613c79816136be565b82529482019490820190613c66565b97505087013592505080821115613c9e57600080fd5b613caa87838801613a54565b93506040860135915080821115613cc057600080fd5b5061393586828701613b71565b600060208284031215613cdf57600080fd5b81356112f8816136be565b600080600080600060a08688031215613d0257600080fd5b8535613d0d816136be565b94506020860135613d1d816136be565b93506040860135925060608601359150608086013567ffffffffffffffff811115613d4757600080fd5b613b648882890161375e565b600060208284031215613d6557600080fd5b81516112f8816136be565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561075657610756613d9f565b8181038181111561075657610756613d9f565b600060208284031215613e0657600080fd5b5051919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613e3e57613e3e613d9f565b5060010190565b60008151808452602080850194506020840160005b838110156139f757815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101613e5a565b60005b83811015613ea7578181015183820152602001613e8f565b50506000910152565b60008151808452613ec8816020860160208601613e8c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60008282518085526020808601955060208260051b8401016020860160005b84811015613f65577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0868403018952613f53838351613eb0565b98840198925090830190600101613f19565b5090979650505050505050565b8060005b6005811015612700578151845260209384019390910190600101613f76565b6000610140888352806020840152613faf81840189613e45565b90508281036040840152613fc381886139c6565b90508281036060840152613fd78187613efa565b915050613fe76080830185613f72565b82610120830152979650505050505050565b600181811c9082168061400d57607f821691505b602082108103614046577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600081548084526020808501945083600052602060002060005b838110156139f757815487529582019560019182019101614066565b6000828254808552602080860195506005818360051b8501016000878152838120815b86811015614174577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0888503018b528282546140e081613ff9565b808752600182811680156140fb57600181146141325761415d565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0084168b8a01528a8315158b1b8a0101945061415d565b8688528a8820885b848110156141555781548b82018e0152908301908c0161413a565b8a018c019550505b509d89019d929650505091909101906001016140a5565b50919998505050505050505050565b8060005b6005811015612700578154845260209093019260019182019101614187565b6101a08082528a5490820181905260008b8152602080822091926101c0850192845b828110156141fa57815473ffffffffffffffffffffffffffffffffffffffff16855293830193600191820191016141c8565b505050508281036020840152614210818c61404c565b90508281036040840152614224818b614082565b9050614233606084018a614183565b6142416101008401896138a0565b8281036101208401526142548188613eb0565b91505061427a61014083018673ffffffffffffffffffffffffffffffffffffffff169052565b6101608201939093526101800152979650505050505050565b600082516142a5818460208701613e8c565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60006101a08083526142f28184018d613e45565b90508281036020840152614306818c6139c6565b9050828103604084015261431a818b613efa565b91505061432a6060830189613f72565b866101008301528561012083015261427a6101408301866138a0565b60006143528254613ff9565b82601f8211156143685783600052602060002090505b547fffffffff00000000000000000000000000000000000000000000000000000000808216935060048310156143a85780818460040360031b1b83161693505b505050919050565b6000815160208301517fffffffff00000000000000000000000000000000000000000000000000000000808216935060048310156143a85760049290920360031b82901b161692915050565b60006020828403121561440e57600080fd5b815180151581146112f857600080fd5b6020815260006112f86020830184613eb0565b601f82111561120c576000816000526020600020601f850160051c8101602086101561445a5750805b601f850160051c820191505b8181101561447957828155600101614466565b505050505050565b815167ffffffffffffffff81111561449b5761449b6136e0565b6144af816144a98454613ff9565b84614431565b602080601f83116001811461450257600084156144cc5750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b178555614479565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b8281101561454f57888601518255948401946001909101908401614530565b508582101561458b57878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b0190555056fea2646970667358221220fe5f16d8649d03ecce1803880966c3a71afc82ce9f55cda9c3a29b9a79fb47d264736f6c63430008180033
Deployed Bytecode
0x60806040526004361061019a5760003560e01c80636d763a6e116100e1578063c0f4e66f1161008a578063e19a9dd911610064578063e19a9dd9146105d4578063f23a6e61146105f4578063f698da2514610639578063ff72ccf1146106a3576101de565b8063c0f4e66f1461057a578063cf3090121461059a578063e0f86f4a146105b4576101de565b8063affed0e0116100bb578063affed0e0146104ff578063bc197c8114610515578063bf3683991461055a576101de565b80636d763a6e1461048f57806374dcb927146104b2578063a2743296146104df576101de565b806340e58ee5116101435780635cb543841161011d5780635cb54384146104025780635f287cf2146104345780635fa2d69a1461046f576101de565b806340e58ee51461037c578063485cc9551461039c57806358f47f37146103bc576101de565b806330326c171161017457806330326c17146102ee57806331c781ed1461033c57806336eef9691461035c576101de565b806301ffc9a71461021657806305268cff1461024b578063150b7a021461029d576101de565b366101de5734156101dc5760405134815233907f78c972371203d575d4b76368a154d92bfb45d32a57696487f3334fbbe5042c14906020015b60405180910390a25b005b34156101dc5760405134815233907fa419615bc8fda4c87663805ee2a3597a6d71c1d476911d9892f340d965bc7bf1906020016101d3565b34801561022257600080fd5b5061023661023136600461367c565b6106c3565b60405190151581526020015b60405180910390f35b34801561025757600080fd5b506003546102789073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610242565b3480156102a957600080fd5b506102bd6102b83660046137ec565b61075c565b6040517fffffffff000000000000000000000000000000000000000000000000000000009091168152602001610242565b3480156102fa57600080fd5b5061032e610309366004613858565b600090815260086020819052604090912090810154600a90910154909160ff90911690565b6040516102429291906138db565b34801561034857600080fd5b506101dc6103573660046138ef565b610786565b34801561036857600080fd5b506101dc61037736600461393f565b610bdc565b34801561038857600080fd5b506101dc610397366004613858565b610d31565b3480156103a857600080fd5b506101dc6103b7366004613961565b610f10565b3480156103c857600080fd5b506103f46103d736600461399a565b600760209081526000928352604080842090915290825290205481565b604051908152602001610242565b34801561040e57600080fd5b5060025461027890610100900473ffffffffffffffffffffffffffffffffffffffff1681565b34801561044057600080fd5b5061023661044f36600461393f565b600960209081526000928352604080842090915290825290205460ff1681565b34801561047b57600080fd5b5061023661048a3660046138ef565b611211565b34801561049b57600080fd5b506104a46112ff565b604051610242929190613a02565b3480156104be57600080fd5b506103f46104cd366004613858565b60066020526000908152604090205481565b3480156104eb57600080fd5b506101dc6104fa36600461393f565b611407565b34801561050b57600080fd5b506103f460055481565b34801561052157600080fd5b506102bd610530366004613ac3565b7fbc197c810000000000000000000000000000000000000000000000000000000095945050505050565b34801561056657600080fd5b506103f4610575366004613858565b611593565b34801561058657600080fd5b506101dc610595366004613bf1565b6115b4565b3480156105a657600080fd5b506002546102369060ff1681565b3480156105c057600080fd5b506103f46105cf36600461393f565b611869565b3480156105e057600080fd5b506101dc6105ef366004613ccd565b611a8e565b34801561060057600080fd5b506102bd61060f366004613cea565b7ff23a6e610000000000000000000000000000000000000000000000000000000095945050505050565b34801561064557600080fd5b506103f4604080517f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218602082015246918101829052306060820152600091906080016040516020818303038152906040528051906020012091505090565b3480156106af57600080fd5b506101dc6106be3660046138ef565b611aff565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f4e2312e000000000000000000000000000000000000000000000000000000000148061075657507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b92915050565b7f150b7a02000000000000000000000000000000000000000000000000000000005b949350505050565b6002546040517f6352211e0000000000000000000000000000000000000000000000000000000081526004810184905261010090910473ffffffffffffffffffffffffffffffffffffffff1690636352211e90602401602060405180830381865afa1580156107f9573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061081d9190613d53565b73ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16146108b6576040517f4566432500000000000000000000000000000000000000000000000000000000815260206004820152601660248201527f53656e6465722069736e2774204e4654206f776e65720000000000000000000060448201526064015b60405180910390fd5b60016000848152600860205260409020600a015460ff1660038111156108de576108de613871565b14610945576040517f4566432500000000000000000000000000000000000000000000000000000000815260206004820152601a60248201527f50726f706f73616c2069736e277420496e697469616c697a656400000000000060448201526064016108ad565b600083815260096020908152604080832085845290915290205460ff16156109c9576040517f4566432500000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f546f6b656e494420616c726561647920766f746564000000000000000000000060448201526064016108ad565b6109d4838383611211565b610a3a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064016108ad565b600083815260086020526040808220815160a0810190925260030160058282826020028201915b815481526020019060010190808311610a6157505050505090506000805b6005811015610ab257828160058110610a9a57610a9a613d70565b60200201518503610aaa57600191505b600101610a7f565b5080610b1a576040517f4566432500000000000000000000000000000000000000000000000000000000815260206004820152601960248201527f546f6b656e4964206e6f74206f6e20766f746572206c6973740000000000000060448201526064016108ad565b6000858152600960209081526040808320878452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001908117909155888452600892839052908320909101805491929091610b7f908490613dce565b90915550506000858152600860208181526040928390209091015482518881529182018790528183015290517fd9d17adaf04c2a5459b44bf7e5250b33016df98b449a4fd79210847265a8f2b09181900360600190a15050505050565b610be4612485565b81158015610bf0575080155b15610c27576040517f3cceffed00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008181526006602052604081208054849290610c45908490613dce565b909155505033600090815260076020908152604080832084845290915281208054849290610c74908490613dce565b90915550610c839050816124f8565b600354610ca79073ffffffffffffffffffffffffffffffffffffffff163084612589565b600354610ccc9073ffffffffffffffffffffffffffffffffffffffff16333085612706565b7f64fa200f914c74a3af5f67325350feb87255cd47f71220ab02558ee1f0efc08d335b6040805173ffffffffffffffffffffffffffffffffffffffff909216825260208201859052810183905260600160405180910390a1610d2d60018055565b5050565b610d39612764565b60016000828152600860205260409020600a015460ff166003811115610d6157610d61613871565b14610dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f50726f706f73616c206973206e6f7420696e697469616c697a6564000000000060448201526064016108ad565b604080516001808252818301909252906020808301908036833750505060008281526008602090815260409091208251610e0893919291909101906134ae565b50604080516001808252818301909252906020808301908036833750505060008281526008602090815260409091208251610e4d936001909201929190910190613538565b5060408051600180825281830190925290816020015b6060815260200190600190039081610e6357505060008281526008602090815260409091208251610e9e936002909201929190910190613573565b50600081815260086020908152604091829020600a0180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600317905590518281527f2f2dfa6b2c0b2a02c860ce19e1752876298d1dc5e5f801c84161e19e48153a9d910160405180910390a150565b600054610100900460ff1615808015610f305750600054600160ff909116105b80610f4a5750303b158015610f4a575060005460ff166001145b610fd6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084016108ad565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055801561103457600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff83166110b1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5468652061646472657373206973207a65726f0000000000000000000000000060448201526064016108ad565b73ffffffffffffffffffffffffffffffffffffffff821661112e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f5468652061646472657373206973207a65726f0000000000000000000000000060448201526064016108ad565b600280547fffffffffffffffffffffff0000000000000000000000000000000000000000ff1661010073ffffffffffffffffffffffffffffffffffffffff8681169190910291909117909155600380547fffffffffffffffffffffffff000000000000000000000000000000000000000016918416919091179055801561120c57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b505050565b60008061121e8585611869565b9050600061122c82856127f5565b6002546040517f6352211e00000000000000000000000000000000000000000000000000000000815260048101889052919250610100900473ffffffffffffffffffffffffffffffffffffffff1690636352211e90602401602060405180830381865afa1580156112a1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112c59190613d53565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614925050505b9392505050565b6060806000600480548060200260200160405190810160405280929190818152602001828054801561135057602002820191906000526020600020905b81548152602001906001019080831161133c575b505050505090506000815167ffffffffffffffff811115611373576113736136e0565b60405190808252806020026020018201604052801561139c578160200160208202803683370190505b50905060005b82518110156113fd57600660008483815181106113c1576113c1613d70565b60200260200101518152602001908152602001600020548282815181106113ea576113ea613d70565b60209081029190910101526001016113a2565b5090939092509050565b61140f612485565b8115801561141b575080155b15611452576040517f6f547c9400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526007602090815260408083208484529091529020548211156114a6576040517f6f547c9400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600081815260066020526040812080548492906114c4908490613de1565b9091555050336000908152600760209081526040808320848452909152812080548492906114f3908490613de1565b9091555050600081815260066020526040812054900361151b5761151681612819565b611524565b611524816124f8565b6003546115489073ffffffffffffffffffffffffffffffffffffffff1633846128e5565b60035461156c9073ffffffffffffffffffffffffffffffffffffffff16308461293b565b7f0d5b0a4b93dc2a1651f13c19976bcb31319f1ebed62d531cc9d02f5d6a1953f233610cef565b600481815481106115a357600080fd5b600091825260209091200154905081565b600254600190610100900473ffffffffffffffffffffffffffffffffffffffff166370a08231336040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602401602060405180830381865afa158015611644573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116689190613df4565b10156116a0576040517f47108e3e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6116a86135c5565b60005b60058110156116f157600481815481106116c7576116c7613d70565b90600052602060002001548282600581106116e4576116e4613d70565b60200201526001016116ab565b506005805490600061170283613e0d565b91905055506040518060e001604052808581526020018481526020018381526020018281526020016000815260200160055481526020016001600381111561174c5761174c613871565b90526005546000908152600860209081526040909120825180519192611777928492909101906134ae565b5060208281015180516117909260018501920190613538565b50604082015180516117ac916002840191602090910190613573565b5060608201516117c290600383019060056135e3565b506080820151600882015560a0820151600982015560c0820151600a820180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600183600381111561181857611818613871565b0217905550506005546040517f3e02129af6dcfbd25daef8658185a25f8f5093fb38eca9ec3bf016600bfb16a1925061185b919087908790879087908590613f95565b60405180910390a150505050565b60008281526008602090815260408083208054825181850281018501909352808352611a7f938301828280156118d557602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116118aa575b5050506000878152600860209081526040918290206001018054835181840281018401909452808452929450925083018282801561193257602002820191906000526020600020905b81548152602001906001019080831161191e575b505050600088815260086020908152604080832060020180548251818502810185019093528083529195509350919084015b82821015611a1057838290600052602060002001805461198390613ff9565b80601f01602080910402602001604051908101604052809291908181526020018280546119af90613ff9565b80156119fc5780601f106119d1576101008083540402835291602001916119fc565b820191906000526020600020905b8154815290600101906020018083116119df57829003601f168201915b505050505081526020019060010190611964565b50505060008881526008602052604090819020815160a081019283905292506003019060059082845b815481526020019060010190808311611a395750505060008a8152600860208190526040909120908101546009820154600a9092015490935090915060ff168a8a612abe565b80519060200120905092915050565b611a96612764565b7f4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c881815560405173ffffffffffffffffffffffffffffffffffffffff8316907f1151116914515bc0891ff9047a6cb32cf902546f83066499bcf8ba33d2353fa290600090a25050565b60025460ff1615611b6c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600d60248201527f4e6f207265656e7472616e63790000000000000000000000000000000000000060448201526064016108ad565b600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915583118015611bae5750611bac83612c1d565b155b15611cba57600260086000611bc4600187613de1565b81526020810191909152604001600020600a015460ff166003811115611bec57611bec613871565b1480611c2e5750600360086000611c04600187613de1565b81526020810191909152604001600020600a015460ff166003811115611c2c57611c2c613871565b145b611cba576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602360248201527f50726576696f75732070726f706f73616c206d757374206265207265736f6c7660448201527f65642e000000000000000000000000000000000000000000000000000000000060648201526084016108ad565b6000838152600860208190526040909120015460031115611d37576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4e6f7420656e6f75676820617070726f76616c7300000000000000000000000060448201526064016108ad565b611d42838383611211565b611da8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f496e76616c6964207369676e617475726500000000000000000000000000000060448201526064016108ad565b6000805b6005811015611dec5760008581526008602052604090206003018160058110611dd757611dd7613d70565b01548403611de457600191505b600101611dac565b5080611e54576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600b60248201527f4e6f74206120766f74657200000000000000000000000000000000000000000060448201526064016108ad565b60016000858152600860205260409020600a015460ff166003811115611e7c57611e7c613871565b14611eb3576040517fff83c80d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000848152600860209081526040808320815181546101009481028201850190935260e08101838152909391928492849190840182828015611f2b57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611f00575b5050505050815260200160018201805480602002602001604051908101604052809291908181526020018280548015611f8357602002820191906000526020600020905b815481526020019060010190808311611f6f575b5050505050815260200160028201805480602002602001604051908101604052809291908181526020016000905b8282101561205d578382906000526020600020018054611fd090613ff9565b80601f0160208091040260200160405190810160405280929190818152602001828054611ffc90613ff9565b80156120495780601f1061201e57610100808354040283529160200191612049565b820191906000526020600020905b81548152906001019060200180831161202c57829003601f168201915b505050505081526020019060010190611fb1565b505050908252506040805160a081019182905260209092019190600384019060059082845b8154815260200190600101908083116120825750505091835250506008820154602082015260098201546040820152600a82015460609091019060ff1660038111156120d0576120d0613871565b60038111156120e1576120e1613871565b9052506000868152600860205260408120600a0180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660021790557f4a204f620c8c5ccdca3fd54d003badd85ba500436a431f0cbda4f558c93c34c8549192505073ffffffffffffffffffffffffffffffffffffffff811615612253578073ffffffffffffffffffffffffffffffffffffffff1663d70cb05160086000898152602001908152602001600020600001600860008a8152602001908152602001600020600101600860008b8152602001908152602001600020600201600860008c8152602001908152602001600020600301600860008d8152602001908152602001600020600a0160009054906101000a900460ff168a338e8e6040518a63ffffffff1660e01b8152600401612220999897969594939291906141a6565b600060405180830381600087803b15801561223a57600080fd5b505af115801561224e573d6000803e3d6000fd5b505050505b6000805b83604001515181101561236c5760008460000151828151811061227c5761227c613d70565b602002602001015173ffffffffffffffffffffffffffffffffffffffff16856020015183815181106122b0576122b0613d70565b6020026020010151866040015184815181106122ce576122ce613d70565b60200260200101516040516122e39190614293565b60006040518083038185875af1925050503d8060008114612320576040519150601f19603f3d011682016040523d82523d6000602084013e612325565b606091505b5050905080925080612363576040517f6a4a8e5300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50600101612257565b5073ffffffffffffffffffffffffffffffffffffffff821615612421578173ffffffffffffffffffffffffffffffffffffffff1663932713686123af8989611869565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815260048101919091528315156024820152604401600060405180830381600087803b15801561240857600080fd5b505af115801561241c573d6000803e3d6000fd5b505050505b6040518781527fd8ae6466d9e43add7523f7d881b37597d4691cbfeb414d8d033f0241a7bf5bf19060200160405180910390a15050600280547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690555050505050565b6002600154036124f1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108ad565b6002600155565b600454600090815b8181101561253d57836004828154811061251c5761251c613d70565b906000526020600020015403612535576001925061253d565b600101612500565b50811561254c5761120c612d52565b600480546001810182556000919091527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b0183905561120c612d52565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa1580156125ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126239190613df4565b9050612700847f095ea7b300000000000000000000000000000000000000000000000000000000856126558686613dce565b60405173ffffffffffffffffffffffffffffffffffffffff909216602483015260448201526064015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612eae565b50505050565b60405173ffffffffffffffffffffffffffffffffffffffff808516602483015283166044820152606481018290526127009085907f23b872dd000000000000000000000000000000000000000000000000000000009060840161267e565b3330146127f3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602c60248201527f4d6574686f642063616e206f6e6c792062652063616c6c656420666f726d207460448201527f68697320636f6e7472616374000000000000000000000000000000000000000060648201526084016108ad565b565b60008060006128048585612fbd565b9150915061281181613002565b509392505050565b60005b600454811015610d2d57816004828154811061283a5761283a613d70565b9060005260206000200154036128dd57805b60045461285b90600190613de1565b8110156128b157600461286f826001613dce565b8154811061287f5761287f613d70565b90600052602060002001546004828154811061289d5761289d613d70565b60009182526020909120015560010161284c565b5060048054806128c3576128c36142af565b600190038181906000526020600020016000905590555050565b60010161281c565b60405173ffffffffffffffffffffffffffffffffffffffff831660248201526044810182905261120c9084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161267e565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa1580156129b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129d59190613df4565b905081811015612a67576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f000000000000000000000000000000000000000000000060648201526084016108ad565b60405173ffffffffffffffffffffffffffffffffffffffff8416602482015282820360448201526127009085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161267e565b606060008a8a8a8a8a8a8a8a8a604051602001612ae3999897969594939291906142de565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052805160209091012090507f19000000000000000000000000000000000000000000000000000000000000007f0100000000000000000000000000000000000000000000000000000000000000612bba604080517f47e79534a245952e8b16893a336b85a3d9ea9fa8c573f3d803afb92a79469218602082015246918101829052306060820152600091906080016040516020818303038152906040528051906020012091505090565b6040517fff0000000000000000000000000000000000000000000000000000000000000093841660208201529290911660218301526022820152604281018290526062016040516020818303038152906040529150509998505050505050505050565b600081815260086020526040812060020180548291908290612c4157612c41613d70565b90600052602060002001612c5490614346565b905060005b6004811015612d48576040805160048152602481019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f40e58ee500000000000000000000000000000000000000000000000000000000179052612cc2906143b0565b8160048110612cd357612cd3613d70565b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916828260048110612d0b57612d0b613d70565b1a60f81b7effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614612d40575060009392505050565b600101612c59565b5060019392505050565b600454600090815b8181101561120c576000925060005b600454600190612d7a908490613de1565b612d849190613de1565b811015612e9f57600660006004612d9c846001613dce565b81548110612dac57612dac613d70565b90600052602060002001548152602001908152602001600020546006600060048481548110612ddd57612ddd613d70565b90600052602060002001548152602001908152602001600020541015612e97576004612e0a826001613dce565b81548110612e1a57612e1a613d70565b906000526020600020015460048281548110612e3857612e38613d70565b906000526020600020015460048381548110612e5657612e56613d70565b60009182526020822001906004612e6e866001613dce565b81548110612e7e57612e7e613d70565b6000918252602090912001929092559190915550600193505b600101612d69565b50821561120c57600101612d5a565b6000612f10826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff166131b89092919063ffffffff16565b9050805160001480612f31575080806020019051810190612f3191906143fc565b61120c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016108ad565b6000808251604103612ff35760208301516040840151606085015160001a612fe7878285856131c7565b94509450505050612ffb565b506000905060025b9250929050565b600081600481111561301657613016613871565b0361301e5750565b600181600481111561303257613032613871565b03613099576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016108ad565b60028160048111156130ad576130ad613871565b03613114576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016108ad565b600381600481111561312857613128613871565b036131b5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c60448201527f756500000000000000000000000000000000000000000000000000000000000060648201526084016108ad565b50565b606061077e84846000856132b6565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156131fe57506000905060036132ad565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613252573d6000803e3d6000fd5b50506040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0015191505073ffffffffffffffffffffffffffffffffffffffff81166132a6576000600192509250506132ad565b9150600090505b94509492505050565b606082471015613348576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016108ad565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516133719190614293565b60006040518083038185875af1925050503d80600081146133ae576040519150601f19603f3d011682016040523d82523d6000602084013e6133b3565b606091505b50915091506133c4878383876133cf565b979650505050505050565b6060831561346557825160000361345e5773ffffffffffffffffffffffffffffffffffffffff85163b61345e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108ad565b508161077e565b61077e838381511561347a5781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108ad919061441e565b828054828255906000526020600020908101928215613528579160200282015b8281111561352857825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9091161782556020909201916001909101906134ce565b50613534929150613610565b5090565b828054828255906000526020600020908101928215613528579160200282015b82811115613528578251825591602001919060010190613558565b8280548282559060005260206000209081019282156135b9579160200282015b828111156135b957825182906135a99082614481565b5091602001919060010190613593565b50613534929150613625565b6040518060a001604052806005906020820280368337509192915050565b82600581019282156135285791602002820182811115613528578251825591602001919060010190613558565b5b808211156135345760008155600101613611565b808211156135345760006136398282613642565b50600101613625565b50805461364e90613ff9565b6000825580601f1061365e575050565b601f0160209004906000526020600020908101906131b59190613610565b60006020828403121561368e57600080fd5b81357fffffffff00000000000000000000000000000000000000000000000000000000811681146112f857600080fd5b73ffffffffffffffffffffffffffffffffffffffff811681146131b557600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613756576137566136e0565b604052919050565b600082601f83011261376f57600080fd5b813567ffffffffffffffff811115613789576137896136e0565b6137ba60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160161370f565b8181528460208386010111156137cf57600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000806080858703121561380257600080fd5b843561380d816136be565b9350602085013561381d816136be565b925060408501359150606085013567ffffffffffffffff81111561384057600080fd5b61384c8782880161375e565b91505092959194509250565b60006020828403121561386a57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b600481106138d7577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b9052565b828152604081016112f860208301846138a0565b60008060006060848603121561390457600080fd5b8335925060208401359150604084013567ffffffffffffffff81111561392957600080fd5b6139358682870161375e565b9150509250925092565b6000806040838503121561395257600080fd5b50508035926020909101359150565b6000806040838503121561397457600080fd5b823561397f816136be565b9150602083013561398f816136be565b809150509250929050565b600080604083850312156139ad57600080fd5b82356139b8816136be565b946020939093013593505050565b60008151808452602080850194506020840160005b838110156139f7578151875295820195908201906001016139db565b509495945050505050565b604081526000613a1560408301856139c6565b8281036020840152613a2781856139c6565b95945050505050565b600067ffffffffffffffff821115613a4a57613a4a6136e0565b5060051b60200190565b600082601f830112613a6557600080fd5b81356020613a7a613a7583613a30565b61370f565b8083825260208201915060208460051b870101935086841115613a9c57600080fd5b602086015b84811015613ab85780358352918301918301613aa1565b509695505050505050565b600080600080600060a08688031215613adb57600080fd5b8535613ae6816136be565b94506020860135613af6816136be565b9350604086013567ffffffffffffffff80821115613b1357600080fd5b613b1f89838a01613a54565b94506060880135915080821115613b3557600080fd5b613b4189838a01613a54565b93506080880135915080821115613b5757600080fd5b50613b648882890161375e565b9150509295509295909350565b600082601f830112613b8257600080fd5b81356020613b92613a7583613a30565b82815260059290921b84018101918181019086841115613bb157600080fd5b8286015b84811015613ab857803567ffffffffffffffff811115613bd55760008081fd5b613be38986838b010161375e565b845250918301918301613bb5565b600080600060608486031215613c0657600080fd5b833567ffffffffffffffff80821115613c1e57600080fd5b818601915086601f830112613c3257600080fd5b81356020613c42613a7583613a30565b82815260059290921b8401810191818101908a841115613c6157600080fd5b948201945b83861015613c88578535613c79816136be565b82529482019490820190613c66565b97505087013592505080821115613c9e57600080fd5b613caa87838801613a54565b93506040860135915080821115613cc057600080fd5b5061393586828701613b71565b600060208284031215613cdf57600080fd5b81356112f8816136be565b600080600080600060a08688031215613d0257600080fd5b8535613d0d816136be565b94506020860135613d1d816136be565b93506040860135925060608601359150608086013567ffffffffffffffff811115613d4757600080fd5b613b648882890161375e565b600060208284031215613d6557600080fd5b81516112f8816136be565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8082018082111561075657610756613d9f565b8181038181111561075657610756613d9f565b600060208284031215613e0657600080fd5b5051919050565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613e3e57613e3e613d9f565b5060010190565b60008151808452602080850194506020840160005b838110156139f757815173ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101613e5a565b60005b83811015613ea7578181015183820152602001613e8f565b50506000910152565b60008151808452613ec8816020860160208601613e8c565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60008282518085526020808601955060208260051b8401016020860160005b84811015613f65577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0868403018952613f53838351613eb0565b98840198925090830190600101613f19565b5090979650505050505050565b8060005b6005811015612700578151845260209384019390910190600101613f76565b6000610140888352806020840152613faf81840189613e45565b90508281036040840152613fc381886139c6565b90508281036060840152613fd78187613efa565b915050613fe76080830185613f72565b82610120830152979650505050505050565b600181811c9082168061400d57607f821691505b602082108103614046577f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b50919050565b600081548084526020808501945083600052602060002060005b838110156139f757815487529582019560019182019101614066565b6000828254808552602080860195506005818360051b8501016000878152838120815b86811015614174577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0888503018b528282546140e081613ff9565b808752600182811680156140fb57600181146141325761415d565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0084168b8a01528a8315158b1b8a0101945061415d565b8688528a8820885b848110156141555781548b82018e0152908301908c0161413a565b8a018c019550505b509d89019d929650505091909101906001016140a5565b50919998505050505050505050565b8060005b6005811015612700578154845260209093019260019182019101614187565b6101a08082528a5490820181905260008b8152602080822091926101c0850192845b828110156141fa57815473ffffffffffffffffffffffffffffffffffffffff16855293830193600191820191016141c8565b505050508281036020840152614210818c61404c565b90508281036040840152614224818b614082565b9050614233606084018a614183565b6142416101008401896138a0565b8281036101208401526142548188613eb0565b91505061427a61014083018673ffffffffffffffffffffffffffffffffffffffff169052565b6101608201939093526101800152979650505050505050565b600082516142a5818460208701613e8c565b9190910192915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b60006101a08083526142f28184018d613e45565b90508281036020840152614306818c6139c6565b9050828103604084015261431a818b613efa565b91505061432a6060830189613f72565b866101008301528561012083015261427a6101408301866138a0565b60006143528254613ff9565b82601f8211156143685783600052602060002090505b547fffffffff00000000000000000000000000000000000000000000000000000000808216935060048310156143a85780818460040360031b1b83161693505b505050919050565b6000815160208301517fffffffff00000000000000000000000000000000000000000000000000000000808216935060048310156143a85760049290920360031b82901b161692915050565b60006020828403121561440e57600080fd5b815180151581146112f857600080fd5b6020815260006112f86020830184613eb0565b601f82111561120c576000816000526020600020601f850160051c8101602086101561445a5750805b601f850160051c820191505b8181101561447957828155600101614466565b505050505050565b815167ffffffffffffffff81111561449b5761449b6136e0565b6144af816144a98454613ff9565b84614431565b602080601f83116001811461450257600084156144cc5750858301515b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600386901b1c1916600185901b178555614479565b6000858152602081207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08616915b8281101561454f57888601518255948401946001909101908401614530565b508582101561458b57878501517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600388901b60f8161c191681555b5050505050600190811b0190555056fea2646970667358221220fe5f16d8649d03ecce1803880966c3a71afc82ce9f55cda9c3a29b9a79fb47d264736f6c63430008180033
Loading...
Loading
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.