Overview
TokenID
32
Total Transfers
-
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
MadMouse
Compiler Version
v0.8.12+commit.f00d7308
Optimization Enabled:
Yes with 1337 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
//SPDX-License-Identifier: MIT pragma solidity ^0.8.12; // 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 // 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 './MadMouseMetadata.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(); contract MadMouse 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 = 5555; uint256 constant MAX_PER_WALLET = 20; uint256 constant price = 0.085 ether; uint256 constant PURCHASE_LIMIT = 5; uint256 constant whitelistPrice = 0.075 ether; uint256 constant WHITELIST_PURCHASE_LIMIT = 5; MadMouseMetadata 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 = 3477; uint256 constant MAX_NUM_LEVEL_3 = 1399; uint256 constant NAME_CHANGE_COST = 50 * 1e18; uint256 constant BIO_CHANGE_COST = 25 * 1e18; uint256 constant MAX_LEN_NAME = 20; uint256 constant MAX_LEN_BIO = 35; uint256 constant MINT_AND_STAKE_MIN_HOLD_DURATION = 2 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_; } /* ------------- External ------------- */ // signatures will be created dynamically function mint( uint256 amount, bytes calldata signature, bool stake ) external payable noContract { if (!publicSaleActive) revert PublicSaleNotActive(); if (PURCHASE_LIMIT < amount) revert ExceedsLimit(); if (msg.value != price * amount) revert IncorrectValue(); if (!validSignature(signature, 0)) revert InvalidSignature(); _mintAndStake(msg.sender, amount, stake); } function whitelistMint( uint256 amount, uint256 limit, bytes calldata signature, bool stake ) external payable noContract { if (publicSaleActive) revert WhitelistNotActive(); if (WHITELIST_PURCHASE_LIMIT < limit) revert SignatureExceedsLimit(); if (msg.value != whitelistPrice * amount) revert IncorrectValue(); 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 tokenURI(uint256 tokenId) public view override returns (string memory) { if (!_exists(tokenId)) revert NonexistentToken(); if (!revealed || address(metadata) == address(0)) return unrevealedURI; return 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 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) external payable onlyOwner { for (uint256 i; i < to.length; ++i) _mintAndStake(to[i], 1, false); } function setSignerAddress(address address_) external payable onlyOwner { signerAddress = address_; } function setMetadataAddress(MadMouseMetadata 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.12; import './Gouda.sol'; import './MadMouse.sol'; import './MadMouseStaking.sol'; import './lib/Base64.sol'; import './lib/MetadataEncode.sol'; import './lib/Ownable.sol'; contract MadMouseMetadata is Ownable { using Strings for uint256; using MetadataEncode for bytes; using TokenDataOps for uint256; using DNAOps for uint256; struct Mouse { string role; string rarity; string fur; string expression; string glasses; string hat; string body; string background; string makeup; string scene; } uint256 constant CLOWN = 0; uint256 constant MAGICIAN = 1; uint256 constant JUGGLER = 2; uint256 constant TRAINER = 3; uint256 constant PERFORMER = 4; /* ------------- Traits ------------- */ // ["Clown", "Magician", "Juggler", "Trainer", "Performer"] bytes constant ROLE = hex'436c6f776e004d6167696369616e004a7567676c657200547261696e657200506572666f726d6572'; // ["Common", "Rare", "Super", "Ultra"] bytes constant RARITIES = hex'436f6d6d6f6e005261726500537570657200556c747261'; // ["Ghost", "Gold", "Lava", "Panther", "Camo", "Blue-Pink", "White", "Pink", "Brown", "Dark Brown", "Green", "Grey", "Ice", "Purple", "Red"] bytes constant FUR = hex'47686f737400476f6c64004c6176610050616e746865720043616d6f00426c75652d50696e6b0057686974650050696e6b0042726f776e004461726b2042726f776e00477265656e00477265790049636500507572706c6500526564'; // ["Awkward", "Angry", "Bored", "Confused", "Grimaced", "Loving", "Laughing", "Sad", "Shy", "Stupid", "Whistling"] bytes constant EXPRESSION = hex'41776b7761726400416e67727900426f72656400436f6e6675736564004772696d61636564004c6f76696e67004c61756768696e670053616400536879005374757069640057686973746c696e67'; // ["Purple", "Green", "Blue", "Light Blue", "Red", "Yellow", "Light Green", "Pink", "Orange", "Throne", "Star Ring", "Colosseum"] bytes constant BACKGROUND = hex'507572706c6500477265656e00426c7565004c6967687420426c7565005265640059656c6c6f77004c6967687420477265656e0050696e6b004f72616e6765005468726f6e6500537461722052696e6700436f6c6f737365756d'; // ["Black", "White", "Blue", "Kimono", "Toge", "Cowboy", "Guard", "Farmer", "Napoleon", "King", "Jumper", "Sailor", "Pirate", "Mexican", "Robin Hood", "Elf", "Viking", "Vampire", "Crocodile", "Asian", "Showman", "Genie", "Barong"] bytes constant BODY = hex'426c61636b00576869746500426c7565004b696d6f6e6f00546f676500436f77626f79004775617264004661726d6572004e61706f6c656f6e004b696e67004a756d706572005361696c6f7200506972617465004d65786963616e00526f62696e20486f6f6400456c660056696b696e670056616d706972650043726f636f64696c6500417369616e0053686f776d616e0047656e6965004261726f6e67'; // ["None", "Black", "White", "Jester", "Sakat", "Laurel", "Cowboy", "Guard", "Farmer", "Napoleon", "Crown", "Helicopter", "Sailor", "Pirate", "Mexican", "Robin Hood", "Elf", "Viking", "Halo", "Crocodile", "Asian", "Showman", "Genie", "Salakot"] bytes constant HAT = hex'4e6f6e6500426c61636b005768697465004a65737465720053616b6174004c617572656c00436f77626f79004775617264004661726d6572004e61706f6c656f6e0043726f776e0048656c69636f70746572005361696c6f7200506972617465004d65786963616e00526f62696e20486f6f6400456c660056696b696e670048616c6f0043726f636f64696c6500417369616e0053686f776d616e0047656e69650053616c616b6f74'; // ["None", "Red", "Green", "Yellow", "Vyper", "Thief", "Cyber", "Rainbow", "3D", "Thug", "Gold", "Monocle", "Manga", "Black", "Ray Black", "Blue", "Purple", "Cat Mask"] bytes constant GLASSES = hex'4e6f6e650052656400477265656e0059656c6c6f77005679706572005468696566004379626572005261696e626f77003344005468756700476f6c64004d6f6e6f636c65004d616e676100426c61636b0052617920426c61636b00426c756500507572706c6500436174204d61736b'; // ["Clown 1", "Clown 2", "Clown 3", "Clown 4", "Clown 5", "Clown 6", "Clown 7", "Clown 8", "Clown 9"] bytes constant CLOWN_MAKEUP = hex'436c6f776e203100436c6f776e203200436c6f776e203300436c6f776e203400436c6f776e203500436c6f776e203600436c6f776e203700436c6f776e203800436c6f776e2039'; // ["Pie", "Balloons", "Twisted Balloons", "Jack in the Box", "Water Spray", "Puppets", "String", "Little Pierre", "Little Murphy"] bytes constant CLOWN_BODY_LEVEL_2 = hex'5069650042616c6c6f6f6e7300547769737465642042616c6c6f6f6e73004a61636b20696e2074686520426f78005761746572205370726179005075707065747300537472696e67004c6974746c6520506965727265004c6974746c65204d7572706879'; // ["Purple Wig", "Rainbow Wig", "Blue Wig", "Teal Wig", "Red Wig", "Green Wig", "Harlequin", "Black Beret", "Blue Beret"] bytes constant CLOWN_WIG_LEVEL_2 = hex'507572706c6520576967005261696e626f772057696700426c756520576967005465616c20576967005265642057696700477265656e20576967004861726c657175696e00426c61636b20426572657400426c7565204265726574'; // ["Pie Master", "Balloon Master", "Twisted Balloon Master", "Jack in the Box Master", "Rainbow Flow", "Puppet Master", "String Master", "Pierre", "Murphy"] bytes constant CLOWN_BODY_LEVEL_3 = hex'506965204d61737465720042616c6c6f6f6e204d617374657200547769737465642042616c6c6f6f6e204d6173746572004a61636b20696e2074686520426f78204d6173746572005261696e626f7720466c6f7700507570706574204d617374657200537472696e67204d617374657200506965727265004d7572706879'; // ["Blue Poster", "Up!", "Red Poster", "Dance Floor", "Red Curtains", "Puppets", "Stadium", "Paris", "New York"] bytes constant CLOWN_BACKGROUND_LEVEL_3 = hex'426c756520506f73746572005570210052656420506f737465720044616e636520466c6f6f7200526564204375727461696e730050757070657473005374616469756d005061726973004e657720596f726b'; // ["Hatter", "Card", "Wizard", "Pento", "Fortune", "Fantasy", "Majestic", "Prisoner"] bytes constant MAGICIAN_HAT = hex'48617474657200436172640057697a6172640050656e746f00466f7274756e650046616e74617379004d616a657374696300507269736f6e6572'; // ["Doves", "Cards", "Wand", "Rabbit", "Crystal", "Levitation", "Saw", "Handcuffed"] bytes constant MAGICIAN_BODY_LEVEL_2 = hex'446f7665730043617264730057616e6400526162626974004372797374616c004c657669746174696f6e005361770048616e64637566666564'; // ["Phoenix", "Card Master", "Wand Master", "Rainbow", "Snow Globe", "Levitation Master", "Grater", "Cement"] bytes constant MAGICIAN_BODY_LEVEL_3 = hex'50686f656e69780043617264204d61737465720057616e64204d6173746572005261696e626f7700536e6f7720476c6f6265004c657669746174696f6e204d6173746572004772617465720043656d656e74'; // ["Blue Curtains", "Pink Poster", "Sky", "Hills", "Snow", "Space", "Factory", "Construction Site"] bytes constant MAGICIAN_BACKGROUND_LEVEL_3 = hex'426c7565204375727461696e730050696e6b20506f7374657200536b790048696c6c7300536e6f7700537061636500466163746f727900436f6e737472756374696f6e2053697465'; // ["None", "Fairy Mouse", "Flying Key", "Owl", "Flying Pot", "Little Mouse", "Light Aura", "Book"] bytes constant MAGICIAN_SCENE_LEVEL_3 = hex'4e6f6e65004661697279204d6f75736500466c79696e67204b6579004f776c00466c79696e6720506f74004c6974746c65204d6f757365004c69676874204175726100426f6f6b'; // ["Juggling Balls", "Clubs", "Knives", "Hoops", "Spinning Plate", "Bolas", "Diabolo", "Slinky"] bytes constant JUGGLER_BODY = hex'4a7567676c696e672042616c6c7300436c756273004b6e6976657300486f6f7073005370696e6e696e6720506c61746500426f6c617300446961626f6c6f00536c696e6b79'; // ["Juggling Ball Scholar", "Club Scholar", "Knife Scholar", "Hoop Scholar", "Spinning Plate Scholar", "Bolas Scholar", "Diabolo Scholar", "Slinky Scholar"] bytes constant JUGGLER_BODY_LEVEL_2 = hex'4a7567676c696e672042616c6c205363686f6c617200436c7562205363686f6c6172004b6e696665205363686f6c617200486f6f70205363686f6c6172005370696e6e696e6720506c617465205363686f6c617200426f6c6173205363686f6c617200446961626f6c6f205363686f6c617200536c696e6b79205363686f6c6172'; // ["Juggling Ball Master", "Club Master", "Knife Master", "Hoop Master", "Spinning Plate Master", "Bolas Master", "Diabolo Master", "Slinky Master"] bytes constant JUGGLER_BODY_LEVEL_3 = hex'4a7567676c696e672042616c6c204d617374657200436c7562204d6173746572004b6e696665204d617374657200486f6f70204d6173746572005370696e6e696e6720506c617465204d617374657200426f6c6173204d617374657200446961626f6c6f204d617374657200536c696e6b79204d6173746572'; // ["Spotlight Top", "Manor", "Target", "Forest", "Spotlight Green-Pink", "Desert", "Fireworks", "Shadow"] bytes constant JUGGLER_BACKGROUND_LEVEL_3 = hex'53706f746c6967687420546f70004d616e6f720054617267657400466f726573740053706f746c6967687420477265656e2d50696e6b004465736572740046697265776f726b7300536861646f77'; // ["Gecko", "Cat", "Chimp", "Turtle", "Donkey", "Teddy Bear", "Seal", "Baby Dodo"] bytes constant TRAINER_PET = hex'4765636b6f00436174004368696d7000547572746c6500446f6e6b65790054656464792042656172005365616c004261627920446f646f'; // ["Blue Whip", "Red Hoop", "Banana", "Green Whip", "Horse Whip", "Honey", "Fish", "Blue Hoop"] bytes constant TRAINER_BODY_LEVEL_2 = hex'426c756520576869700052656420486f6f700042616e616e6100477265656e205768697000486f727365205768697000486f6e6579004669736800426c756520486f6f70'; // ["Crocodile", "Tiger", "Monkey", "Komodo", "Horse", "Bear", "Otaria", "Dodo"] bytes constant TRAINER_PET_LEVEL_2 = hex'43726f636f64696c65005469676572004d6f6e6b6579004b6f6d6f646f00486f7273650042656172004f746172696100446f646f'; // ["Light Whip", "Fire Hoop", "Bananas", "Rainbow Whip", "Uniwhip", "Bamboo", "Fish Feast", "Rainbow Hoop"] bytes constant TRAINER_BODY_LEVEL_3 = hex'4c696768742057686970004669726520486f6f700042616e616e6173005261696e626f77205768697000556e69776869700042616d626f6f0046697368204665617374005261696e626f7720486f6f70'; // ["T-Rex", "Lion", "Gorilla", "Dragon", "Unicorn", "Panda", "Walrus", "Peacock"] bytes constant TRAINER_PET_LEVEL_3 = hex'542d526578004c696f6e00476f72696c6c6100447261676f6e00556e69636f726e0050616e64610057616c72757300506561636f636b'; // ["Tent", "Red Ring", "Green Ring", "Castle", "Lake", "Bamboo", "Grey Ring", "Peacock"] bytes constant TRAINER_BACKGROUND_LEVEL_3 = hex'54656e74005265642052696e6700477265656e2052696e6700436173746c65004c616b650042616d626f6f00477265792052696e6700506561636f636b'; // ["Hula Hoop", "Rolla Bolla", "Monocycle", "Aerial Hoop", "None", "Swing", "Dumbbells", "Trampoline"] bytes constant PERFORMER_SCENE = hex'48756c6120486f6f7000526f6c6c6120426f6c6c61004d6f6e6f6379636c650041657269616c20486f6f70004e6f6e65005377696e670044756d6262656c6c73005472616d706f6c696e65'; // ["Trickster", "Rolla Bolla", "Funambulist", "Trapezist", "Pendulum Master", "Dancer", "Mr Muscle", "Trampoline"] bytes constant PERFORMER_BODY_LEVEL_2 = hex'547269636b7374657200526f6c6c6120426f6c6c610046756e616d62756c6973740054726170657a6973740050656e64756c756d204d61737465720044616e636572004d72204d7573636c65005472616d706f6c696e65'; // ["Hula Hoop Trickster", "Tower", "Funambulist", "Trapezist Twins", "None", "Tap Dance", "Dumbbell Stand", "Cody"] bytes constant PERFORMER_SCENE_LEVEL_2 = hex'48756c6120486f6f7020547269636b7374657200546f7765720046756e616d62756c6973740054726170657a697374205477696e73004e6f6e65005461702044616e63650044756d6262656c6c205374616e6400436f6479'; // ["Chairman", "Skater", "Daredevil", "Megaphone", "None", "Virtuoso", "Hercules", "Canonist"] bytes constant PERFORMER_BODY_LEVEL_3 = hex'43686169726d616e00536b617465720044617265646576696c004d65676170686f6e65004e6f6e650056697274756f736f0048657263756c65730043616e6f6e697374'; // ["Pyramid", "Skater", "Daredevil", "Firestar", "None", "Salsa", "Barbell", "Canonman"] bytes constant PERFORMER_SCENE_LEVEL_3 = hex'507972616d696400536b617465720044617265646576696c004669726573746172004e6f6e650053616c73610042617262656c6c0043616e6f6e6d616e'; // ["Red Podium", "Half-Pipe", "Blue Podium", "Dark Tent", "Mesmerized", "Stage", "Hercules Poster", "Purple Ring"] bytes constant PERFORMER_BACKGROUND_LEVEL_3 = hex'52656420506f6469756d0048616c662d5069706500426c756520506f6469756d004461726b2054656e74004d65736d6572697a65640053746167650048657263756c657320506f7374657200507572706c652052696e67'; /* ------------- Rarities ------------- */ // [9, 9, 14, 14, 14, 14, 17, 18, 21, 21, 21, 21, 21, 21, 21] uint256 constant WEIGHTS_FUR = 0x00000000000000000000000000000000001515151515151512110e0e0e0e0909; // [63, 14, 14, 14, 5, 14, 5, 5, 14, 14, 14, 14, 5, 14, 14, 14, 14, 5] uint256 constant WEIGHTS_GLASSES = 0x0000000000000000000000000000050e0e0e0e050e0e0e0e05050e050e0e0e3f; // [8, 8, 8, 15, 15, 15, 15, 15, 8, 2, 15, 15, 15, 15, 15, 15, 3, 3, 3, 15, 3, 15, 15] uint256 constant WEIGHTS_BODY = 0x0000000000000000000f0f030f0303030f0f0f0f0f0f02080f0f0f0f0f080808; // [25, 25, 25, 25, 25, 25, 25, 25, 25, 10, 11, 10] uint256 constant WEIGHTS_BACKGROUND = 0x00000000000000000000000000000000000000000a0b0a191919191919191919; // [13, 8, 8, 8, 14, 14, 14, 14, 14, 8, 3, 14, 14, 14, 14, 14, 14, 3, 3, 3, 14, 3, 14, 14] uint256 constant WEIGHTS_HAT = 0x00000000000000000e0e030e0303030e0e0e0e0e0e03080e0e0e0e0e0808080d; /* ------------- External ------------- */ MadMouse public madmouse; function setMadMouseAddress(MadMouse madmouse_) external onlyOwner { madmouse = madmouse_; } // will act as an ERC721 proxy function balanceOf(address user) external view returns (uint256) { return madmouse.numOwned(user); } function buildMouseMetadata(uint256 tokenId, uint256 level) external view returns (string memory) { return string.concat('data:application/json;base64,', Base64.encode(bytes(mouseMetadataJSON(tokenId, level)))); } /* ------------- Json ------------- */ function getMouse(uint256 dna, uint256 level) private pure returns (Mouse memory mouse) { uint256 dnaRole = dna & 0xFF; uint256 dnaFur = (dna >> 8) & 0xFF; uint256 dnaClass = (dna >> 16) & 0xFF; uint256 dnaExpression = (dna >> 24) & 0xFF; uint256 dnaGlasses = (dna >> 32) & 0xFF; uint256 dnaBody = (dna >> 40) & 0xFF; uint256 dnaBackground = (dna >> 48) & 0xFF; uint256 dnaHat = (dna >> 56) & 0xFF; uint256 dnaSpecial = (dna >> 64) & 0xFF; uint256 role = dnaRole % 5; mouse.role = ROLE.decode(role); mouse.rarity = RARITIES.decode(dna.toRarity()); mouse.fur = FUR.selectWeighted(dnaFur, WEIGHTS_FUR); mouse.expression = EXPRESSION.decode(dnaExpression % 11); mouse.glasses = GLASSES.selectWeighted(dnaGlasses, WEIGHTS_GLASSES); mouse.body = BODY.selectWeighted(dnaBody, WEIGHTS_BODY); mouse.background = BACKGROUND.selectWeighted(dnaBackground, WEIGHTS_BACKGROUND); mouse.hat = HAT.selectWeighted(dnaHat, WEIGHTS_HAT); uint256 class; if (role == CLOWN) { class = dnaClass % 9; mouse.makeup = CLOWN_MAKEUP.decode(class); if (level == 2) mouse.body = CLOWN_BODY_LEVEL_2.decode(class); if (level >= 2) { uint256 hat = dnaHat % 9; if (hat == 6) hat = class; mouse.hat = CLOWN_WIG_LEVEL_2.decode(hat); } if (level == 3) mouse.body = CLOWN_BODY_LEVEL_3.decode(class); if (level == 3) { uint256 backgroundType = dnaBackground % 9; if (backgroundType == 6) mouse.background = CLOWN_BACKGROUND_LEVEL_3.decode(class); else mouse.background = CLOWN_BACKGROUND_LEVEL_3.decode(backgroundType); } } if (role == MAGICIAN) { class = dnaClass % 8; mouse.hat = MAGICIAN_HAT.decode(class); if (level == 2) mouse.body = MAGICIAN_BODY_LEVEL_2.decode(class); if (level == 3) mouse.body = MAGICIAN_BODY_LEVEL_3.decode(class); if (level == 3) { uint256 sceneType = dnaSpecial % 8; if (class == 1 && (sceneType < 4 || 6 < sceneType)) sceneType = 4; mouse.scene = MAGICIAN_SCENE_LEVEL_3.decode(sceneType); } if (level == 3) { uint256 backgroundType = dnaBackground % 8; if (backgroundType == 6) mouse.background = MAGICIAN_BACKGROUND_LEVEL_3.decode(class); else mouse.background = MAGICIAN_BACKGROUND_LEVEL_3.decode(backgroundType); } } if (role == JUGGLER) { class = dnaClass % 8; if (level == 1) mouse.body = JUGGLER_BODY.decode(class); if (level == 2) mouse.body = JUGGLER_BODY_LEVEL_2.decode(class); if (level == 3) mouse.body = JUGGLER_BODY_LEVEL_3.decode(class); if (level == 3) { uint256 backgroundType = dnaBackground % 8; if (backgroundType == 2) mouse.background = JUGGLER_BACKGROUND_LEVEL_3.decode(class); else mouse.background = JUGGLER_BACKGROUND_LEVEL_3.decode(backgroundType); } } if (role == TRAINER) { class = dnaClass % 8; if (level == 1) mouse.scene = TRAINER_PET.decode(class); if (level == 2) mouse.body = TRAINER_BODY_LEVEL_2.decode(class); if (level == 2) mouse.scene = TRAINER_PET_LEVEL_2.decode(class); if (level == 3) mouse.body = TRAINER_BODY_LEVEL_3.decode(class); if (level == 3) mouse.scene = TRAINER_PET_LEVEL_3.decode(class); if (level == 3) { uint256 backgroundType = dnaBackground % 8; if (backgroundType == 7) mouse.background = TRAINER_BACKGROUND_LEVEL_3.decode(class); else mouse.background = TRAINER_BACKGROUND_LEVEL_3.decode(backgroundType); } } if (role == PERFORMER) { class = dnaClass % 8; if (level >= 1) { if (class == 4) mouse.body = 'Hypnotist'; else mouse.scene = PERFORMER_SCENE.decode(class); } if (level >= 2) mouse.body = PERFORMER_BODY_LEVEL_2.decode(class); if (level >= 2 && class != 4) mouse.scene = PERFORMER_SCENE_LEVEL_2.decode(class); if (level == 3) { if (class != 4) mouse.body = PERFORMER_BODY_LEVEL_3.decode(class); if (class != 4) mouse.scene = PERFORMER_SCENE_LEVEL_3.decode(class); if (class == 4) mouse.glasses = 'Hypnotist'; } if (level == 3) { uint256 backgroundType = dnaBackground % 8; if (backgroundType == 1 || backgroundType == 4 || backgroundType == 5 || backgroundType == 6) mouse.background = PERFORMER_BACKGROUND_LEVEL_3.decode(class); else mouse.background = PERFORMER_BACKGROUND_LEVEL_3.decode(backgroundType); } } } function mouseMetadataJSON(uint256 tokenId, uint256 level) private view returns (string memory) { uint256 dna = madmouse.getDNA(tokenId); bool mintAndStake = madmouse._tokenDataOf(tokenId).mintAndStake(); string memory name = madmouse.mouseName(tokenId); string memory bio = madmouse.mouseBio(tokenId); if (bytes(name).length == 0) name = string.concat('Mad Mouse #', tokenId.toString()); if (bytes(bio).length == 0) bio = madmouse.description(); string memory imageURI = string.concat( madmouse.imagesBaseURI(), ((level - 1) * 10_000 + tokenId).toString(), '.png' ); string memory baseData = string.concat( MetadataEncode.keyValueString('name', name), MetadataEncode.keyValueString('description', bio), MetadataEncode.keyValueString('image', imageURI), MetadataEncode.keyValue('id', tokenId.toString()), MetadataEncode.keyValueString('dna', dna.toHexString()) ); string memory result = string.concat( '{', baseData, MetadataEncode.keyValueString('OG', mintAndStake ? 'Staker' : ''), MetadataEncode.attributes(getAttributesList(dna, level)), '}' ); return result; } function getAttributesList(uint256 dna, uint256 level) private pure returns (string memory) { Mouse memory mouse = getMouse(dna, level); string memory attributes = string.concat( MetadataEncode.attribute('Level', level.toString()), MetadataEncode.attributeString('Role', mouse.role), MetadataEncode.attributeString('Rarity', mouse.rarity), MetadataEncode.attributeString('Background', mouse.background), MetadataEncode.attributeString('Scene', mouse.scene), MetadataEncode.attributeString('Fur', mouse.fur) ); attributes = string.concat( attributes, MetadataEncode.attributeString('Expression', mouse.expression), MetadataEncode.attributeString('Glasses', mouse.glasses), MetadataEncode.attributeString('Hat', mouse.hat), MetadataEncode.attributeString('Makeup', mouse.makeup), MetadataEncode.attributeString('Body', mouse.body, false) ); return attributes; } // function getOGStatus(uint256 ownerCount) private pure returns (string memory) { // return // ownerCount == 1 ? MetadataEncode.keyValueString('OG', 'Minter') : ownerCount == 2 // ? MetadataEncode.keyValueString('OG', 'Hodler') // : ''; // } // function getHodlerStatus(uint256 timestamp) private view returns (string memory) { // return // (block.timestamp - timestamp) > 69 days // ? MetadataEncode.keyValueString('HODLER LEVEL', 'Diamond Handed') // : ''; // } }
//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 = 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 { // note: less than you would receive in 10 seconds if (reward > 0.0001 ether) 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.6.0; /// @title Base64 /// @author Brecht Devos - <[email protected]> /// @notice Provides functions for encoding/decoding base64 library Base64 { string internal constant TABLE_ENCODE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; bytes internal constant TABLE_DECODE = hex'0000000000000000000000000000000000000000000000000000000000000000' hex'00000000000000000000003e0000003f3435363738393a3b3c3d000000000000' hex'00000102030405060708090a0b0c0d0e0f101112131415161718190000000000' hex'001a1b1c1d1e1f202122232425262728292a2b2c2d2e2f303132330000000000'; function encode(bytes memory data) internal pure returns (string memory) { if (data.length == 0) return ''; // load the table into memory string memory table = TABLE_ENCODE; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((data.length + 2) / 3); // add some extra buffer at the end required for the writing string memory result = new string(encodedLen + 32); assembly { // set the actual output length mstore(result, encodedLen) // prepare the lookup table let tablePtr := add(table, 1) // input ptr let dataPtr := data let endPtr := add(dataPtr, mload(data)) // result ptr, jump over length let resultPtr := add(result, 32) // run over the input, 3 bytes at a time for { } lt(dataPtr, endPtr) { } { // read 3 bytes dataPtr := add(dataPtr, 3) let input := mload(dataPtr) // write 4 characters mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F)))) resultPtr := add(resultPtr, 1) mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F)))) resultPtr := add(resultPtr, 1) } // padding with '=' switch mod(mload(data), 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } } return result; } function decode(string memory _data) internal pure returns (bytes memory) { bytes memory data = bytes(_data); if (data.length == 0) return new bytes(0); require(data.length % 4 == 0, 'invalid base64 decoder input'); // load the table into memory bytes memory table = TABLE_DECODE; // every 4 characters represent 3 bytes uint256 decodedLen = (data.length / 4) * 3; // add some extra buffer at the end required for the writing bytes memory result = new bytes(decodedLen + 32); assembly { // padding with '=' let lastBytes := mload(add(data, mload(data))) if eq(and(lastBytes, 0xFF), 0x3d) { decodedLen := sub(decodedLen, 1) if eq(and(lastBytes, 0xFFFF), 0x3d3d) { decodedLen := sub(decodedLen, 1) } } // set the actual output length mstore(result, decodedLen) // prepare the lookup table let tablePtr := add(table, 1) // input ptr let dataPtr := data let endPtr := add(dataPtr, mload(data)) // result ptr, jump over length let resultPtr := add(result, 32) // run over the input, 4 characters at a time for { } lt(dataPtr, endPtr) { } { // read 4 characters dataPtr := add(dataPtr, 4) let input := mload(dataPtr) // write 3 bytes let output := add( add( shl(18, and(mload(add(tablePtr, and(shr(24, input), 0xFF))), 0xFF)), shl(12, and(mload(add(tablePtr, and(shr(16, input), 0xFF))), 0xFF)) ), add( shl(6, and(mload(add(tablePtr, and(shr(8, input), 0xFF))), 0xFF)), and(mload(add(tablePtr, and(input, 0xFF))), 0xFF) ) ) mstore(resultPtr, shl(232, output)) resultPtr := add(resultPtr, 3) } } return result; } }
//SPDX-License-Identifier: MIT pragma solidity ^0.8.12; // Warning: // This library is untested and was only written with // the specific use-case in mind of encoding traits for MadMouse. // Use at own risk. library MetadataEncode { /* ------------- Traits ------------- */ function encode(string[] memory strs) internal pure returns (bytes memory) { bytes memory a; for (uint256 i; i < strs.length; i++) { if (i < strs.length - 1) a = abi.encodePacked(a, strs[i], bytes1(0)); else a = abi.encodePacked(a, strs[i]); } return a; } function decode(bytes memory input, uint256 index) internal pure returns (string memory) { uint256 counter; uint256 start; uint256 end; for (; end < input.length; end++) { if (input[end] == 0x00) { if (counter == index) return getSlice(input, start, end); start = end + 1; counter++; } } return getSlice(input, start, end); } function getSlice( bytes memory input, uint256 start, uint256 end ) internal pure returns (string memory) { bytes memory out = new bytes(end - start); for (uint256 i = 0; i < end - start; i++) out[i] = input[i + start]; return string(out); } /* ------------- Rarities ------------- */ function selectWeighted( bytes memory traits, uint256 r, uint256 weights ) internal pure returns (string memory) { uint256 index = selectWeighted(r, weights); return decode(traits, index); } function selectWeighted(uint256 r, uint256 weights) private pure returns (uint256) { unchecked { for (uint256 i; i < 32; ++i) { r -= (weights >> (i << 3)) & 0xFF; if (r > 0xFF) return i; } } return 666666; } function encode(uint256[] memory weights) internal pure returns (bytes32) { uint256 r; uint256 sum; for (uint256 i; i < weights.length; i++) { r |= weights[i] << (i << 3); sum += weights[i]; } require(sum == 256, 'Should sum to 256'); return bytes32(r); } function decode(bytes32 code, uint256 length) internal pure returns (uint256[] memory) { uint256[] memory r = new uint256[](length); for (uint256 i; i < length; i++) r[i] = uint256(code >> (i << 3)) & 0xFF; return r; } /* ------------- Helpers ------------- */ function keyValue(string memory key, string memory value) internal pure returns (string memory) { return bytes(value).length > 0 ? string.concat('"', key, '": ', value, ', ') : ''; } function keyValueString(string memory key, string memory value) internal pure returns (string memory) { return bytes(value).length > 0 ? string.concat('"', key, '": ', '"', value, '", ') : ''; } function attributeString(string memory traitType, string memory value) internal pure returns (string memory) { return attributeString(traitType, value, true); } function attributeString( string memory traitType, string memory value, bool comma ) internal pure returns (string memory) { return bytes(value).length > 0 ? attribute(traitType, string.concat('"', value, '"'), comma) : ''; } function attribute(string memory traitType, string memory value) internal pure returns (string memory) { return attribute(traitType, value, true); } function attribute( string memory traitType, string memory value, bool comma ) internal pure returns (string memory) { return bytes(value).length > 0 ? string.concat('{"trait_type": "', traitType, '", "value": ', value, '}', comma ? ', ' : '') : ''; } function attributes(string memory attr) internal pure returns (string memory) { return string.concat('"attributes": [', attr, ']'); } }
// 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(); 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) { 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) { 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": 1337 }, "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":"SignatureExceedsLimit","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[]"}],"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":"contract MadMouseMetadata","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"bytes","name":"signature","type":"bytes"},{"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":"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":"contract MadMouseMetadata","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
6101c0604052600f80546001600160a01b031990811673fb79a928c5d6c5932ba83aa8c7145cbdcdb9fd2e1790915560108054909116733ade0c5e35cbf136245f4e4bbf4563bd151d39d117905562278d006013553480156200006157600080fd5b506040516200635138038062006351833981016040819052620000849162000271565b7faa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af44560001b671bc16d674ec8000073f0d54349addcf704f77ae15b96510dea15cb795273514910771af9ca656af840dff83e8264ecf986ca6115b3601483836040518060400160405280600e81526020016d4d61644d6f75736543697263757360901b815250604051806040016040528060038152602001624d4d4360e81b81525060018686846000908051906020019062000141929190620001cb565b50835162000157906001906020870190620001cb565b5060a09190915260c05260805250506001600160a01b03918216610100521660e052600880546001600160a01b031916331790556200019a42624f1a006200028b565b61012052620001ae4263096601806200028b565b610140525050506101609290925261018052506101a052620002ef565b828054620001d990620002b2565b90600052602060002090601f016020900481019282620001fd576000855562000248565b82601f106200021857805160ff191683800117855562000248565b8280016001018555821562000248579182015b82811115620002485782518255916020019190600101906200022b565b50620002569291506200025a565b5090565b5b808211156200025657600081556001016200025b565b6000602082840312156200028457600080fd5b5051919050565b60008219821115620002ad57634e487b7160e01b600052601160045260246000fd5b500190565b600181811c90821680620002c757607f821691505b60208210811415620002e957634e487b7160e01b600052602260045260246000fd5b50919050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a051615fa0620003b1600039600061368a01526000613514015260006134f3015260006142fd01526000818161283401528181614d5e01528181614db00152614de30152600081816122070152614409015260006143da01526000613e4801526000613dec015260008181611ee101528181611f0601528181612d3101528181612d5301528181613d50015281816140fd015261412e0152615fa06000f3fe6080604052600436106104b65760003560e01c806388486f8611610279578063c0d4c3071161015e578063e1da26c6116100d6578063ea9384fa1161008a578063f40f0f521161006f578063f40f0f5214610c02578063f948dbf614610c22578063fe55932a14610c3557600080fd5b8063ea9384fa14610bcf578063f2fde38b14610be257600080fd5b8063e449f341116100bb578063e449f34114610b61578063e4a73e5b14610b74578063e985e9c514610b9457600080fd5b8063e1da26c614610b46578063e2e06fa314610b4e57600080fd5b8063c9be651b1161012d578063cdaecb1911610112578063cdaecb1914610b16578063da4f633b14610b2b578063e17b25af14610b3357600080fd5b8063c9be651b14610ad6578063cb4bd00e14610af657600080fd5b8063c0d4c30714610a63578063c32d3ae214610a76578063c3d33cb514610aa3578063c87b56dd14610ab657600080fd5b806399ff2190116101f1578063aaab6339116101c0578063b88a802f116101a5578063b88a802f14610a21578063b88d4fde14610a29578063bc8893b414610a4957600080fd5b8063aaab6339146109ea578063b61f88b414610a0157600080fd5b806399ff21901461098e5780639bbe87d9146109a45780639be65a60146109b7578063a22cb465146109ca57600080fd5b8063930bdc871161024857806394985ddd1161022d57806394985ddd1461094657806395d89b411461096657806396cf6c6c1461097b57600080fd5b8063930bdc87146109205780639366c1fd1461093357600080fd5b806388486f86146108ba578063895d2206146108da5780638da5cb5b146108ef57806390c3f38f1461090d57600080fd5b80633307dcfe1161039f5780636352211e116103175780637168fcea116102e65780637ee843cc116102cb5780637ee843cc146108745780638091aa031461088757806386481d401461089a57600080fd5b80637168fcea1461083f5780637284e4161461085f57600080fd5b80636352211e146107b25780636a8954b9146107d25780636c08c6b1146107ff57806370a082311461081f57600080fd5b806342842e0e1161036e5780635bb209a5116103535780635bb209a51461075f5780636035386a1461077f578063628cbb6d1461079257600080fd5b806342842e0e1461072c5780634fc918bc1461074c57600080fd5b80633307dcfe146106e4578063392f37e9146106ec5780633ccfd60b1461071157806341ab7f481461071957600080fd5b8063110d62411161043257806320fc7eb21161040157806326e0d280116103e657806326e0d2801461069b578063279350bd146106b15780632828adb2146106d157600080fd5b806320fc7eb21461065b57806323b872dd1461067b57600080fd5b8063110d6241146105ff578063176ca01d1461061f57806318160ddd146106325780631ae0b4ec1461064857600080fd5b806308ee0c74116104895780630b747d911161046e5780630b747d91146105c35780630ce90ec2146105d95780630fbf0a93146105ec57600080fd5b806308ee0c7414610575578063095ea7b3146105a357600080fd5b806301ffc9a7146104bb578063046dc166146104f057806306fdde0314610505578063081812fc14610527575b600080fd5b3480156104c757600080fd5b506104db6104d63660046154d7565b610c48565b60405190151581526020015b60405180910390f35b6105036104fe366004615509565b610ce5565b005b34801561051157600080fd5b5061051a610d32565b6040516104e7919061557e565b34801561053357600080fd5b5061055d610542366004615591565b6002602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016104e7565b34801561058157600080fd5b50610595610590366004615509565b610dc0565b6040519081526020016104e7565b3480156105af57600080fd5b506105036105be3660046155aa565b610de4565b3480156105cf57600080fd5b50610595600d5481565b6105036105e7366004615591565b610eb0565b6105036105fa36600461561b565b611117565b34801561060b57600080fd5b5060095461055d906001600160a01b031681565b61050361062d3660046156ad565b611178565b34801561063e57600080fd5b5061059560045481565b610503610656366004615591565b6112c0565b34801561066757600080fd5b50610595610676366004615509565b6112f0565b34801561068757600080fd5b50610503610696366004615718565b611316565b3480156106a757600080fd5b5061059560125481565b3480156106bd57600080fd5b5061051a6106cc366004615759565b611567565b6105036106df366004615591565b611670565b6105036116ef565b3480156106f857600080fd5b50600e5461055d9061010090046001600160a01b031681565b61050361174c565b610503610727366004615591565b6117cf565b34801561073857600080fd5b50610503610747366004615718565b6118a8565b61050361075a36600461577b565b6118c3565b34801561076b57600080fd5b5061059561077a366004615591565b61198e565b61050361078d36600461561b565b6119e3565b34801561079e57600080fd5b5061051a6107ad366004615591565b611b26565b3480156107be57600080fd5b5061055d6107cd366004615591565b611b3f565b3480156107de57600080fd5b506107f26107ed366004615509565b611b4d565b6040516104e791906157e7565b34801561080b57600080fd5b5061059561081a366004615591565b611cf7565b34801561082b57600080fd5b5061059561083a366004615509565b611d68565b34801561084b57600080fd5b5061059561085a366004615509565b611dcd565b34801561086b57600080fd5b5061051a611dfc565b6105036108823660046158f8565b611e09565b610503610895366004615509565b611e6a565b3480156108a657600080fd5b506105956108b5366004615591565b611eb7565b3480156108c657600080fd5b5061055d6108d5366004615591565b611ece565b3480156108e657600080fd5b50610595611edc565b3480156108fb57600080fd5b506008546001600160a01b031661055d565b61050361091b3660046158f8565b611f5e565b61050361092e36600461592d565b611f9c565b610503610941366004615509565b611ff8565b34801561095257600080fd5b50610503610961366004615759565b6121fc565b34801561097257600080fd5b5061051a61227f565b610503610989366004615966565b61228c565b34801561099a57600080fd5b5061059560115481565b6105036109b2366004615591565b61236f565b6105036109c5366004615509565b6123e7565b3480156109d657600080fd5b506105036109e53660046159c5565b61250a565b3480156109f657600080fd5b50600d5415156104db565b348015610a0d57600080fd5b5061051a610a1c366004615591565b612576565b61050361258f565b348015610a3557600080fd5b50610503610a443660046159f3565b6125a9565b348015610a5557600080fd5b50600e546104db9060ff1681565b610503610a7136600461561b565b61269c565b348015610a8257600080fd5b50610a96610a91366004615509565b612715565b6040516104e79190615a96565b610503610ab136600461577b565b612983565b348015610ac257600080fd5b5061051a610ad1366004615591565b612a27565b348015610ae257600080fd5b506107f2610af13660046155aa565b612b90565b348015610b0257600080fd5b506104db610b113660046155aa565b612e37565b348015610b2257600080fd5b5061051a6133f4565b610503613401565b610503610b41366004615509565b613438565b6105036134a2565b610503610b5c366004615b65565b61353b565b610503610b6f36600461561b565b613579565b348015610b8057600080fd5b50600f5461055d906001600160a01b031681565b348015610ba057600080fd5b506104db610baf366004615b82565b600360209081526000928352604080842090915290825290205460ff1681565b610503610bdd366004615bb0565b6135c5565b348015610bee57600080fd5b50610503610bfd366004615509565b61373a565b348015610c0e57600080fd5b50610595610c1d366004615509565b613787565b610503610c30366004615bf5565b6137ab565b610503610c43366004615bf5565b6138d5565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161480610cab57507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b80610cdf57507f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b6008546001600160a01b03163314610d1057604051633e8be92f60e01b815260040160405180910390fd5b601080546001600160a01b0319166001600160a01b0392909216919091179055565b60008054610d3f90615c41565b80601f0160208091040260200160405190810160405280929190818152602001828054610d6b90615c41565b8015610db85780601f10610d8d57610100808354040283529160200191610db8565b820191906000526020600020905b815481529060010190602001808311610d9b57829003601f168201915b505050505081565b6001600160a01b03811660009081526006602052604081205460781c60ff16610cdf565b6000610df7610df283611cf7565b6139f6565b9050336001600160a01b03821614801590610e3657506001600160a01b038116600090815260036020908152604080832033845290915290205460ff16155b15610e54576040516327da82d560e11b815260040160405180910390fd5b60008281526002602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000610ebb82611cf7565b905080336001600160a01b03821614610ee757604051633a6bbed360e01b815260040160405180910390fd5b600160fc83901c016002811115610f2a576040517f921c7d5f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060011415610fdb57610d9560115410610f575760405163519f594360e01b815260040160405180910390fd5b60095460405163079cc67960e41b815233600482015268068155a43676e0000060248201526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015610fab57600080fd5b505af1158015610fbf573d6000803e3d6000fd5b50505050601160008154610fd290615c8c565b9091555061107f565b61057760125410610fff5760405163519f594360e01b815260040160405180910390fd5b60095460405163079cc67960e41b81523360048201526812f939c99edab8000060248201526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561105357600080fd5b505af1158015611067573d6000803e3d6000fd5b5050505060126000815461107a90615c8c565b909155505b60006110ac7f10000000000000000000000000000000000000000000000000000000000000008501613a19565b90506110bd8460dc1c600116151590565b80156110cb575060185460ff165b156110ff5760006110da613a62565b90506110e881878785613a81565b336000908152600660205260409020919091559150505b60009485526005602052604090942093909355505050565b6000611121613a62565b905060005b82811015611163576111513385858481811061114457611144615ca7565b9050602002013584613b0d565b915061115c81615c8c565b9050611126565b50336000908152600660205260409020555050565b32331461119857604051632514e60160e21b815260040160405180910390fd5b600e5460ff16156111d5576040517f04cc9ce200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8360051015611210576040517f4c3ff92d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112228567010a741a46278000615cbd565b341461124157604051636956f2ab60e11b815260040160405180910390fd5b61124c838386613c92565b61126957604051638baa579f60e01b815260040160405180910390fd5b3360009081526006602052604081205460141c620fffff1690508461128e8783615cdc565b11156112ad57604051632795088960e11b815260040160405180910390fd5b6112b8338784613d32565b505050505050565b6008546001600160a01b031633146112eb57604051633e8be92f60e01b815260040160405180910390fd5b601355565b6001600160a01b03811660009081526006602052604081205460141c620fffff16610cdf565b6001600160a01b038216301415611354576000611331613a62565b905061133e338383613b0d565b3360009081526006602052604090205550505050565b600061135f82611cf7565b9050600061136c826139f6565b90506000336001600160a01b03831614806113aa57506001600160a01b038216600090815260036020908152604080832033845290915290205460ff165b806113cb57506000848152600260205260409020546001600160a01b031633145b9050806113eb576040516327da82d560e11b815260040160405180910390fd5b6001600160a01b03851661142b576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b856001600160a01b0316826001600160a01b031614611476576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600084815260026020526040902080546001600160a01b03191690556114f46114ef426114c3886114aa60018a0189614071565b6001600160a01b0319166001600160a01b039091161790565b7fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff1660a09190911b1790565b6140d5565b6000858152600560209081526040808320939093556001600160a01b038981168084526006909252838320805460001901905588168083528383208054600101905592518793927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a45050505b505050565b6060611572836140f8565b61158f5760405163163a09e160e31b815260040160405180910390fd5b60185460ff1615806115af5750600e5461010090046001600160a01b0316155b156115d457604051806060016040528060358152602001615f36603591399050610cdf565b600e546040517f452ce83e00000000000000000000000000000000000000000000000000000000815260048101859052602481018490526101009091046001600160a01b03169063452ce83e90604401600060405180830381865afa158015611641573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116699190810190615cf4565b9392505050565b600061168161167e83611cf7565b90565b90506001600160a01b03811633148015906116b65750336116aa6008546001600160a01b031690565b6001600160a01b031614155b156116d457604051633a6bbed360e01b815260040160405180910390fd5b60008281526014602052604081206116eb916152cc565b5050565b6008546001600160a01b0316331461171a57604051633e8be92f60e01b815260040160405180910390fd5b600d541561173b57604051631f5ae5c960e21b815260040160405180910390fd5b611746600143615d62565b40600d55565b6008546001600160a01b0316331461177757604051633e8be92f60e01b815260040160405180910390fd5b600f5460405147916001600160a01b0316908290600081818185875af1925050503d80600081146117c4576040519150601f19603f3d011682016040523d82523d6000602084013e6117c9565b606091505b50505050565b60006117d9613a62565b905060ff60c082901c168281141561181d576040517f61de27c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b821580159061183357506118313384612e37565b155b1561186a576040517fc1757b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7fffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffff821660c084901b1733600090815260066020526040902055505050565b611562838383604051806020016040528060008152506125a9565b6008546001600160a01b031633146118ee57604051633e8be92f60e01b815260040160405180910390fd5b60005b8181101561198757600083838381811061190d5761190d615ca7565b905060200201359050806000141561192457600080fd5b85858381811061193657611936615ca7565b905060200201602081019061194b9190615509565b6000918252600b602052604090912080546001600160a01b0319166001600160a01b0390921691909117905561198081615c8c565b90506118f1565b5050505050565b60185460009060ff166119b45760405163847b198f60e01b815260040160405180910390fd5b6119bd826140f8565b6119da5760405163163a09e160e31b815260040160405180910390fd5b610cdf8261415a565b60185460ff16611a065760405163847b198f60e01b815260040160405180910390fd5b6000611a10613a62565b905060008060005b84811015611b0c57858582818110611a3257611a32615ca7565b905060200201359250611a4483611cf7565b915033826001600160a01b031614611a6f57604051633a6bbed360e01b815260040160405180910390fd5b611a7e8260dc1c600116151590565b611a9b576040516333155e1360e21b815260040160405180910390fd5b60f882901c600f1615611ada576040517f6e62ff6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611ae684848485613a81565b60008581526005602052604090208190559094509150611b0581615c8c565b9050611a18565b505033600090815260066020526040902091909155505050565b60156020526000908152604090208054610d3f90615c41565b6000610cdf610df283611cf7565b60185460609060ff16611b6e57505060408051600081526020810190915290565b6040517fc9be651b0000000000000000000000000000000000000000000000000000000081526001600160a01b038316600482015260016024820152600090309063c9be651b90604401600060405180830381865afa158015611bd5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611bfd9190810190615d79565b6001600160a01b038416600090815260066020526040812054919250611c238583614198565b90506000805b8451811015611cc057611c54858281518110611c4757611c47615ca7565b6020026020010151611cf7565b915060f882901c600f16611c8f57611c8784868381518110611c7857611c78615ca7565b60200260200101518485613a81565b509350611cb0565b6000858281518110611ca357611ca3615ca7565b6020026020010181815250505b611cb981615c8c565b9050611c29565b506000611ccd8785614198565b9050828111611cea57604080516000815260208101909152611cec565b845b979650505050505050565b6000611d02826140f8565b611d1f5760405163163a09e160e31b815260040160405180910390fd5b815b6000818152600560205260409020548015611d5557838214611d4b57611d46816141dd565b611d4d565b805b949350505050565b5080611d6081615e1f565b915050611d21565b60006001600160a01b038216611daa576040517fcbe7266800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038216600090815260066020526040902054620fffff16610cdf565b6001600160a01b03811660009081526006602052604081205461166960ff607883901c16620fffff8316615cdc565b60168054610d3f90615c41565b6008546001600160a01b03163314611e3457604051633e8be92f60e01b815260040160405180910390fd5b60185460ff16611e575760405163847b198f60e01b815260040160405180910390fd5b80516116eb906017906020840190615306565b6008546001600160a01b03163314611e9557604051633e8be92f60e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b6000610cdf611ec583611cf7565b60fc1c60010190565b6000610cdf61167e83611cf7565b6000807f00000000000000000000000000000000000000000000000000000000000000005b6004547f000000000000000000000000000000000000000000000000000000000000000001811015611f5857611f44611f3982611cf7565b60dc1c600116151590565b15611f50578160010191505b600101611f01565b50919050565b6008546001600160a01b03163314611f8957604051633e8be92f60e01b815260040160405180910390fd5b80516116eb906016906020840190615306565b6008546001600160a01b03163314611fc757604051633e8be92f60e01b815260040160405180910390fd5b6001600160a01b03919091166000908152600c60205260409020805463ffffffff191660e09290921c919091179055565b6000612002613a62565b6001600160a01b0383166000908152600a602052604090205490915080612055576040517f8792488500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015261dead6024820152604481018290526000906001600160a01b038516906323b872dd906064016020604051808303816000875af11580156120c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120ea9190615e36565b905080612123576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061212f8460da1c90565b905042620bdd806121408184615cdc565b61214a9190615cdc565b1115612182576040517fce347a8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7b03ffffffffffffffffffffffffffffffffffffffffffffffffffffff84164260da1b173360009081526006602090815260409182902092909255516001600160a01b03871681527faa30aaf13ce297e169ade8c74495e8ca52c662afc30e851ee8ca4b2c3bda82f9910160405180910390a15050505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146122795760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c0060448201526064015b60405180910390fd5b600d5550565b60018054610d3f90615c41565b3233146122ac57604051632514e60160e21b815260040160405180910390fd5b600e5460ff166122e8576040517fc7d08f0400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b836005101561230a57604051632795088960e11b815260040160405180910390fd5b61231c8467012dfb0cb5e88000615cbd565b341461233b57604051636956f2ab60e11b815260040160405180910390fd5b61234783836000613c92565b61236457604051638baa579f60e01b815260040160405180910390fd5b6117c9338583613d32565b600061237d61167e83611cf7565b90506001600160a01b03811633148015906123b25750336123a66008546001600160a01b031690565b6001600160a01b031614155b156123d057604051633a6bbed360e01b815260040160405180910390fd5b60008281526015602052604081206116eb916152cc565b6008546001600160a01b0316331461241257604051633e8be92f60e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015612459573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061247d9190615e53565b6040517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018290529091506001600160a01b0383169063a9059cbb906044016020604051808303816000875af11580156124e6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115629190615e36565b3360008181526003602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60146020526000908152604090208054610d3f90615c41565b612597613a62565b33600090815260066020526040902055565b6125b4848484611316565b6001600160a01b0383163b1580159061266557506040517f150b7a0200000000000000000000000000000000000000000000000000000000808252906001600160a01b0385169063150b7a0290612615903390899088908890600401615e6c565b6020604051808303816000875af1158015612634573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126589190615ea8565b6001600160e01b03191614155b156117c9576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6008546001600160a01b031633146126c757604051633e8be92f60e01b815260040160405180910390fd5b60005b81811015611562576127058383838181106126e7576126e7615ca7565b90506020020160208101906126fc9190615509565b60016000613d32565b61270e81615c8c565b90506126ca565b61271d61538a565b6001600160a01b038216600090815260066020526040902054607881901c60ff16825261277b81608081901c60ff9081161515608883901c8216151501609083901c8216151501609883901c821615150160a09290921c1615150190565b6020830152606461278b82614212565b8161279857612798615ec5565b04604083015260646127aa848361427b565b816127b7576127b7615ec5565b046060830152620bdd806127cb8260da1c90565b0142106127d95760006127dc565b600a5b6080830152602881901c64ffffffffff1660a0830181905215801590612811575062278d00602882901c64ffffffffff160142115b61281c57600061281f565b600a5b60c083015260d281901c60ff166101208301527f00000000000000000000000000000000000000000000000000000000000000004211806128655750607881901c60ff16155b6128a0576064607882901c60ff166107d060d284901c60ff16028161288c5761288c615ec5565b048161289a5761289a615ec5565b046128a3565b60005b61014083015260c881901c6103ff1660e083015260646128c2826142a8565b816128cf576128cf615ec5565b04610100830181905261014083015160c084015160808501516060860151604087015101010190910101610160830181905260a882901c60ff166101fe60af84901c16016103fc60b684901c16016101808401819052670de0b6b3a76400008082026101a0860152606492830190910202046101c083015261295183826142d9565b6101e08301526129618160da1c90565b4203620bdd80036102008301526129778161439c565b61022083015250919050565b6008546001600160a01b031633146129ae57604051633e8be92f60e01b815260040160405180910390fd5b60005b83811015611987578282828181106129cb576129cb615ca7565b90506020020135600a60008787858181106129e8576129e8615ca7565b90506020020160208101906129fd9190615509565b6001600160a01b03168152602081019190915260400160002055612a2081615c8c565b90506129b1565b6060612a32826140f8565b612a4f5760405163163a09e160e31b815260040160405180910390fd5b60185460ff161580612a6f5750600e5461010090046001600160a01b0316155b15612a9357604051806060016040528060358152602001615f366035913992915050565b600e546040517f86481d40000000000000000000000000000000000000000000000000000000008152600481018490526101009091046001600160a01b03169063452ce83e90849030906386481d4090602401602060405180830381865afa158015612b03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b279190615e53565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381865afa158015612b68573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610cdf9190810190615cf4565b606060008215612c6e5782600114612c29576040517f7168fcea0000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201523090637168fcea906024015b602060405180830381865afa158015612c00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c249190615e53565b612cd6565b6040517f08ee0c740000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015230906308ee0c7490602401612be3565b6040516370a0823160e01b81526001600160a01b038516600482015230906370a0823190602401602060405180830381865afa158015612cb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cd69190615e53565b905060008167ffffffffffffffff811115612cf357612cf361582b565b604051908082528060200260200182016040528015612d1c578160200160208202803683370190505b50905081612d2d579150610cdf9050565b60007f00000000000000000000000000000000000000000000000000000000000000005b7f000000000000000000000000000000000000000000000000000000000000000060045401811015612e2c576000612d8882611cf7565b9050806001600160a01b0316886001600160a01b03161415612e23576000612db58260dc1c600116151590565b905087158015612dc3575080155b80612dd65750876001148015612dd65750805b80612de15750876002145b15612e215782858580600101965081518110612dff57612dff615ca7565b60200260200101818152505083861415612e2157849650505050505050610cdf565b505b50600101612d51565b509095945050505050565b600081612e4657506000610cdf565b601382101561325757604080516102608101825260008152734bb33f6e69fd62cf3abbcc6f1f43b94a5d572c2b602082015273bea8123277142de42571f1fac045225a1d347977918101919091527312d2d1bed91c24f878f37e66bd829ce7197e4d146060820152730c2e57efddba8c768147d1fdf9176a0a6ebd5d836080820152736e5a65b5f9dd7b1b08ff212e210dcd642de0db8b60a08201527317ed38f5f519c6ed563be6486e629041bed3dfbc60c082015273dd67892e722be69909d7c285db572852d5f8897c60e0820152738a90cab2b38dba80c64b7734e58ee1db38b8992e610100820152736f44db5ed6b86d9cc6046d0c78b82cad9e600f6a61012082015273219b8ab790decc32444a6600971c7c371825253961014082015273c4a0b1e7aa137ada8b2f911a501638088dfdd508610160820152739712228ceeda1e2ddde52cd5100b88986d1cb49c6101808201527356b391339615fd0e88e0d370f451fa91478bb20f6101a082015273648e8428e0104ec7d08667866a3568a72fe3898f6101c082015273d2f668a8461d6761115daf8aeb3cdf5f40c532c66101e082015273bad6186e92002e312078b5a1dafd5ddf63d3f73161020082015273cb4307f1c3b5556256748ddf5b86e81258990b3c610220820152735c211b8e4f93f00e2bd68e82f4e00fbb3302b35c61024082015280836013811061305157613051615ca7565b60200201516040516370a0823160e01b81526001600160a01b038681166004830152909116906370a0823190602401602060405180830381865afa15801561309d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130c19190615e53565b156130d0576001915050610cdf565b82600a1415613181578083601381106130eb576130eb615ca7565b60200201516040517f7dd54ea70000000000000000000000000000000000000000000000000000000081526001600160a01b03868116600483015290911690637dd54ea7906024015b602060405180830381865afa158015613151573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131759190615e53565b60001415915050610cdf565b82600c14156131e95780836013811061319c5761319c615ca7565b60200201516040517f4da6a5560000000000000000000000000000000000000000000000000000000081526001600160a01b03868116600483015290911690634da6a55690602401613134565b82601014156132515780836013811061320457613204615ca7565b60200201516040517f46a43d9a0000000000000000000000000000000000000000000000000000000081526001600160a01b038681166004830152909116906346a43d9a90602401613134565b506133eb565b6000828152600b60205260409020546001600160a01b031680156133e9576040516370a0823160e01b81526001600160a01b0385811660048301528216906370a0823190602401602060405180830381865afa1580156132bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132df9190615e53565b156132ee576001915050610cdf565b6001600160a01b0381166000908152600c602052604090205460e01b6001600160e01b03198116156133e7576040516001600160a01b0386811660248301526000918291851690849060440160408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516133789190615edb565b600060405180830381855afa9150503d80600081146133b3576040519150601f19603f3d011682016040523d82523d6000602084013e6133b8565b606091505b50915091508180156133dc5750808060200190518101906133d99190615e53565b15155b945050505050610cdf565b505b505b50600092915050565b60178054610d3f90615c41565b336000908152600660205260409020547fffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffff16612597565b6008546001600160a01b0316331461346357604051633e8be92f60e01b815260040160405180910390fd5b600e80546001600160a01b03909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b6008546001600160a01b031633146134cd57604051633e8be92f60e01b815260040160405180910390fd5b600d54156134ee57604051631f5ae5c960e21b815260040160405180910390fd5b6135387f00000000000000000000000000000000000000000000000000000000000000007f00000000000000000000000000000000000000000000000000000000000000006143d6565b50565b6008546001600160a01b0316331461356657604051633e8be92f60e01b815260040160405180910390fd5b600e805460ff1916911515919091179055565b6000613583613a62565b905060005b82811015611163576135b3338585848181106135a6576135a6615ca7565b9050602002013584614552565b91506135be81615c8c565b9050613588565b6008546001600160a01b031633146135f057604051633e8be92f60e01b815260040160405180910390fd5b600d54613629576040517f7607330600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60185460ff1615613666576040517fb22df23900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516020810183905201604051602081830303815290604052805190602001207f0000000000000000000000000000000000000000000000000000000000000000146136e0576040517f3fbcde7200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6018805460ff191660011790558151613700906017906020850190615306565b506116eb81600d54604080516020810192909252810182905260600160408051601f198184030181529190528051602090910120600d5550565b6008546001600160a01b0316331461376557604051633e8be92f60e01b815260040160405180910390fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815260066020526040812054610cdf9083906142d9565b8260006137b782611cf7565b905060006137d064ffffffffff60a084901c1642615d62565b905033826001600160a01b0316146137fb57604051633a6bbed360e01b815260040160405180910390fd5b60135481101561381e57604051639a6a107b60e01b815260040160405180910390fd5b61382a85856023614707565b61384757604051630ec0325960e21b815260040160405180910390fd5b60095460405163079cc67960e41b815233600482015268015af1d78b58c4000060248201526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561389b57600080fd5b505af11580156138af573d6000803e3d6000fd5b50505060008781526015602052604090206138cc9150868661541a565b50505050505050565b8260006138e182611cf7565b905060006138fa64ffffffffff60a084901c1642615d62565b905033826001600160a01b03161461392557604051633a6bbed360e01b815260040160405180910390fd5b60135481101561394857604051639a6a107b60e01b815260040160405180910390fd5b61395485856014614707565b61397157604051630ec0325960e21b815260040160405180910390fd5b60095460405163079cc67960e41b81523360048201526802b5e3af16b188000060248201526001600160a01b03909116906379cc679090604401600060405180830381600087803b1580156139c557600080fd5b505af11580156139d9573d6000803e3d6000fd5b50505060008781526014602052604090206138cc9150868661541a565b6000613a078260dc1c600116151590565b15613a13575030919050565b81610cdf565b600080613a3060c884901c620fffff16600261499f565b60c81b7ffffffffff00000ffffffffffffffffffffffffffffffffffffffffffffffffff939093169290921792915050565b33600090815260066020526040812054613a7b816149b5565b91505090565b600080808060f885901c600f16613aaa57613aa5613a9e8861415a565b86906149f8565b613aac565b845b9050613ac281613abc8a89614a42565b90614ac7565b6fffffffffffffffffffffffffffffffff19166fffffffffffffffffffffffffffffffff89161793506001600160e01b0319166001600160e01b038516179150505b94509492505050565b600060ff607883901c1681613b2185611cf7565b90506000613b2e826139f6565b905060648310613b5157604051634543792f60e11b815260040160405180910390fd5b866001600160a01b0316816001600160a01b031614613b8357604051633a6bbed360e01b815260040160405180910390fd5b600086815260026020526040812080546001600160a01b031916905580613bab888886614b41565b90925090506fffffffffffffffffffffffffffffffff87166fffffffffffffffffffffffffffffffff198316176001600160e01b0385166001600160e01b03198316179097507b10000000000000000000000000000000000000000000000000000000179350613c23600160001989019060781b0190565b965084613c405769ffffffffff00000000001987164260281b1796505b60008881526005602052604080822086905551899130916001600160a01b038d16917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a45094979650505050505050565b60408051306020820152339181019190915260608101829052600090819060800160408051601f198184030181528282528051602091820120601054601f890183900483028501830190935287845293506001600160a01b0390911691613d1f918890889081908401838280828437600092019190915250613d199250869150614ba39050565b90614bf6565b6001600160a01b03161495945050505050565b6004546001600160a01b0384166000818152600660205260409020547f0000000000000000000000000000000000000000000000000000000000000000830191620fffff601483901c1690613db3576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b85613dea576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000008685011115613e46576040517fed70473800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000000000868201118015613e775750303b15155b15613eae576040517fd7fac8c700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613eba828760141b0190565b91506000613ec9884288614c1a565b90508660011415613edb57600160de1b175b8515613fe25760ff607884901c16613ef2846149b5565b9350613f00848960781b0190565b935060648882011115613f2657604051634543792f60e11b815260040160405180910390fd5b80613f415769ffffffffff00000000001984164260281b1793505b6000805b89811015613fda578087019150613f5d828786614b41565b604051919750945082906001600160a01b038d16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4604051829030906001600160a01b038e16907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90600090a4600101613f45565b505050614035565b9186019160005b8781101561403357604051858201906001600160a01b038b16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4600101613fe9565b505b6001600160a01b039097166000908152600660209081526040808320949094559381526005909352509020939093555060048054909101905550565b60006140828260de1c600116151590565b15801561409b5750600083815260056020526040902054155b80156140ab57506140ab836140f8565b156140c9576140b9826141dd565b6000848152600560205260409020555b600160de1b8217611669565b600080613a306140ef620fffff60c886901c166001615cdc565b620fffff61499f565b6000817f000000000000000000000000000000000000000000000000000000000000000011158015610cdf5750600454614152907f0000000000000000000000000000000000000000000000000000000000000000615cdc565b821092915050565b6000600d548260405160200161417a929190918252602082015260400190565b60408051601f19818403018152919052805160209091012092915050565b60006141a382614c7c565b6141ac83614cd8565b6141b584614d3e565b6141be856142a8565b6141c8878761427b565b6141d187614212565b01010101019392505050565b60006141ee8260dd1c600116151590565b6141f95760046141fc565b60025b60ff166001600160e01b03901c82169050919050565b60008061425083608081901c60ff9081161515608883901c8216151501609083901c8216151501609883901c821615150160a09290921c1615150190565b905060038110614272576005811061426a57610dac611669565b6107d0611669565b60009392505050565b600060ff60c083901c1661428f8482612e37565b61429d576000915050610cdf565b506103e89392505050565b600060ff607883901c16801561427257806103e860c885901c6103ff1602816142d3576142d3615ec5565b04611669565b600064ffffffffff605083901c16806142f6576000915050610cdf565b60006143227f00000000000000000000000000000000000000000000000000000000000000004261499f565b9050600082821061433557828203614338565b60005b905062015180670de0b6b3a764000060b687901c6103fc1660af88901c6101fe1660ff60a88a901c1601018302020480614379576000945050505050610cdf565b60006143858888614198565b905061271080820183020498975050505050505050565b6143a461548e565b506040805160608101825260ff60a884901c8116825260b084901c8116602083015260b89390931c9092169082015290565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316634000aea07f000000000000000000000000000000000000000000000000000000000000000084866000604051602001614446929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b815260040161447393929190615ef7565b6020604051808303816000875af1158015614492573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144b69190615e36565b50600083815260076020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a090910190925281519183019190912093879052919052614512906001615cdc565b600085815260076020526040902055611d4d8482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b60008061455e84611cf7565b90508060dc81901c60011615156001600160a01b038083169088161461459757604051633a6bbed360e01b815260040160405180910390fd5b806145b5576040516333155e1360e21b815260040160405180910390fd5b6000806145c3888887614e12565b90925090506fffffffffffffffffffffffffffffffff87166fffffffffffffffffffffffffffffffff198316176001600160e01b0386166001600160e01b0319831617909750945061461a8560dd1c600116151590565b156146575761465461462f8960010187614071565b7fffffffffdfffffffffffffffffffffffffffffffffffffffffffffffffffffff1690565b94505b6000888152600560205260408082207fffffffffefffffffffffffffffffffffffffffffffffffffffffffffffffffff9790971696879055517fffffffffffffffffffffffffffffffffff0000000000000000000000000000019890980169ffffffffff000000000019164260281b179789916001600160a01b038c169130917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a45094979650505050505050565b60008084848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505082519293505060019091109050806147565750828151115b8061478657508060008151811061476f5761476f615ca7565b6020910101516001600160f81b031916600160fd1b145b806147c25750806001825161479b9190615d62565b815181106147ab576147ab615ca7565b6020910101516001600160f81b031916600160fd1b145b156147d1576000915050611669565b6000816000815181106147e6576147e6615ca7565b01602001516001600160f81b03191690506000805b83518110156149915783818151811061481657614816615ca7565b01602001516001600160f81b03191691507f60000000000000000000000000000000000000000000000000000000000000008211801561487f57507f7b000000000000000000000000000000000000000000000000000000000000006001600160f81b03198316105b806148e757507f40000000000000000000000000000000000000000000000000000000000000006001600160f81b031983161180156148e757507f5b000000000000000000000000000000000000000000000000000000000000006001600160f81b03198316105b806148ff5750600160fd1b6001600160f81b03198316145b8061496757507f2f000000000000000000000000000000000000000000000000000000000000006001600160f81b0319831611801561496757507f3a000000000000000000000000000000000000000000000000000000000000006001600160f81b03198316105b1561497457819250614981565b6000945050505050611669565b61498a81615c8c565b90506147fb565b506001979650505050505050565b60008183106149ae5781611669565b5090919050565b6000806149c233846142d9565b90507fffffffffffffffffffffffffffffffffff0000000000ffffffffffffffffffff83164260501b1792506149ae3382614e93565b600060f4614a0583614f1c565b901b60f86001600560ff861606017ff00fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8616911b1717905092915050565b6000600f60f883901c168015614a7157600f60c81b602c84901c1660016078600384901b011b90940393909303925b614a808360dd1c600116151590565b15614aab577ffffffffffffc0000000000000000000000000000000000000000000000000000909301925b600360fc84901c6001016001911b60a0011b9093039392505050565b6000600f60f883901c168015614af45760016078600383901b011b93909301602c83901c600f60c81b1601925b614b038360dd1c600116151590565b15614b2a577a04000000000000000000000000000000000000000000000000000093909301925b5050600160fc9190911c810160031b60a0011b0190565b600080614b538360dd1c600116151590565b158015614b65575060f883901c600f16155b8015614b73575060185460ff165b15614b8e57614b8b614b848661415a565b84906149f8565b92505b614b988484614ac7565b959294509192505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b6000806000614c058585614f65565b91509150614c1281614fd5565b509392505050565b60006001600160a01b03841660a084901b177901000000000000000000000000000000000000000000000000001782614c535780614c73565b7b3000000000000000000000000000000000000000000000000000000081175b95945050505050565b6000605082901c64ffffffffff1660da83901c620bdd800180821115614ca6575060009392505050565b804211614cb857506103e89392505050565b8142038282036103e80281614ccf57614ccf615ec5565b04949350505050565b600064ffffffffff602883901c1662278d00810142811115614cfe575060009392505050565b64ffffffffff605085901c16818110614d1d57506103e8949350505050565b8042038242036103e80281614d3457614d34615ec5565b0495945050505050565b600060ff60d283901c1664ffffffffff605084901c16811580614d8057507f000000000000000000000000000000000000000000000000000000000000000081115b15614d8f575060009392505050565b6000607885901c60ff166107d0840281614dab57614dab615ec5565b0490507f00000000000000000000000000000000000000000000000000000000000000004211614ddd57949350505050565b814203827f000000000000000000000000000000000000000000000000000000000000000003820281614d3457614d34615ec5565b600080614e1f8484614a42565b9350614e308360dd1c600116151590565b8015614e5257506202a300614e5064ffffffffff60a086901c1642615d62565b105b15614e89576040517f463e718b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5091939092509050565b655af3107a40008111156116eb576009546040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b158015614f0857600080fd5b505af11580156112b8573d6000803e3d6000fd5b600060ff600883901c16606c811115614f385750600092915050565b6049811115614f4a5750600192915050565b6011811115614f5c5750600292915050565b50600392915050565b600080825160411415614f9c5760208301516040840151606085015160001a614f9087828585615190565b94509450505050614fce565b825160401415614fc65760208301516040840151614fbb86838361527a565b935093505050614fce565b506000905060025b9250929050565b6000816004811115614fe957614fe9615f1f565b1415614ff25750565b600181600481111561500657615006615f1f565b14156150545760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401612270565b600281600481111561506857615068615f1f565b14156150b65760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401612270565b60038160048111156150ca576150ca615f1f565b14156151235760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401612270565b600481600481111561513757615137615f1f565b14156135385760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401612270565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156151c75750600090506003613b04565b8460ff16601b141580156151df57508460ff16601c14155b156151f05750600090506004613b04565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015615244573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661526d57600060019250925050613b04565b9660009650945050505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316816152b060ff86901c601b615cdc565b90506152be87828885615190565b935093505050935093915050565b5080546152d890615c41565b6000825580601f106152e8575050565b601f01602090049060005260206000209081019061353891906154ac565b82805461531290615c41565b90600052602060002090601f016020900481019282615334576000855561537a565b82601f1061534d57805160ff191683800117855561537a565b8280016001018555821561537a579182015b8281111561537a57825182559160200191906001019061535f565b506153869291506154ac565b5090565b604051806102400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200161541561548e565b905290565b82805461542690615c41565b90600052602060002090601f016020900481019282615448576000855561537a565b82601f106154615782800160ff1982351617855561537a565b8280016001018555821561537a579182015b8281111561537a578235825591602001919060010190615473565b60405180606001604052806003906020820280368337509192915050565b5b8082111561538657600081556001016154ad565b6001600160e01b03198116811461353857600080fd5b6000602082840312156154e957600080fd5b8135611669816154c1565b6001600160a01b038116811461353857600080fd5b60006020828403121561551b57600080fd5b8135611669816154f4565b60005b83811015615541578181015183820152602001615529565b838111156117c95750506000910152565b6000815180845261556a816020860160208601615526565b601f01601f19169290920160200192915050565b6020815260006116696020830184615552565b6000602082840312156155a357600080fd5b5035919050565b600080604083850312156155bd57600080fd5b82356155c8816154f4565b946020939093013593505050565b60008083601f8401126155e857600080fd5b50813567ffffffffffffffff81111561560057600080fd5b6020830191508360208260051b8501011115614fce57600080fd5b6000806020838503121561562e57600080fd5b823567ffffffffffffffff81111561564557600080fd5b615651858286016155d6565b90969095509350505050565b60008083601f84011261566f57600080fd5b50813567ffffffffffffffff81111561568757600080fd5b602083019150836020828501011115614fce57600080fd5b801515811461353857600080fd5b6000806000806000608086880312156156c557600080fd5b8535945060208601359350604086013567ffffffffffffffff8111156156ea57600080fd5b6156f68882890161565d565b909450925050606086013561570a8161569f565b809150509295509295909350565b60008060006060848603121561572d57600080fd5b8335615738816154f4565b92506020840135615748816154f4565b929592945050506040919091013590565b6000806040838503121561576c57600080fd5b50508035926020909101359150565b6000806000806040858703121561579157600080fd5b843567ffffffffffffffff808211156157a957600080fd5b6157b5888389016155d6565b909650945060208701359150808211156157ce57600080fd5b506157db878288016155d6565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b8181101561581f57835183529284019291840191600101615803565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561586a5761586a61582b565b604052919050565b600067ffffffffffffffff82111561588c5761588c61582b565b50601f01601f191660200190565b60006158ad6158a884615872565b615841565b90508281528383830111156158c157600080fd5b828260208301376000602084830101529392505050565b600082601f8301126158e957600080fd5b6116698383356020850161589a565b60006020828403121561590a57600080fd5b813567ffffffffffffffff81111561592157600080fd5b611d4d848285016158d8565b6000806040838503121561594057600080fd5b823561594b816154f4565b9150602083013561595b816154c1565b809150509250929050565b6000806000806060858703121561597c57600080fd5b84359350602085013567ffffffffffffffff81111561599a57600080fd5b6159a68782880161565d565b90945092505060408501356159ba8161569f565b939692955090935050565b600080604083850312156159d857600080fd5b82356159e3816154f4565b9150602083013561595b8161569f565b60008060008060808587031215615a0957600080fd5b8435615a14816154f4565b93506020850135615a24816154f4565b925060408501359150606085013567ffffffffffffffff811115615a4757600080fd5b8501601f81018713615a5857600080fd5b615a678782356020840161589a565b91505092959194509250565b8060005b60038110156117c9578151845260209384019390910190600101615a77565b815181526020808301519082015260408083015190820152606080830151908201526080808301519082015260a0808301519082015260c0808301519082015260e08083015190820152610100808301519082015261012080830151908201526101408083015190820152610160808301519082015261018080830151908201526101a080830151908201526101c080830151908201526101e0808301519082015261020080830151908201526102208083015161028083019190615b5d82850182615a73565b505092915050565b600060208284031215615b7757600080fd5b81356116698161569f565b60008060408385031215615b9557600080fd5b8235615ba0816154f4565b9150602083013561595b816154f4565b60008060408385031215615bc357600080fd5b823567ffffffffffffffff811115615bda57600080fd5b615be6858286016158d8565b95602094909401359450505050565b600080600060408486031215615c0a57600080fd5b83359250602084013567ffffffffffffffff811115615c2857600080fd5b615c348682870161565d565b9497909650939450505050565b600181811c90821680615c5557607f821691505b60208210811415611f5857634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415615ca057615ca0615c76565b5060010190565b634e487b7160e01b600052603260045260246000fd5b6000816000190483118215151615615cd757615cd7615c76565b500290565b60008219821115615cef57615cef615c76565b500190565b600060208284031215615d0657600080fd5b815167ffffffffffffffff811115615d1d57600080fd5b8201601f81018413615d2e57600080fd5b8051615d3c6158a882615872565b818152856020838501011115615d5157600080fd5b614c73826020830160208601615526565b600082821015615d7457615d74615c76565b500390565b60006020808385031215615d8c57600080fd5b825167ffffffffffffffff80821115615da457600080fd5b818501915085601f830112615db857600080fd5b815181811115615dca57615dca61582b565b8060051b9150615ddb848301615841565b8181529183018401918481019088841115615df557600080fd5b938501935b83851015615e1357845182529385019390850190615dfa565b98975050505050505050565b600081615e2e57615e2e615c76565b506000190190565b600060208284031215615e4857600080fd5b81516116698161569f565b600060208284031215615e6557600080fd5b5051919050565b60006001600160a01b03808716835280861660208401525083604083015260806060830152615e9e6080830184615552565b9695505050505050565b600060208284031215615eba57600080fd5b8151611669816154c1565b634e487b7160e01b600052601260045260246000fd5b60008251615eed818460208701615526565b9190910192915050565b6001600160a01b0384168152826020820152606060408201526000614c736060830184615552565b634e487b7160e01b600052602160045260246000fdfe697066733a2f2f516d57394e4b55475965735469597835695350316f3832746e344368713969317951563644426e7a7a6e72485448a264697066735822122071bb7a7c5aec0cc90d60a643aad4aeac0cae2d534b00e35b8cae3ad56fc51b3464736f6c634300080c0033b2393709b4cf0156fc89b28edf511f1d19de6851aa70ec585f949c7f16a7b523
Deployed Bytecode
0x6080604052600436106104b65760003560e01c806388486f8611610279578063c0d4c3071161015e578063e1da26c6116100d6578063ea9384fa1161008a578063f40f0f521161006f578063f40f0f5214610c02578063f948dbf614610c22578063fe55932a14610c3557600080fd5b8063ea9384fa14610bcf578063f2fde38b14610be257600080fd5b8063e449f341116100bb578063e449f34114610b61578063e4a73e5b14610b74578063e985e9c514610b9457600080fd5b8063e1da26c614610b46578063e2e06fa314610b4e57600080fd5b8063c9be651b1161012d578063cdaecb1911610112578063cdaecb1914610b16578063da4f633b14610b2b578063e17b25af14610b3357600080fd5b8063c9be651b14610ad6578063cb4bd00e14610af657600080fd5b8063c0d4c30714610a63578063c32d3ae214610a76578063c3d33cb514610aa3578063c87b56dd14610ab657600080fd5b806399ff2190116101f1578063aaab6339116101c0578063b88a802f116101a5578063b88a802f14610a21578063b88d4fde14610a29578063bc8893b414610a4957600080fd5b8063aaab6339146109ea578063b61f88b414610a0157600080fd5b806399ff21901461098e5780639bbe87d9146109a45780639be65a60146109b7578063a22cb465146109ca57600080fd5b8063930bdc871161024857806394985ddd1161022d57806394985ddd1461094657806395d89b411461096657806396cf6c6c1461097b57600080fd5b8063930bdc87146109205780639366c1fd1461093357600080fd5b806388486f86146108ba578063895d2206146108da5780638da5cb5b146108ef57806390c3f38f1461090d57600080fd5b80633307dcfe1161039f5780636352211e116103175780637168fcea116102e65780637ee843cc116102cb5780637ee843cc146108745780638091aa031461088757806386481d401461089a57600080fd5b80637168fcea1461083f5780637284e4161461085f57600080fd5b80636352211e146107b25780636a8954b9146107d25780636c08c6b1146107ff57806370a082311461081f57600080fd5b806342842e0e1161036e5780635bb209a5116103535780635bb209a51461075f5780636035386a1461077f578063628cbb6d1461079257600080fd5b806342842e0e1461072c5780634fc918bc1461074c57600080fd5b80633307dcfe146106e4578063392f37e9146106ec5780633ccfd60b1461071157806341ab7f481461071957600080fd5b8063110d62411161043257806320fc7eb21161040157806326e0d280116103e657806326e0d2801461069b578063279350bd146106b15780632828adb2146106d157600080fd5b806320fc7eb21461065b57806323b872dd1461067b57600080fd5b8063110d6241146105ff578063176ca01d1461061f57806318160ddd146106325780631ae0b4ec1461064857600080fd5b806308ee0c74116104895780630b747d911161046e5780630b747d91146105c35780630ce90ec2146105d95780630fbf0a93146105ec57600080fd5b806308ee0c7414610575578063095ea7b3146105a357600080fd5b806301ffc9a7146104bb578063046dc166146104f057806306fdde0314610505578063081812fc14610527575b600080fd5b3480156104c757600080fd5b506104db6104d63660046154d7565b610c48565b60405190151581526020015b60405180910390f35b6105036104fe366004615509565b610ce5565b005b34801561051157600080fd5b5061051a610d32565b6040516104e7919061557e565b34801561053357600080fd5b5061055d610542366004615591565b6002602052600090815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020016104e7565b34801561058157600080fd5b50610595610590366004615509565b610dc0565b6040519081526020016104e7565b3480156105af57600080fd5b506105036105be3660046155aa565b610de4565b3480156105cf57600080fd5b50610595600d5481565b6105036105e7366004615591565b610eb0565b6105036105fa36600461561b565b611117565b34801561060b57600080fd5b5060095461055d906001600160a01b031681565b61050361062d3660046156ad565b611178565b34801561063e57600080fd5b5061059560045481565b610503610656366004615591565b6112c0565b34801561066757600080fd5b50610595610676366004615509565b6112f0565b34801561068757600080fd5b50610503610696366004615718565b611316565b3480156106a757600080fd5b5061059560125481565b3480156106bd57600080fd5b5061051a6106cc366004615759565b611567565b6105036106df366004615591565b611670565b6105036116ef565b3480156106f857600080fd5b50600e5461055d9061010090046001600160a01b031681565b61050361174c565b610503610727366004615591565b6117cf565b34801561073857600080fd5b50610503610747366004615718565b6118a8565b61050361075a36600461577b565b6118c3565b34801561076b57600080fd5b5061059561077a366004615591565b61198e565b61050361078d36600461561b565b6119e3565b34801561079e57600080fd5b5061051a6107ad366004615591565b611b26565b3480156107be57600080fd5b5061055d6107cd366004615591565b611b3f565b3480156107de57600080fd5b506107f26107ed366004615509565b611b4d565b6040516104e791906157e7565b34801561080b57600080fd5b5061059561081a366004615591565b611cf7565b34801561082b57600080fd5b5061059561083a366004615509565b611d68565b34801561084b57600080fd5b5061059561085a366004615509565b611dcd565b34801561086b57600080fd5b5061051a611dfc565b6105036108823660046158f8565b611e09565b610503610895366004615509565b611e6a565b3480156108a657600080fd5b506105956108b5366004615591565b611eb7565b3480156108c657600080fd5b5061055d6108d5366004615591565b611ece565b3480156108e657600080fd5b50610595611edc565b3480156108fb57600080fd5b506008546001600160a01b031661055d565b61050361091b3660046158f8565b611f5e565b61050361092e36600461592d565b611f9c565b610503610941366004615509565b611ff8565b34801561095257600080fd5b50610503610961366004615759565b6121fc565b34801561097257600080fd5b5061051a61227f565b610503610989366004615966565b61228c565b34801561099a57600080fd5b5061059560115481565b6105036109b2366004615591565b61236f565b6105036109c5366004615509565b6123e7565b3480156109d657600080fd5b506105036109e53660046159c5565b61250a565b3480156109f657600080fd5b50600d5415156104db565b348015610a0d57600080fd5b5061051a610a1c366004615591565b612576565b61050361258f565b348015610a3557600080fd5b50610503610a443660046159f3565b6125a9565b348015610a5557600080fd5b50600e546104db9060ff1681565b610503610a7136600461561b565b61269c565b348015610a8257600080fd5b50610a96610a91366004615509565b612715565b6040516104e79190615a96565b610503610ab136600461577b565b612983565b348015610ac257600080fd5b5061051a610ad1366004615591565b612a27565b348015610ae257600080fd5b506107f2610af13660046155aa565b612b90565b348015610b0257600080fd5b506104db610b113660046155aa565b612e37565b348015610b2257600080fd5b5061051a6133f4565b610503613401565b610503610b41366004615509565b613438565b6105036134a2565b610503610b5c366004615b65565b61353b565b610503610b6f36600461561b565b613579565b348015610b8057600080fd5b50600f5461055d906001600160a01b031681565b348015610ba057600080fd5b506104db610baf366004615b82565b600360209081526000928352604080842090915290825290205460ff1681565b610503610bdd366004615bb0565b6135c5565b348015610bee57600080fd5b50610503610bfd366004615509565b61373a565b348015610c0e57600080fd5b50610595610c1d366004615509565b613787565b610503610c30366004615bf5565b6137ab565b610503610c43366004615bf5565b6138d5565b60007f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b031983161480610cab57507f80ac58cd000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b80610cdf57507f5b5e139f000000000000000000000000000000000000000000000000000000006001600160e01b03198316145b92915050565b6008546001600160a01b03163314610d1057604051633e8be92f60e01b815260040160405180910390fd5b601080546001600160a01b0319166001600160a01b0392909216919091179055565b60008054610d3f90615c41565b80601f0160208091040260200160405190810160405280929190818152602001828054610d6b90615c41565b8015610db85780601f10610d8d57610100808354040283529160200191610db8565b820191906000526020600020905b815481529060010190602001808311610d9b57829003601f168201915b505050505081565b6001600160a01b03811660009081526006602052604081205460781c60ff16610cdf565b6000610df7610df283611cf7565b6139f6565b9050336001600160a01b03821614801590610e3657506001600160a01b038116600090815260036020908152604080832033845290915290205460ff16155b15610e54576040516327da82d560e11b815260040160405180910390fd5b60008281526002602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000610ebb82611cf7565b905080336001600160a01b03821614610ee757604051633a6bbed360e01b815260040160405180910390fd5b600160fc83901c016002811115610f2a576040517f921c7d5f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060011415610fdb57610d9560115410610f575760405163519f594360e01b815260040160405180910390fd5b60095460405163079cc67960e41b815233600482015268068155a43676e0000060248201526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015610fab57600080fd5b505af1158015610fbf573d6000803e3d6000fd5b50505050601160008154610fd290615c8c565b9091555061107f565b61057760125410610fff5760405163519f594360e01b815260040160405180910390fd5b60095460405163079cc67960e41b81523360048201526812f939c99edab8000060248201526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561105357600080fd5b505af1158015611067573d6000803e3d6000fd5b5050505060126000815461107a90615c8c565b909155505b60006110ac7f10000000000000000000000000000000000000000000000000000000000000008501613a19565b90506110bd8460dc1c600116151590565b80156110cb575060185460ff165b156110ff5760006110da613a62565b90506110e881878785613a81565b336000908152600660205260409020919091559150505b60009485526005602052604090942093909355505050565b6000611121613a62565b905060005b82811015611163576111513385858481811061114457611144615ca7565b9050602002013584613b0d565b915061115c81615c8c565b9050611126565b50336000908152600660205260409020555050565b32331461119857604051632514e60160e21b815260040160405180910390fd5b600e5460ff16156111d5576040517f04cc9ce200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8360051015611210576040517f4c3ff92d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112228567010a741a46278000615cbd565b341461124157604051636956f2ab60e11b815260040160405180910390fd5b61124c838386613c92565b61126957604051638baa579f60e01b815260040160405180910390fd5b3360009081526006602052604081205460141c620fffff1690508461128e8783615cdc565b11156112ad57604051632795088960e11b815260040160405180910390fd5b6112b8338784613d32565b505050505050565b6008546001600160a01b031633146112eb57604051633e8be92f60e01b815260040160405180910390fd5b601355565b6001600160a01b03811660009081526006602052604081205460141c620fffff16610cdf565b6001600160a01b038216301415611354576000611331613a62565b905061133e338383613b0d565b3360009081526006602052604090205550505050565b600061135f82611cf7565b9050600061136c826139f6565b90506000336001600160a01b03831614806113aa57506001600160a01b038216600090815260036020908152604080832033845290915290205460ff165b806113cb57506000848152600260205260409020546001600160a01b031633145b9050806113eb576040516327da82d560e11b815260040160405180910390fd5b6001600160a01b03851661142b576040517fea553b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b856001600160a01b0316826001600160a01b031614611476576040517fa114810000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600084815260026020526040902080546001600160a01b03191690556114f46114ef426114c3886114aa60018a0189614071565b6001600160a01b0319166001600160a01b039091161790565b7fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff1660a09190911b1790565b6140d5565b6000858152600560209081526040808320939093556001600160a01b038981168084526006909252838320805460001901905588168083528383208054600101905592518793927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a45050505b505050565b6060611572836140f8565b61158f5760405163163a09e160e31b815260040160405180910390fd5b60185460ff1615806115af5750600e5461010090046001600160a01b0316155b156115d457604051806060016040528060358152602001615f36603591399050610cdf565b600e546040517f452ce83e00000000000000000000000000000000000000000000000000000000815260048101859052602481018490526101009091046001600160a01b03169063452ce83e90604401600060405180830381865afa158015611641573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116699190810190615cf4565b9392505050565b600061168161167e83611cf7565b90565b90506001600160a01b03811633148015906116b65750336116aa6008546001600160a01b031690565b6001600160a01b031614155b156116d457604051633a6bbed360e01b815260040160405180910390fd5b60008281526014602052604081206116eb916152cc565b5050565b6008546001600160a01b0316331461171a57604051633e8be92f60e01b815260040160405180910390fd5b600d541561173b57604051631f5ae5c960e21b815260040160405180910390fd5b611746600143615d62565b40600d55565b6008546001600160a01b0316331461177757604051633e8be92f60e01b815260040160405180910390fd5b600f5460405147916001600160a01b0316908290600081818185875af1925050503d80600081146117c4576040519150601f19603f3d011682016040523d82523d6000602084013e6117c9565b606091505b50505050565b60006117d9613a62565b905060ff60c082901c168281141561181d576040517f61de27c100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b821580159061183357506118313384612e37565b155b1561186a576040517fc1757b3400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7fffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffff821660c084901b1733600090815260066020526040902055505050565b611562838383604051806020016040528060008152506125a9565b6008546001600160a01b031633146118ee57604051633e8be92f60e01b815260040160405180910390fd5b60005b8181101561198757600083838381811061190d5761190d615ca7565b905060200201359050806000141561192457600080fd5b85858381811061193657611936615ca7565b905060200201602081019061194b9190615509565b6000918252600b602052604090912080546001600160a01b0319166001600160a01b0390921691909117905561198081615c8c565b90506118f1565b5050505050565b60185460009060ff166119b45760405163847b198f60e01b815260040160405180910390fd5b6119bd826140f8565b6119da5760405163163a09e160e31b815260040160405180910390fd5b610cdf8261415a565b60185460ff16611a065760405163847b198f60e01b815260040160405180910390fd5b6000611a10613a62565b905060008060005b84811015611b0c57858582818110611a3257611a32615ca7565b905060200201359250611a4483611cf7565b915033826001600160a01b031614611a6f57604051633a6bbed360e01b815260040160405180910390fd5b611a7e8260dc1c600116151590565b611a9b576040516333155e1360e21b815260040160405180910390fd5b60f882901c600f1615611ada576040517f6e62ff6400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611ae684848485613a81565b60008581526005602052604090208190559094509150611b0581615c8c565b9050611a18565b505033600090815260066020526040902091909155505050565b60156020526000908152604090208054610d3f90615c41565b6000610cdf610df283611cf7565b60185460609060ff16611b6e57505060408051600081526020810190915290565b6040517fc9be651b0000000000000000000000000000000000000000000000000000000081526001600160a01b038316600482015260016024820152600090309063c9be651b90604401600060405180830381865afa158015611bd5573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611bfd9190810190615d79565b6001600160a01b038416600090815260066020526040812054919250611c238583614198565b90506000805b8451811015611cc057611c54858281518110611c4757611c47615ca7565b6020026020010151611cf7565b915060f882901c600f16611c8f57611c8784868381518110611c7857611c78615ca7565b60200260200101518485613a81565b509350611cb0565b6000858281518110611ca357611ca3615ca7565b6020026020010181815250505b611cb981615c8c565b9050611c29565b506000611ccd8785614198565b9050828111611cea57604080516000815260208101909152611cec565b845b979650505050505050565b6000611d02826140f8565b611d1f5760405163163a09e160e31b815260040160405180910390fd5b815b6000818152600560205260409020548015611d5557838214611d4b57611d46816141dd565b611d4d565b805b949350505050565b5080611d6081615e1f565b915050611d21565b60006001600160a01b038216611daa576040517fcbe7266800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b038216600090815260066020526040902054620fffff16610cdf565b6001600160a01b03811660009081526006602052604081205461166960ff607883901c16620fffff8316615cdc565b60168054610d3f90615c41565b6008546001600160a01b03163314611e3457604051633e8be92f60e01b815260040160405180910390fd5b60185460ff16611e575760405163847b198f60e01b815260040160405180910390fd5b80516116eb906017906020840190615306565b6008546001600160a01b03163314611e9557604051633e8be92f60e01b815260040160405180910390fd5b600980546001600160a01b0319166001600160a01b0392909216919091179055565b6000610cdf611ec583611cf7565b60fc1c60010190565b6000610cdf61167e83611cf7565b6000807f00000000000000000000000000000000000000000000000000000000000000015b6004547f000000000000000000000000000000000000000000000000000000000000000101811015611f5857611f44611f3982611cf7565b60dc1c600116151590565b15611f50578160010191505b600101611f01565b50919050565b6008546001600160a01b03163314611f8957604051633e8be92f60e01b815260040160405180910390fd5b80516116eb906016906020840190615306565b6008546001600160a01b03163314611fc757604051633e8be92f60e01b815260040160405180910390fd5b6001600160a01b03919091166000908152600c60205260409020805463ffffffff191660e09290921c919091179055565b6000612002613a62565b6001600160a01b0383166000908152600a602052604090205490915080612055576040517f8792488500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f23b872dd00000000000000000000000000000000000000000000000000000000815233600482015261dead6024820152604481018290526000906001600160a01b038516906323b872dd906064016020604051808303816000875af11580156120c6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120ea9190615e36565b905080612123576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600061212f8460da1c90565b905042620bdd806121408184615cdc565b61214a9190615cdc565b1115612182576040517fce347a8500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7b03ffffffffffffffffffffffffffffffffffffffffffffffffffffff84164260da1b173360009081526006602090815260409182902092909255516001600160a01b03871681527faa30aaf13ce297e169ade8c74495e8ca52c662afc30e851ee8ca4b2c3bda82f9910160405180910390a15050505050565b336001600160a01b037f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb795216146122795760405162461bcd60e51b815260206004820152601f60248201527f4f6e6c7920565246436f6f7264696e61746f722063616e2066756c66696c6c0060448201526064015b60405180910390fd5b600d5550565b60018054610d3f90615c41565b3233146122ac57604051632514e60160e21b815260040160405180910390fd5b600e5460ff166122e8576040517fc7d08f0400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b836005101561230a57604051632795088960e11b815260040160405180910390fd5b61231c8467012dfb0cb5e88000615cbd565b341461233b57604051636956f2ab60e11b815260040160405180910390fd5b61234783836000613c92565b61236457604051638baa579f60e01b815260040160405180910390fd5b6117c9338583613d32565b600061237d61167e83611cf7565b90506001600160a01b03811633148015906123b25750336123a66008546001600160a01b031690565b6001600160a01b031614155b156123d057604051633a6bbed360e01b815260040160405180910390fd5b60008281526015602052604081206116eb916152cc565b6008546001600160a01b0316331461241257604051633e8be92f60e01b815260040160405180910390fd5b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa158015612459573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061247d9190615e53565b6040517fa9059cbb000000000000000000000000000000000000000000000000000000008152336004820152602481018290529091506001600160a01b0383169063a9059cbb906044016020604051808303816000875af11580156124e6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115629190615e36565b3360008181526003602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b60146020526000908152604090208054610d3f90615c41565b612597613a62565b33600090815260066020526040902055565b6125b4848484611316565b6001600160a01b0383163b1580159061266557506040517f150b7a0200000000000000000000000000000000000000000000000000000000808252906001600160a01b0385169063150b7a0290612615903390899088908890600401615e6c565b6020604051808303816000875af1158015612634573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126589190615ea8565b6001600160e01b03191614155b156117c9576040517fd1a57ed600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6008546001600160a01b031633146126c757604051633e8be92f60e01b815260040160405180910390fd5b60005b81811015611562576127058383838181106126e7576126e7615ca7565b90506020020160208101906126fc9190615509565b60016000613d32565b61270e81615c8c565b90506126ca565b61271d61538a565b6001600160a01b038216600090815260066020526040902054607881901c60ff16825261277b81608081901c60ff9081161515608883901c8216151501609083901c8216151501609883901c821615150160a09290921c1615150190565b6020830152606461278b82614212565b8161279857612798615ec5565b04604083015260646127aa848361427b565b816127b7576127b7615ec5565b046060830152620bdd806127cb8260da1c90565b0142106127d95760006127dc565b600a5b6080830152602881901c64ffffffffff1660a0830181905215801590612811575062278d00602882901c64ffffffffff160142115b61281c57600061281f565b600a5b60c083015260d281901c60ff166101208301527f0000000000000000000000000000000000000000000000000000000062913a964211806128655750607881901c60ff16155b6128a0576064607882901c60ff166107d060d284901c60ff16028161288c5761288c615ec5565b048161289a5761289a615ec5565b046128a3565b60005b61014083015260c881901c6103ff1660e083015260646128c2826142a8565b816128cf576128cf615ec5565b04610100830181905261014083015160c084015160808501516060860151604087015101010190910101610160830181905260a882901c60ff166101fe60af84901c16016103fc60b684901c16016101808401819052670de0b6b3a76400008082026101a0860152606492830190910202046101c083015261295183826142d9565b6101e08301526129618160da1c90565b4203620bdd80036102008301526129778161439c565b61022083015250919050565b6008546001600160a01b031633146129ae57604051633e8be92f60e01b815260040160405180910390fd5b60005b83811015611987578282828181106129cb576129cb615ca7565b90506020020135600a60008787858181106129e8576129e8615ca7565b90506020020160208101906129fd9190615509565b6001600160a01b03168152602081019190915260400160002055612a2081615c8c565b90506129b1565b6060612a32826140f8565b612a4f5760405163163a09e160e31b815260040160405180910390fd5b60185460ff161580612a6f5750600e5461010090046001600160a01b0316155b15612a9357604051806060016040528060358152602001615f366035913992915050565b600e546040517f86481d40000000000000000000000000000000000000000000000000000000008152600481018490526101009091046001600160a01b03169063452ce83e90849030906386481d4090602401602060405180830381865afa158015612b03573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b279190615e53565b6040516001600160e01b031960e085901b16815260048101929092526024820152604401600060405180830381865afa158015612b68573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610cdf9190810190615cf4565b606060008215612c6e5782600114612c29576040517f7168fcea0000000000000000000000000000000000000000000000000000000081526001600160a01b03851660048201523090637168fcea906024015b602060405180830381865afa158015612c00573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c249190615e53565b612cd6565b6040517f08ee0c740000000000000000000000000000000000000000000000000000000081526001600160a01b038516600482015230906308ee0c7490602401612be3565b6040516370a0823160e01b81526001600160a01b038516600482015230906370a0823190602401602060405180830381865afa158015612cb2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cd69190615e53565b905060008167ffffffffffffffff811115612cf357612cf361582b565b604051908082528060200260200182016040528015612d1c578160200160208202803683370190505b50905081612d2d579150610cdf9050565b60007f00000000000000000000000000000000000000000000000000000000000000015b7f000000000000000000000000000000000000000000000000000000000000000160045401811015612e2c576000612d8882611cf7565b9050806001600160a01b0316886001600160a01b03161415612e23576000612db58260dc1c600116151590565b905087158015612dc3575080155b80612dd65750876001148015612dd65750805b80612de15750876002145b15612e215782858580600101965081518110612dff57612dff615ca7565b60200260200101818152505083861415612e2157849650505050505050610cdf565b505b50600101612d51565b509095945050505050565b600081612e4657506000610cdf565b601382101561325757604080516102608101825260008152734bb33f6e69fd62cf3abbcc6f1f43b94a5d572c2b602082015273bea8123277142de42571f1fac045225a1d347977918101919091527312d2d1bed91c24f878f37e66bd829ce7197e4d146060820152730c2e57efddba8c768147d1fdf9176a0a6ebd5d836080820152736e5a65b5f9dd7b1b08ff212e210dcd642de0db8b60a08201527317ed38f5f519c6ed563be6486e629041bed3dfbc60c082015273dd67892e722be69909d7c285db572852d5f8897c60e0820152738a90cab2b38dba80c64b7734e58ee1db38b8992e610100820152736f44db5ed6b86d9cc6046d0c78b82cad9e600f6a61012082015273219b8ab790decc32444a6600971c7c371825253961014082015273c4a0b1e7aa137ada8b2f911a501638088dfdd508610160820152739712228ceeda1e2ddde52cd5100b88986d1cb49c6101808201527356b391339615fd0e88e0d370f451fa91478bb20f6101a082015273648e8428e0104ec7d08667866a3568a72fe3898f6101c082015273d2f668a8461d6761115daf8aeb3cdf5f40c532c66101e082015273bad6186e92002e312078b5a1dafd5ddf63d3f73161020082015273cb4307f1c3b5556256748ddf5b86e81258990b3c610220820152735c211b8e4f93f00e2bd68e82f4e00fbb3302b35c61024082015280836013811061305157613051615ca7565b60200201516040516370a0823160e01b81526001600160a01b038681166004830152909116906370a0823190602401602060405180830381865afa15801561309d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130c19190615e53565b156130d0576001915050610cdf565b82600a1415613181578083601381106130eb576130eb615ca7565b60200201516040517f7dd54ea70000000000000000000000000000000000000000000000000000000081526001600160a01b03868116600483015290911690637dd54ea7906024015b602060405180830381865afa158015613151573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131759190615e53565b60001415915050610cdf565b82600c14156131e95780836013811061319c5761319c615ca7565b60200201516040517f4da6a5560000000000000000000000000000000000000000000000000000000081526001600160a01b03868116600483015290911690634da6a55690602401613134565b82601014156132515780836013811061320457613204615ca7565b60200201516040517f46a43d9a0000000000000000000000000000000000000000000000000000000081526001600160a01b038681166004830152909116906346a43d9a90602401613134565b506133eb565b6000828152600b60205260409020546001600160a01b031680156133e9576040516370a0823160e01b81526001600160a01b0385811660048301528216906370a0823190602401602060405180830381865afa1580156132bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132df9190615e53565b156132ee576001915050610cdf565b6001600160a01b0381166000908152600c602052604090205460e01b6001600160e01b03198116156133e7576040516001600160a01b0386811660248301526000918291851690849060440160408051601f198184030181529181526020820180516001600160e01b03166001600160e01b03199094169390931790925290516133789190615edb565b600060405180830381855afa9150503d80600081146133b3576040519150601f19603f3d011682016040523d82523d6000602084013e6133b8565b606091505b50915091508180156133dc5750808060200190518101906133d99190615e53565b15155b945050505050610cdf565b505b505b50600092915050565b60178054610d3f90615c41565b336000908152600660205260409020547fffffffffffffff00ffffffffffffffffffffffffffffffffffffffffffffffff16612597565b6008546001600160a01b0316331461346357604051633e8be92f60e01b815260040160405180910390fd5b600e80546001600160a01b03909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b6008546001600160a01b031633146134cd57604051633e8be92f60e01b815260040160405180910390fd5b600d54156134ee57604051631f5ae5c960e21b815260040160405180910390fd5b6135387faa77729d3466ca35ae8d28b3bbac7cc36a5031efdc430821c02bc31a238af4457f0000000000000000000000000000000000000000000000001bc16d674ec800006143d6565b50565b6008546001600160a01b0316331461356657604051633e8be92f60e01b815260040160405180910390fd5b600e805460ff1916911515919091179055565b6000613583613a62565b905060005b82811015611163576135b3338585848181106135a6576135a6615ca7565b9050602002013584614552565b91506135be81615c8c565b9050613588565b6008546001600160a01b031633146135f057604051633e8be92f60e01b815260040160405180910390fd5b600d54613629576040517f7607330600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60185460ff1615613666576040517fb22df23900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b604080516020810183905201604051602081830303815290604052805190602001207fb2393709b4cf0156fc89b28edf511f1d19de6851aa70ec585f949c7f16a7b523146136e0576040517f3fbcde7200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6018805460ff191660011790558151613700906017906020850190615306565b506116eb81600d54604080516020810192909252810182905260600160408051601f198184030181529190528051602090910120600d5550565b6008546001600160a01b0316331461376557604051633e8be92f60e01b815260040160405180910390fd5b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6001600160a01b038116600090815260066020526040812054610cdf9083906142d9565b8260006137b782611cf7565b905060006137d064ffffffffff60a084901c1642615d62565b905033826001600160a01b0316146137fb57604051633a6bbed360e01b815260040160405180910390fd5b60135481101561381e57604051639a6a107b60e01b815260040160405180910390fd5b61382a85856023614707565b61384757604051630ec0325960e21b815260040160405180910390fd5b60095460405163079cc67960e41b815233600482015268015af1d78b58c4000060248201526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561389b57600080fd5b505af11580156138af573d6000803e3d6000fd5b50505060008781526015602052604090206138cc9150868661541a565b50505050505050565b8260006138e182611cf7565b905060006138fa64ffffffffff60a084901c1642615d62565b905033826001600160a01b03161461392557604051633a6bbed360e01b815260040160405180910390fd5b60135481101561394857604051639a6a107b60e01b815260040160405180910390fd5b61395485856014614707565b61397157604051630ec0325960e21b815260040160405180910390fd5b60095460405163079cc67960e41b81523360048201526802b5e3af16b188000060248201526001600160a01b03909116906379cc679090604401600060405180830381600087803b1580156139c557600080fd5b505af11580156139d9573d6000803e3d6000fd5b50505060008781526014602052604090206138cc9150868661541a565b6000613a078260dc1c600116151590565b15613a13575030919050565b81610cdf565b600080613a3060c884901c620fffff16600261499f565b60c81b7ffffffffff00000ffffffffffffffffffffffffffffffffffffffffffffffffff939093169290921792915050565b33600090815260066020526040812054613a7b816149b5565b91505090565b600080808060f885901c600f16613aaa57613aa5613a9e8861415a565b86906149f8565b613aac565b845b9050613ac281613abc8a89614a42565b90614ac7565b6fffffffffffffffffffffffffffffffff19166fffffffffffffffffffffffffffffffff89161793506001600160e01b0319166001600160e01b038516179150505b94509492505050565b600060ff607883901c1681613b2185611cf7565b90506000613b2e826139f6565b905060648310613b5157604051634543792f60e11b815260040160405180910390fd5b866001600160a01b0316816001600160a01b031614613b8357604051633a6bbed360e01b815260040160405180910390fd5b600086815260026020526040812080546001600160a01b031916905580613bab888886614b41565b90925090506fffffffffffffffffffffffffffffffff87166fffffffffffffffffffffffffffffffff198316176001600160e01b0385166001600160e01b03198316179097507b10000000000000000000000000000000000000000000000000000000179350613c23600160001989019060781b0190565b965084613c405769ffffffffff00000000001987164260281b1796505b60008881526005602052604080822086905551899130916001600160a01b038d16917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a45094979650505050505050565b60408051306020820152339181019190915260608101829052600090819060800160408051601f198184030181528282528051602091820120601054601f890183900483028501830190935287845293506001600160a01b0390911691613d1f918890889081908401838280828437600092019190915250613d199250869150614ba39050565b90614bf6565b6001600160a01b03161495945050505050565b6004546001600160a01b0384166000818152600660205260409020547f0000000000000000000000000000000000000000000000000000000000000001830191620fffff601483901c1690613db3576040517f2e07630000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b85613dea576040517fb562e8dd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000015b38685011115613e46576040517fed70473800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b7f0000000000000000000000000000000000000000000000000000000000000014868201118015613e775750303b15155b15613eae576040517fd7fac8c700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b613eba828760141b0190565b91506000613ec9884288614c1a565b90508660011415613edb57600160de1b175b8515613fe25760ff607884901c16613ef2846149b5565b9350613f00848960781b0190565b935060648882011115613f2657604051634543792f60e11b815260040160405180910390fd5b80613f415769ffffffffff00000000001984164260281b1793505b6000805b89811015613fda578087019150613f5d828786614b41565b604051919750945082906001600160a01b038d16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4604051829030906001600160a01b038e16907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90600090a4600101613f45565b505050614035565b9186019160005b8781101561403357604051858201906001600160a01b038b16906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4600101613fe9565b505b6001600160a01b039097166000908152600660209081526040808320949094559381526005909352509020939093555060048054909101905550565b60006140828260de1c600116151590565b15801561409b5750600083815260056020526040902054155b80156140ab57506140ab836140f8565b156140c9576140b9826141dd565b6000848152600560205260409020555b600160de1b8217611669565b600080613a306140ef620fffff60c886901c166001615cdc565b620fffff61499f565b6000817f000000000000000000000000000000000000000000000000000000000000000111158015610cdf5750600454614152907f0000000000000000000000000000000000000000000000000000000000000001615cdc565b821092915050565b6000600d548260405160200161417a929190918252602082015260400190565b60408051601f19818403018152919052805160209091012092915050565b60006141a382614c7c565b6141ac83614cd8565b6141b584614d3e565b6141be856142a8565b6141c8878761427b565b6141d187614212565b01010101019392505050565b60006141ee8260dd1c600116151590565b6141f95760046141fc565b60025b60ff166001600160e01b03901c82169050919050565b60008061425083608081901c60ff9081161515608883901c8216151501609083901c8216151501609883901c821615150160a09290921c1615150190565b905060038110614272576005811061426a57610dac611669565b6107d0611669565b60009392505050565b600060ff60c083901c1661428f8482612e37565b61429d576000915050610cdf565b506103e89392505050565b600060ff607883901c16801561427257806103e860c885901c6103ff1602816142d3576142d3615ec5565b04611669565b600064ffffffffff605083901c16806142f6576000915050610cdf565b60006143227f000000000000000000000000000000000000000000000000000000006ba822164261499f565b9050600082821061433557828203614338565b60005b905062015180670de0b6b3a764000060b687901c6103fc1660af88901c6101fe1660ff60a88a901c1601018302020480614379576000945050505050610cdf565b60006143858888614198565b905061271080820183020498975050505050505050565b6143a461548e565b506040805160608101825260ff60a884901c8116825260b084901c8116602083015260b89390931c9092169082015290565b60007f000000000000000000000000514910771af9ca656af840dff83e8264ecf986ca6001600160a01b0316634000aea07f000000000000000000000000f0d54349addcf704f77ae15b96510dea15cb795284866000604051602001614446929190918252602082015260400190565b6040516020818303038152906040526040518463ffffffff1660e01b815260040161447393929190615ef7565b6020604051808303816000875af1158015614492573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906144b69190615e36565b50600083815260076020818152604080842054815180840189905280830186905230606082015260808082018390528351808303909101815260a090910190925281519183019190912093879052919052614512906001615cdc565b600085815260076020526040902055611d4d8482604080516020808201949094528082019290925280518083038201815260609092019052805191012090565b60008061455e84611cf7565b90508060dc81901c60011615156001600160a01b038083169088161461459757604051633a6bbed360e01b815260040160405180910390fd5b806145b5576040516333155e1360e21b815260040160405180910390fd5b6000806145c3888887614e12565b90925090506fffffffffffffffffffffffffffffffff87166fffffffffffffffffffffffffffffffff198316176001600160e01b0386166001600160e01b0319831617909750945061461a8560dd1c600116151590565b156146575761465461462f8960010187614071565b7fffffffffdfffffffffffffffffffffffffffffffffffffffffffffffffffffff1690565b94505b6000888152600560205260408082207fffffffffefffffffffffffffffffffffffffffffffffffffffffffffffffffff9790971696879055517fffffffffffffffffffffffffffffffffff0000000000000000000000000000019890980169ffffffffff000000000019164260281b179789916001600160a01b038c169130917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a45094979650505050505050565b60008084848080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505082519293505060019091109050806147565750828151115b8061478657508060008151811061476f5761476f615ca7565b6020910101516001600160f81b031916600160fd1b145b806147c25750806001825161479b9190615d62565b815181106147ab576147ab615ca7565b6020910101516001600160f81b031916600160fd1b145b156147d1576000915050611669565b6000816000815181106147e6576147e6615ca7565b01602001516001600160f81b03191690506000805b83518110156149915783818151811061481657614816615ca7565b01602001516001600160f81b03191691507f60000000000000000000000000000000000000000000000000000000000000008211801561487f57507f7b000000000000000000000000000000000000000000000000000000000000006001600160f81b03198316105b806148e757507f40000000000000000000000000000000000000000000000000000000000000006001600160f81b031983161180156148e757507f5b000000000000000000000000000000000000000000000000000000000000006001600160f81b03198316105b806148ff5750600160fd1b6001600160f81b03198316145b8061496757507f2f000000000000000000000000000000000000000000000000000000000000006001600160f81b0319831611801561496757507f3a000000000000000000000000000000000000000000000000000000000000006001600160f81b03198316105b1561497457819250614981565b6000945050505050611669565b61498a81615c8c565b90506147fb565b506001979650505050505050565b60008183106149ae5781611669565b5090919050565b6000806149c233846142d9565b90507fffffffffffffffffffffffffffffffffff0000000000ffffffffffffffffffff83164260501b1792506149ae3382614e93565b600060f4614a0583614f1c565b901b60f86001600560ff861606017ff00fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8616911b1717905092915050565b6000600f60f883901c168015614a7157600f60c81b602c84901c1660016078600384901b011b90940393909303925b614a808360dd1c600116151590565b15614aab577ffffffffffffc0000000000000000000000000000000000000000000000000000909301925b600360fc84901c6001016001911b60a0011b9093039392505050565b6000600f60f883901c168015614af45760016078600383901b011b93909301602c83901c600f60c81b1601925b614b038360dd1c600116151590565b15614b2a577a04000000000000000000000000000000000000000000000000000093909301925b5050600160fc9190911c810160031b60a0011b0190565b600080614b538360dd1c600116151590565b158015614b65575060f883901c600f16155b8015614b73575060185460ff165b15614b8e57614b8b614b848661415a565b84906149f8565b92505b614b988484614ac7565b959294509192505050565b6040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b6000806000614c058585614f65565b91509150614c1281614fd5565b509392505050565b60006001600160a01b03841660a084901b177901000000000000000000000000000000000000000000000000001782614c535780614c73565b7b3000000000000000000000000000000000000000000000000000000081175b95945050505050565b6000605082901c64ffffffffff1660da83901c620bdd800180821115614ca6575060009392505050565b804211614cb857506103e89392505050565b8142038282036103e80281614ccf57614ccf615ec5565b04949350505050565b600064ffffffffff602883901c1662278d00810142811115614cfe575060009392505050565b64ffffffffff605085901c16818110614d1d57506103e8949350505050565b8042038242036103e80281614d3457614d34615ec5565b0495945050505050565b600060ff60d283901c1664ffffffffff605084901c16811580614d8057507f0000000000000000000000000000000000000000000000000000000062913a9681115b15614d8f575060009392505050565b6000607885901c60ff166107d0840281614dab57614dab615ec5565b0490507f0000000000000000000000000000000000000000000000000000000062913a964211614ddd57949350505050565b814203827f0000000000000000000000000000000000000000000000000000000062913a9603820281614d3457614d34615ec5565b600080614e1f8484614a42565b9350614e308360dd1c600116151590565b8015614e5257506202a300614e5064ffffffffff60a086901c1642615d62565b105b15614e89576040517f463e718b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5091939092509050565b655af3107a40008111156116eb576009546040517f40c10f190000000000000000000000000000000000000000000000000000000081526001600160a01b03848116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b158015614f0857600080fd5b505af11580156112b8573d6000803e3d6000fd5b600060ff600883901c16606c811115614f385750600092915050565b6049811115614f4a5750600192915050565b6011811115614f5c5750600292915050565b50600392915050565b600080825160411415614f9c5760208301516040840151606085015160001a614f9087828585615190565b94509450505050614fce565b825160401415614fc65760208301516040840151614fbb86838361527a565b935093505050614fce565b506000905060025b9250929050565b6000816004811115614fe957614fe9615f1f565b1415614ff25750565b600181600481111561500657615006615f1f565b14156150545760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606401612270565b600281600481111561506857615068615f1f565b14156150b65760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401612270565b60038160048111156150ca576150ca615f1f565b14156151235760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401612270565b600481600481111561513757615137615f1f565b14156135385760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b6064820152608401612270565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311156151c75750600090506003613b04565b8460ff16601b141580156151df57508460ff16601c14155b156151f05750600090506004613b04565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015615244573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b03811661526d57600060019250925050613b04565b9660009650945050505050565b6000807f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316816152b060ff86901c601b615cdc565b90506152be87828885615190565b935093505050935093915050565b5080546152d890615c41565b6000825580601f106152e8575050565b601f01602090049060005260206000209081019061353891906154ac565b82805461531290615c41565b90600052602060002090601f016020900481019282615334576000855561537a565b82601f1061534d57805160ff191683800117855561537a565b8280016001018555821561537a579182015b8281111561537a57825182559160200191906001019061535f565b506153869291506154ac565b5090565b604051806102400160405280600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200160008152602001600081526020016000815260200161541561548e565b905290565b82805461542690615c41565b90600052602060002090601f016020900481019282615448576000855561537a565b82601f106154615782800160ff1982351617855561537a565b8280016001018555821561537a579182015b8281111561537a578235825591602001919060010190615473565b60405180606001604052806003906020820280368337509192915050565b5b8082111561538657600081556001016154ad565b6001600160e01b03198116811461353857600080fd5b6000602082840312156154e957600080fd5b8135611669816154c1565b6001600160a01b038116811461353857600080fd5b60006020828403121561551b57600080fd5b8135611669816154f4565b60005b83811015615541578181015183820152602001615529565b838111156117c95750506000910152565b6000815180845261556a816020860160208601615526565b601f01601f19169290920160200192915050565b6020815260006116696020830184615552565b6000602082840312156155a357600080fd5b5035919050565b600080604083850312156155bd57600080fd5b82356155c8816154f4565b946020939093013593505050565b60008083601f8401126155e857600080fd5b50813567ffffffffffffffff81111561560057600080fd5b6020830191508360208260051b8501011115614fce57600080fd5b6000806020838503121561562e57600080fd5b823567ffffffffffffffff81111561564557600080fd5b615651858286016155d6565b90969095509350505050565b60008083601f84011261566f57600080fd5b50813567ffffffffffffffff81111561568757600080fd5b602083019150836020828501011115614fce57600080fd5b801515811461353857600080fd5b6000806000806000608086880312156156c557600080fd5b8535945060208601359350604086013567ffffffffffffffff8111156156ea57600080fd5b6156f68882890161565d565b909450925050606086013561570a8161569f565b809150509295509295909350565b60008060006060848603121561572d57600080fd5b8335615738816154f4565b92506020840135615748816154f4565b929592945050506040919091013590565b6000806040838503121561576c57600080fd5b50508035926020909101359150565b6000806000806040858703121561579157600080fd5b843567ffffffffffffffff808211156157a957600080fd5b6157b5888389016155d6565b909650945060208701359150808211156157ce57600080fd5b506157db878288016155d6565b95989497509550505050565b6020808252825182820181905260009190848201906040850190845b8181101561581f57835183529284019291840191600101615803565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561586a5761586a61582b565b604052919050565b600067ffffffffffffffff82111561588c5761588c61582b565b50601f01601f191660200190565b60006158ad6158a884615872565b615841565b90508281528383830111156158c157600080fd5b828260208301376000602084830101529392505050565b600082601f8301126158e957600080fd5b6116698383356020850161589a565b60006020828403121561590a57600080fd5b813567ffffffffffffffff81111561592157600080fd5b611d4d848285016158d8565b6000806040838503121561594057600080fd5b823561594b816154f4565b9150602083013561595b816154c1565b809150509250929050565b6000806000806060858703121561597c57600080fd5b84359350602085013567ffffffffffffffff81111561599a57600080fd5b6159a68782880161565d565b90945092505060408501356159ba8161569f565b939692955090935050565b600080604083850312156159d857600080fd5b82356159e3816154f4565b9150602083013561595b8161569f565b60008060008060808587031215615a0957600080fd5b8435615a14816154f4565b93506020850135615a24816154f4565b925060408501359150606085013567ffffffffffffffff811115615a4757600080fd5b8501601f81018713615a5857600080fd5b615a678782356020840161589a565b91505092959194509250565b8060005b60038110156117c9578151845260209384019390910190600101615a77565b815181526020808301519082015260408083015190820152606080830151908201526080808301519082015260a0808301519082015260c0808301519082015260e08083015190820152610100808301519082015261012080830151908201526101408083015190820152610160808301519082015261018080830151908201526101a080830151908201526101c080830151908201526101e0808301519082015261020080830151908201526102208083015161028083019190615b5d82850182615a73565b505092915050565b600060208284031215615b7757600080fd5b81356116698161569f565b60008060408385031215615b9557600080fd5b8235615ba0816154f4565b9150602083013561595b816154f4565b60008060408385031215615bc357600080fd5b823567ffffffffffffffff811115615bda57600080fd5b615be6858286016158d8565b95602094909401359450505050565b600080600060408486031215615c0a57600080fd5b83359250602084013567ffffffffffffffff811115615c2857600080fd5b615c348682870161565d565b9497909650939450505050565b600181811c90821680615c5557607f821691505b60208210811415611f5857634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415615ca057615ca0615c76565b5060010190565b634e487b7160e01b600052603260045260246000fd5b6000816000190483118215151615615cd757615cd7615c76565b500290565b60008219821115615cef57615cef615c76565b500190565b600060208284031215615d0657600080fd5b815167ffffffffffffffff811115615d1d57600080fd5b8201601f81018413615d2e57600080fd5b8051615d3c6158a882615872565b818152856020838501011115615d5157600080fd5b614c73826020830160208601615526565b600082821015615d7457615d74615c76565b500390565b60006020808385031215615d8c57600080fd5b825167ffffffffffffffff80821115615da457600080fd5b818501915085601f830112615db857600080fd5b815181811115615dca57615dca61582b565b8060051b9150615ddb848301615841565b8181529183018401918481019088841115615df557600080fd5b938501935b83851015615e1357845182529385019390850190615dfa565b98975050505050505050565b600081615e2e57615e2e615c76565b506000190190565b600060208284031215615e4857600080fd5b81516116698161569f565b600060208284031215615e6557600080fd5b5051919050565b60006001600160a01b03808716835280861660208401525083604083015260806060830152615e9e6080830184615552565b9695505050505050565b600060208284031215615eba57600080fd5b8151611669816154c1565b634e487b7160e01b600052601260045260246000fd5b60008251615eed818460208701615526565b9190910192915050565b6001600160a01b0384168152826020820152606060408201526000614c736060830184615552565b634e487b7160e01b600052602160045260246000fdfe697066733a2f2f516d57394e4b55475965735469597835695350316f3832746e344368713969317951563644426e7a7a6e72485448a264697066735822122071bb7a7c5aec0cc90d60a643aad4aeac0cae2d534b00e35b8cae3ad56fc51b3464736f6c634300080c0033
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 ]
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.