ERC-721
Overview
Max Total Supply
5,000 MMC
Holders
334
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
2 MMCLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
MadMouseTroupe
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 932 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT pragma solidity ^0.8.13; // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM`MMM NMM MMM MMM MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM MMMMhMMMMMMM MMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMM MM-MMMMM MMMM MMMM lMMMDMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMM jMMMMl MM MMM M MMM M MMMM MMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMM MMMMMMMMM , ` M Y MM MMM BMMMMMM MMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMM MMMMMMMMMMMM IM MM l MMM X MM. MMMMMMMMMM MMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM.nlMMMMMMMMMMMMMMMMM]._ MMMMMMMMMMMMMMMNMMMMMMMMMMMMMM // MMMMMMMMMMMMMM TMMMMMMMMMMMMMMMMMM +MMMMMMMMMMMM: rMMMMMMMMN MMMMMMMMMMMMMM // MMMMMMMMMMMM MMMMMMMMMMMMMMMM MMMMMM MMMMMMMM qMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMM^ MMMb .MMMMMMMMMMMMMMMMMMM // MMMMMMMMMM MMMMMMMMMMMMMMM MM MMMMMMM MMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMM M gMMMMMMMMMMMMMMMMM // MMMMMMMMu MMMMMMMMMMMMMMM MMMMMMM .MMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMM :MMMMMMMMMMMMMMMM // MMMMMMM^ MMMMMMMMMMMMMMMl MMMMMMMM MMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMM // MMMMMMM MMMMMMMMMMMMMMMM MMMMMMMM MMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMM // MMMMMMr MMMMMMMMMMMMMMMM MMMMMMMM .MMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMM // MMMMMMM MMMMMMMMMMMMMMMMM DMMMMMMMMMM MMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMM|`MMMMMMMMMMMMMMMM q MMMMMMMMMMMMMMMMMMM MMMMMMM // MMMMMMMMMTMMMMMMMMMMMMMMM qMMMMMMMMMMMMMMMMMMgMMMMMMMMM // MMMMMMMMq MMMMMMMMMMMMMMMh jMMMMMMMMMMMMMMMMMMM nMMMMMMMM // MMMMMMMMMM MMMMMMMMMMMMMMMQ nc -MMMMMn MMMMMMMMMMMMMMMMMMMM MMMMMMMMMM // MMMMMMMMMM.MMMMMMMMMMMMMMMMMMl M1 `MMMMMMMMMMMMMMMMMMMMMMrMMMMMMMMMM // MMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMM :MMMMMMMMMM MMMMMMMMMMMM qMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMM MMMMMMX MMMMMMMMMMMMMMM uMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMM DMMMMMMMMM IMMMMMMMMMMMMMMMMMMMMMMM M Y MMMMMMMN MMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMM MMMMMM `` M MM MMM , MMMM Mv MMM MMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMM MMh Ml . M MMMM I MMMT M :M ,MMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMM MMMMMMMMt MM MMMMB m ]MMM MMMM MMMMMM MMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMM MMMMM MMM TM MM 9U .MM _MMMMM MMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMM YMMMMMMMn MMMM +MMMMMMM1`MMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM.`MMM MMM MMMMM`.MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MM M M M M M______ ____ ___ __ __ ____ ___ M M M M M M MM // MM M M M M M| || \ / \ | | || \ / _] M M M M M M MM // MM M M M M M | || D ) || | || o ) [_ M M M M M M MM // MM M M M M M M|_| |_|| /| O || | || _/ _] M M M M M MMM // MM M M M M M M | | | \| || : || | | [_ M M M M M M MM // MMM M M M M M | | | . \ || || | | | M M M M M MMM // MM M M M M M |__| |__|\_|\___/ \__,_||__| |_____|M M M M M M MM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM // MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM author: phaze MMM import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; import '@openzeppelin/contracts/utils/cryptography/ECDSA.sol'; import './lib/Ownable.sol'; import {VRFBaseMainnet as VRFBase} from './lib/VRFBase.sol'; import './Gouda.sol'; import './MadMouseStaking.sol'; error PublicSaleNotActive(); error WhitelistNotActive(); error InvalidAmount(); error ExceedsLimit(); error SignatureExceedsLimit(); error IncorrectValue(); error InvalidSignature(); error ContractCallNotAllowed(); error InvalidString(); error MaxLevelReached(); error MaxNumberReached(); error MinHoldDurationRequired(); error IncorrectHash(); error CollectionAlreadyRevealed(); error CollectionNotRevealed(); error TokenDataAlreadySet(); error MintAndStakeMinHoldDurationNotReached(); interface IMadMouseMetadata { function buildMouseMetadata(uint256 tokenId, uint256 level) external view returns (string memory); } contract MadMouseTroupe is Ownable, MadMouseStaking, VRFBase { using ECDSA for bytes32; using UserDataOps for uint256; using TokenDataOps for uint256; using DNAOps for uint256; bool public publicSaleActive; uint256 constant MAX_SUPPLY = 5000; uint256 constant MAX_PER_WALLET = 50; uint256 constant PURCHASE_LIMIT = 3; uint256 constant whitelistPrice = 0.075 ether; address public metadata; address public multiSigTreasury = 0xFB79a928C5d6c5932Ba83Aa8C7145cBDCDb9fd2E; address signerAddress = 0x3ADE0c5e35cbF136245F4e4bBf4563BD151d39D1; uint256 public totalLevel2Reached; uint256 public totalLevel3Reached; uint256 constant LEVEL_2_COST = 120 * 1e18; uint256 constant LEVEL_3_COST = 350 * 1e18; uint256 constant MAX_NUM_LEVEL_2 = 3300; uint256 constant MAX_NUM_LEVEL_3 = 1200; uint256 constant NAME_CHANGE_COST = 25 * 1e18; uint256 constant BIO_CHANGE_COST = 15 * 1e18; uint256 constant MAX_LEN_NAME = 20; uint256 constant MAX_LEN_BIO = 35; uint256 constant MINT_AND_STAKE_MIN_HOLD_DURATION = 3 days; uint256 profileUpdateMinHoldDuration = 30 days; mapping(uint256 => string) public mouseName; mapping(uint256 => string) public mouseBio; string public description; string public imagesBaseURI; string constant unrevealedURI = 'ipfs://QmW9NKUGYesTiYx5iSP1o82tn4Chq9i1yQV6DBnzznrHTH'; bool private revealed; bytes32 immutable secretHash; constructor(bytes32 secretHash_) MadMouseStaking(MAX_SUPPLY, MAX_PER_WALLET) { secretHash = secretHash_; _mintAndStake(multiSigTreasury, 30, false); } /* ------------- External ------------- */ function mint(uint256 amount, bool stake) external payable noContract { if (!publicSaleActive) revert PublicSaleNotActive(); if (PURCHASE_LIMIT < amount) revert ExceedsLimit(); uint256 price_ = price(); if (msg.value != price_ * amount) revert IncorrectValue(); if (price_ == 0) { // free mints will at first be restricted to purchase limit uint256 numMinted = _userData[msg.sender].numMinted(); if (numMinted + amount > PURCHASE_LIMIT) revert ExceedsLimit(); // free mints > 1 will be staked if (amount != 1) stake = true; } _mintAndStake(msg.sender, amount, stake); } function whitelistMint( uint256 amount, uint256 limit, bytes calldata signature, bool stake ) external payable noContract { if (publicSaleActive) revert WhitelistNotActive(); if (!validSignature(signature, limit)) revert InvalidSignature(); uint256 numMinted = _userData[msg.sender].numMinted(); if (numMinted + amount > limit) revert ExceedsLimit(); _mintAndStake(msg.sender, amount, stake); } function levelUp(uint256 tokenId) external payable { uint256 tokenData = _tokenDataOf(tokenId); address owner = tokenData.trueOwner(); if (owner != msg.sender) revert IncorrectOwner(); uint256 level = tokenData.level(); if (level > 2) revert MaxLevelReached(); if (level == 1) { if (totalLevel2Reached >= MAX_NUM_LEVEL_2) revert MaxNumberReached(); gouda.burnFrom(msg.sender, LEVEL_2_COST); ++totalLevel2Reached; } else { if (totalLevel3Reached >= MAX_NUM_LEVEL_3) revert MaxNumberReached(); gouda.burnFrom(msg.sender, LEVEL_3_COST); ++totalLevel3Reached; } uint256 newTokenData = tokenData.increaseLevel().resetOwnerCount(); if (tokenData.staked() && revealed) { uint256 userData = _claimReward(); (userData, newTokenData) = updateDataWhileStaked(userData, tokenId, tokenData, newTokenData); _userData[msg.sender] = userData; } _tokenData[tokenId] = newTokenData; } function setName(uint256 tokenId, string calldata name) external payable onlyLongtermHolder(tokenId) { if (!isValidString(name, MAX_LEN_NAME)) revert InvalidString(); gouda.burnFrom(msg.sender, NAME_CHANGE_COST); mouseName[tokenId] = name; } function setBio(uint256 tokenId, string calldata bio) external payable onlyLongtermHolder(tokenId) { if (!isValidString(bio, MAX_LEN_BIO)) revert InvalidString(); gouda.burnFrom(msg.sender, BIO_CHANGE_COST); mouseBio[tokenId] = bio; } // only to be used by owner in extreme cases when these reflect negatively on the collection // since they are automatically shown in the metadata (on OpenSea) function resetName(uint256 tokenId) external payable { address _owner = _tokenDataOf(tokenId).trueOwner(); if (_owner != msg.sender && owner() != msg.sender) revert IncorrectOwner(); delete mouseName[tokenId]; } function resetBio(uint256 tokenId) external payable { address _owner = _tokenDataOf(tokenId).trueOwner(); if (_owner != msg.sender && owner() != msg.sender) revert IncorrectOwner(); delete mouseBio[tokenId]; } /* ------------- View ------------- */ function price() public view returns (uint256) { return totalSupply < 3500 ? 0 ether : .02 ether; } function tokenURI(uint256 tokenId) public view override returns (string memory) { if (!_exists(tokenId)) revert NonexistentToken(); if (!revealed || address(metadata) == address(0)) return unrevealedURI; return IMadMouseMetadata(address(metadata)).buildMouseMetadata(tokenId, this.getLevel(tokenId)); } function previewTokenURI(uint256 tokenId, uint256 level) external view returns (string memory) { if (!_exists(tokenId)) revert NonexistentToken(); if (!revealed || address(metadata) == address(0)) return unrevealedURI; return IMadMouseMetadata(address(metadata)).buildMouseMetadata(tokenId, level); } function getDNA(uint256 tokenId) external view onceRevealed returns (uint256) { if (!_exists(tokenId)) revert NonexistentToken(); return computeDNA(tokenId); } function getLevel(uint256 tokenId) external view returns (uint256) { return _tokenDataOf(tokenId).level(); } /* ------------- Private ------------- */ function validSignature(bytes calldata signature, uint256 limit) private view returns (bool) { bytes32 msgHash = keccak256(abi.encode(address(this), msg.sender, limit)); return msgHash.toEthSignedMessageHash().recover(signature) == signerAddress; } // not guarded for reveal function computeDNA(uint256 tokenId) private view returns (uint256) { return uint256(keccak256(abi.encodePacked(randomSeed, tokenId))); } /* ------------- Owner ------------- */ function setPublicSaleActive(bool active) external payable onlyOwner { publicSaleActive = active; } function setProfileUpdateMinHoldDuration(uint256 duration) external payable onlyOwner { profileUpdateMinHoldDuration = duration; } function giveAway(address[] calldata to, uint256[] calldata amounts) external payable onlyOwner { for (uint256 i; i < to.length; ++i) _mintAndStake(to[i], amounts[i], false); } function setSignerAddress(address address_) external payable onlyOwner { signerAddress = address_; } function setMetadataAddress(address metadata_) external payable onlyOwner { metadata = metadata_; } function withdraw() external payable onlyOwner { uint256 balance = address(this).balance; multiSigTreasury.call{value: balance}(''); } function recoverToken(IERC20 token) external payable onlyOwner { uint256 balance = token.balanceOf(address(this)); token.transfer(msg.sender, balance); } function setDescription(string memory description_) external payable onlyOwner { description = description_; } // requires that the reveal is first done through chainlink vrf function setImagesBaseURI(string memory uri) external payable onlyOwner onceRevealed { imagesBaseURI = uri; } // extra security for reveal: // the owner sets a hash of a secret seed // once chainlink randomness fulfills, the secret is revealed and shifts the secret seed set by chainlink // Why? The final randomness should come from a trusted third party, // however devs need time to generate the collection from the metadata. // There is a time-frame in which an unfair advantage is gained after the seed is set and before the metadata is revealed. // This eliminates any possibility of the team generating an unfair seed and any unfair advantage by snipers. function reveal(string memory _imagesBaseURI, bytes32 secretSeed_) external payable onlyOwner whenRandomSeedSet { if (revealed) revert CollectionAlreadyRevealed(); if (secretHash != keccak256(abi.encode(secretSeed_))) revert IncorrectHash(); revealed = true; imagesBaseURI = _imagesBaseURI; _shiftRandomSeed(uint256(secretSeed_)); } /* ------------- Hooks ------------- */ // update role, level information when staking function _beforeStakeDataTransform( uint256 tokenId, uint256 userData, uint256 tokenData ) internal view override returns (uint256, uint256) { // assumption that mint&stake won't have revealed yet if (!tokenData.mintAndStake() && tokenData.role() == 0 && revealed) tokenData = tokenData.setRoleAndRarity(computeDNA(tokenId)); userData = userData.updateUserDataStake(tokenData); return (userData, tokenData); } function _beforeUnstakeDataTransform( uint256, uint256 userData, uint256 tokenData ) internal view override returns (uint256, uint256) { userData = userData.updateUserDataUnstake(tokenData); if (tokenData.mintAndStake() && block.timestamp - tokenData.lastTransfer() < MINT_AND_STAKE_MIN_HOLD_DURATION) revert MintAndStakeMinHoldDurationNotReached(); return (userData, tokenData); } function updateStakedTokenData(uint256[] calldata tokenIds) external payable onceRevealed { uint256 userData = _claimReward(); uint256 tokenId; uint256 tokenData; for (uint256 i; i < tokenIds.length; ++i) { tokenId = tokenIds[i]; tokenData = _tokenDataOf(tokenId); if (tokenData.trueOwner() != msg.sender) revert IncorrectOwner(); if (!tokenData.staked()) revert TokenIdUnstaked(); // only useful for staked ids if (tokenData.role() != 0) revert TokenDataAlreadySet(); (userData, tokenData) = updateDataWhileStaked(userData, tokenId, tokenData, tokenData); _tokenData[tokenId] = tokenData; } _userData[msg.sender] = userData; } // note: must be guarded by check for revealed function updateDataWhileStaked( uint256 userData, uint256 tokenId, uint256 oldTokenData, uint256 newTokenData ) private view returns (uint256, uint256) { uint256 userDataX; // add in the role and rarity data if not already uint256 tokenDataX = newTokenData.role() != 0 ? newTokenData : newTokenData.setRoleAndRarity(computeDNA(tokenId)); // update userData as if to unstake with old tokenData and stake with new tokenData userDataX = userData.updateUserDataUnstake(oldTokenData).updateUserDataStake(tokenDataX); return applySafeDataTransform(userData, newTokenData, userDataX, tokenDataX); } // simulates a token update and only returns ids != 0 if // the user gets a bonus increase upon updating staked data function shouldUpdateStakedIds(address user) external view returns (uint256[] memory) { if (!revealed) return new uint256[](0); uint256[] memory stakedIds = this.tokenIdsOf(user, 1); uint256 userData = _userData[user]; uint256 oldTotalBonus = totalBonus(user, userData); uint256 tokenData; for (uint256 i; i < stakedIds.length; ++i) { tokenData = _tokenDataOf(stakedIds[i]); if (tokenData.role() == 0) (userData, ) = updateDataWhileStaked(userData, stakedIds[i], tokenData, tokenData); else stakedIds[i] = 0; } uint256 newTotalBonus = totalBonus(user, userData); return (newTotalBonus > oldTotalBonus) ? stakedIds : new uint256[](0); } /* ------------- Modifier ------------- */ modifier onceRevealed() { if (!revealed) revert CollectionNotRevealed(); _; } modifier noContract() { if (tx.origin != msg.sender) revert ContractCallNotAllowed(); _; } modifier onlyLongtermHolder(uint256 tokenId) { uint256 tokenData = _tokenDataOf(tokenId); uint256 timeHeld = block.timestamp - tokenData.lastTransfer(); if (tokenData.trueOwner() != msg.sender) revert IncorrectOwner(); if (timeHeld < profileUpdateMinHoldDuration) revert MinHoldDurationRequired(); _; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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); /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; error CallerIsNotTheOwner(); abstract contract Ownable { address _owner; constructor() { _owner = msg.sender; } function owner() public view returns (address) { return _owner; } modifier onlyOwner() { if (msg.sender != _owner) revert CallerIsNotTheOwner(); _; } function transferOwnership(address newOwner) external onlyOwner { _owner = newOwner; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@chainlink/contracts/src/v0.8/VRFConsumerBase.sol'; import './Ownable.sol'; error RandomSeedNotSet(); error RandomSeedAlreadySet(); contract VRFBase is VRFConsumerBase, Ownable { bytes32 private immutable keyHash; uint256 private immutable fee; uint256 public randomSeed; constructor( bytes32 keyHash_, uint256 fee_, address vrfCoordinator_, address link_ ) VRFConsumerBase(vrfCoordinator_, link_) { keyHash = keyHash_; fee = fee_; } /* ------------- Owner ------------- */ function requestRandomSeed() external payable virtual onlyOwner whenRandomSeedUnset { requestRandomness(keyHash, fee); } // this function should not be needed and is just an emergency fail-safe if // for some reason chainlink is not able to fulfill the randomness callback function forceFulfillRandomness() external payable virtual onlyOwner whenRandomSeedUnset { randomSeed = uint256(blockhash(block.number - 1)); } /* ------------- Internal ------------- */ function fulfillRandomness(bytes32, uint256 randomNumber) internal virtual override { randomSeed = randomNumber; } function _shiftRandomSeed(uint256 randomNumber) internal { randomSeed = uint256(keccak256(abi.encode(randomSeed, randomNumber))); } /* ------------- View ------------- */ function randomSeedSet() public view returns (bool) { return randomSeed > 0; } /* ------------- Modifier ------------- */ modifier whenRandomSeedSet() { if (!randomSeedSet()) revert RandomSeedNotSet(); _; } modifier whenRandomSeedUnset() { if (randomSeedSet()) revert RandomSeedAlreadySet(); _; } } // get your shit together Chainlink... contract VRFBaseMainnet is VRFBase( 0xAA77729D3466CA35AE8D28B3BBAC7CC36A5031EFDC430821C02BC31A238AF445, 2 * 1e18, 0xf0d54349aDdcf704F77AE15b96510dEA15cb7952, 0x514910771AF9Ca656af840dff83E8264EcF986CA ) { } contract VRFBaseRinkeby is VRFBase( 0x2ed0feb3e7fd2022120aa84fab1945545a9f2ffc9076fd6156fa96eaff4c1311, 0.1 * 1e18, 0xb3dCcb4Cf7a26f6cf6B120Cf5A73875B7BBc655B, 0x01BE23585060835E02B77ef475b0Cc51aA1e0709 ) {} contract VRFBaseMumbai is VRFBase( 0x6e75b569a01ef56d18cab6a8e71e6600d6ce853834d4a5748b720d06f878b3a4, 0.0001 * 1e18, 0x8C7382F9D8f56b33781fE506E897a4F1e2d17255, 0x326C977E6efc84E512bB9C30f76E30c160eD06FB ) {}
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/access/AccessControl.sol'; import '@openzeppelin/contracts/token/ERC20/ERC20.sol'; contract Gouda is ERC20, AccessControl { bytes32 constant MINT_AUTHORITY = keccak256('MINT_AUTHORITY'); bytes32 constant BURN_AUTHORITY = keccak256('BURN_AUTHORITY'); bytes32 constant TREASURY = keccak256('TREASURY'); address public multiSigTreasury = 0xFB79a928C5d6c5932Ba83Aa8C7145cBDCDb9fd2E; constructor(address madmouse) ERC20('Gouda', 'GOUDA') { _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); _setupRole(MINT_AUTHORITY, madmouse); _setupRole(BURN_AUTHORITY, madmouse); _setupRole(TREASURY, multiSigTreasury); _mint(multiSigTreasury, 200_000 * 1e18); } /* ------------- Restricted ------------- */ function mint(address user, uint256 amount) external onlyRole(MINT_AUTHORITY) { _mint(user, amount); } /* ------------- ERC20Burnable ------------- */ function burnFrom(address account, uint256 amount) public { if (!hasRole(BURN_AUTHORITY, msg.sender)) _spendAllowance(account, msg.sender, amount); _burn(account, amount); } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import './Gouda.sol'; import './lib/ERC721M.sol'; import './lib/Ownable.sol'; error InvalidBoostToken(); error TransferFailed(); error BoostInEffect(); error NotSpecialGuestOwner(); error SpecialGuestIndexMustDiffer(); abstract contract MadMouseStaking is ERC721M, Ownable { using UserDataOps for uint256; event BoostActivation(address token); Gouda public gouda; uint256 constant dailyReward = 0.3 * 1e18; uint256 constant ROLE_BONUS_3 = 2000; uint256 constant ROLE_BONUS_5 = 3500; uint256 constant TOKEN_BONUS = 1000; uint256 constant TIME_BONUS = 1000; uint256 constant RARITY_BONUS = 1000; uint256 constant OG_BONUS = 2000; uint256 constant SPECIAL_GUEST_BONUS = 1000; uint256 immutable OG_BONUS_END; uint256 immutable LAST_GOUDA_EMISSION_DATE; uint256 constant TOKEN_BOOST_DURATION = 9 days; uint256 constant TOKEN_BOOST_COOLDOWN = 9 days; uint256 constant TIME_BONUS_STAKE_DURATION = 30 days; mapping(IERC20 => uint256) tokenBoostCosts; mapping(uint256 => IERC721) specialGuests; mapping(IERC721 => bytes4) specialGuestsNumStakedSelector; address constant burnAddress = 0x000000000000000000000000000000000000dEaD; constructor(uint256 maxSupply_, uint256 maxPerWallet_) ERC721M('MadMouseCircus', 'MMC', 1, maxSupply_, maxPerWallet_) { OG_BONUS_END = block.timestamp + 60 days; LAST_GOUDA_EMISSION_DATE = block.timestamp + 5 * 365 days; } /* ------------- External ------------- */ function burnForBoost(IERC20 token) external payable { uint256 userData = _claimReward(); uint256 boostCost = tokenBoostCosts[token]; if (boostCost == 0) revert InvalidBoostToken(); bool success = token.transferFrom(msg.sender, burnAddress, boostCost); if (!success) revert TransferFailed(); uint256 boostStart = userData.boostStart(); if (boostStart + TOKEN_BOOST_DURATION + TOKEN_BOOST_COOLDOWN > block.timestamp) revert BoostInEffect(); _userData[msg.sender] = userData.setBoostStart(block.timestamp); emit BoostActivation(address(token)); } function claimSpecialGuest(uint256 collectionIndex) external payable { uint256 userData = _claimReward(); uint256 specialGuestIndexOld = userData.specialGuestIndex(); if (collectionIndex == specialGuestIndexOld) revert SpecialGuestIndexMustDiffer(); if (collectionIndex != 0 && !hasSpecialGuest(msg.sender, collectionIndex)) revert NotSpecialGuestOwner(); _userData[msg.sender] = userData.setSpecialGuestIndex(collectionIndex); } function clearSpecialGuestData() external payable { _userData[msg.sender] = _userData[msg.sender].setSpecialGuestIndex(0); } /* ------------- Internal ------------- */ function tokenBonus(uint256 userData) private view returns (uint256) { unchecked { uint256 lastClaimed = userData.lastClaimed(); uint256 boostEnd = userData.boostStart() + TOKEN_BOOST_DURATION; if (lastClaimed > boostEnd) return 0; if (block.timestamp <= boostEnd) return TOKEN_BONUS; // follows: lastClaimed <= boostEnd < block.timestamp // user is half-way through running out of boost, calculate exact fraction, // as if claim was initiated once at end of boost and once now // bonus * (time delta spent with boost bonus) / (complete duration) return (TOKEN_BONUS * (boostEnd - lastClaimed)) / (block.timestamp - lastClaimed); } } function roleBonus(uint256 userData) private pure returns (uint256) { uint256 numRoles = userData.uniqueRoleCount(); return numRoles < 3 ? 0 : numRoles < 5 ? ROLE_BONUS_3 : ROLE_BONUS_5; } function rarityBonus(uint256 userData) private pure returns (uint256) { unchecked { uint256 numStaked = userData.numStaked(); return numStaked == 0 ? 0 : (userData.rarityPoints() * RARITY_BONUS) / numStaked; } } function OGBonus(uint256 userData) private view returns (uint256) { unchecked { uint256 count = userData.OGCount(); uint256 lastClaimed = userData.lastClaimed(); if (count == 0 || lastClaimed > OG_BONUS_END) return 0; // follows: 0 < count <= numStaked uint256 bonus = (count * OG_BONUS) / userData.numStaked(); if (block.timestamp <= OG_BONUS_END) return bonus; // follows: lastClaimed <= OG_BONUS_END < block.timestamp return (bonus * (OG_BONUS_END - lastClaimed)) / (block.timestamp - lastClaimed); } } function timeBonus(uint256 userData) private view returns (uint256) { unchecked { uint256 stakeStart = userData.stakeStart(); uint256 stakeBonusStart = stakeStart + TIME_BONUS_STAKE_DURATION; if (block.timestamp < stakeBonusStart) return 0; uint256 lastClaimed = userData.lastClaimed(); if (lastClaimed >= stakeBonusStart) return TIME_BONUS; // follows: lastClaimed < stakeBonusStart <= block.timestamp return (TIME_BONUS * (block.timestamp - stakeBonusStart)) / (block.timestamp - lastClaimed); } } function hasSpecialGuest(address user, uint256 index) public view returns (bool) { if (index == 0) return false; // first 18 addresses are hardcoded to save gas if (index < 19) { address[19] memory guests = [ 0x0000000000000000000000000000000000000000, // 0: reserved 0x4BB33f6E69fd62cf3abbcC6F1F43b94A5D572C2B, // 1: Bears Deluxe 0xbEA8123277142dE42571f1fAc045225a1D347977, // 2: DystoPunks 0x12d2D1beD91c24f878F37E66bd829Ce7197e4d14, // 3: Galactic Apes 0x0c2E57EFddbA8c768147D1fdF9176a0A6EBd5d83, // 4: Kaiju Kingz 0x6E5a65B5f9Dd7b1b08Ff212E210DCd642DE0db8B, // 5: Octohedz 0x17eD38f5F519C6ED563BE6486e629041Bed3dfbC, // 6: PXQuest Adventurer 0xdd67892E722bE69909d7c285dB572852d5F8897C, // 7: Scholarz 0x8a90CAb2b38dba80c64b7734e58Ee1dB38B8992e, // 8: Doodles 0x6F44Db5ed6b86d9cC6046D0C78B82caD9E600F6a, // 9: Digi Dragonz 0x219B8aB790dECC32444a6600971c7C3718252539, // 10: Sneaky Vampire Syndicate 0xC4a0b1E7AA137ADA8b2F911A501638088DFdD508, // 11: Uninterested Unicorns 0x9712228cEeDA1E2dDdE52Cd5100B88986d1Cb49c, // 12: Wulfz 0x56b391339615fd0e88E0D370f451fA91478Bb20F, // 13: Ethalien 0x648E8428e0104Ec7D08667866a3568a72Fe3898F, // 14: Dysto Apez 0xd2F668a8461D6761115dAF8Aeb3cDf5F40C532C6, // 15: Karafuru 0xbad6186E92002E312078b5a1dAfd5ddf63d3f731, // 16: Anonymice 0xcB4307F1c3B5556256748DDF5B86E81258990B3C, // 17: The Other Side 0x5c211B8E4f93F00E2BD68e82F4E00FbB3302b35c // 18: Global Citizen Club ]; if (IERC721(guests[index]).balanceOf(user) != 0) return true; if (index == 10) return ISVSGraveyard(guests[index]).getBuriedCount(user) != 0; else if (index == 12) return AWOO(guests[index]).getStakedAmount(user) != 0; else if (index == 16) return CheethV2(guests[index]).stakedMiceQuantity(user) != 0; } else { IERC721 collection = specialGuests[index]; if (address(collection) != address(0)) { if (collection.balanceOf(user) != 0) return true; bytes4 selector = specialGuestsNumStakedSelector[collection]; if (selector != bytes4(0)) { (bool success, bytes memory data) = address(collection).staticcall( abi.encodeWithSelector(selector, user) ); return success && abi.decode(data, (uint256)) != 0; } } } return false; } function specialGuestBonus(address user, uint256 userData) private view returns (uint256) { uint256 index = userData.specialGuestIndex(); if (!hasSpecialGuest(user, index)) return 0; return SPECIAL_GUEST_BONUS; } function _pendingReward(address user, uint256 userData) internal view override returns (uint256) { uint256 lastClaimed = userData.lastClaimed(); if (lastClaimed == 0) return 0; uint256 timestamp = min(LAST_GOUDA_EMISSION_DATE, block.timestamp); unchecked { uint256 delta = timestamp < lastClaimed ? 0 : timestamp - lastClaimed; uint256 reward = (userData.baseReward() * delta * dailyReward) / (1 days); if (reward == 0) return 0; uint256 bonus = totalBonus(user, userData); // needs to be calculated per myriad for more accuracy return (reward * (10000 + bonus)) / 10000; } } function totalBonus(address user, uint256 userData) internal view returns (uint256) { unchecked { return roleBonus(userData) + specialGuestBonus(user, userData) + rarityBonus(userData) + OGBonus(userData) + timeBonus(userData) + tokenBonus(userData); } } function _payoutReward(address user, uint256 reward) internal override { if (reward != 0) gouda.mint(user, reward); } /* ------------- View ------------- */ // for convenience struct StakeInfo { uint256 numStaked; uint256 roleCount; uint256 roleBonus; uint256 specialGuestBonus; uint256 tokenBoost; uint256 stakeStart; uint256 timeBonus; uint256 rarityPoints; uint256 rarityBonus; uint256 OGCount; uint256 OGBonus; uint256 totalBonus; uint256 multiplierBase; uint256 dailyRewardBase; uint256 dailyReward; uint256 pendingReward; int256 tokenBoostDelta; uint256[3] levelBalances; } // calculates momentary totalBonus for display instead of effective bonus function getUserStakeInfo(address user) external view returns (StakeInfo memory info) { unchecked { uint256 userData = _userData[user]; info.numStaked = userData.numStaked(); info.roleCount = userData.uniqueRoleCount(); info.roleBonus = roleBonus(userData) / 100; info.specialGuestBonus = specialGuestBonus(user, userData) / 100; info.tokenBoost = (block.timestamp < userData.boostStart() + TOKEN_BOOST_DURATION) ? TOKEN_BONUS / 100 : 0; info.stakeStart = userData.stakeStart(); info.timeBonus = (info.stakeStart > 0 && block.timestamp > userData.stakeStart() + TIME_BONUS_STAKE_DURATION) ? TIME_BONUS / 100 : 0; info.OGCount = userData.OGCount(); info.OGBonus = (block.timestamp > OG_BONUS_END || userData.numStaked() == 0) ? 0 : (userData.OGCount() * OG_BONUS) / userData.numStaked() / 100; info.rarityPoints = userData.rarityPoints(); info.rarityBonus = rarityBonus(userData) / 100; info.totalBonus = info.roleBonus + info.specialGuestBonus + info.tokenBoost + info.timeBonus + info.rarityBonus + info.OGBonus; info.multiplierBase = userData.baseReward(); info.dailyRewardBase = info.multiplierBase * dailyReward; info.dailyReward = (info.dailyRewardBase * (100 + info.totalBonus)) / 100; info.pendingReward = _pendingReward(user, userData); info.tokenBoostDelta = int256(TOKEN_BOOST_DURATION) - int256(block.timestamp - userData.boostStart()); info.levelBalances = userData.levelBalances(); } } /* ------------- Owner ------------- */ function setGoudaToken(Gouda gouda_) external payable onlyOwner { gouda = gouda_; } function setSpecialGuests(IERC721[] calldata collections, uint256[] calldata indices) external payable onlyOwner { for (uint256 i; i < indices.length; ++i) { uint256 index = indices[i]; require(index != 0); specialGuests[index] = collections[i]; } } function setSpecialGuestStakingSelector(IERC721 collection, bytes4 selector) external payable onlyOwner { specialGuestsNumStakedSelector[collection] = selector; } function setBoostTokens(IERC20[] calldata _boostTokens, uint256[] calldata _boostCosts) external payable onlyOwner { for (uint256 i; i < _boostTokens.length; ++i) tokenBoostCosts[_boostTokens[i]] = _boostCosts[i]; } } // Special guest's staking interfaces interface ISVSGraveyard { function getBuriedCount(address burier) external view returns (uint256); } interface AWOO { function getStakedAmount(address staker) external view returns (uint256); } interface CheethV2 { function stakedMiceQuantity(address _address) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./interfaces/LinkTokenInterface.sol"; import "./VRFRequestIDBase.sol"; /** **************************************************************************** * @notice Interface for contracts using VRF randomness * ***************************************************************************** * @dev PURPOSE * * @dev Reggie the Random Oracle (not his real job) wants to provide randomness * @dev to Vera the verifier in such a way that Vera can be sure he's not * @dev making his output up to suit himself. Reggie provides Vera a public key * @dev to which he knows the secret key. Each time Vera provides a seed to * @dev Reggie, he gives back a value which is computed completely * @dev deterministically from the seed and the secret key. * * @dev Reggie provides a proof by which Vera can verify that the output was * @dev correctly computed once Reggie tells it to her, but without that proof, * @dev the output is indistinguishable to her from a uniform random sample * @dev from the output space. * * @dev The purpose of this contract is to make it easy for unrelated contracts * @dev to talk to Vera the verifier about the work Reggie is doing, to provide * @dev simple access to a verifiable source of randomness. * ***************************************************************************** * @dev USAGE * * @dev Calling contracts must inherit from VRFConsumerBase, and can * @dev initialize VRFConsumerBase's attributes in their constructor as * @dev shown: * * @dev contract VRFConsumer { * @dev constuctor(<other arguments>, address _vrfCoordinator, address _link) * @dev VRFConsumerBase(_vrfCoordinator, _link) public { * @dev <initialization with other arguments goes here> * @dev } * @dev } * * @dev The oracle will have given you an ID for the VRF keypair they have * @dev committed to (let's call it keyHash), and have told you the minimum LINK * @dev price for VRF service. Make sure your contract has sufficient LINK, and * @dev call requestRandomness(keyHash, fee, seed), where seed is the input you * @dev want to generate randomness from. * * @dev Once the VRFCoordinator has received and validated the oracle's response * @dev to your request, it will call your contract's fulfillRandomness method. * * @dev The randomness argument to fulfillRandomness is the actual random value * @dev generated from your seed. * * @dev The requestId argument is generated from the keyHash and the seed by * @dev makeRequestId(keyHash, seed). If your contract could have concurrent * @dev requests open, you can use the requestId to track which seed is * @dev associated with which randomness. See VRFRequestIDBase.sol for more * @dev details. (See "SECURITY CONSIDERATIONS" for principles to keep in mind, * @dev if your contract could have multiple requests in flight simultaneously.) * * @dev Colliding `requestId`s are cryptographically impossible as long as seeds * @dev differ. (Which is critical to making unpredictable randomness! See the * @dev next section.) * * ***************************************************************************** * @dev SECURITY CONSIDERATIONS * * @dev A method with the ability to call your fulfillRandomness method directly * @dev could spoof a VRF response with any random value, so it's critical that * @dev it cannot be directly called by anything other than this base contract * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method). * * @dev For your users to trust that your contract's random behavior is free * @dev from malicious interference, it's best if you can write it so that all * @dev behaviors implied by a VRF response are executed *during* your * @dev fulfillRandomness method. If your contract must store the response (or * @dev anything derived from it) and use it later, you must ensure that any * @dev user-significant behavior which depends on that stored value cannot be * @dev manipulated by a subsequent VRF request. * * @dev Similarly, both miners and the VRF oracle itself have some influence * @dev over the order in which VRF responses appear on the blockchain, so if * @dev your contract could have multiple VRF requests in flight simultaneously, * @dev you must ensure that the order in which the VRF responses arrive cannot * @dev be used to manipulate your contract's user-significant behavior. * * @dev Since the ultimate input to the VRF is mixed with the block hash of the * @dev block in which the request is made, user-provided seeds have no impact * @dev on its economic security properties. They are only included for API * @dev compatability with previous versions of this contract. * * @dev Since the block hash of the block which contains the requestRandomness * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful * @dev miner could, in principle, fork the blockchain to evict the block * @dev containing the request, forcing the request to be included in a * @dev different block with a different hash, and therefore a different input * @dev to the VRF. However, such an attack would incur a substantial economic * @dev cost. This cost scales with the number of blocks the VRF oracle waits * @dev until it calls responds to a request. */ abstract contract VRFConsumerBase is VRFRequestIDBase { /** * @notice fulfillRandomness handles the VRF response. Your contract must * @notice implement it. See "SECURITY CONSIDERATIONS" above for important * @notice principles to keep in mind when implementing your fulfillRandomness * @notice method. * * @dev VRFConsumerBase expects its subcontracts to have a method with this * @dev signature, and will call it once it has verified the proof * @dev associated with the randomness. (It is triggered via a call to * @dev rawFulfillRandomness, below.) * * @param requestId The Id initially returned by requestRandomness * @param randomness the VRF output */ function fulfillRandomness(bytes32 requestId, uint256 randomness) internal virtual; /** * @dev In order to keep backwards compatibility we have kept the user * seed field around. We remove the use of it because given that the blockhash * enters later, it overrides whatever randomness the used seed provides. * Given that it adds no security, and can easily lead to misunderstandings, * we have removed it from usage and can now provide a simpler API. */ uint256 private constant USER_SEED_PLACEHOLDER = 0; /** * @notice requestRandomness initiates a request for VRF output given _seed * * @dev The fulfillRandomness method receives the output, once it's provided * @dev by the Oracle, and verified by the vrfCoordinator. * * @dev The _keyHash must already be registered with the VRFCoordinator, and * @dev the _fee must exceed the fee specified during registration of the * @dev _keyHash. * * @dev The _seed parameter is vestigial, and is kept only for API * @dev compatibility with older versions. It can't *hurt* to mix in some of * @dev your own randomness, here, but it's not necessary because the VRF * @dev oracle will mix the hash of the block containing your request into the * @dev VRF seed it ultimately uses. * * @param _keyHash ID of public key against which randomness is generated * @param _fee The amount of LINK to send with the request * * @return requestId unique ID for this request * * @dev The returned requestId can be used to distinguish responses to * @dev concurrent requests. It is passed as the first argument to * @dev fulfillRandomness. */ function requestRandomness(bytes32 _keyHash, uint256 _fee) internal returns (bytes32 requestId) { LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, USER_SEED_PLACEHOLDER)); // This is the seed passed to VRFCoordinator. The oracle will mix this with // the hash of the block containing this request to obtain the seed/input // which is finally passed to the VRF cryptographic machinery. uint256 vRFSeed = makeVRFInputSeed(_keyHash, USER_SEED_PLACEHOLDER, address(this), nonces[_keyHash]); // nonces[_keyHash] must stay in sync with // VRFCoordinator.nonces[_keyHash][this], which was incremented by the above // successful LINK.transferAndCall (in VRFCoordinator.randomnessRequest). // This provides protection against the user repeating their input seed, // which would result in a predictable/duplicate output, if multiple such // requests appeared in the same block. nonces[_keyHash] = nonces[_keyHash] + 1; return makeRequestId(_keyHash, vRFSeed); } LinkTokenInterface internal immutable LINK; address private immutable vrfCoordinator; // Nonces for each VRF key from which randomness has been requested. // // Must stay in sync with VRFCoordinator[_keyHash][this] mapping(bytes32 => uint256) /* keyHash */ /* nonce */ private nonces; /** * @param _vrfCoordinator address of VRFCoordinator contract * @param _link address of LINK token contract * * @dev https://docs.chain.link/docs/link-token-contracts */ constructor(address _vrfCoordinator, address _link) { vrfCoordinator = _vrfCoordinator; LINK = LinkTokenInterface(_link); } // rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF // proof. rawFulfillRandomness then calls fulfillRandomness, after validating // the origin of the call function rawFulfillRandomness(bytes32 requestId, uint256 randomness) external { require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill"); fulfillRandomness(requestId, randomness); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface LinkTokenInterface { function allowance(address owner, address spender) external view returns (uint256 remaining); function approve(address spender, uint256 value) external returns (bool success); function balanceOf(address owner) external view returns (uint256 balance); function decimals() external view returns (uint8 decimalPlaces); function decreaseApproval(address spender, uint256 addedValue) external returns (bool success); function increaseApproval(address spender, uint256 subtractedValue) external; function name() external view returns (string memory tokenName); function symbol() external view returns (string memory tokenSymbol); function totalSupply() external view returns (uint256 totalTokensIssued); function transfer(address to, uint256 value) external returns (bool success); function transferAndCall( address to, uint256 value, bytes calldata data ) external returns (bool success); function transferFrom( address from, address to, uint256 value ) external returns (bool success); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract VRFRequestIDBase { /** * @notice returns the seed which is actually input to the VRF coordinator * * @dev To prevent repetition of VRF output due to repetition of the * @dev user-supplied seed, that seed is combined in a hash with the * @dev user-specific nonce, and the address of the consuming contract. The * @dev risk of repetition is mostly mitigated by inclusion of a blockhash in * @dev the final seed, but the nonce does protect against repetition in * @dev requests which are included in a single block. * * @param _userSeed VRF seed input provided by user * @param _requester Address of the requesting contract * @param _nonce User-specific nonce at the time of the request */ function makeVRFInputSeed( bytes32 _keyHash, uint256 _userSeed, address _requester, uint256 _nonce ) internal pure returns (uint256) { return uint256(keccak256(abi.encode(_keyHash, _userSeed, _requester, _nonce))); } /** * @notice Returns the id for this request * @param _keyHash The serviceAgreement ID to be used for this request * @param _vRFInputSeed The seed to be passed directly to the VRF * @return The id for this request * * @dev Note that _vRFInputSeed is not the seed passed by the consuming * @dev contract, but the one generated by makeVRFInputSeed */ function makeRequestId(bytes32 _keyHash, uint256 _vRFInputSeed) internal pure returns (bytes32) { return keccak256(abi.encodePacked(_keyHash, _vRFInputSeed)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role, _msgSender()); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, _allowances[owner][spender] + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = _allowances[owner][spender]; require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Spend `amount` form the allowance of `owner` toward `spender`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// 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 v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/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 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol'; import '@openzeppelin/contracts/utils/Address.sol'; import '@openzeppelin/contracts/utils/Strings.sol'; import './ERC721MLibrary.sol'; error IncorrectOwner(); error NonexistentToken(); error QueryForZeroAddress(); error TokenIdUnstaked(); error ExceedsStakingLimit(); error MintToZeroAddress(); error MintZeroQuantity(); error MintMaxSupplyReached(); error MintMaxWalletReached(); error CallerNotOwnerNorApproved(); error ApprovalToCaller(); error ApproveToCurrentOwner(); error TransferFromIncorrectOwner(); error TransferToNonERC721ReceiverImplementer(); error TransferToZeroAddress(); abstract contract ERC721M { using Address for address; using Strings for uint256; using UserDataOps for uint256; using TokenDataOps for uint256; event Transfer(address indexed from, address indexed to, uint256 indexed id); event Approval(address indexed owner, address indexed spender, uint256 indexed id); event ApprovalForAll(address indexed owner, address indexed operator, bool approved); string public name; string public symbol; mapping(uint256 => address) public getApproved; mapping(address => mapping(address => bool)) public isApprovedForAll; uint256 public totalSupply; uint256 immutable startingIndex; uint256 immutable collectionSize; uint256 immutable maxPerWallet; // note: hard limit of 255, otherwise overflows can happen uint256 constant stakingLimit = 100; mapping(uint256 => uint256) internal _tokenData; mapping(address => uint256) internal _userData; constructor( string memory name_, string memory symbol_, uint256 startingIndex_, uint256 collectionSize_, uint256 maxPerWallet_ ) { name = name_; symbol = symbol_; collectionSize = collectionSize_; maxPerWallet = maxPerWallet_; startingIndex = startingIndex_; } /* ------------- External ------------- */ function stake(uint256[] calldata tokenIds) external payable { uint256 userData = _claimReward(); for (uint256 i; i < tokenIds.length; ++i) userData = _stake(msg.sender, tokenIds[i], userData); _userData[msg.sender] = userData; } function unstake(uint256[] calldata tokenIds) external payable { uint256 userData = _claimReward(); for (uint256 i; i < tokenIds.length; ++i) userData = _unstake(msg.sender, tokenIds[i], userData); _userData[msg.sender] = userData; } function claimReward() external payable { _userData[msg.sender] = _claimReward(); } /* ------------- Private ------------- */ function _stake( address from, uint256 tokenId, uint256 userData ) private returns (uint256) { uint256 _numStaked = userData.numStaked(); uint256 tokenData = _tokenDataOf(tokenId); address owner = tokenData.owner(); if (_numStaked >= stakingLimit) revert ExceedsStakingLimit(); if (owner != from) revert IncorrectOwner(); delete getApproved[tokenId]; // hook, used for reading DNA, updating role balances, (uint256 userDataX, uint256 tokenDataX) = _beforeStakeDataTransform(tokenId, userData, tokenData); (userData, tokenData) = applySafeDataTransform(userData, tokenData, userDataX, tokenDataX); tokenData = tokenData.setstaked(); userData = userData.decreaseBalance(1).increaseNumStaked(1); if (_numStaked == 0) userData = userData.setStakeStart(block.timestamp); _tokenData[tokenId] = tokenData; emit Transfer(from, address(this), tokenId); return userData; } function _unstake( address to, uint256 tokenId, uint256 userData ) private returns (uint256) { uint256 tokenData = _tokenDataOf(tokenId); address owner = tokenData.trueOwner(); bool isStaked = tokenData.staked(); if (owner != to) revert IncorrectOwner(); if (!isStaked) revert TokenIdUnstaked(); (uint256 userDataX, uint256 tokenDataX) = _beforeUnstakeDataTransform(tokenId, userData, tokenData); (userData, tokenData) = applySafeDataTransform(userData, tokenData, userDataX, tokenDataX); // if mintAndStake flag is set, we need to make sure that next tokenData is set // because tokenData in this case is implicit and needs to carry over if (tokenData.mintAndStake()) { unchecked { tokenData = _ensureTokenDataSet(tokenId + 1, tokenData).unsetMintAndStake(); } } tokenData = tokenData.unsetstaked(); userData = userData.increaseBalance(1).decreaseNumStaked(1).setStakeStart(block.timestamp); _tokenData[tokenId] = tokenData; emit Transfer(address(this), to, tokenId); return userData; } /* ------------- Internal ------------- */ function _mintAndStake( address to, uint256 quantity, bool stake_ ) internal { unchecked { uint256 totalSupply_ = totalSupply; uint256 startTokenId = startingIndex + totalSupply_; uint256 userData = _userData[to]; uint256 numMinted_ = userData.numMinted(); if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); if (totalSupply_ + quantity > collectionSize) revert MintMaxSupplyReached(); if (numMinted_ + quantity > maxPerWallet && address(this).code.length != 0) revert MintMaxWalletReached(); // don't update for airdrops if (to == msg.sender) userData = userData.increaseNumMinted(quantity); uint256 tokenData = TokenDataOps.newTokenData(to, block.timestamp, stake_); // don't have to care about next token data if only minting one // could optimize to implicitly flag last token id of batch if (quantity == 1) tokenData = tokenData.flagNextTokenDataSet(); if (stake_) { uint256 _numStaked = userData.numStaked(); userData = claimReward(userData); userData = userData.increaseNumStaked(quantity); if (_numStaked + quantity > stakingLimit) revert ExceedsStakingLimit(); if (_numStaked == 0) userData = userData.setStakeStart(block.timestamp); uint256 tokenId; for (uint256 i; i < quantity; ++i) { tokenId = startTokenId + i; (userData, tokenData) = _beforeStakeDataTransform(tokenId, userData, tokenData); emit Transfer(address(0), to, tokenId); emit Transfer(to, address(this), tokenId); } } else { userData = userData.increaseBalance(quantity); for (uint256 i; i < quantity; ++i) emit Transfer(address(0), to, startTokenId + i); } _userData[to] = userData; _tokenData[startTokenId] = tokenData; totalSupply += quantity; } } function _claimReward() internal returns (uint256) { uint256 userData = _userData[msg.sender]; return claimReward(userData); } function claimReward(uint256 userData) private returns (uint256) { uint256 reward = _pendingReward(msg.sender, userData); userData = userData.setLastClaimed(block.timestamp); _payoutReward(msg.sender, reward); return userData; } function _tokenDataOf(uint256 tokenId) public view returns (uint256) { if (!_exists(tokenId)) revert NonexistentToken(); for (uint256 curr = tokenId; ; curr--) { uint256 tokenData = _tokenData[curr]; if (tokenData != 0) return (curr == tokenId) ? tokenData : tokenData.copy(); } // unreachable return 0; } function _exists(uint256 tokenId) internal view returns (bool) { return startingIndex <= tokenId && tokenId < startingIndex + totalSupply; } function transferFrom( address from, address to, uint256 tokenId ) public { // make sure no one is misled by token transfer events if (to == address(this)) { uint256 userData = _claimReward(); _userData[msg.sender] = _stake(msg.sender, tokenId, userData); } else { uint256 tokenData = _tokenDataOf(tokenId); address owner = tokenData.owner(); bool isApprovedOrOwner = (msg.sender == owner || isApprovedForAll[owner][msg.sender] || getApproved[tokenId] == msg.sender); if (!isApprovedOrOwner) revert CallerNotOwnerNorApproved(); if (to == address(0)) revert TransferToZeroAddress(); if (owner != from) revert TransferFromIncorrectOwner(); delete getApproved[tokenId]; unchecked { _tokenData[tokenId] = _ensureTokenDataSet(tokenId + 1, tokenData) .setOwner(to) .setLastTransfer(block.timestamp) .incrementOwnerCount(); } _userData[from] = _userData[from].decreaseBalance(1); _userData[to] = _userData[to].increaseBalance(1); emit Transfer(from, to, tokenId); } } function _ensureTokenDataSet(uint256 tokenId, uint256 tokenData) private returns (uint256) { if (!tokenData.nextTokenDataSet() && _tokenData[tokenId] == 0 && _exists(tokenId)) _tokenData[tokenId] = tokenData.copy(); // make sure to not pass any token specific data in return tokenData.flagNextTokenDataSet(); } /* ------------- Virtual (hooks) ------------- */ function _beforeStakeDataTransform( uint256, // tokenId uint256 userData, uint256 tokenData ) internal view virtual returns (uint256, uint256) { return (userData, tokenData); } function _beforeUnstakeDataTransform( uint256, // tokenId uint256 userData, uint256 tokenData ) internal view virtual returns (uint256, uint256) { return (userData, tokenData); } function _pendingReward(address, uint256 userData) internal view virtual returns (uint256); function _payoutReward(address user, uint256 reward) internal virtual; /* ------------- View ------------- */ function ownerOf(uint256 tokenId) external view returns (address) { return _tokenDataOf(tokenId).owner(); } function trueOwnerOf(uint256 tokenId) external view returns (address) { return _tokenDataOf(tokenId).trueOwner(); } function balanceOf(address owner) external view returns (uint256) { if (owner == address(0)) revert QueryForZeroAddress(); return _userData[owner].balance(); } function numStaked(address user) external view returns (uint256) { return _userData[user].numStaked(); } function numOwned(address user) external view returns (uint256) { uint256 userData = _userData[user]; return userData.balance() + userData.numStaked(); } function numMinted(address user) external view returns (uint256) { return _userData[user].numMinted(); } function pendingReward(address user) external view returns (uint256) { return _pendingReward(user, _userData[user]); } // O(N) read-only functions function tokenIdsOf(address user, uint256 type_) external view returns (uint256[] memory) { unchecked { uint256 numTotal = type_ == 0 ? this.balanceOf(user) : type_ == 1 ? this.numStaked(user) : this.numOwned(user); uint256[] memory ids = new uint256[](numTotal); if (numTotal == 0) return ids; uint256 count; for (uint256 i = startingIndex; i < totalSupply + startingIndex; ++i) { uint256 tokenData = _tokenDataOf(i); if (user == tokenData.trueOwner()) { bool staked = tokenData.staked(); if ((type_ == 0 && !staked) || (type_ == 1 && staked) || type_ == 2) { ids[count++] = i; if (numTotal == count) return ids; } } } return ids; } } function totalNumStaked() external view returns (uint256) { unchecked { uint256 count; for (uint256 i = startingIndex; i < startingIndex + totalSupply; ++i) { if (_tokenDataOf(i).staked()) ++count; } return count; } } /* ------------- ERC721 ------------- */ function tokenURI(uint256 id) public view virtual returns (string memory); function supportsInterface(bytes4 interfaceId) external view virtual returns (bool) { return interfaceId == 0x01ffc9a7 || // ERC165 Interface ID for ERC165 interfaceId == 0x80ac58cd || // ERC165 Interface ID for ERC721 interfaceId == 0x5b5e139f; // ERC165 Interface ID for ERC721Metadata } function approve(address spender, uint256 tokenId) external { address owner = _tokenDataOf(tokenId).owner(); if (msg.sender != owner && !isApprovedForAll[owner][msg.sender]) revert CallerNotOwnerNorApproved(); getApproved[tokenId] = spender; emit Approval(owner, spender, tokenId); } function setApprovalForAll(address operator, bool approved) external { isApprovedForAll[msg.sender][operator] = approved; emit ApprovalForAll(msg.sender, operator, approved); } function safeTransferFrom( address from, address to, uint256 tokenId ) external { safeTransferFrom(from, to, tokenId, ''); } function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public { transferFrom(from, to, tokenId); if ( to.code.length != 0 && IERC721Receiver(to).onERC721Received(msg.sender, from, tokenId, data) != IERC721Receiver(to).onERC721Received.selector ) revert TransferToNonERC721ReceiverImplementer(); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // # ERC721M.sol // // _tokenData layout: // 0x________/cccccbbbbbbbbbbaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa // a [ 0] (uint160): address #owner (owner of token id) // b [160] (uint40): timestamp #lastTransfer (timestamp since the last transfer) // c [200] (uint20): #ownerCount (number of total owners of token) // f [220] (uint1): #staked flag (flag whether id has been staked) Note: this carries over when calling 'ownerOf' // f [221] (uint1): #mintAndStake flag (flag whether to carry over stake flag when calling tokenDataOf; used for mintAndStake and boost) // e [222] (uint1): #nextTokenDataSet flag (flag whether the data of next token id has already been set) // _ [224] (uint32): arbitrary data uint256 constant RESTRICTED_TOKEN_DATA = 0x00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; // # MadMouse.sol // // _tokenData (metadata) layout: // 0xefg00000________________________________________________________ // e [252] (uint4): #level (mouse level) [0...2] (must be 0-based) // f [248] (uint4): #role (mouse role) [1...5] (must start at 1) // g [244] (uint4): #rarity (mouse rarity) [0...3] struct TokenData { address owner; uint256 lastTransfer; uint256 ownerCount; bool staked; bool mintAndStake; bool nextTokenDataSet; uint256 level; uint256 role; uint256 rarity; } // # ERC721M.sol // // _userData layout: // 0x________________________________ddccccccccccbbbbbbbbbbaaaaaaaaaa // a [ 0] (uint32): #balance (owner ERC721 balance) // b [ 40] (uint40): timestamp #stakeStart (timestamp when stake started) // c [ 80] (uint40): timestamp #lastClaimed (timestamp when user last claimed rewards) // d [120] (uint8): #numStaked (balance count of all staked tokens) // _ [128] (uint128): arbitrary data uint256 constant RESTRICTED_USER_DATA = 0x00000000000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; // # MadMouseStaking.sol // // _userData (boost) layout: // 0xttttttttt/o/rriiffgghhaabbccddee________________________________ // a-e [128] (5x uint8): #roleBalances (balance of all staked roles) // f-h [168] (3x uint8): #levelBalances (balance of all staked levels) // i [192] (uint8): #specialGuestIndex (signals whether the user claims to hold a token of a certain collection) // r [200] (uint10): #rarityPoints (counter of rare traits; 1 is rare, 2 is super-rare, 3 is ultra-rare) // o [210] (uint8): #OGCount (counter of rare traits; 1 is rare, 2 is super-rare, 3 is ultra-rare) // t [218] (uint38): timestamp #boostStart (timestamp of when the boost by burning tokens of affiliate collections started) struct UserData { uint256 balance; uint256 stakeStart; uint256 lastClaimed; uint256 numStaked; uint256[5] roleBalances; uint256 uniqueRoleCount; // inferred uint256[3] levelBalances; uint256 specialGuestIndex; uint256 rarityPoints; uint256 OGCount; uint256 boostStart; } function applySafeDataTransform( uint256 userData, uint256 tokenData, uint256 userDataTransformed, uint256 tokenDataTransformed ) pure returns (uint256, uint256) { // mask transformed data in order to leave base data untouched in any case userData = (userData & RESTRICTED_USER_DATA) | (userDataTransformed & ~RESTRICTED_USER_DATA); tokenData = (tokenData & RESTRICTED_TOKEN_DATA) | (tokenDataTransformed & ~RESTRICTED_TOKEN_DATA); return (userData, tokenData); } // @note: many of these are unchecked, because safemath wouldn't be able to guard // overflows while updating bitmaps unless custom checks were to be implemented library UserDataOps { function getUserData(uint256 userData) internal pure returns (UserData memory) { return UserData({ balance: UserDataOps.balance(userData), stakeStart: UserDataOps.stakeStart(userData), lastClaimed: UserDataOps.lastClaimed(userData), numStaked: UserDataOps.numStaked(userData), roleBalances: UserDataOps.roleBalances(userData), uniqueRoleCount: UserDataOps.uniqueRoleCount(userData), levelBalances: UserDataOps.levelBalances(userData), specialGuestIndex: UserDataOps.specialGuestIndex(userData), rarityPoints: UserDataOps.rarityPoints(userData), OGCount: UserDataOps.OGCount(userData), boostStart: UserDataOps.boostStart(userData) }); } function balance(uint256 userData) internal pure returns (uint256) { return userData & 0xFFFFF; } function increaseBalance(uint256 userData, uint256 amount) internal pure returns (uint256) { unchecked { return userData + amount; } } function decreaseBalance(uint256 userData, uint256 amount) internal pure returns (uint256) { unchecked { return userData - amount; } } function numMinted(uint256 userData) internal pure returns (uint256) { return (userData >> 20) & 0xFFFFF; } function increaseNumMinted(uint256 userData, uint256 amount) internal pure returns (uint256) { unchecked { return userData + (amount << 20); } } function stakeStart(uint256 userData) internal pure returns (uint256) { return (userData >> 40) & 0xFFFFFFFFFF; } function setStakeStart(uint256 userData, uint256 timestamp) internal pure returns (uint256) { return (userData & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000FFFFFFFFFF) | (timestamp << 40); } function lastClaimed(uint256 userData) internal pure returns (uint256) { return (userData >> 80) & 0xFFFFFFFFFF; } function setLastClaimed(uint256 userData, uint256 timestamp) internal pure returns (uint256) { return (userData & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF0000000000FFFFFFFFFFFFFFFFFFFF) | (timestamp << 80); } function numStaked(uint256 userData) internal pure returns (uint256) { return (userData >> 120) & 0xFF; } function increaseNumStaked(uint256 userData, uint256 amount) internal pure returns (uint256) { unchecked { return userData + (amount << 120); } } function decreaseNumStaked(uint256 userData, uint256 amount) internal pure returns (uint256) { unchecked { return userData - (amount << 120); } } function roleBalances(uint256 userData) internal pure returns (uint256[5] memory balances) { balances = [ (userData >> (128 + 0)) & 0xFF, (userData >> (128 + 8)) & 0xFF, (userData >> (128 + 16)) & 0xFF, (userData >> (128 + 24)) & 0xFF, (userData >> (128 + 32)) & 0xFF ]; } // trait counts are set through hook in madmouse contract (MadMouse::_beforeStakeDataTransform) function uniqueRoleCount(uint256 userData) internal pure returns (uint256) { unchecked { return (toUInt256((userData >> (128)) & 0xFF > 0) + toUInt256((userData >> (128 + 8)) & 0xFF > 0) + toUInt256((userData >> (128 + 16)) & 0xFF > 0) + toUInt256((userData >> (128 + 24)) & 0xFF > 0) + toUInt256((userData >> (128 + 32)) & 0xFF > 0)); } } function levelBalances(uint256 userData) internal pure returns (uint256[3] memory balances) { unchecked { balances = [ (userData >> (168 + 0)) & 0xFF, (userData >> (168 + 8)) & 0xFF, (userData >> (168 + 16)) & 0xFF ]; } } // depends on the levels of the staked tokens (also set in hook MadMouse::_beforeStakeDataTransform) // counts the base reward, depending on the levels of staked ids function baseReward(uint256 userData) internal pure returns (uint256) { unchecked { return (((userData >> (168)) & 0xFF) + (((userData >> (168 + 8)) & 0xFF) << 1) + (((userData >> (168 + 16)) & 0xFF) << 2)); } } function rarityPoints(uint256 userData) internal pure returns (uint256) { return (userData >> 200) & 0x3FF; } function specialGuestIndex(uint256 userData) internal pure returns (uint256) { return (userData >> 192) & 0xFF; } function setSpecialGuestIndex(uint256 userData, uint256 index) internal pure returns (uint256) { return (userData & ~uint256(0xFF << 192)) | (index << 192); } function boostStart(uint256 userData) internal pure returns (uint256) { return (userData >> 218) & 0xFFFFFFFFFF; } function setBoostStart(uint256 userData, uint256 timestamp) internal pure returns (uint256) { return (userData & ~(uint256(0xFFFFFFFFFF) << 218)) | (timestamp << 218); } function OGCount(uint256 userData) internal pure returns (uint256) { return (userData >> 210) & 0xFF; } // (should start at 128, 168; but role/level start at 1...) function updateUserDataStake(uint256 userData, uint256 tokenData) internal pure returns (uint256) { unchecked { uint256 role = TokenDataOps.role(tokenData); if (role > 0) { userData += uint256(1) << (120 + (role << 3)); // roleBalances userData += TokenDataOps.rarity(tokenData) << 200; // rarityPoints } if (TokenDataOps.mintAndStake(tokenData)) userData += uint256(1) << 210; // OGCount userData += uint256(1) << (160 + (TokenDataOps.level(tokenData) << 3)); // levelBalances return userData; } } function updateUserDataUnstake(uint256 userData, uint256 tokenData) internal pure returns (uint256) { unchecked { uint256 role = TokenDataOps.role(tokenData); if (role > 0) { userData -= uint256(1) << (120 + (role << 3)); // roleBalances userData -= TokenDataOps.rarity(tokenData) << 200; // rarityPoints } if (TokenDataOps.mintAndStake(tokenData)) userData -= uint256(1) << 210; // OG-count userData -= uint256(1) << (160 + (TokenDataOps.level(tokenData) << 3)); // levelBalances return userData; } } function increaseLevelBalances(uint256 userData, uint256 tokenData) internal pure returns (uint256) { unchecked { return userData + (uint256(1) << (160 + (TokenDataOps.level(tokenData) << 3))); } } function decreaseLevelBalances(uint256 userData, uint256 tokenData) internal pure returns (uint256) { unchecked { return userData - (uint256(1) << (160 + (TokenDataOps.level(tokenData) << 3))); } } } library TokenDataOps { function getTokenData(uint256 tokenData) internal view returns (TokenData memory) { return TokenData({ owner: TokenDataOps.owner(tokenData), lastTransfer: TokenDataOps.lastTransfer(tokenData), ownerCount: TokenDataOps.ownerCount(tokenData), staked: TokenDataOps.staked(tokenData), mintAndStake: TokenDataOps.mintAndStake(tokenData), nextTokenDataSet: TokenDataOps.nextTokenDataSet(tokenData), level: TokenDataOps.level(tokenData), role: TokenDataOps.role(tokenData), rarity: TokenDataOps.rarity(tokenData) }); } function newTokenData( address owner_, uint256 lastTransfer_, bool stake_ ) internal pure returns (uint256) { uint256 tokenData = (uint256(uint160(owner_)) | (lastTransfer_ << 160) | (uint256(1) << 200)); return stake_ ? setstaked(setMintAndStake(tokenData)) : tokenData; } function copy(uint256 tokenData) internal pure returns (uint256) { // tokenData minus the token specific flags (4/2bits), i.e. only owner, lastTransfer, ownerCount // stake flag (& mintAndStake flag) carries over if mintAndStake was called return tokenData & (RESTRICTED_TOKEN_DATA >> (mintAndStake(tokenData) ? 2 : 4)); } function owner(uint256 tokenData) internal view returns (address) { if (staked(tokenData)) return address(this); return trueOwner(tokenData); } function setOwner(uint256 tokenData, address owner_) internal pure returns (uint256) { return (tokenData & 0xFFFFFFFFFFFFFFFFFFFFFFFF0000000000000000000000000000000000000000) | uint160(owner_); } function staked(uint256 tokenData) internal pure returns (bool) { return ((tokenData >> 220) & uint256(1)) > 0; // Note: this can carry over when calling 'ownerOf' } function setstaked(uint256 tokenData) internal pure returns (uint256) { return tokenData | (uint256(1) << 220); } function unsetstaked(uint256 tokenData) internal pure returns (uint256) { return tokenData & ~(uint256(1) << 220); } function mintAndStake(uint256 tokenData) internal pure returns (bool) { return ((tokenData >> 221) & uint256(1)) > 0; } function setMintAndStake(uint256 tokenData) internal pure returns (uint256) { return tokenData | (uint256(1) << 221); } function unsetMintAndStake(uint256 tokenData) internal pure returns (uint256) { return tokenData & ~(uint256(1) << 221); } function nextTokenDataSet(uint256 tokenData) internal pure returns (bool) { return ((tokenData >> 222) & uint256(1)) > 0; } function flagNextTokenDataSet(uint256 tokenData) internal pure returns (uint256) { return tokenData | (uint256(1) << 222); // nextTokenDatatSet flag (don't repeat the read/write) } function trueOwner(uint256 tokenData) internal pure returns (address) { return address(uint160(tokenData)); } function ownerCount(uint256 tokenData) internal pure returns (uint256) { return (tokenData >> 200) & 0xFFFFF; } function incrementOwnerCount(uint256 tokenData) internal pure returns (uint256) { uint256 newOwnerCount = min(ownerCount(tokenData) + 1, 0xFFFFF); return (tokenData & ~(uint256(0xFFFFF) << 200)) | (newOwnerCount << 200); } function resetOwnerCount(uint256 tokenData) internal pure returns (uint256) { uint256 count = min(ownerCount(tokenData), 2); // keep minter status return (tokenData & ~(uint256(0xFFFFF) << 200)) | (count << 200); } function lastTransfer(uint256 tokenData) internal pure returns (uint256) { return (tokenData >> 160) & 0xFFFFFFFFFF; } function setLastTransfer(uint256 tokenData, uint256 timestamp) internal pure returns (uint256) { return (tokenData & 0xFFFFFFFFFFFFFF0000000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) | (timestamp << 160); } // MadMouse function level(uint256 tokenData) internal pure returns (uint256) { unchecked { return 1 + (tokenData >> 252); } } function increaseLevel(uint256 tokenData) internal pure returns (uint256) { unchecked { return tokenData + (uint256(1) << 252); } } function role(uint256 tokenData) internal pure returns (uint256) { return (tokenData >> 248) & 0xF; } function rarity(uint256 tokenData) internal pure returns (uint256) { return (tokenData >> 244) & 0xF; } // these slots should be are already 0 function setRoleAndRarity(uint256 tokenData, uint256 dna) internal pure returns (uint256) { return ((tokenData & ~(uint256(0xFF) << 244)) | (DNAOps.toRole(dna) << 248) | (DNAOps.toRarity(dna) << 244)); } } library DNAOps { function toRole(uint256 dna) internal pure returns (uint256) { unchecked { return 1 + ((dna & 0xFF) % 5); } } function toRarity(uint256 dna) internal pure returns (uint256) { uint256 dnaFur = (dna >> 8) & 0xFF; if (dnaFur > 108) return 0; if (dnaFur > 73) return 1; if (dnaFur > 17) return 2; return 3; } } /* ------------- Helpers ------------- */ // more efficient https://github.com/ethereum/solidity/issues/659 function toUInt256(bool x) pure returns (uint256 r) { assembly { r := x } } function min(uint256 a, uint256 b) pure returns (uint256) { return a < b ? a : b; } function isValidString(string calldata str, uint256 maxLen) pure returns (bool) { unchecked { bytes memory b = bytes(str); if (b.length < 1 || b.length > maxLen || b[0] == 0x20 || b[b.length - 1] == 0x20) return false; bytes1 lastChar = b[0]; bytes1 char; for (uint256 i; i < b.length; ++i) { char = b[i]; if ( (char > 0x60 && char < 0x7B) || //a-z (char > 0x40 && char < 0x5B) || //A-Z (char == 0x20) || //space (char > 0x2F && char < 0x3A) //9-0 ) { lastChar = char; } else { return false; } } return true; } }
{ "optimizer": { "enabled": true, "runs": 932 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"bytes32","name":"secretHash_","type":"bytes32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"BoostInEffect","type":"error"},{"inputs":[],"name":"CallerIsNotTheOwner","type":"error"},{"inputs":[],"name":"CallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"CollectionAlreadyRevealed","type":"error"},{"inputs":[],"name":"CollectionNotRevealed","type":"error"},{"inputs":[],"name":"ContractCallNotAllowed","type":"error"},{"inputs":[],"name":"ExceedsLimit","type":"error"},{"inputs":[],"name":"ExceedsStakingLimit","type":"error"},{"inputs":[],"name":"IncorrectHash","type":"error"},{"inputs":[],"name":"IncorrectOwner","type":"error"},{"inputs":[],"name":"IncorrectValue","type":"error"},{"inputs":[],"name":"InvalidBoostToken","type":"error"},{"inputs":[],"name":"InvalidSignature","type":"error"},{"inputs":[],"name":"InvalidString","type":"error"},{"inputs":[],"name":"MaxLevelReached","type":"error"},{"inputs":[],"name":"MaxNumberReached","type":"error"},{"inputs":[],"name":"MinHoldDurationRequired","type":"error"},{"inputs":[],"name":"MintAndStakeMinHoldDurationNotReached","type":"error"},{"inputs":[],"name":"MintMaxSupplyReached","type":"error"},{"inputs":[],"name":"MintMaxWalletReached","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NonexistentToken","type":"error"},{"inputs":[],"name":"NotSpecialGuestOwner","type":"error"},{"inputs":[],"name":"PublicSaleNotActive","type":"error"},{"inputs":[],"name":"QueryForZeroAddress","type":"error"},{"inputs":[],"name":"RandomSeedAlreadySet","type":"error"},{"inputs":[],"name":"RandomSeedNotSet","type":"error"},{"inputs":[],"name":"SpecialGuestIndexMustDiffer","type":"error"},{"inputs":[],"name":"TokenDataAlreadySet","type":"error"},{"inputs":[],"name":"TokenIdUnstaked","type":"error"},{"inputs":[],"name":"TransferFailed","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"WhitelistNotActive","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"BoostActivation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"_tokenDataOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"burnForBoost","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"claimReward","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"collectionIndex","type":"uint256"}],"name":"claimSpecialGuest","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"clearSpecialGuestData","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"forceFulfillRandomness","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getDNA","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getLevel","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getUserStakeInfo","outputs":[{"components":[{"internalType":"uint256","name":"numStaked","type":"uint256"},{"internalType":"uint256","name":"roleCount","type":"uint256"},{"internalType":"uint256","name":"roleBonus","type":"uint256"},{"internalType":"uint256","name":"specialGuestBonus","type":"uint256"},{"internalType":"uint256","name":"tokenBoost","type":"uint256"},{"internalType":"uint256","name":"stakeStart","type":"uint256"},{"internalType":"uint256","name":"timeBonus","type":"uint256"},{"internalType":"uint256","name":"rarityPoints","type":"uint256"},{"internalType":"uint256","name":"rarityBonus","type":"uint256"},{"internalType":"uint256","name":"OGCount","type":"uint256"},{"internalType":"uint256","name":"OGBonus","type":"uint256"},{"internalType":"uint256","name":"totalBonus","type":"uint256"},{"internalType":"uint256","name":"multiplierBase","type":"uint256"},{"internalType":"uint256","name":"dailyRewardBase","type":"uint256"},{"internalType":"uint256","name":"dailyReward","type":"uint256"},{"internalType":"uint256","name":"pendingReward","type":"uint256"},{"internalType":"int256","name":"tokenBoostDelta","type":"int256"},{"internalType":"uint256[3]","name":"levelBalances","type":"uint256[3]"}],"internalType":"struct MadMouseStaking.StakeInfo","name":"info","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"to","type":"address[]"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"giveAway","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"gouda","outputs":[{"internalType":"contract Gouda","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"hasSpecialGuest","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"imagesBaseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"levelUp","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"metadata","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bool","name":"stake","type":"bool"}],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"mouseBio","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"mouseName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"multiSigTreasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"numMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"numOwned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"numStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"pendingReward","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"level","type":"uint256"}],"name":"previewTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"price","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSaleActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"randomSeed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"randomSeedSet","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"requestId","type":"bytes32"},{"internalType":"uint256","name":"randomness","type":"uint256"}],"name":"rawFulfillRandomness","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"token","type":"address"}],"name":"recoverToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"requestRandomSeed","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"resetBio","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"resetName","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"_imagesBaseURI","type":"string"},{"internalType":"bytes32","name":"secretSeed_","type":"bytes32"}],"name":"reveal","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"bio","type":"string"}],"name":"setBio","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20[]","name":"_boostTokens","type":"address[]"},{"internalType":"uint256[]","name":"_boostCosts","type":"uint256[]"}],"name":"setBoostTokens","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"description_","type":"string"}],"name":"setDescription","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract Gouda","name":"gouda_","type":"address"}],"name":"setGoudaToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setImagesBaseURI","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"metadata_","type":"address"}],"name":"setMetadataAddress","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"name","type":"string"}],"name":"setName","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"duration","type":"uint256"}],"name":"setProfileUpdateMinHoldDuration","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bool","name":"active","type":"bool"}],"name":"setPublicSaleActive","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"address_","type":"address"}],"name":"setSignerAddress","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC721","name":"collection","type":"address"},{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"setSpecialGuestStakingSelector","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC721[]","name":"collections","type":"address[]"},{"internalType":"uint256[]","name":"indices","type":"uint256[]"}],"name":"setSpecialGuests","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"shouldUpdateStakedIds","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"stake","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"type_","type":"uint256"}],"name":"tokenIdsOf","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalLevel2Reached","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalLevel3Reached","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalNumStaked","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"trueOwnerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"unstake","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"updateStakedTokenData","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"},{"internalType":"bool","name":"stake","type":"bool"}],"name":"whitelistMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"payable","type":"function"}]
Contract Creation Code
6101c0604052600f80546001600160a01b031990811673fb79a928c5d6c5932ba83aa8c7145cbdcdb9fd2e1790915560108054909116733ade0c5e35cbf136245f4e4bbf4563bd151d39d117905562278d006013553480156200006157600080fd5b50604051620074e1380380620074e1833981016040819052620000849162001335565b7faa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af44560001b671bc16d674ec8000073f0d54349addcf704f77ae15b96510dea15cb795273514910771af9ca656af840dff83e8264ecf986ca611388603283836040518060400160405280600e81526020016d4d61644d6f75736543697263757360901b815250604051806040016040528060038152602001624d4d4360e81b815250600186868460009080519060200190620001419291906200128f565b508351620001579060019060208701906200128f565b5060a09190915260c05260805250506001600160a01b03918216610100521660e052600880546001600160a01b031916331790556200019a42624f1a006200134f565b61012052620001ae4263096601806200134f565b610140525050506101609290925261018052506101a0819052600f54620001e2906001600160a01b0316601e6000620001e9565b506200141c565b6004546080516001600160a01b03851660009081526006602090815260408220549284019291906200022690839062003a14620004e7821b17901c565b90506001600160a01b0387166200024f57604051622e076360e81b815260040160405180910390fd5b85600003620002715760405163b562e8dd60e01b815260040160405180910390fd5b60a05186850111156200029757604051631dae08e760e31b815260040160405180910390fd5b60c051868201118015620002ab5750303b15155b15620002ca5760405163d7fac8c760e01b815260040160405180910390fd5b336001600160a01b03881603620002f857620002f58683620004f260201b62003a1f1790919060201c565b91505b6000620003128842886200050060201b62003a261760201c565b905086600103620003365762000333816200053660201b62003a881760201c565b90505b85156200044f57600062000355846200053f60201b62003a911760201c565b9050620003628462000548565b93506200037e88856200058860201b62003a9a1790919060201c565b935060648882011115620003a557604051634543792f60e11b815260040160405180910390fd5b80600003620003cb57620003c842856200058f60201b62003aa11790919060201c565b93505b6000805b8981101562000446578681019150620003ea828786620005a4565b604051919750945082906001600160a01b038d1690600090600080516020620074c1833981519152908290a4604051829030906001600160a01b038e1690600080516020620074c183398151915290600090a4600101620003cf565b505050620004ab565b6200046987846200063f60201b62003ab81790919060201c565b925060005b87811015620004a957604051858201906001600160a01b038b1690600090600080516020620074c1833981519152908290a46001016200046e565b505b6001600160a01b039097166000908152600660209081526040808320949094559381526005909352509020939093555060048054909101905550565b60141c620fffff1690565b601481901b82015b92915050565b60006001600160a01b03841660a084901b17600160c81b17826200052557806200052d565b600360dc1b81175b95945050505050565b600160de1b1790565b60781c60ff1690565b60008062000557338462000643565b90506200057342846200071a60201b62003abc1790919060201c565b92506200058133826200072f565b5090919050565b60781b0190565b60281b64ffffffffff60281b19919091161790565b600080620005bd83620007a360201b62003ad81760201c565b158015620005de5750620005dc83620007ae60201b62003ae31760201c565b155b8015620005ed575060185460ff165b156200061a57620006176200060286620007b7565b84620007f660201b62003aec1790919060201c565b92505b6200063483856200084160201b62003b361790919060201c565b959294509192505050565b0190565b6000806200065c83620008e460201b62003bb01760201c565b90508060000362000672576000915050620004fa565b6000620006896101405142620008f160201b60201c565b905060008282106200069e57828203620006a1565b60005b9050600062015180670429d069189e000083620006c9896200090b60201b62003bbd1760201c565b020281620006db57620006db62001376565b04905080600003620006f5576000945050505050620004fa565b60006200070388886200092e565b905061271080820183020498975050505050505050565b60501b64ffffffffff60501b19919091161790565b80156200079f576009546040516340c10f1960e01b81526001600160a01b03848116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b1580156200078557600080fd5b505af11580156200079a573d6000803e3d6000fd5b505050505b5050565b60dd1c600116151590565b60f81c600f1690565b6000600d5482604051602001620007d8929190918252602082015260400190565b60408051601f19818403018152919052805160209091012092915050565b600060f462000810836200097f60201b62003be01760201c565b901b60f86200082a84620009cb60201b62003c291760201c565b6001610f0160f41b038616911b1717905092915050565b6000806200085a83620007ae60201b62003ae31760201c565b905080156200089257600381901b6078016001901b8401935060c86200088b84620009de60201b62003c3c1760201c565b901b840193505b620008a883620007a360201b62003ad81760201c565b15620008b957600160d21b93909301925b6003620008d184620009e760201b6200202d1760201c565b6001911b60a0011b939093019392505050565b60501c64ffffffffff1690565b600081831062000902578162000904565b825b9392505050565b60a881901c60ff166101fe60af83901c16016103fc60b69290921c919091160190565b60006200093b82620009f0565b620009468362000a73565b620009518462000af9565b6200095c8562000bac565b62000968878762000c09565b620009738762000c4b565b01010101019392505050565b600060ff600883901c16606c8111156200099c5750600092915050565b6049811115620009af5750600192915050565b6011811115620009c25750600292915050565b50600392915050565b6000600560ff8316066001019050919050565b60f41c600f1690565b60fc1c60010190565b60008062000a0983620008e460201b62003bb01760201c565b90506000620bdd8062000a278562000c8a60201b62003c451760201c565b0190508082111562000a3d575060009392505050565b80421162000a5057506103e89392505050565b8142038282036103e8028162000a6a5762000a6a62001376565b04949350505050565b60008062000a8c8362000c9060201b62003c4b1760201c565b905062278d0081014281111562000aa7575060009392505050565b600062000abf85620008e460201b62003bb01760201c565b905081811062000ad557506103e8949350505050565b8042038242036103e8028162000aef5762000aef62001376565b0495945050505050565b60008062000b128362000c9d60201b62003c581760201c565b9050600062000b2c84620008e460201b62003bb01760201c565b905081158062000b3e57506101205181115b1562000b4e575060009392505050565b600062000b66856200053f60201b62003a911760201c565b6107d084028162000b7b5762000b7b62001376565b04905061012051421162000b9157949350505050565b81420382610120510382028162000aef5762000aef62001376565b60008062000bc5836200053f60201b62003a911760201c565b9050801562000c0057806103e862000be88562000ca660201b62003c611760201c565b028162000bf95762000bf962001376565b0462000904565b60009392505050565b60008062000c228362000cb060201b62003c6b1760201c565b905062000c30848262000cb9565b62000c40576000915050620004fa565b506103e89392505050565b60008062000c64836200125860201b62003c741760201c565b90506003811062000c00576005811062000c8157610dac62000904565b6107d062000904565b60da1c90565b60281c64ffffffffff1690565b60d21c60ff1690565b60c81c6103ff1690565b60c01c60ff1690565b60008160000362000ccd57506000620004fa565b6013821015620010ac57604080516102608101825260008152734bb33f6e69fd62cf3abbcc6f1f43b94a5d572c2b602082015273bea8123277142de42571f1fac045225a1d347977918101919091527312d2d1bed91c24f878f37e66bd829ce7197e4d146060820152730c2e57efddba8c768147d1fdf9176a0a6ebd5d836080820152736e5a65b5f9dd7b1b08ff212e210dcd642de0db8b60a08201527317ed38f5f519c6ed563be6486e629041bed3dfbc60c082015273dd67892e722be69909d7c285db572852d5f8897c60e0820152738a90cab2b38dba80c64b7734e58ee1db38b8992e610100820152736f44db5ed6b86d9cc6046d0c78b82cad9e600f6a61012082015273219b8ab790decc32444a6600971c7c371825253961014082015273c4a0b1e7aa137ada8b2f911a501638088dfdd508610160820152739712228ceeda1e2ddde52cd5100b88986d1cb49c6101808201527356b391339615fd0e88e0d370f451fa91478bb20f6101a082015273648e8428e0104ec7d08667866a3568a72fe3898f6101c082015273d2f668a8461d6761115daf8aeb3cdf5f40c532c66101e082015273bad6186e92002e312078b5a1dafd5ddf63d3f73161020082015273cb4307f1c3b5556256748ddf5b86e81258990b3c610220820152735c211b8e4f93f00e2bd68e82f4e00fbb3302b35c61024082015280836013811062000edc5762000edc6200138c565b60200201516040516370a0823160e01b81526001600160a01b038681166004830152909116906370a0823190602401602060405180830381865afa15801562000f29573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000f4f919062001335565b1562000f60576001915050620004fa565b82600a0362000fff5780836013811062000f7e5762000f7e6200138c565b6020020151604051637dd54ea760e01b81526001600160a01b03868116600483015290911690637dd54ea7906024015b602060405180830381865afa15801562000fcc573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000ff2919062001335565b60001415915050620004fa565b82600c0362001052578083601381106200101d576200101d6200138c565b60200201516040516326d352ab60e11b81526001600160a01b03868116600483015290911690634da6a5569060240162000fae565b82601003620010a5578083601381106200107057620010706200138c565b60200201516040516323521ecd60e11b81526001600160a01b038681166004830152909116906346a43d9a9060240162000fae565b506200124f565b6000828152600b60205260409020546001600160a01b031680156200124d576040516370a0823160e01b81526001600160a01b0385811660048301528216906370a0823190602401602060405180830381865afa15801562001112573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062001138919062001335565b1562001149576001915050620004fa565b6001600160a01b0381166000908152600c602052604090205460e01b6001600160e01b03198116156200124b576040516001600160a01b0386811660248301526000918291851690849060440160408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909416939093179092529051620011d69190620013a2565b600060405180830381855afa9150503d806000811462001213576040519150601f19603f3d011682016040523d82523d6000602084013e62001218565b606091505b50915091508180156200123f5750808060200190518101906200123c919062001335565b15155b945050505050620004fa565b505b505b50600092915050565b608081901c60ff9081161515608883901c8216151501609083901c8216151501609883901c821615150160a09290921c1615150190565b8280546200129d90620013e0565b90600052602060002090601f016020900481019282620012c157600085556200130c565b82601f10620012dc57805160ff19168380011785556200130c565b828001600101855582156200130c579182015b828111156200130c578251825591602001919060010190620012ef565b506200131a9291506200131e565b5090565b5b808211156200131a57600081556001016200131f565b6000602082840312156200134857600080fd5b5051919050565b600082198211156200137157634e487b7160e01b600052601160045260246000fd5b500190565b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6000825160005b81811015620013c55760208186018101518583015201620013a9565b81811115620013d5576000828501525b509190910192915050565b600181811c90821680620013f557607f821691505b6020821081036200141657634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a051615fe3620014de60003960006136a90152600061353301526000613512015260006145d001526000818161286d01528181614e3601528181614e880152614ebb01526000818161237101526146e0015260006146b101526000614106015260006140aa0152600081816120490152818161206e01528181612d6d01528181612d8f0152818161400b015281816143ce01526143ff0152615fe36000f3fe6080604052600436106104d15760003560e01c806386481d4011610279578063bc8893b41161015e578063e1da26c6116100d6578063ea9384fa1161008a578063f40f0f521161006f578063f40f0f5214610c32578063f948dbf614610c52578063fe55932a14610c6557600080fd5b8063ea9384fa14610bff578063f2fde38b14610c1257600080fd5b8063e449f341116100bb578063e449f34114610b91578063e4a73e5b14610ba4578063e985e9c514610bc457600080fd5b8063e1da26c614610b76578063e2e06fa314610b7e57600080fd5b8063c9be651b1161012d578063cdaecb1911610112578063cdaecb1914610b46578063da4f633b14610b5b578063e17b25af14610b6357600080fd5b8063c9be651b14610b06578063cb4bd00e14610b2657600080fd5b8063bc8893b414610a8c578063c32d3ae214610aa6578063c3d33cb514610ad3578063c87b56dd14610ae657600080fd5b806399ff2190116101f1578063a22cb465116101c0578063b61f88b4116101a5578063b61f88b414610a44578063b88a802f14610a64578063b88d4fde14610a6c57600080fd5b8063a22cb46514610a0d578063aaab633914610a2d57600080fd5b806399ff2190146109bc5780639bbe87d9146109d25780639be65a60146109e5578063a035b1fe146109f857600080fd5b806390c3f38f116102485780639366c1fd1161022d5780639366c1fd1461097457806394985ddd1461098757806395d89b41146109a757600080fd5b806390c3f38f1461094e578063930bdc871461096157600080fd5b806386481d40146108db57806388486f86146108fb578063895d22061461091b5780638da5cb5b1461093057600080fd5b80632828adb2116103ba578063628cbb6d1161033257806370a08231116102e65780637284e416116102cb5780637284e416146108a05780637ee843cc146108b55780638091aa03146108c857600080fd5b806370a08231146108605780637168fcea1461088057600080fd5b806367f68fac1161031757806367f68fac146108005780636a8954b9146108135780636c08c6b11461084057600080fd5b8063628cbb6d146107c05780636352211e146107e057600080fd5b806341ab7f48116103895780634fc918bc1161036e5780634fc918bc1461077a5780635bb209a51461078d5780636035386a146107ad57600080fd5b806341ab7f481461074757806342842e0e1461075a57600080fd5b80632828adb2146106ff5780633307dcfe14610712578063392f37e91461071a5780633ccfd60b1461073f57600080fd5b8063110d62411161044d57806320fc7eb21161041c57806323b872dd1161040157806323b872dd146106a957806326e0d280146106c9578063279350bd146106df57600080fd5b806320fc7eb21461067657806322a2eced1461069657600080fd5b8063110d62411461061a578063176ca01d1461063a57806318160ddd1461064d5780631ae0b4ec1461066357600080fd5b806308ee0c74116104a45780630b747d91116104895780630b747d91146105de5780630ce90ec2146105f45780630fbf0a931461060757600080fd5b806308ee0c7414610590578063095ea7b3146105be57600080fd5b806301ffc9a7146104d6578063046dc1661461050b57806306fdde0314610520578063081812fc14610542575b600080fd5b3480156104e257600080fd5b506104f66104f1366004615557565b610c78565b60405190151581526020015b60405180910390f35b61051e610519366004615589565b610d15565b005b34801561052c57600080fd5b50610535610d62565b60405161050291906155fe565b34801561054e57600080fd5b5061057861055d366004615611565b6002602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610502565b34801561059c57600080fd5b506105b06105ab366004615589565b610df0565b604051908152602001610502565b3480156105ca57600080fd5b5061051e6105d936600461562a565b610e14565b3480156105ea57600080fd5b506105b0600d5481565b61051e610602366004615611565b610ee0565b61051e61061536600461569b565b61112a565b34801561062657600080fd5b50600954610578906001600160a01b031681565b61051e61064836600461572d565b61118b565b34801561065957600080fd5b506105b060045481565b61051e610671366004615611565b611280565b34801561068257600080fd5b506105b0610691366004615589565b6112b0565b61051e6106a4366004615798565b6112d6565b3480156106b557600080fd5b5061051e6106c4366004615804565b61136d565b3480156106d557600080fd5b506105b060125481565b3480156106eb57600080fd5b506105356106fa366004615845565b6115bd565b61051e61070d366004615611565b6116c6565b61051e611745565b34801561072657600080fd5b50600e546105789061010090046001600160a01b031681565b61051e6117a2565b61051e610755366004615611565b611825565b34801561076657600080fd5b5061051e610775366004615804565b6118e2565b61051e610788366004615798565b6118fd565b34801561079957600080fd5b506105b06107a8366004615611565b6119c0565b61051e6107bb36600461569b565b611a15565b3480156107cc57600080fd5b506105356107db366004615611565b611b58565b3480156107ec57600080fd5b506105786107fb366004615611565b611b71565b61051e61080e366004615867565b611b7f565b34801561081f57600080fd5b5061083361082e366004615589565b611cb2565b6040516105029190615897565b34801561084c57600080fd5b506105b061085b366004615611565b611e5f565b34801561086c57600080fd5b506105b061087b366004615589565b611ed0565b34801561088c57600080fd5b506105b061089b366004615589565b611f35565b3480156108ac57600080fd5b50610535611f64565b61051e6108c33660046159a8565b611f71565b61051e6108d6366004615589565b611fd2565b3480156108e757600080fd5b506105b06108f6366004615611565b61201f565b34801561090757600080fd5b50610578610916366004615611565b612036565b34801561092757600080fd5b506105b0612044565b34801561093c57600080fd5b506008546001600160a01b0316610578565b61051e61095c3660046159a8565b6120c6565b61051e61096f3660046159dd565b612104565b61051e610982366004615589565b612160565b34801561099357600080fd5b5061051e6109a2366004615845565b612366565b3480156109b357600080fd5b506105356123e9565b3480156109c857600080fd5b506105b060115481565b61051e6109e0366004615611565b6123f6565b61051e6109f3366004615589565b61246e565b348015610a0457600080fd5b506105b0612591565b348015610a1957600080fd5b5061051e610a28366004615a0b565b6125bc565b348015610a3957600080fd5b50600d5415156104f6565b348015610a5057600080fd5b50610535610a5f366004615611565b612628565b61051e612641565b348015610a7857600080fd5b5061051e610a87366004615a39565b61265b565b348015610a9857600080fd5b50600e546104f69060ff1681565b348015610ab257600080fd5b50610ac6610ac1366004615589565b61274e565b6040516105029190615adc565b61051e610ae1366004615798565b6129bc565b348015610af257600080fd5b50610535610b01366004615611565b612a60565b348015610b1257600080fd5b50610833610b2136600461562a565b612bc9565b348015610b3257600080fd5b506104f6610b4136600461562a565b612e71565b348015610b5257600080fd5b5061053561342e565b61051e61343b565b61051e610b71366004615589565b613457565b61051e6134c1565b61051e610b8c366004615bab565b61355a565b61051e610b9f36600461569b565b613598565b348015610bb057600080fd5b50600f54610578906001600160a01b031681565b348015610bd057600080fd5b506104f6610bdf366004615bc8565b600360209081526000928352604080842090915290825290205460ff1681565b61051e610c0d366004615bf6565b6135e4565b348015610c1e57600080fd5b5061051e610c2d366004615589565b613759565b348015610c3e57600080fd5b506105b0610c4d366004615589565b6137a6565b61051e610c60366004615c3b565b6137ca565b61051e610c73366004615c3b565b6138f3565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161480610cdb57507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b80610d0f57507f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b6008546001600160a01b03163314610d4057604051633e8be92f60e01b815260040160405180910390fd5b601080546001600160a01b0319166001600160a01b0392909216919091179055565b60008054610d6f90615c87565b80601f0160208091040260200160405190810160405280929190818152602001828054610d9b90615c87565b8015610de85780601f10610dbd57610100808354040283529160200191610de8565b820191906000526020600020905b815481529060010190602001808311610dcb57829003601f168201915b505050505081565b6001600160a01b03811660009081526006602052604081205460781c60ff16610d0f565b6000610e27610e2283611e5f565b613cab565b9050336001600160a01b03821614801590610e6657506001600160a01b038116600090815260036020908152604080832033845290915290205460ff16155b15610e84576040516327da82d560e11b815260040160405180910390fd5b60008281526002602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000610eeb82611e5f565b905080336001600160a01b03821614610f1757604051633a6bbed360e01b815260040160405180910390fd5b600160fc83901c016002811115610f5a576040517f921c7d5f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060010361100a57610ce460115410610f865760405163519f594360e01b815260040160405180910390fd5b60095460405163079cc67960e41b815233600482015268068155a43676e0000060248201526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015610fda57600080fd5b505af1158015610fee573d6000803e3d6000fd5b5050505060116000815461100190615cd1565b909155506110ae565b6104b06012541061102e5760405163519f594360e01b815260040160405180910390fd5b60095460405163079cc67960e41b81523360048201526812f939c99edab8000060248201526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561108257600080fd5b505af1158015611096573d6000803e3d6000fd5b505050506012600081546110a990615cd1565b909155505b60006110bf600160fc1b8501613cce565b90506110d08460dc1c600116151590565b80156110de575060185460ff165b156111125760006110ed613d17565b90506110fb81878785613d36565b336000908152600660205260409020919091559150505b60009485526005602052604090942093909355505050565b6000611134613d17565b905060005b82811015611176576111643385858481811061115757611157615cea565b9050602002013584613dc5565b915061116f81615cd1565b9050611139565b50336000908152600660205260409020555050565b3233146111ab57604051632514e60160e21b815260040160405180910390fd5b600e5460ff16156111e8576040517f04cc9ce200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6111f3838386613f4d565b611229576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526006602052604081205460141c620fffff1690508461124e8783615d00565b111561126d57604051632795088960e11b815260040160405180910390fd5b611278338784613fed565b505050505050565b6008546001600160a01b031633146112ab57604051633e8be92f60e01b815260040160405180910390fd5b601355565b6001600160a01b03811660009081526006602052604081205460141c620fffff16610d0f565b6008546001600160a01b0316331461130157604051633e8be92f60e01b815260040160405180910390fd5b60005b838110156113665761135685858381811061132157611321615cea565b90506020020160208101906113369190615589565b84848481811061134857611348615cea565b905060200201356000613fed565b61135f81615cd1565b9050611304565b5050505050565b306001600160a01b038316036113aa576000611387613d17565b9050611394338383613dc5565b3360009081526006602052604090205550505050565b60006113b582611e5f565b905060006113c282613cab565b90506000336001600160a01b038316148061140057506001600160a01b038216600090815260036020908152604080832033845290915290205460ff165b8061142157506000848152600260205260409020546001600160a01b031633145b905080611441576040516327da82d560e11b815260040160405180910390fd5b6001600160a01b038516611481576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b856001600160a01b0316826001600160a01b0316146114cc576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600084815260026020526040902080546001600160a01b031916905561154a611545426115198861150060018a0189614342565b6001600160a01b0319166001600160a01b039091161790565b7fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff1660a09190911b1790565b6143a6565b6000858152600560209081526040808320939093556001600160a01b038981168084526006909252838320805460001901905588168083528383208054600101905592518793927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a45050505b505050565b60606115c8836143c9565b6115e55760405163163a09e160e31b815260040160405180910390fd5b60185460ff1615806116055750600e5461010090046001600160a01b0316155b1561162a57604051806060016040528060358152602001615f79603591399050610d0f565b600e546040517f452ce83e00000000000000000000000000000000000000000000000000000000815260048101859052602481018490526101009091046001600160a01b03169063452ce83e90604401600060405180830381865afa158015611697573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116bf9190810190615d18565b9392505050565b60006116d76116d483611e5f565b90565b90506001600160a01b038116331480159061170c5750336117006008546001600160a01b031690565b6001600160a01b031614155b1561172a57604051633a6bbed360e01b815260040160405180910390fd5b60008281526014602052604081206117419161534c565b5050565b6008546001600160a01b0316331461177057604051633e8be92f60e01b815260040160405180910390fd5b600d541561179157604051631f5ae5c960e21b815260040160405180910390fd5b61179c600143615d86565b40600d55565b6008546001600160a01b031633146117cd57604051633e8be92f60e01b815260040160405180910390fd5b600f5460405147916001600160a01b0316908290600081818185875af1925050503d806000811461181a576040519150601f19603f3d011682016040523d82523d6000602084013e61181f565b606091505b50505050565b600061182f613d17565b905060ff60c082901c16808303611872576040517f61de27c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b821580159061188857506118863384612e71565b155b156118bf576040517fc1757b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff60c01b19821660c084901b1733600090815260066020526040902055505050565b6115b88383836040518060200160405280600081525061265b565b6008546001600160a01b0316331461192857604051633e8be92f60e01b815260040160405180910390fd5b60005b8181101561136657600083838381811061194757611947615cea565b9050602002013590508060000361195d57600080fd5b85858381811061196f5761196f615cea565b90506020020160208101906119849190615589565b6000918252600b602052604090912080546001600160a01b0319166001600160a01b039092169190911790556119b981615cd1565b905061192b565b60185460009060ff166119e65760405163847b198f60e01b815260040160405180910390fd5b6119ef826143c9565b611a0c5760405163163a09e160e31b815260040160405180910390fd5b610d0f8261442b565b60185460ff16611a385760405163847b198f60e01b815260040160405180910390fd5b6000611a42613d17565b905060008060005b84811015611b3e57858582818110611a6457611a64615cea565b905060200201359250611a7683611e5f565b915033826001600160a01b031614611aa157604051633a6bbed360e01b815260040160405180910390fd5b611ab08260dc1c600116151590565b611acd576040516333155e1360e21b815260040160405180910390fd5b60f882901c600f1615611b0c576040517f6e62ff6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611b1884848485613d36565b60008581526005602052604090208190559094509150611b3781615cd1565b9050611a4a565b505033600090815260066020526040902091909155505050565b60156020526000908152604090208054610d6f90615c87565b6000610d0f610e2283611e5f565b323314611b9f57604051632514e60160e21b815260040160405180910390fd5b600e5460ff16611bdb576040517fc7d08f0400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8160031015611bfd57604051632795088960e11b815260040160405180910390fd5b6000611c07612591565b9050611c138382615d9d565b3414611c4b576040517fd2ade55600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600003611ca7573360009081526006602052604081205460141c620fffff1690506003611c798583615d00565b1115611c9857604051632795088960e11b815260040160405180910390fd5b83600114611ca557600192505b505b6115b8338484613fed565b60185460609060ff16611cd357505060408051600081526020810190915290565b6040517fc9be651b0000000000000000000000000000000000000000000000000000000081526001600160a01b038316600482015260016024820152600090309063c9be651b90604401600060405180830381865afa158015611d3a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d629190810190615dbc565b6001600160a01b038416600090815260066020526040812054919250611d888583614469565b90506000805b8451811015611e2857611db9858281518110611dac57611dac615cea565b6020026020010151611e5f565b915060f882901c600f16600003611df757611def84868381518110611de057611de0615cea565b60200260200101518485613d36565b509350611e18565b6000858281518110611e0b57611e0b615cea565b6020026020010181815250505b611e2181615cd1565b9050611d8e565b506000611e358785614469565b9050828111611e5257604080516000815260208101909152611e54565b845b979650505050505050565b6000611e6a826143c9565b611e875760405163163a09e160e31b815260040160405180910390fd5b815b6000818152600560205260409020548015611ebd57838214611eb357611eae816144ae565b611eb5565b805b949350505050565b5080611ec881615e62565b915050611e89565b60006001600160a01b038216611f12576040517fcbe7266800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038216600090815260066020526040902054620fffff16610d0f565b6001600160a01b0381166000908152600660205260408120546116bf60ff607883901c16620fffff8316615d00565b60168054610d6f90615c87565b6008546001600160a01b03163314611f9c57604051633e8be92f60e01b815260040160405180910390fd5b60185460ff16611fbf5760405163847b198f60e01b815260040160405180910390fd5b8051611741906017906020840190615386565b6008546001600160a01b03163314611ffd57604051633e8be92f60e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b6000610d0f61202d83611e5f565b60fc1c60010190565b6000610d0f6116d483611e5f565b6000807f00000000000000000000000000000000000000000000000000000000000000005b6004547f0000000000000000000000000000000000000000000000000000000000000000018110156120c0576120ac6120a182611e5f565b60dc1c600116151590565b156120b8578160010191505b600101612069565b50919050565b6008546001600160a01b031633146120f157604051633e8be92f60e01b815260040160405180910390fd5b8051611741906016906020840190615386565b6008546001600160a01b0316331461212f57604051633e8be92f60e01b815260040160405180910390fd5b6001600160a01b03919091166000908152600c60205260409020805463ffffffff191660e09290921c919091179055565b600061216a613d17565b6001600160a01b0383166000908152600a60205260408120549192508190036121bf576040517f8792488500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015261dead6024820152604481018290526000906001600160a01b038516906323b872dd906064016020604051808303816000875af1158015612230573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122549190615e79565b90508061228d576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006122998460da1c90565b905042620bdd806122aa8184615d00565b6122b49190615d00565b11156122ec576040517fce347a8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7b03ffffffffffffffffffffffffffffffffffffffffffffffffffffff84164260da1b173360009081526006602090815260409182902092909255516001600160a01b03871681527faa30aaf13ce297e169ade8c74495e8ca52c662afc30e851ee8ca4b2c3bda82f9910160405180910390a15050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146123e35760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c0060448201526064015b60405180910390fd5b600d5550565b60018054610d6f90615c87565b60006124046116d483611e5f565b90506001600160a01b038116331480159061243957503361242d6008546001600160a01b031690565b6001600160a01b031614155b1561245757604051633a6bbed360e01b815260040160405180910390fd5b60008281526015602052604081206117419161534c565b6008546001600160a01b0316331461249957604051633e8be92f60e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156124e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125049190615e96565b6040517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018290529091506001600160a01b0383169063a9059cbb906044016020604051808303816000875af115801561256d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115b89190615e79565b6000610dac600454106125ab5766470de4df8200006125ae565b60005b66ffffffffffffff16905090565b3360008181526003602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60146020526000908152604090208054610d6f90615c87565b612649613d17565b33600090815260066020526040902055565b61266684848461136d565b6001600160a01b0383163b1580159061271757506040517f150b7a0200000000000000000000000000000000000000000000000000000000808252906001600160a01b0385169063150b7a02906126c7903390899088908890600401615eaf565b6020604051808303816000875af11580156126e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061270a9190615eeb565b6001600160e01b03191614155b1561181f576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61275661540a565b6001600160a01b038216600090815260066020526040902054607881901c60ff1682526127b481608081901c60ff9081161515608883901c8216151501609083901c8216151501609883901c821615150160a09290921c1615150190565b602083015260646127c4826144e3565b816127d1576127d1615f08565b04604083015260646127e3848361454c565b816127f0576127f0615f08565b046060830152620bdd806128048260da1c90565b014210612812576000612815565b600a5b6080830152602881901c64ffffffffff1660a083018190521580159061284a575062278d00602882901c64ffffffffff160142115b612855576000612858565b600a5b60c083015260d281901c60ff166101208301527f000000000000000000000000000000000000000000000000000000000000000042118061289e5750607881901c60ff16155b6128d9576064607882901c60ff166107d060d284901c60ff1602816128c5576128c5615f08565b04816128d3576128d3615f08565b046128dc565b60005b61014083015260c881901c6103ff1660e083015260646128fb82614579565b8161290857612908615f08565b04610100830181905261014083015160c084015160808501516060860151604087015101010190910101610160830181905260a882901c60ff166101fe60af84901c16016103fc60b684901c16016101808401819052670429d069189e00008082026101a0860152606492830190910202046101c083015261298a83826145aa565b6101e083015261299a8160da1c90565b4203620bdd80036102008301526129b081614673565b61022083015250919050565b6008546001600160a01b031633146129e757604051633e8be92f60e01b815260040160405180910390fd5b60005b8381101561136657828282818110612a0457612a04615cea565b90506020020135600a6000878785818110612a2157612a21615cea565b9050602002016020810190612a369190615589565b6001600160a01b03168152602081019190915260400160002055612a5981615cd1565b90506129ea565b6060612a6b826143c9565b612a885760405163163a09e160e31b815260040160405180910390fd5b60185460ff161580612aa85750600e5461010090046001600160a01b0316155b15612acc57604051806060016040528060358152602001615f796035913992915050565b600e546040517f86481d40000000000000000000000000000000000000000000000000000000008152600481018490526101009091046001600160a01b03169063452ce83e90849030906386481d4090602401602060405180830381865afa158015612b3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b609190615e96565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381865afa158015612ba1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d0f9190810190615d18565b606060008215612ca75782600114612c62576040517f7168fcea0000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201523090637168fcea906024015b602060405180830381865afa158015612c39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c5d9190615e96565b612d0f565b6040517f08ee0c740000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015230906308ee0c7490602401612c1c565b6040516370a0823160e01b81526001600160a01b038516600482015230906370a0823190602401602060405180830381865afa158015612ceb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d0f9190615e96565b905060008167ffffffffffffffff811115612d2c57612d2c6158db565b604051908082528060200260200182016040528015612d55578160200160208202803683370190505b50905081600003612d69579150610d0f9050565b60007f00000000000000000000000000000000000000000000000000000000000000005b7f000000000000000000000000000000000000000000000000000000000000000060045401811015612e66576000612dc482611e5f565b9050806001600160a01b0316886001600160a01b031603612e5d576000612df08260dc1c600116151590565b905087158015612dfe575080155b80612e115750876001148015612e115750805b80612e1c5750876002145b15612e5b5782858580600101965081518110612e3a57612e3a615cea565b602002602001018181525050838603612e5b57849650505050505050610d0f565b505b50600101612d8d565b509095945050505050565b600081600003612e8357506000610d0f565b601382101561329157604080516102608101825260008152734bb33f6e69fd62cf3abbcc6f1f43b94a5d572c2b602082015273bea8123277142de42571f1fac045225a1d347977918101919091527312d2d1bed91c24f878f37e66bd829ce7197e4d146060820152730c2e57efddba8c768147d1fdf9176a0a6ebd5d836080820152736e5a65b5f9dd7b1b08ff212e210dcd642de0db8b60a08201527317ed38f5f519c6ed563be6486e629041bed3dfbc60c082015273dd67892e722be69909d7c285db572852d5f8897c60e0820152738a90cab2b38dba80c64b7734e58ee1db38b8992e610100820152736f44db5ed6b86d9cc6046d0c78b82cad9e600f6a61012082015273219b8ab790decc32444a6600971c7c371825253961014082015273c4a0b1e7aa137ada8b2f911a501638088dfdd508610160820152739712228ceeda1e2ddde52cd5100b88986d1cb49c6101808201527356b391339615fd0e88e0d370f451fa91478bb20f6101a082015273648e8428e0104ec7d08667866a3568a72fe3898f6101c082015273d2f668a8461d6761115daf8aeb3cdf5f40c532c66101e082015273bad6186e92002e312078b5a1dafd5ddf63d3f73161020082015273cb4307f1c3b5556256748ddf5b86e81258990b3c610220820152735c211b8e4f93f00e2bd68e82f4e00fbb3302b35c61024082015280836013811061308e5761308e615cea565b60200201516040516370a0823160e01b81526001600160a01b038681166004830152909116906370a0823190602401602060405180830381865afa1580156130da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130fe9190615e96565b1561310d576001915050610d0f565b82600a036131bd5780836013811061312757613127615cea565b60200201516040517f7dd54ea70000000000000000000000000000000000000000000000000000000081526001600160a01b03868116600483015290911690637dd54ea7906024015b602060405180830381865afa15801561318d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131b19190615e96565b60001415915050610d0f565b82600c03613224578083601381106131d7576131d7615cea565b60200201516040517f4da6a5560000000000000000000000000000000000000000000000000000000081526001600160a01b03868116600483015290911690634da6a55690602401613170565b8260100361328b5780836013811061323e5761323e615cea565b60200201516040517f46a43d9a0000000000000000000000000000000000000000000000000000000081526001600160a01b038681166004830152909116906346a43d9a90602401613170565b50613425565b6000828152600b60205260409020546001600160a01b03168015613423576040516370a0823160e01b81526001600160a01b0385811660048301528216906370a0823190602401602060405180830381865afa1580156132f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133199190615e96565b15613328576001915050610d0f565b6001600160a01b0381166000908152600c602052604090205460e01b6001600160e01b0319811615613421576040516001600160a01b0386811660248301526000918291851690849060440160408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516133b29190615f1e565b600060405180830381855afa9150503d80600081146133ed576040519150601f19603f3d011682016040523d82523d6000602084013e6133f2565b606091505b50915091508180156134165750808060200190518101906134139190615e96565b15155b945050505050610d0f565b505b505b50600092915050565b60178054610d6f90615c87565b3360009081526006602052604090205460ff60c01b1916612649565b6008546001600160a01b0316331461348257604051633e8be92f60e01b815260040160405180910390fd5b600e80546001600160a01b03909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b6008546001600160a01b031633146134ec57604051633e8be92f60e01b815260040160405180910390fd5b600d541561350d57604051631f5ae5c960e21b815260040160405180910390fd5b6135577f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006146ad565b50565b6008546001600160a01b0316331461358557604051633e8be92f60e01b815260040160405180910390fd5b600e805460ff1916911515919091179055565b60006135a2613d17565b905060005b82811015611176576135d2338585848181106135c5576135c5615cea565b9050602002013584614829565b91506135dd81615cd1565b90506135a7565b6008546001600160a01b0316331461360f57604051633e8be92f60e01b815260040160405180910390fd5b600d54613648576040517f7607330600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60185460ff1615613685576040517fb22df23900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516020810183905201604051602081830303815290604052805190602001207f0000000000000000000000000000000000000000000000000000000000000000146136ff576040517f3fbcde7200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6018805460ff19166001179055815161371f906017906020850190615386565b5061174181600d54604080516020810192909252810182905260600160408051601f198184030181529190528051602090910120600d5550565b6008546001600160a01b0316331461378457604051633e8be92f60e01b815260040160405180910390fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815260066020526040812054610d0f9083906145aa565b8260006137d682611e5f565b905060006137ef64ffffffffff60a084901c1642615d86565b905033826001600160a01b03161461381a57604051633a6bbed360e01b815260040160405180910390fd5b60135481101561383d57604051639a6a107b60e01b815260040160405180910390fd5b613849858560236149ce565b61386657604051630ec0325960e21b815260040160405180910390fd5b60095460405163079cc67960e41b815233600482015267d02ab486cedc000060248201526001600160a01b03909116906379cc679090604401600060405180830381600087803b1580156138b957600080fd5b505af11580156138cd573d6000803e3d6000fd5b50505060008781526015602052604090206138ea9150868661549a565b50505050505050565b8260006138ff82611e5f565b9050600061391864ffffffffff60a084901c1642615d86565b905033826001600160a01b03161461394357604051633a6bbed360e01b815260040160405180910390fd5b60135481101561396657604051639a6a107b60e01b815260040160405180910390fd5b613972858560146149ce565b61398f57604051630ec0325960e21b815260040160405180910390fd5b60095460405163079cc67960e41b815233600482015268015af1d78b58c4000060248201526001600160a01b03909116906379cc679090604401600060405180830381600087803b1580156139e357600080fd5b505af11580156139f7573d6000803e3d6000fd5b50505060008781526014602052604090206138ea9150868661549a565b60141c620fffff1690565b60141b0190565b60006001600160a01b03841660a084901b177901000000000000000000000000000000000000000000000000001782613a5f5780613a7f565b7b3000000000000000000000000000000000000000000000000000000081175b95945050505050565b600160de1b1790565b60781c60ff1690565b60781b0190565b60281b69ffffffffff000000000019919091161790565b0190565b60501b6effffffffff0000000000000000000019919091161790565b60dd1c600116151590565b60f81c600f1690565b600060f4613af983613be0565b901b60f86001600560ff861606017ff00fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8616911b1717905092915050565b6000600f60f883901c168015613b635760016078600383901b011b93909301602c83901c600f60c81b1601925b613b728360dd1c600116151590565b15613b99577a04000000000000000000000000000000000000000000000000000093909301925b5050600160fc9190911c810160031b60a0011b0190565b60501c64ffffffffff1690565b60a881901c60ff166101fe60af83901c16016103fc60b69290921c919091160190565b600060ff600883901c16606c811115613bfc5750600092915050565b6049811115613c0e5750600192915050565b6011811115613c205750600292915050565b50600392915050565b6000600560ff8316066001019050919050565b60f41c600f1690565b60da1c90565b60281c64ffffffffff1690565b60d21c60ff1690565b60c81c6103ff1690565b60c01c60ff1690565b608081901c60ff9081161515608883901c8216151501609083901c8216151501609883901c821615150160a09290921c1615150190565b6000613cbc8260dc1c600116151590565b15613cc8575030919050565b81610d0f565b600080613ce560c884901c620fffff166002614bad565b60c81b7ffffffffff00000ffffffffffffffffffffffffffffffffffffffffffffffffff939093169290921792915050565b33600090815260066020526040812054613d3081614bc3565b91505090565b600080808060f885901c600f16600003613d6257613d5d613d568861442b565b8690613aec565b613d64565b845b9050613d7a81613d748a89614bf6565b90613b36565b6fffffffffffffffffffffffffffffffff19166fffffffffffffffffffffffffffffffff89161793506001600160e01b0319166001600160e01b038516179150505b94509492505050565b600060ff607883901c1681613dd985611e5f565b90506000613de682613cab565b905060648310613e0957604051634543792f60e11b815260040160405180910390fd5b866001600160a01b0316816001600160a01b031614613e3b57604051633a6bbed360e01b815260040160405180910390fd5b600086815260026020526040812080546001600160a01b031916905580613e63888886614c7b565b90925090506fffffffffffffffffffffffffffffffff87166fffffffffffffffffffffffffffffffff198316176001600160e01b0385166001600160e01b03198316179097507b10000000000000000000000000000000000000000000000000000000179350613edb600160001989019060781b0190565b965084600003613efb5769ffffffffff00000000001987164260281b1796505b60008881526005602052604080822086905551899130916001600160a01b038d16917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a45094979650505050505050565b60408051306020820152339181019190915260608101829052600090819060800160408051601f198184030181528282528051602091820120601054601f890183900483028501830190935287845293506001600160a01b0390911691613fda918890889081908401838280828437600092019190915250613fd49250869150614cdd9050565b90614d30565b6001600160a01b03161495945050505050565b6004546001600160a01b0384166000818152600660205260409020547f0000000000000000000000000000000000000000000000000000000000000000830191620fffff601483901c169061406e576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b856000036140a8576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000008685011115614104576040517fed70473800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000008682011180156141355750303b15155b1561416c576040517fd7fac8c700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336001600160a01b0388160361418b57614188828760141b0190565b91505b6000614198884288613a26565b9050866001036141a957600160de1b175b85156142b35760ff607884901c166141c084614bc3565b93506141ce848960781b0190565b9350606488820111156141f457604051634543792f60e11b815260040160405180910390fd5b806000036142125769ffffffffff00000000001984164260281b1793505b6000805b898110156142ab57808701915061422e828786614c7b565b604051919750945082906001600160a01b038d16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4604051829030906001600160a01b038e16907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90600090a4600101614216565b505050614306565b9186019160005b8781101561430457604051858201906001600160a01b038b16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46001016142ba565b505b6001600160a01b039097166000908152600660209081526040808320949094559381526005909352509020939093555060048054909101905550565b60006143538260de1c600116151590565b15801561436c5750600083815260056020526040902054155b801561437c575061437c836143c9565b1561439a5761438a826144ae565b6000848152600560205260409020555b600160de1b82176116bf565b600080613ce56143c0620fffff60c886901c166001615d00565b620fffff614bad565b6000817f000000000000000000000000000000000000000000000000000000000000000011158015610d0f5750600454614423907f0000000000000000000000000000000000000000000000000000000000000000615d00565b821092915050565b6000600d548260405160200161444b929190918252602082015260400190565b60408051601f19818403018152919052805160209091012092915050565b600061447482614d54565b61447d83614db0565b61448684614e16565b61448f85614579565b614499878761454c565b6144a2876144e3565b01010101019392505050565b60006144bf8260dd1c600116151590565b6144ca5760046144cd565b60025b60ff166001600160e01b03901c82169050919050565b60008061452183608081901c60ff9081161515608883901c8216151501609083901c8216151501609883901c821615150160a09290921c1615150190565b905060038110614543576005811061453b57610dac6116bf565b6107d06116bf565b60009392505050565b600060ff60c083901c166145608482612e71565b61456e576000915050610d0f565b506103e89392505050565b600060ff607883901c16801561454357806103e860c885901c6103ff1602816145a4576145a4615f08565b046116bf565b600064ffffffffff605083901c168082036145c9576000915050610d0f565b60006145f57f000000000000000000000000000000000000000000000000000000000000000042614bad565b905060008282106146085782820361460b565b60005b905062015180670429d069189e000060b687901c6103fc1660af88901c6101fe1660ff60a88a901c160101830202046000819003614650576000945050505050610d0f565b600061465c8888614469565b905061271080820183020498975050505050505050565b61467b61550e565b506040805160608101825260ff60a884901c8116825260b084901c8116602083015260b89390931c9092169082015290565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634000aea07f00000000000000000000000000000000000000000000000000000000000000008486600060405160200161471d929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b815260040161474a93929190615f3a565b6020604051808303816000875af1158015614769573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061478d9190615e79565b50600083815260076020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a0909101909252815191830191909120938790529190526147e9906001615d00565b600085815260076020526040902055611eb58482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b60008061483584611e5f565b90508060dc81901c60011615156001600160a01b038083169088161461486e57604051633a6bbed360e01b815260040160405180910390fd5b8061488c576040516333155e1360e21b815260040160405180910390fd5b60008061489a888887614eea565b90925090506fffffffffffffffffffffffffffffffff87166fffffffffffffffffffffffffffffffff198316176001600160e01b0386166001600160e01b031983161790975094506148f18560dd1c600116151590565b1561492e5761492b6149068960010187614342565b7fffffffffdfffffffffffffffffffffffffffffffffffffffffffffffffffffff1690565b94505b6000888152600560205260408082207fffffffffefffffffffffffffffffffffffffffffffffffffffffffffffffffff9790971696879055516efffffffffffffffffffffffffffffe199890980169ffffffffff000000000019164260281b179789916001600160a01b038c169130917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a45094979650505050505050565b60008084848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250508251929350506001909110905080614a1d5750828151115b80614a4d575080600081518110614a3657614a36615cea565b6020910101516001600160f81b031916600160fd1b145b80614a80575080600182510381518110614a6957614a69615cea565b6020910101516001600160f81b031916600160fd1b145b15614a8f5760009150506116bf565b600081600081518110614aa457614aa4615cea565b01602001516001600160f81b03191690506000805b8351811015614b9f57838181518110614ad457614ad4615cea565b01602001516001600160f81b0319169150600360fd1b82118015614b055750607b60f81b6001600160f81b03198316105b80614b355750600160fe1b6001600160f81b03198316118015614b355750605b60f81b6001600160f81b03198316105b80614b4d5750600160fd1b6001600160f81b03198316145b80614b7d5750602f60f81b6001600160f81b03198316118015614b7d5750601d60f91b6001600160f81b03198316105b15614b8a57819250614b97565b60009450505050506116bf565b600101614ab9565b506001979650505050505050565b6000818310614bbc57816116bf565b5090919050565b600080614bd033846145aa565b90506effffffffff000000000000000000001983164260501b179250614bbc3382614f6b565b6000600f60f883901c168015614c2557600f60c81b602c84901c1660016078600384901b011b90940393909303925b614c348360dd1c600116151590565b15614c5f577ffffffffffffc0000000000000000000000000000000000000000000000000000909301925b600360fc84901c6001016001911b60a0011b9093039392505050565b600080614c8d8360dd1c600116151590565b158015614c9f575060f883901c600f16155b8015614cad575060185460ff165b15614cc857614cc5614cbe8661442b565b8490613aec565b92505b614cd28484613b36565b959294509192505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b6000806000614d3f8585614fec565b91509150614d4c8161505a565b509392505050565b6000605082901c64ffffffffff1660da83901c620bdd800180821115614d7e575060009392505050565b804211614d9057506103e89392505050565b8142038282036103e80281614da757614da7615f08565b04949350505050565b600064ffffffffff602883901c1662278d00810142811115614dd6575060009392505050565b64ffffffffff605085901c16818110614df557506103e8949350505050565b8042038242036103e80281614e0c57614e0c615f08565b0495945050505050565b600060ff60d283901c1664ffffffffff605084901c16811580614e5857507f000000000000000000000000000000000000000000000000000000000000000081115b15614e67575060009392505050565b6000607885901c60ff166107d0840281614e8357614e83615f08565b0490507f00000000000000000000000000000000000000000000000000000000000000004211614eb557949350505050565b814203827f000000000000000000000000000000000000000000000000000000000000000003820281614e0c57614e0c615f08565b600080614ef78484614bf6565b9350614f088360dd1c600116151590565b8015614f2a57506203f480614f2864ffffffffff60a086901c1642615d86565b105b15614f61576040517f463e718b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5091939092509050565b8015611741576009546040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b158015614fd857600080fd5b505af1158015611278573d6000803e3d6000fd5b60008082516041036150225760208301516040840151606085015160001a61501687828585615210565b94509450505050615053565b825160400361504b57602083015160408401516150408683836152fa565b935093505050615053565b506000905060025b9250929050565b600081600481111561506e5761506e615f62565b036150765750565b600181600481111561508a5761508a615f62565b036150d75760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016123da565b60028160048111156150eb576150eb615f62565b036151385760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016123da565b600381600481111561514c5761514c615f62565b036151a45760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016123da565b60048160048111156151b8576151b8615f62565b036135575760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016123da565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156152475750600090506003613dbc565b8460ff16601b1415801561525f57508460ff16601c14155b156152705750600090506004613dbc565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156152c4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166152ed57600060019250925050613dbc565b9660009650945050505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168161533060ff86901c601b615d00565b905061533e87828885615210565b935093505050935093915050565b50805461535890615c87565b6000825580601f10615368575050565b601f016020900490600052602060002090810190613557919061552c565b82805461539290615c87565b90600052602060002090601f0160209004810192826153b457600085556153fa565b82601f106153cd57805160ff19168380011785556153fa565b828001600101855582156153fa579182015b828111156153fa5782518255916020019190600101906153df565b5061540692915061552c565b5090565b604051806102400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200161549561550e565b905290565b8280546154a690615c87565b90600052602060002090601f0160209004810192826154c857600085556153fa565b82601f106154e15782800160ff198235161785556153fa565b828001600101855582156153fa579182015b828111156153fa5782358255916020019190600101906154f3565b60405180606001604052806003906020820280368337509192915050565b5b80821115615406576000815560010161552d565b6001600160e01b03198116811461355757600080fd5b60006020828403121561556957600080fd5b81356116bf81615541565b6001600160a01b038116811461355757600080fd5b60006020828403121561559b57600080fd5b81356116bf81615574565b60005b838110156155c15781810151838201526020016155a9565b8381111561181f5750506000910152565b600081518084526155ea8160208601602086016155a6565b601f01601f19169290920160200192915050565b6020815260006116bf60208301846155d2565b60006020828403121561562357600080fd5b5035919050565b6000806040838503121561563d57600080fd5b823561564881615574565b946020939093013593505050565b60008083601f84011261566857600080fd5b50813567ffffffffffffffff81111561568057600080fd5b6020830191508360208260051b850101111561505357600080fd5b600080602083850312156156ae57600080fd5b823567ffffffffffffffff8111156156c557600080fd5b6156d185828601615656565b90969095509350505050565b60008083601f8401126156ef57600080fd5b50813567ffffffffffffffff81111561570757600080fd5b60208301915083602082850101111561505357600080fd5b801515811461355757600080fd5b60008060008060006080868803121561574557600080fd5b8535945060208601359350604086013567ffffffffffffffff81111561576a57600080fd5b615776888289016156dd565b909450925050606086013561578a8161571f565b809150509295509295909350565b600080600080604085870312156157ae57600080fd5b843567ffffffffffffffff808211156157c657600080fd5b6157d288838901615656565b909650945060208701359150808211156157eb57600080fd5b506157f887828801615656565b95989497509550505050565b60008060006060848603121561581957600080fd5b833561582481615574565b9250602084013561583481615574565b929592945050506040919091013590565b6000806040838503121561585857600080fd5b50508035926020909101359150565b6000806040838503121561587a57600080fd5b82359150602083013561588c8161571f565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b818110156158cf578351835292840192918401916001016158b3565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561591a5761591a6158db565b604052919050565b600067ffffffffffffffff82111561593c5761593c6158db565b50601f01601f191660200190565b600061595d61595884615922565b6158f1565b905082815283838301111561597157600080fd5b828260208301376000602084830101529392505050565b600082601f83011261599957600080fd5b6116bf8383356020850161594a565b6000602082840312156159ba57600080fd5b813567ffffffffffffffff8111156159d157600080fd5b611eb584828501615988565b600080604083850312156159f057600080fd5b82356159fb81615574565b9150602083013561588c81615541565b60008060408385031215615a1e57600080fd5b8235615a2981615574565b9150602083013561588c8161571f565b60008060008060808587031215615a4f57600080fd5b8435615a5a81615574565b93506020850135615a6a81615574565b925060408501359150606085013567ffffffffffffffff811115615a8d57600080fd5b8501601f81018713615a9e57600080fd5b615aad8782356020840161594a565b91505092959194509250565b8060005b600381101561181f578151845260209384019390910190600101615abd565b815181526020808301519082015260408083015190820152606080830151908201526080808301519082015260a0808301519082015260c0808301519082015260e08083015190820152610100808301519082015261012080830151908201526101408083015190820152610160808301519082015261018080830151908201526101a080830151908201526101c080830151908201526101e0808301519082015261020080830151908201526102208083015161028083019190615ba382850182615ab9565b505092915050565b600060208284031215615bbd57600080fd5b81356116bf8161571f565b60008060408385031215615bdb57600080fd5b8235615be681615574565b9150602083013561588c81615574565b60008060408385031215615c0957600080fd5b823567ffffffffffffffff811115615c2057600080fd5b615c2c85828601615988565b95602094909401359450505050565b600080600060408486031215615c5057600080fd5b83359250602084013567ffffffffffffffff811115615c6e57600080fd5b615c7a868287016156dd565b9497909650939450505050565b600181811c90821680615c9b57607f821691505b6020821081036120c057634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201615ce357615ce3615cbb565b5060010190565b634e487b7160e01b600052603260045260246000fd5b60008219821115615d1357615d13615cbb565b500190565b600060208284031215615d2a57600080fd5b815167ffffffffffffffff811115615d4157600080fd5b8201601f81018413615d5257600080fd5b8051615d6061595882615922565b818152856020838501011115615d7557600080fd5b613a7f8260208301602086016155a6565b600082821015615d9857615d98615cbb565b500390565b6000816000190483118215151615615db757615db7615cbb565b500290565b60006020808385031215615dcf57600080fd5b825167ffffffffffffffff80821115615de757600080fd5b818501915085601f830112615dfb57600080fd5b815181811115615e0d57615e0d6158db565b8060051b9150615e1e8483016158f1565b8181529183018401918481019088841115615e3857600080fd5b938501935b83851015615e5657845182529385019390850190615e3d565b98975050505050505050565b600081615e7157615e71615cbb565b506000190190565b600060208284031215615e8b57600080fd5b81516116bf8161571f565b600060208284031215615ea857600080fd5b5051919050565b60006001600160a01b03808716835280861660208401525083604083015260806060830152615ee160808301846155d2565b9695505050505050565b600060208284031215615efd57600080fd5b81516116bf81615541565b634e487b7160e01b600052601260045260246000fd5b60008251615f308184602087016155a6565b9190910192915050565b6001600160a01b0384168152826020820152606060408201526000613a7f60608301846155d2565b634e487b7160e01b600052602160045260246000fdfe697066733a2f2f516d57394e4b55475965735469597835695350316f3832746e344368713969317951563644426e7a7a6e72485448a264697066735822122072440053b890fc851549bbf36064722edb929bbb5153af02b62902b01c5fa63f64736f6c634300080d0033ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efb2393709b4cf0156fc89b28edf511f1d19de6851aa70ec585f949c7f16a7b523
Deployed Bytecode
0x6080604052600436106104d15760003560e01c806386481d4011610279578063bc8893b41161015e578063e1da26c6116100d6578063ea9384fa1161008a578063f40f0f521161006f578063f40f0f5214610c32578063f948dbf614610c52578063fe55932a14610c6557600080fd5b8063ea9384fa14610bff578063f2fde38b14610c1257600080fd5b8063e449f341116100bb578063e449f34114610b91578063e4a73e5b14610ba4578063e985e9c514610bc457600080fd5b8063e1da26c614610b76578063e2e06fa314610b7e57600080fd5b8063c9be651b1161012d578063cdaecb1911610112578063cdaecb1914610b46578063da4f633b14610b5b578063e17b25af14610b6357600080fd5b8063c9be651b14610b06578063cb4bd00e14610b2657600080fd5b8063bc8893b414610a8c578063c32d3ae214610aa6578063c3d33cb514610ad3578063c87b56dd14610ae657600080fd5b806399ff2190116101f1578063a22cb465116101c0578063b61f88b4116101a5578063b61f88b414610a44578063b88a802f14610a64578063b88d4fde14610a6c57600080fd5b8063a22cb46514610a0d578063aaab633914610a2d57600080fd5b806399ff2190146109bc5780639bbe87d9146109d25780639be65a60146109e5578063a035b1fe146109f857600080fd5b806390c3f38f116102485780639366c1fd1161022d5780639366c1fd1461097457806394985ddd1461098757806395d89b41146109a757600080fd5b806390c3f38f1461094e578063930bdc871461096157600080fd5b806386481d40146108db57806388486f86146108fb578063895d22061461091b5780638da5cb5b1461093057600080fd5b80632828adb2116103ba578063628cbb6d1161033257806370a08231116102e65780637284e416116102cb5780637284e416146108a05780637ee843cc146108b55780638091aa03146108c857600080fd5b806370a08231146108605780637168fcea1461088057600080fd5b806367f68fac1161031757806367f68fac146108005780636a8954b9146108135780636c08c6b11461084057600080fd5b8063628cbb6d146107c05780636352211e146107e057600080fd5b806341ab7f48116103895780634fc918bc1161036e5780634fc918bc1461077a5780635bb209a51461078d5780636035386a146107ad57600080fd5b806341ab7f481461074757806342842e0e1461075a57600080fd5b80632828adb2146106ff5780633307dcfe14610712578063392f37e91461071a5780633ccfd60b1461073f57600080fd5b8063110d62411161044d57806320fc7eb21161041c57806323b872dd1161040157806323b872dd146106a957806326e0d280146106c9578063279350bd146106df57600080fd5b806320fc7eb21461067657806322a2eced1461069657600080fd5b8063110d62411461061a578063176ca01d1461063a57806318160ddd1461064d5780631ae0b4ec1461066357600080fd5b806308ee0c74116104a45780630b747d91116104895780630b747d91146105de5780630ce90ec2146105f45780630fbf0a931461060757600080fd5b806308ee0c7414610590578063095ea7b3146105be57600080fd5b806301ffc9a7146104d6578063046dc1661461050b57806306fdde0314610520578063081812fc14610542575b600080fd5b3480156104e257600080fd5b506104f66104f1366004615557565b610c78565b60405190151581526020015b60405180910390f35b61051e610519366004615589565b610d15565b005b34801561052c57600080fd5b50610535610d62565b60405161050291906155fe565b34801561054e57600080fd5b5061057861055d366004615611565b6002602052600090815260409020546001600160a01b031681565b6040516001600160a01b039091168152602001610502565b34801561059c57600080fd5b506105b06105ab366004615589565b610df0565b604051908152602001610502565b3480156105ca57600080fd5b5061051e6105d936600461562a565b610e14565b3480156105ea57600080fd5b506105b0600d5481565b61051e610602366004615611565b610ee0565b61051e61061536600461569b565b61112a565b34801561062657600080fd5b50600954610578906001600160a01b031681565b61051e61064836600461572d565b61118b565b34801561065957600080fd5b506105b060045481565b61051e610671366004615611565b611280565b34801561068257600080fd5b506105b0610691366004615589565b6112b0565b61051e6106a4366004615798565b6112d6565b3480156106b557600080fd5b5061051e6106c4366004615804565b61136d565b3480156106d557600080fd5b506105b060125481565b3480156106eb57600080fd5b506105356106fa366004615845565b6115bd565b61051e61070d366004615611565b6116c6565b61051e611745565b34801561072657600080fd5b50600e546105789061010090046001600160a01b031681565b61051e6117a2565b61051e610755366004615611565b611825565b34801561076657600080fd5b5061051e610775366004615804565b6118e2565b61051e610788366004615798565b6118fd565b34801561079957600080fd5b506105b06107a8366004615611565b6119c0565b61051e6107bb36600461569b565b611a15565b3480156107cc57600080fd5b506105356107db366004615611565b611b58565b3480156107ec57600080fd5b506105786107fb366004615611565b611b71565b61051e61080e366004615867565b611b7f565b34801561081f57600080fd5b5061083361082e366004615589565b611cb2565b6040516105029190615897565b34801561084c57600080fd5b506105b061085b366004615611565b611e5f565b34801561086c57600080fd5b506105b061087b366004615589565b611ed0565b34801561088c57600080fd5b506105b061089b366004615589565b611f35565b3480156108ac57600080fd5b50610535611f64565b61051e6108c33660046159a8565b611f71565b61051e6108d6366004615589565b611fd2565b3480156108e757600080fd5b506105b06108f6366004615611565b61201f565b34801561090757600080fd5b50610578610916366004615611565b612036565b34801561092757600080fd5b506105b0612044565b34801561093c57600080fd5b506008546001600160a01b0316610578565b61051e61095c3660046159a8565b6120c6565b61051e61096f3660046159dd565b612104565b61051e610982366004615589565b612160565b34801561099357600080fd5b5061051e6109a2366004615845565b612366565b3480156109b357600080fd5b506105356123e9565b3480156109c857600080fd5b506105b060115481565b61051e6109e0366004615611565b6123f6565b61051e6109f3366004615589565b61246e565b348015610a0457600080fd5b506105b0612591565b348015610a1957600080fd5b5061051e610a28366004615a0b565b6125bc565b348015610a3957600080fd5b50600d5415156104f6565b348015610a5057600080fd5b50610535610a5f366004615611565b612628565b61051e612641565b348015610a7857600080fd5b5061051e610a87366004615a39565b61265b565b348015610a9857600080fd5b50600e546104f69060ff1681565b348015610ab257600080fd5b50610ac6610ac1366004615589565b61274e565b6040516105029190615adc565b61051e610ae1366004615798565b6129bc565b348015610af257600080fd5b50610535610b01366004615611565b612a60565b348015610b1257600080fd5b50610833610b2136600461562a565b612bc9565b348015610b3257600080fd5b506104f6610b4136600461562a565b612e71565b348015610b5257600080fd5b5061053561342e565b61051e61343b565b61051e610b71366004615589565b613457565b61051e6134c1565b61051e610b8c366004615bab565b61355a565b61051e610b9f36600461569b565b613598565b348015610bb057600080fd5b50600f54610578906001600160a01b031681565b348015610bd057600080fd5b506104f6610bdf366004615bc8565b600360209081526000928352604080842090915290825290205460ff1681565b61051e610c0d366004615bf6565b6135e4565b348015610c1e57600080fd5b5061051e610c2d366004615589565b613759565b348015610c3e57600080fd5b506105b0610c4d366004615589565b6137a6565b61051e610c60366004615c3b565b6137ca565b61051e610c73366004615c3b565b6138f3565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161480610cdb57507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b80610d0f57507f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b6008546001600160a01b03163314610d4057604051633e8be92f60e01b815260040160405180910390fd5b601080546001600160a01b0319166001600160a01b0392909216919091179055565b60008054610d6f90615c87565b80601f0160208091040260200160405190810160405280929190818152602001828054610d9b90615c87565b8015610de85780601f10610dbd57610100808354040283529160200191610de8565b820191906000526020600020905b815481529060010190602001808311610dcb57829003601f168201915b505050505081565b6001600160a01b03811660009081526006602052604081205460781c60ff16610d0f565b6000610e27610e2283611e5f565b613cab565b9050336001600160a01b03821614801590610e6657506001600160a01b038116600090815260036020908152604080832033845290915290205460ff16155b15610e84576040516327da82d560e11b815260040160405180910390fd5b60008281526002602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000610eeb82611e5f565b905080336001600160a01b03821614610f1757604051633a6bbed360e01b815260040160405180910390fd5b600160fc83901c016002811115610f5a576040517f921c7d5f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060010361100a57610ce460115410610f865760405163519f594360e01b815260040160405180910390fd5b60095460405163079cc67960e41b815233600482015268068155a43676e0000060248201526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015610fda57600080fd5b505af1158015610fee573d6000803e3d6000fd5b5050505060116000815461100190615cd1565b909155506110ae565b6104b06012541061102e5760405163519f594360e01b815260040160405180910390fd5b60095460405163079cc67960e41b81523360048201526812f939c99edab8000060248201526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561108257600080fd5b505af1158015611096573d6000803e3d6000fd5b505050506012600081546110a990615cd1565b909155505b60006110bf600160fc1b8501613cce565b90506110d08460dc1c600116151590565b80156110de575060185460ff165b156111125760006110ed613d17565b90506110fb81878785613d36565b336000908152600660205260409020919091559150505b60009485526005602052604090942093909355505050565b6000611134613d17565b905060005b82811015611176576111643385858481811061115757611157615cea565b9050602002013584613dc5565b915061116f81615cd1565b9050611139565b50336000908152600660205260409020555050565b3233146111ab57604051632514e60160e21b815260040160405180910390fd5b600e5460ff16156111e8576040517f04cc9ce200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6111f3838386613f4d565b611229576040517f8baa579f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526006602052604081205460141c620fffff1690508461124e8783615d00565b111561126d57604051632795088960e11b815260040160405180910390fd5b611278338784613fed565b505050505050565b6008546001600160a01b031633146112ab57604051633e8be92f60e01b815260040160405180910390fd5b601355565b6001600160a01b03811660009081526006602052604081205460141c620fffff16610d0f565b6008546001600160a01b0316331461130157604051633e8be92f60e01b815260040160405180910390fd5b60005b838110156113665761135685858381811061132157611321615cea565b90506020020160208101906113369190615589565b84848481811061134857611348615cea565b905060200201356000613fed565b61135f81615cd1565b9050611304565b5050505050565b306001600160a01b038316036113aa576000611387613d17565b9050611394338383613dc5565b3360009081526006602052604090205550505050565b60006113b582611e5f565b905060006113c282613cab565b90506000336001600160a01b038316148061140057506001600160a01b038216600090815260036020908152604080832033845290915290205460ff165b8061142157506000848152600260205260409020546001600160a01b031633145b905080611441576040516327da82d560e11b815260040160405180910390fd5b6001600160a01b038516611481576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b856001600160a01b0316826001600160a01b0316146114cc576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600084815260026020526040902080546001600160a01b031916905561154a611545426115198861150060018a0189614342565b6001600160a01b0319166001600160a01b039091161790565b7fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff1660a09190911b1790565b6143a6565b6000858152600560209081526040808320939093556001600160a01b038981168084526006909252838320805460001901905588168083528383208054600101905592518793927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a45050505b505050565b60606115c8836143c9565b6115e55760405163163a09e160e31b815260040160405180910390fd5b60185460ff1615806116055750600e5461010090046001600160a01b0316155b1561162a57604051806060016040528060358152602001615f79603591399050610d0f565b600e546040517f452ce83e00000000000000000000000000000000000000000000000000000000815260048101859052602481018490526101009091046001600160a01b03169063452ce83e90604401600060405180830381865afa158015611697573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116bf9190810190615d18565b9392505050565b60006116d76116d483611e5f565b90565b90506001600160a01b038116331480159061170c5750336117006008546001600160a01b031690565b6001600160a01b031614155b1561172a57604051633a6bbed360e01b815260040160405180910390fd5b60008281526014602052604081206117419161534c565b5050565b6008546001600160a01b0316331461177057604051633e8be92f60e01b815260040160405180910390fd5b600d541561179157604051631f5ae5c960e21b815260040160405180910390fd5b61179c600143615d86565b40600d55565b6008546001600160a01b031633146117cd57604051633e8be92f60e01b815260040160405180910390fd5b600f5460405147916001600160a01b0316908290600081818185875af1925050503d806000811461181a576040519150601f19603f3d011682016040523d82523d6000602084013e61181f565b606091505b50505050565b600061182f613d17565b905060ff60c082901c16808303611872576040517f61de27c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b821580159061188857506118863384612e71565b155b156118bf576040517fc1757b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff60c01b19821660c084901b1733600090815260066020526040902055505050565b6115b88383836040518060200160405280600081525061265b565b6008546001600160a01b0316331461192857604051633e8be92f60e01b815260040160405180910390fd5b60005b8181101561136657600083838381811061194757611947615cea565b9050602002013590508060000361195d57600080fd5b85858381811061196f5761196f615cea565b90506020020160208101906119849190615589565b6000918252600b602052604090912080546001600160a01b0319166001600160a01b039092169190911790556119b981615cd1565b905061192b565b60185460009060ff166119e65760405163847b198f60e01b815260040160405180910390fd5b6119ef826143c9565b611a0c5760405163163a09e160e31b815260040160405180910390fd5b610d0f8261442b565b60185460ff16611a385760405163847b198f60e01b815260040160405180910390fd5b6000611a42613d17565b905060008060005b84811015611b3e57858582818110611a6457611a64615cea565b905060200201359250611a7683611e5f565b915033826001600160a01b031614611aa157604051633a6bbed360e01b815260040160405180910390fd5b611ab08260dc1c600116151590565b611acd576040516333155e1360e21b815260040160405180910390fd5b60f882901c600f1615611b0c576040517f6e62ff6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611b1884848485613d36565b60008581526005602052604090208190559094509150611b3781615cd1565b9050611a4a565b505033600090815260066020526040902091909155505050565b60156020526000908152604090208054610d6f90615c87565b6000610d0f610e2283611e5f565b323314611b9f57604051632514e60160e21b815260040160405180910390fd5b600e5460ff16611bdb576040517fc7d08f0400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8160031015611bfd57604051632795088960e11b815260040160405180910390fd5b6000611c07612591565b9050611c138382615d9d565b3414611c4b576040517fd2ade55600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b80600003611ca7573360009081526006602052604081205460141c620fffff1690506003611c798583615d00565b1115611c9857604051632795088960e11b815260040160405180910390fd5b83600114611ca557600192505b505b6115b8338484613fed565b60185460609060ff16611cd357505060408051600081526020810190915290565b6040517fc9be651b0000000000000000000000000000000000000000000000000000000081526001600160a01b038316600482015260016024820152600090309063c9be651b90604401600060405180830381865afa158015611d3a573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611d629190810190615dbc565b6001600160a01b038416600090815260066020526040812054919250611d888583614469565b90506000805b8451811015611e2857611db9858281518110611dac57611dac615cea565b6020026020010151611e5f565b915060f882901c600f16600003611df757611def84868381518110611de057611de0615cea565b60200260200101518485613d36565b509350611e18565b6000858281518110611e0b57611e0b615cea565b6020026020010181815250505b611e2181615cd1565b9050611d8e565b506000611e358785614469565b9050828111611e5257604080516000815260208101909152611e54565b845b979650505050505050565b6000611e6a826143c9565b611e875760405163163a09e160e31b815260040160405180910390fd5b815b6000818152600560205260409020548015611ebd57838214611eb357611eae816144ae565b611eb5565b805b949350505050565b5080611ec881615e62565b915050611e89565b60006001600160a01b038216611f12576040517fcbe7266800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038216600090815260066020526040902054620fffff16610d0f565b6001600160a01b0381166000908152600660205260408120546116bf60ff607883901c16620fffff8316615d00565b60168054610d6f90615c87565b6008546001600160a01b03163314611f9c57604051633e8be92f60e01b815260040160405180910390fd5b60185460ff16611fbf5760405163847b198f60e01b815260040160405180910390fd5b8051611741906017906020840190615386565b6008546001600160a01b03163314611ffd57604051633e8be92f60e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b6000610d0f61202d83611e5f565b60fc1c60010190565b6000610d0f6116d483611e5f565b6000807f00000000000000000000000000000000000000000000000000000000000000015b6004547f0000000000000000000000000000000000000000000000000000000000000001018110156120c0576120ac6120a182611e5f565b60dc1c600116151590565b156120b8578160010191505b600101612069565b50919050565b6008546001600160a01b031633146120f157604051633e8be92f60e01b815260040160405180910390fd5b8051611741906016906020840190615386565b6008546001600160a01b0316331461212f57604051633e8be92f60e01b815260040160405180910390fd5b6001600160a01b03919091166000908152600c60205260409020805463ffffffff191660e09290921c919091179055565b600061216a613d17565b6001600160a01b0383166000908152600a60205260408120549192508190036121bf576040517f8792488500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015261dead6024820152604481018290526000906001600160a01b038516906323b872dd906064016020604051808303816000875af1158015612230573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122549190615e79565b90508061228d576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006122998460da1c90565b905042620bdd806122aa8184615d00565b6122b49190615d00565b11156122ec576040517fce347a8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7b03ffffffffffffffffffffffffffffffffffffffffffffffffffffff84164260da1b173360009081526006602090815260409182902092909255516001600160a01b03871681527faa30aaf13ce297e169ade8c74495e8ca52c662afc30e851ee8ca4b2c3bda82f9910160405180910390a15050505050565b336001600160a01b037f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb795216146123e35760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c0060448201526064015b60405180910390fd5b600d5550565b60018054610d6f90615c87565b60006124046116d483611e5f565b90506001600160a01b038116331480159061243957503361242d6008546001600160a01b031690565b6001600160a01b031614155b1561245757604051633a6bbed360e01b815260040160405180910390fd5b60008281526015602052604081206117419161534c565b6008546001600160a01b0316331461249957604051633e8be92f60e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156124e0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125049190615e96565b6040517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018290529091506001600160a01b0383169063a9059cbb906044016020604051808303816000875af115801561256d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115b89190615e79565b6000610dac600454106125ab5766470de4df8200006125ae565b60005b66ffffffffffffff16905090565b3360008181526003602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60146020526000908152604090208054610d6f90615c87565b612649613d17565b33600090815260066020526040902055565b61266684848461136d565b6001600160a01b0383163b1580159061271757506040517f150b7a0200000000000000000000000000000000000000000000000000000000808252906001600160a01b0385169063150b7a02906126c7903390899088908890600401615eaf565b6020604051808303816000875af11580156126e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061270a9190615eeb565b6001600160e01b03191614155b1561181f576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61275661540a565b6001600160a01b038216600090815260066020526040902054607881901c60ff1682526127b481608081901c60ff9081161515608883901c8216151501609083901c8216151501609883901c821615150160a09290921c1615150190565b602083015260646127c4826144e3565b816127d1576127d1615f08565b04604083015260646127e3848361454c565b816127f0576127f0615f08565b046060830152620bdd806128048260da1c90565b014210612812576000612815565b600a5b6080830152602881901c64ffffffffff1660a083018190521580159061284a575062278d00602882901c64ffffffffff160142115b612855576000612858565b600a5b60c083015260d281901c60ff166101208301527f000000000000000000000000000000000000000000000000000000006296981042118061289e5750607881901c60ff16155b6128d9576064607882901c60ff166107d060d284901c60ff1602816128c5576128c5615f08565b04816128d3576128d3615f08565b046128dc565b60005b61014083015260c881901c6103ff1660e083015260646128fb82614579565b8161290857612908615f08565b04610100830181905261014083015160c084015160808501516060860151604087015101010190910101610160830181905260a882901c60ff166101fe60af84901c16016103fc60b684901c16016101808401819052670429d069189e00008082026101a0860152606492830190910202046101c083015261298a83826145aa565b6101e083015261299a8160da1c90565b4203620bdd80036102008301526129b081614673565b61022083015250919050565b6008546001600160a01b031633146129e757604051633e8be92f60e01b815260040160405180910390fd5b60005b8381101561136657828282818110612a0457612a04615cea565b90506020020135600a6000878785818110612a2157612a21615cea565b9050602002016020810190612a369190615589565b6001600160a01b03168152602081019190915260400160002055612a5981615cd1565b90506129ea565b6060612a6b826143c9565b612a885760405163163a09e160e31b815260040160405180910390fd5b60185460ff161580612aa85750600e5461010090046001600160a01b0316155b15612acc57604051806060016040528060358152602001615f796035913992915050565b600e546040517f86481d40000000000000000000000000000000000000000000000000000000008152600481018490526101009091046001600160a01b03169063452ce83e90849030906386481d4090602401602060405180830381865afa158015612b3c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b609190615e96565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381865afa158015612ba1573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610d0f9190810190615d18565b606060008215612ca75782600114612c62576040517f7168fcea0000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201523090637168fcea906024015b602060405180830381865afa158015612c39573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c5d9190615e96565b612d0f565b6040517f08ee0c740000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015230906308ee0c7490602401612c1c565b6040516370a0823160e01b81526001600160a01b038516600482015230906370a0823190602401602060405180830381865afa158015612ceb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d0f9190615e96565b905060008167ffffffffffffffff811115612d2c57612d2c6158db565b604051908082528060200260200182016040528015612d55578160200160208202803683370190505b50905081600003612d69579150610d0f9050565b60007f00000000000000000000000000000000000000000000000000000000000000015b7f000000000000000000000000000000000000000000000000000000000000000160045401811015612e66576000612dc482611e5f565b9050806001600160a01b0316886001600160a01b031603612e5d576000612df08260dc1c600116151590565b905087158015612dfe575080155b80612e115750876001148015612e115750805b80612e1c5750876002145b15612e5b5782858580600101965081518110612e3a57612e3a615cea565b602002602001018181525050838603612e5b57849650505050505050610d0f565b505b50600101612d8d565b509095945050505050565b600081600003612e8357506000610d0f565b601382101561329157604080516102608101825260008152734bb33f6e69fd62cf3abbcc6f1f43b94a5d572c2b602082015273bea8123277142de42571f1fac045225a1d347977918101919091527312d2d1bed91c24f878f37e66bd829ce7197e4d146060820152730c2e57efddba8c768147d1fdf9176a0a6ebd5d836080820152736e5a65b5f9dd7b1b08ff212e210dcd642de0db8b60a08201527317ed38f5f519c6ed563be6486e629041bed3dfbc60c082015273dd67892e722be69909d7c285db572852d5f8897c60e0820152738a90cab2b38dba80c64b7734e58ee1db38b8992e610100820152736f44db5ed6b86d9cc6046d0c78b82cad9e600f6a61012082015273219b8ab790decc32444a6600971c7c371825253961014082015273c4a0b1e7aa137ada8b2f911a501638088dfdd508610160820152739712228ceeda1e2ddde52cd5100b88986d1cb49c6101808201527356b391339615fd0e88e0d370f451fa91478bb20f6101a082015273648e8428e0104ec7d08667866a3568a72fe3898f6101c082015273d2f668a8461d6761115daf8aeb3cdf5f40c532c66101e082015273bad6186e92002e312078b5a1dafd5ddf63d3f73161020082015273cb4307f1c3b5556256748ddf5b86e81258990b3c610220820152735c211b8e4f93f00e2bd68e82f4e00fbb3302b35c61024082015280836013811061308e5761308e615cea565b60200201516040516370a0823160e01b81526001600160a01b038681166004830152909116906370a0823190602401602060405180830381865afa1580156130da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130fe9190615e96565b1561310d576001915050610d0f565b82600a036131bd5780836013811061312757613127615cea565b60200201516040517f7dd54ea70000000000000000000000000000000000000000000000000000000081526001600160a01b03868116600483015290911690637dd54ea7906024015b602060405180830381865afa15801561318d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131b19190615e96565b60001415915050610d0f565b82600c03613224578083601381106131d7576131d7615cea565b60200201516040517f4da6a5560000000000000000000000000000000000000000000000000000000081526001600160a01b03868116600483015290911690634da6a55690602401613170565b8260100361328b5780836013811061323e5761323e615cea565b60200201516040517f46a43d9a0000000000000000000000000000000000000000000000000000000081526001600160a01b038681166004830152909116906346a43d9a90602401613170565b50613425565b6000828152600b60205260409020546001600160a01b03168015613423576040516370a0823160e01b81526001600160a01b0385811660048301528216906370a0823190602401602060405180830381865afa1580156132f5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133199190615e96565b15613328576001915050610d0f565b6001600160a01b0381166000908152600c602052604090205460e01b6001600160e01b0319811615613421576040516001600160a01b0386811660248301526000918291851690849060440160408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516133b29190615f1e565b600060405180830381855afa9150503d80600081146133ed576040519150601f19603f3d011682016040523d82523d6000602084013e6133f2565b606091505b50915091508180156134165750808060200190518101906134139190615e96565b15155b945050505050610d0f565b505b505b50600092915050565b60178054610d6f90615c87565b3360009081526006602052604090205460ff60c01b1916612649565b6008546001600160a01b0316331461348257604051633e8be92f60e01b815260040160405180910390fd5b600e80546001600160a01b03909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b6008546001600160a01b031633146134ec57604051633e8be92f60e01b815260040160405180910390fd5b600d541561350d57604051631f5ae5c960e21b815260040160405180910390fd5b6135577faa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af4457f0000000000000000000000000000000000000000000000001bc16d674ec800006146ad565b50565b6008546001600160a01b0316331461358557604051633e8be92f60e01b815260040160405180910390fd5b600e805460ff1916911515919091179055565b60006135a2613d17565b905060005b82811015611176576135d2338585848181106135c5576135c5615cea565b9050602002013584614829565b91506135dd81615cd1565b90506135a7565b6008546001600160a01b0316331461360f57604051633e8be92f60e01b815260040160405180910390fd5b600d54613648576040517f7607330600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60185460ff1615613685576040517fb22df23900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516020810183905201604051602081830303815290604052805190602001207fb2393709b4cf0156fc89b28edf511f1d19de6851aa70ec585f949c7f16a7b523146136ff576040517f3fbcde7200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6018805460ff19166001179055815161371f906017906020850190615386565b5061174181600d54604080516020810192909252810182905260600160408051601f198184030181529190528051602090910120600d5550565b6008546001600160a01b0316331461378457604051633e8be92f60e01b815260040160405180910390fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815260066020526040812054610d0f9083906145aa565b8260006137d682611e5f565b905060006137ef64ffffffffff60a084901c1642615d86565b905033826001600160a01b03161461381a57604051633a6bbed360e01b815260040160405180910390fd5b60135481101561383d57604051639a6a107b60e01b815260040160405180910390fd5b613849858560236149ce565b61386657604051630ec0325960e21b815260040160405180910390fd5b60095460405163079cc67960e41b815233600482015267d02ab486cedc000060248201526001600160a01b03909116906379cc679090604401600060405180830381600087803b1580156138b957600080fd5b505af11580156138cd573d6000803e3d6000fd5b50505060008781526015602052604090206138ea9150868661549a565b50505050505050565b8260006138ff82611e5f565b9050600061391864ffffffffff60a084901c1642615d86565b905033826001600160a01b03161461394357604051633a6bbed360e01b815260040160405180910390fd5b60135481101561396657604051639a6a107b60e01b815260040160405180910390fd5b613972858560146149ce565b61398f57604051630ec0325960e21b815260040160405180910390fd5b60095460405163079cc67960e41b815233600482015268015af1d78b58c4000060248201526001600160a01b03909116906379cc679090604401600060405180830381600087803b1580156139e357600080fd5b505af11580156139f7573d6000803e3d6000fd5b50505060008781526014602052604090206138ea9150868661549a565b60141c620fffff1690565b60141b0190565b60006001600160a01b03841660a084901b177901000000000000000000000000000000000000000000000000001782613a5f5780613a7f565b7b3000000000000000000000000000000000000000000000000000000081175b95945050505050565b600160de1b1790565b60781c60ff1690565b60781b0190565b60281b69ffffffffff000000000019919091161790565b0190565b60501b6effffffffff0000000000000000000019919091161790565b60dd1c600116151590565b60f81c600f1690565b600060f4613af983613be0565b901b60f86001600560ff861606017ff00fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8616911b1717905092915050565b6000600f60f883901c168015613b635760016078600383901b011b93909301602c83901c600f60c81b1601925b613b728360dd1c600116151590565b15613b99577a04000000000000000000000000000000000000000000000000000093909301925b5050600160fc9190911c810160031b60a0011b0190565b60501c64ffffffffff1690565b60a881901c60ff166101fe60af83901c16016103fc60b69290921c919091160190565b600060ff600883901c16606c811115613bfc5750600092915050565b6049811115613c0e5750600192915050565b6011811115613c205750600292915050565b50600392915050565b6000600560ff8316066001019050919050565b60f41c600f1690565b60da1c90565b60281c64ffffffffff1690565b60d21c60ff1690565b60c81c6103ff1690565b60c01c60ff1690565b608081901c60ff9081161515608883901c8216151501609083901c8216151501609883901c821615150160a09290921c1615150190565b6000613cbc8260dc1c600116151590565b15613cc8575030919050565b81610d0f565b600080613ce560c884901c620fffff166002614bad565b60c81b7ffffffffff00000ffffffffffffffffffffffffffffffffffffffffffffffffff939093169290921792915050565b33600090815260066020526040812054613d3081614bc3565b91505090565b600080808060f885901c600f16600003613d6257613d5d613d568861442b565b8690613aec565b613d64565b845b9050613d7a81613d748a89614bf6565b90613b36565b6fffffffffffffffffffffffffffffffff19166fffffffffffffffffffffffffffffffff89161793506001600160e01b0319166001600160e01b038516179150505b94509492505050565b600060ff607883901c1681613dd985611e5f565b90506000613de682613cab565b905060648310613e0957604051634543792f60e11b815260040160405180910390fd5b866001600160a01b0316816001600160a01b031614613e3b57604051633a6bbed360e01b815260040160405180910390fd5b600086815260026020526040812080546001600160a01b031916905580613e63888886614c7b565b90925090506fffffffffffffffffffffffffffffffff87166fffffffffffffffffffffffffffffffff198316176001600160e01b0385166001600160e01b03198316179097507b10000000000000000000000000000000000000000000000000000000179350613edb600160001989019060781b0190565b965084600003613efb5769ffffffffff00000000001987164260281b1796505b60008881526005602052604080822086905551899130916001600160a01b038d16917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a45094979650505050505050565b60408051306020820152339181019190915260608101829052600090819060800160408051601f198184030181528282528051602091820120601054601f890183900483028501830190935287845293506001600160a01b0390911691613fda918890889081908401838280828437600092019190915250613fd49250869150614cdd9050565b90614d30565b6001600160a01b03161495945050505050565b6004546001600160a01b0384166000818152600660205260409020547f0000000000000000000000000000000000000000000000000000000000000001830191620fffff601483901c169061406e576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b856000036140a8576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000013888685011115614104576040517fed70473800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000328682011180156141355750303b15155b1561416c576040517fd7fac8c700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b336001600160a01b0388160361418b57614188828760141b0190565b91505b6000614198884288613a26565b9050866001036141a957600160de1b175b85156142b35760ff607884901c166141c084614bc3565b93506141ce848960781b0190565b9350606488820111156141f457604051634543792f60e11b815260040160405180910390fd5b806000036142125769ffffffffff00000000001984164260281b1793505b6000805b898110156142ab57808701915061422e828786614c7b565b604051919750945082906001600160a01b038d16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4604051829030906001600160a01b038e16907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90600090a4600101614216565b505050614306565b9186019160005b8781101561430457604051858201906001600160a01b038b16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a46001016142ba565b505b6001600160a01b039097166000908152600660209081526040808320949094559381526005909352509020939093555060048054909101905550565b60006143538260de1c600116151590565b15801561436c5750600083815260056020526040902054155b801561437c575061437c836143c9565b1561439a5761438a826144ae565b6000848152600560205260409020555b600160de1b82176116bf565b600080613ce56143c0620fffff60c886901c166001615d00565b620fffff614bad565b6000817f000000000000000000000000000000000000000000000000000000000000000111158015610d0f5750600454614423907f0000000000000000000000000000000000000000000000000000000000000001615d00565b821092915050565b6000600d548260405160200161444b929190918252602082015260400190565b60408051601f19818403018152919052805160209091012092915050565b600061447482614d54565b61447d83614db0565b61448684614e16565b61448f85614579565b614499878761454c565b6144a2876144e3565b01010101019392505050565b60006144bf8260dd1c600116151590565b6144ca5760046144cd565b60025b60ff166001600160e01b03901c82169050919050565b60008061452183608081901c60ff9081161515608883901c8216151501609083901c8216151501609883901c821615150160a09290921c1615150190565b905060038110614543576005811061453b57610dac6116bf565b6107d06116bf565b60009392505050565b600060ff60c083901c166145608482612e71565b61456e576000915050610d0f565b506103e89392505050565b600060ff607883901c16801561454357806103e860c885901c6103ff1602816145a4576145a4615f08565b046116bf565b600064ffffffffff605083901c168082036145c9576000915050610d0f565b60006145f57f000000000000000000000000000000000000000000000000000000006bad7f9042614bad565b905060008282106146085782820361460b565b60005b905062015180670429d069189e000060b687901c6103fc1660af88901c6101fe1660ff60a88a901c160101830202046000819003614650576000945050505050610d0f565b600061465c8888614469565b905061271080820183020498975050505050505050565b61467b61550e565b506040805160608101825260ff60a884901c8116825260b084901c8116602083015260b89390931c9092169082015290565b60007f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca6001600160a01b0316634000aea07f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb79528486600060405160200161471d929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b815260040161474a93929190615f3a565b6020604051808303816000875af1158015614769573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061478d9190615e79565b50600083815260076020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a0909101909252815191830191909120938790529190526147e9906001615d00565b600085815260076020526040902055611eb58482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b60008061483584611e5f565b90508060dc81901c60011615156001600160a01b038083169088161461486e57604051633a6bbed360e01b815260040160405180910390fd5b8061488c576040516333155e1360e21b815260040160405180910390fd5b60008061489a888887614eea565b90925090506fffffffffffffffffffffffffffffffff87166fffffffffffffffffffffffffffffffff198316176001600160e01b0386166001600160e01b031983161790975094506148f18560dd1c600116151590565b1561492e5761492b6149068960010187614342565b7fffffffffdfffffffffffffffffffffffffffffffffffffffffffffffffffffff1690565b94505b6000888152600560205260408082207fffffffffefffffffffffffffffffffffffffffffffffffffffffffffffffffff9790971696879055516efffffffffffffffffffffffffffffe199890980169ffffffffff000000000019164260281b179789916001600160a01b038c169130917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a45094979650505050505050565b60008084848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250508251929350506001909110905080614a1d5750828151115b80614a4d575080600081518110614a3657614a36615cea565b6020910101516001600160f81b031916600160fd1b145b80614a80575080600182510381518110614a6957614a69615cea565b6020910101516001600160f81b031916600160fd1b145b15614a8f5760009150506116bf565b600081600081518110614aa457614aa4615cea565b01602001516001600160f81b03191690506000805b8351811015614b9f57838181518110614ad457614ad4615cea565b01602001516001600160f81b0319169150600360fd1b82118015614b055750607b60f81b6001600160f81b03198316105b80614b355750600160fe1b6001600160f81b03198316118015614b355750605b60f81b6001600160f81b03198316105b80614b4d5750600160fd1b6001600160f81b03198316145b80614b7d5750602f60f81b6001600160f81b03198316118015614b7d5750601d60f91b6001600160f81b03198316105b15614b8a57819250614b97565b60009450505050506116bf565b600101614ab9565b506001979650505050505050565b6000818310614bbc57816116bf565b5090919050565b600080614bd033846145aa565b90506effffffffff000000000000000000001983164260501b179250614bbc3382614f6b565b6000600f60f883901c168015614c2557600f60c81b602c84901c1660016078600384901b011b90940393909303925b614c348360dd1c600116151590565b15614c5f577ffffffffffffc0000000000000000000000000000000000000000000000000000909301925b600360fc84901c6001016001911b60a0011b9093039392505050565b600080614c8d8360dd1c600116151590565b158015614c9f575060f883901c600f16155b8015614cad575060185460ff165b15614cc857614cc5614cbe8661442b565b8490613aec565b92505b614cd28484613b36565b959294509192505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b6000806000614d3f8585614fec565b91509150614d4c8161505a565b509392505050565b6000605082901c64ffffffffff1660da83901c620bdd800180821115614d7e575060009392505050565b804211614d9057506103e89392505050565b8142038282036103e80281614da757614da7615f08565b04949350505050565b600064ffffffffff602883901c1662278d00810142811115614dd6575060009392505050565b64ffffffffff605085901c16818110614df557506103e8949350505050565b8042038242036103e80281614e0c57614e0c615f08565b0495945050505050565b600060ff60d283901c1664ffffffffff605084901c16811580614e5857507f000000000000000000000000000000000000000000000000000000006296981081115b15614e67575060009392505050565b6000607885901c60ff166107d0840281614e8357614e83615f08565b0490507f00000000000000000000000000000000000000000000000000000000629698104211614eb557949350505050565b814203827f000000000000000000000000000000000000000000000000000000006296981003820281614e0c57614e0c615f08565b600080614ef78484614bf6565b9350614f088360dd1c600116151590565b8015614f2a57506203f480614f2864ffffffffff60a086901c1642615d86565b105b15614f61576040517f463e718b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5091939092509050565b8015611741576009546040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b158015614fd857600080fd5b505af1158015611278573d6000803e3d6000fd5b60008082516041036150225760208301516040840151606085015160001a61501687828585615210565b94509450505050615053565b825160400361504b57602083015160408401516150408683836152fa565b935093505050615053565b506000905060025b9250929050565b600081600481111561506e5761506e615f62565b036150765750565b600181600481111561508a5761508a615f62565b036150d75760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016123da565b60028160048111156150eb576150eb615f62565b036151385760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016123da565b600381600481111561514c5761514c615f62565b036151a45760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016123da565b60048160048111156151b8576151b8615f62565b036135575760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016123da565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156152475750600090506003613dbc565b8460ff16601b1415801561525f57508460ff16601c14155b156152705750600090506004613dbc565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa1580156152c4573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381166152ed57600060019250925050613dbc565b9660009650945050505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168161533060ff86901c601b615d00565b905061533e87828885615210565b935093505050935093915050565b50805461535890615c87565b6000825580601f10615368575050565b601f016020900490600052602060002090810190613557919061552c565b82805461539290615c87565b90600052602060002090601f0160209004810192826153b457600085556153fa565b82601f106153cd57805160ff19168380011785556153fa565b828001600101855582156153fa579182015b828111156153fa5782518255916020019190600101906153df565b5061540692915061552c565b5090565b604051806102400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200161549561550e565b905290565b8280546154a690615c87565b90600052602060002090601f0160209004810192826154c857600085556153fa565b82601f106154e15782800160ff198235161785556153fa565b828001600101855582156153fa579182015b828111156153fa5782358255916020019190600101906154f3565b60405180606001604052806003906020820280368337509192915050565b5b80821115615406576000815560010161552d565b6001600160e01b03198116811461355757600080fd5b60006020828403121561556957600080fd5b81356116bf81615541565b6001600160a01b038116811461355757600080fd5b60006020828403121561559b57600080fd5b81356116bf81615574565b60005b838110156155c15781810151838201526020016155a9565b8381111561181f5750506000910152565b600081518084526155ea8160208601602086016155a6565b601f01601f19169290920160200192915050565b6020815260006116bf60208301846155d2565b60006020828403121561562357600080fd5b5035919050565b6000806040838503121561563d57600080fd5b823561564881615574565b946020939093013593505050565b60008083601f84011261566857600080fd5b50813567ffffffffffffffff81111561568057600080fd5b6020830191508360208260051b850101111561505357600080fd5b600080602083850312156156ae57600080fd5b823567ffffffffffffffff8111156156c557600080fd5b6156d185828601615656565b90969095509350505050565b60008083601f8401126156ef57600080fd5b50813567ffffffffffffffff81111561570757600080fd5b60208301915083602082850101111561505357600080fd5b801515811461355757600080fd5b60008060008060006080868803121561574557600080fd5b8535945060208601359350604086013567ffffffffffffffff81111561576a57600080fd5b615776888289016156dd565b909450925050606086013561578a8161571f565b809150509295509295909350565b600080600080604085870312156157ae57600080fd5b843567ffffffffffffffff808211156157c657600080fd5b6157d288838901615656565b909650945060208701359150808211156157eb57600080fd5b506157f887828801615656565b95989497509550505050565b60008060006060848603121561581957600080fd5b833561582481615574565b9250602084013561583481615574565b929592945050506040919091013590565b6000806040838503121561585857600080fd5b50508035926020909101359150565b6000806040838503121561587a57600080fd5b82359150602083013561588c8161571f565b809150509250929050565b6020808252825182820181905260009190848201906040850190845b818110156158cf578351835292840192918401916001016158b3565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561591a5761591a6158db565b604052919050565b600067ffffffffffffffff82111561593c5761593c6158db565b50601f01601f191660200190565b600061595d61595884615922565b6158f1565b905082815283838301111561597157600080fd5b828260208301376000602084830101529392505050565b600082601f83011261599957600080fd5b6116bf8383356020850161594a565b6000602082840312156159ba57600080fd5b813567ffffffffffffffff8111156159d157600080fd5b611eb584828501615988565b600080604083850312156159f057600080fd5b82356159fb81615574565b9150602083013561588c81615541565b60008060408385031215615a1e57600080fd5b8235615a2981615574565b9150602083013561588c8161571f565b60008060008060808587031215615a4f57600080fd5b8435615a5a81615574565b93506020850135615a6a81615574565b925060408501359150606085013567ffffffffffffffff811115615a8d57600080fd5b8501601f81018713615a9e57600080fd5b615aad8782356020840161594a565b91505092959194509250565b8060005b600381101561181f578151845260209384019390910190600101615abd565b815181526020808301519082015260408083015190820152606080830151908201526080808301519082015260a0808301519082015260c0808301519082015260e08083015190820152610100808301519082015261012080830151908201526101408083015190820152610160808301519082015261018080830151908201526101a080830151908201526101c080830151908201526101e0808301519082015261020080830151908201526102208083015161028083019190615ba382850182615ab9565b505092915050565b600060208284031215615bbd57600080fd5b81356116bf8161571f565b60008060408385031215615bdb57600080fd5b8235615be681615574565b9150602083013561588c81615574565b60008060408385031215615c0957600080fd5b823567ffffffffffffffff811115615c2057600080fd5b615c2c85828601615988565b95602094909401359450505050565b600080600060408486031215615c5057600080fd5b83359250602084013567ffffffffffffffff811115615c6e57600080fd5b615c7a868287016156dd565b9497909650939450505050565b600181811c90821680615c9b57607f821691505b6020821081036120c057634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060018201615ce357615ce3615cbb565b5060010190565b634e487b7160e01b600052603260045260246000fd5b60008219821115615d1357615d13615cbb565b500190565b600060208284031215615d2a57600080fd5b815167ffffffffffffffff811115615d4157600080fd5b8201601f81018413615d5257600080fd5b8051615d6061595882615922565b818152856020838501011115615d7557600080fd5b613a7f8260208301602086016155a6565b600082821015615d9857615d98615cbb565b500390565b6000816000190483118215151615615db757615db7615cbb565b500290565b60006020808385031215615dcf57600080fd5b825167ffffffffffffffff80821115615de757600080fd5b818501915085601f830112615dfb57600080fd5b815181811115615e0d57615e0d6158db565b8060051b9150615e1e8483016158f1565b8181529183018401918481019088841115615e3857600080fd5b938501935b83851015615e5657845182529385019390850190615e3d565b98975050505050505050565b600081615e7157615e71615cbb565b506000190190565b600060208284031215615e8b57600080fd5b81516116bf8161571f565b600060208284031215615ea857600080fd5b5051919050565b60006001600160a01b03808716835280861660208401525083604083015260806060830152615ee160808301846155d2565b9695505050505050565b600060208284031215615efd57600080fd5b81516116bf81615541565b634e487b7160e01b600052601260045260246000fd5b60008251615f308184602087016155a6565b9190910192915050565b6001600160a01b0384168152826020820152606060408201526000613a7f60608301846155d2565b634e487b7160e01b600052602160045260246000fdfe697066733a2f2f516d57394e4b55475965735469597835695350316f3832746e344368713969317951563644426e7a7a6e72485448a264697066735822122072440053b890fc851549bbf36064722edb929bbb5153af02b62902b01c5fa63f64736f6c634300080d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
b2393709b4cf0156fc89b28edf511f1d19de6851aa70ec585f949c7f16a7b523
-----Decoded View---------------
Arg [0] : secretHash_ (bytes32): 0xb2393709b4cf0156fc89b28edf511f1d19de6851aa70ec585f949c7f16a7b523
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : b2393709b4cf0156fc89b28edf511f1d19de6851aa70ec585f949c7f16a7b523
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.