More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 364 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Rat Attack | 16658513 | 524 days ago | IN | 0 ETH | 0.00355007 | ||||
Rat Attack | 16615024 | 530 days ago | IN | 0 ETH | 0.00300536 | ||||
Rat Attack | 16517123 | 544 days ago | IN | 0 ETH | 0.00216419 | ||||
Rat Attack | 16474382 | 550 days ago | IN | 0 ETH | 0.00250787 | ||||
Rat Attack | 16440076 | 555 days ago | IN | 0 ETH | 0.00280931 | ||||
Rat Attack | 16411191 | 559 days ago | IN | 0 ETH | 0.00270098 | ||||
Rat Attack | 16406233 | 559 days ago | IN | 0 ETH | 0.00368104 | ||||
Rat Attack | 16391483 | 562 days ago | IN | 0 ETH | 0.00413556 | ||||
Rat Attack | 16359190 | 566 days ago | IN | 0 ETH | 0.00329596 | ||||
Rat Attack | 16356691 | 566 days ago | IN | 0 ETH | 0.00252969 | ||||
Rat Attack | 16348167 | 568 days ago | IN | 0 ETH | 0.00260589 | ||||
Rat Attack | 16300511 | 574 days ago | IN | 0 ETH | 0.0027356 | ||||
Rat Attack | 16288541 | 576 days ago | IN | 0 ETH | 0.00241547 | ||||
Rat Attack | 16284688 | 576 days ago | IN | 0 ETH | 0.00364376 | ||||
Rat Attack | 16284670 | 576 days ago | IN | 0 ETH | 0.00329187 | ||||
Rat Attack | 16283407 | 577 days ago | IN | 0 ETH | 0.00237523 | ||||
Rat Attack | 16281836 | 577 days ago | IN | 0 ETH | 0.0021976 | ||||
Rat Attack | 16281704 | 577 days ago | IN | 0 ETH | 0.00254265 | ||||
Rat Attack | 16281700 | 577 days ago | IN | 0 ETH | 0.00229512 | ||||
Rat Attack | 16279259 | 577 days ago | IN | 0 ETH | 0.00262806 | ||||
Rat Attack | 16278676 | 577 days ago | IN | 0 ETH | 0.00251893 | ||||
Rat Attack | 16277913 | 577 days ago | IN | 0 ETH | 0.00236882 | ||||
Rat Attack | 16277401 | 577 days ago | IN | 0 ETH | 0.00301358 | ||||
Rat Attack | 16276640 | 578 days ago | IN | 0 ETH | 0.00231515 | ||||
Rat Attack | 16276468 | 578 days ago | IN | 0 ETH | 0.0019687 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
MiamiMetacity
Compiler Version
v0.8.13+commit.abaa5c0e
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.13; import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "./utils/Helpers.sol"; import "./utils/Security.sol"; import "./Metacity.sol"; import "./CITY.sol"; contract MiamiMetacity is Ownable, IERC721Receiver, Pausable, ReentrancyGuard, Security { // struct to store a stake's token, owner, and earning values struct Stake { uint16 tokenId; address owner; uint80 resetTime; uint256 earned; } event NFTStaked(address indexed owner, uint256 indexed tokenId); event NFTClaimed(uint256 indexed tokenId, uint256 earned, uint256 cityTax, uint256 ratTax); event RatAttacked(uint256 indexed tokenId, uint256 indexed zenTokenId, uint256 attackAmount, bool success); // reference to the Metacity NFT contract Metacity metacity; // reference to the $CITY contract for minting $CITY earnings CITY city; // city owner address address public cityOwnerAddress; // rats claim address address public ratsClaimAddress; // city zens uint16[] public cityZens; // num of city rats uint256 public numOfRats; // maps tokenId to a stake mapping(uint256 => Stake) private stakes; // tracks location of each tokenId in City mapping(uint256 => uint256) private cityIndexes; // maps tokenId to vacation until mapping(uint256 => uint256) public vacations; // maps tokenId to last action made mapping(uint256 => uint256) public ratActions; // counter uint256 private actionCounter = 0; // daily rate uint256 public DAILY_EARN_RATE = 100; // percentage // power gain rate uint256 public POWER_GAIN_RATE = 300; // percentage // power starting point uint256 public POWER_STARTING_POINT = 20; // percentage // vacation time uint256 public ZEN_VACATION_TIME = 48 hours; // hours // rat freeze time uint256 public RAT_FREEZE_TIME = 1 hours; // hours // city tax uint256 public CITY_TAX = 10; // percentage // rats tax uint256 public RATS_TAX = 30; // percentage // there will only ever be (roughly) 100 million $CITY earned through staking uint256 public MAXIMUM_CITY = 100_000_000 ether; // amount of $CITY earned so far uint256 public totalCityEarned; // emergency rescue to allow unstaking without any checks but without $CITY bool public rescueEnabled = false; /// @param _metacity reference to the Metacity NFT contract /// @param _city reference to the $CITY token constructor(address _metacity, address _city) { metacity = Metacity(_metacity); city = CITY(_city); } // STAKING /// @dev adds zens and rets to the MetaCity /// @param tokenIds the IDs of the zens to stake function addCityZensAndRats(uint16[] calldata tokenIds) external whenNotPaused nonReentrant isEOA { for (uint i = 0; i < tokenIds.length; i++) { // counter for randoms actionCounter++; require(metacity.ownerOf(tokenIds[i]) == _msgSender(), "Not the owner"); require(vacations[tokenIds[i]] < block.timestamp, "On vacation"); require(ratActions[tokenIds[i]] < block.timestamp, "Too soon"); metacity.transferFrom(_msgSender(), address(this), tokenIds[i]); stakes[tokenIds[i]] = Stake({ owner: _msgSender(), tokenId: uint16(tokenIds[i]), resetTime: uint80(block.timestamp), earned: 0 }); if (metacity.isZen(tokenIds[i])) { cityZens.push(uint16(tokenIds[i])); cityIndexes[tokenIds[i]] = cityZens.length - 1; } else { ratActions[tokenIds[i]] = block.timestamp + RAT_FREEZE_TIME; numOfRats++; } emit NFTStaked(_msgSender(), tokenIds[i]); } } // ATTACK /// @dev Rat attacks the MetaCity /// @param tokenId the ID of the Rat on the MetaCity function ratAttack(uint256 tokenId) external whenNotPaused nonReentrant isEOA { require(stakes[tokenId].owner == _msgSender(), "Not the owner"); require(ratActions[tokenId] < block.timestamp, "Too soon"); require(!metacity.isZen(tokenId), "Only rats can attack"); // counter for randoms actionCounter++; // get rat info uint256 _ratPower = ratPower(tokenId); // generate random number uint256 seed = Helpers.random(actionCounter); // check rat attack bool successfullyAttacked = (seed % 100) <= _ratPower; // anyway choose the zen to attack seed >>= 16; uint256 zenIndex = seed % cityZens.length; uint16 zenTokenId = cityZens[zenIndex]; uint256 _zenEarned = earned(zenTokenId); // update rat next action ratActions[tokenId] = block.timestamp + RAT_FREEZE_TIME; // reset the rat reset time to now (rat power back to starting point) stakes[tokenId].resetTime = uint80(block.timestamp); // update zen and rat earnings if (successfullyAttacked) { // remove zen earnings stakes[zenTokenId].resetTime = uint80(block.timestamp); // pay the rat stakes[tokenId].earned += _zenEarned; } else { // just to keep the same gas cost // remove zen earnings (not really) stakes[zenTokenId].resetTime = stakes[zenTokenId].resetTime; // pay the rat (not really) stakes[tokenId].earned += 0; } emit RatAttacked(tokenId, zenTokenId, _zenEarned, successfullyAttacked); } // CLAIMING / UNSTAKING /// @dev unstake zens and rets to the MetaCity /// @param tokenIds the IDs of the zens to unstake function vacationCityZensAndRats(uint16[] calldata tokenIds) external whenNotPaused nonReentrant isEOA { // total for all tokens uint256 _earned = 0; uint256 _cityTax = 0; uint256 _ratTax = 0; // loop tokens for (uint i = 0; i < tokenIds.length; i++) { // counter for randoms actionCounter++; Stake memory stake = stakes[tokenIds[i]]; require(stake.owner == _msgSender(), "Metacity was not staked by user"); // token stake values uint256 tokenEarned = 0; uint256 tokenCityTax = 0; uint256 tokenRatTax = 0; // check CITY left if (totalCityEarned < MAXIMUM_CITY) { tokenEarned = earned(tokenIds[i]); if (tokenEarned > MAXIMUM_CITY - totalCityEarned) { // not enough $CITY tokenEarned = MAXIMUM_CITY - totalCityEarned; } totalCityEarned += tokenEarned; } if (metacity.isZen(tokenIds[i])) { vacations[tokenIds[i]] = block.timestamp + ZEN_VACATION_TIME; _removeZenFromCity(stake); // pay taxes tokenCityTax = tokenEarned * CITY_TAX / 100; tokenRatTax = tokenEarned * RATS_TAX / 100; tokenEarned = tokenEarned - tokenCityTax - tokenRatTax; } else { require(ratActions[tokenIds[i]] < block.timestamp, "Too soon"); ratActions[tokenIds[i]] = block.timestamp + RAT_FREEZE_TIME; numOfRats--; } delete stakes[tokenIds[i]]; metacity.safeTransferFrom(address(this), _msgSender(), tokenIds[i]); _earned += tokenEarned; _cityTax += tokenCityTax; _ratTax += tokenRatTax; emit NFTClaimed(tokenIds[i], tokenEarned, tokenCityTax, tokenRatTax); } if (_earned > 0) { city.mint(_msgSender(), _earned); } // TAX AND RAT TAX if (_cityTax > 0) { city.mint(cityOwnerAddress, _cityTax); } if (_ratTax > 0) { city.mint(ratsClaimAddress, _ratTax); } } /// @dev earnings /// @param tokenId the ID of the nft on the MetaCity /// @return earned amount earned so far function earned(uint256 tokenId) public view returns(uint256) { Stake memory _stake = stakes[tokenId]; require(block.timestamp > _stake.resetTime, "Can't get earnings on the attacking / staking block"); if (_stake.tokenId != tokenId) { return 0; } return metacity.isZen(tokenId) ? metacity.level(tokenId) * DAILY_EARN_RATE * 1e18 * (block.timestamp - _stake.resetTime) / 86400 / 100 : stakes[tokenId].earned; } /// @dev rat power /// @param tokenId the ID of the rat on the MetaCity /// @return power amount of power gained so far function ratPower(uint256 tokenId) public view returns(uint256) { require(!metacity.isZen(tokenId), "Only rats have power"); Stake memory _stake = stakes[tokenId]; if (_stake.tokenId != tokenId) { return 0; } uint256 power = POWER_STARTING_POINT + metacity.level(tokenId) * POWER_GAIN_RATE * (block.timestamp - _stake.resetTime) / 86400 / 100; return power > 100 ? 100 : power; } /// @dev Unstake without earnings /// @param tokenIds the IDs of the zens to unstake function rescue(uint16[] calldata tokenIds) external whenPaused nonReentrant isEOA { require(rescueEnabled, "rescue is not enabled"); for (uint i = 0; i < tokenIds.length; i++) { Stake memory stake = stakes[tokenIds[i]]; require(stake.owner == _msgSender(), "Metacity was not staked by user"); delete stakes[tokenIds[i]]; delete cityIndexes[tokenIds[i]]; metacity.safeTransferFrom(address(this), _msgSender(), tokenIds[i]); } } /// @dev remove from stakes array /// @param stake current tokenId stake function _removeZenFromCity(Stake memory stake) internal { uint256 lastTokenId = cityZens[cityZens.length - 1]; cityZens[cityIndexes[stake.tokenId]] = uint16(lastTokenId); // Shuffle last tokenId to current position cityIndexes[lastTokenId] = cityIndexes[stake.tokenId]; delete cityIndexes[stake.tokenId]; cityZens.pop(); // Remove duplicate } /** ADMIN */ /// @dev sets the city owner address /// @param _cityOwnerAddress address if the city owner function setCityOwnerAddress(address _cityOwnerAddress) external onlyOwner { cityOwnerAddress = _cityOwnerAddress; } /// @dev sets the rats claim address /// @param _ratsClaimAddress address if the city owner function setRatsClaimAddress(address _ratsClaimAddress) external onlyOwner { ratsClaimAddress = _ratsClaimAddress; } /// @dev allows owner to enable "rescue mode" /// @param _enabled boolean function setRescueEnabled(bool _enabled) external onlyOwner { rescueEnabled = _enabled; } /// @dev enables owner to pause / unpause minting /// @param _paused boolean function setPaused(bool _paused) external onlyOwner { if (_paused) _pause(); else _unpause(); } function setCityParams( uint256 dailyEarnRate, uint256 powerGainRate, uint256 powerStartingPoint, uint256 zenVacationTime, uint256 ratFreezeTime, uint256 cityTax, uint256 ratsTax, uint256 maximumCity ) external onlyOwner { DAILY_EARN_RATE = dailyEarnRate; POWER_GAIN_RATE = powerGainRate; POWER_STARTING_POINT = powerStartingPoint; ZEN_VACATION_TIME = zenVacationTime; RAT_FREEZE_TIME = ratFreezeTime; // hours CITY_TAX = cityTax; RATS_TAX = ratsTax; // percentage MAXIMUM_CITY = maximumCity; } function onERC721Received( address, address from, uint256, bytes calldata ) external pure override returns (bytes4) { require(from == address(0x0), "Cannot send tokens to MetaCity directly"); return IERC721Receiver.onERC721Received.selector; } }
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.13; import "@openzeppelin/contracts/utils/Address.sol"; contract Security { /// @dev Check if caller is a wallet modifier isEOA() { require(!(Address.isContract(msg.sender)) && tx.origin == msg.sender, "Only EOA"); _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; library Helpers { /// @dev generates a pseudorandom number /// @param seed a value ensure different outcomes for different sources in the same block /// @return a pseudorandom value function random(uint256 seed) internal view returns (uint256) { return uint256(keccak256(abi.encodePacked( tx.origin, blockhash(block.number - 1), block.difficulty, block.timestamp, seed ))); } string internal constant TABLE = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'; function base64(bytes memory data) internal pure returns (string memory) { if (data.length == 0) return ''; // load the table into memory string memory table = TABLE; // 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) {} { dataPtr := add(dataPtr, 3) // read 3 bytes let input := mload(dataPtr) // write 4 characters mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr(18, input), 0x3F))))) resultPtr := add(resultPtr, 1) mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr(12, input), 0x3F))))) resultPtr := add(resultPtr, 1) mstore(resultPtr, shl(248, mload(add(tablePtr, and(shr( 6, input), 0x3F))))) resultPtr := add(resultPtr, 1) mstore(resultPtr, shl(248, 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; } }
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.13; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "./ERC721Opensea.sol"; import "./utils/Helpers.sol"; import "./utils/Security.sol"; import "./Interfaces/IMetacity.sol"; import "./Interfaces/ITraits.sol"; import "./CITY.sol"; contract Metacity is IMetacity, ERC721Opensea, Ownable, Pausable, ReentrancyGuard, Security { using ECDSA for bytes32; uint256 public startTime = 1669053600; // Monday, November 21, 2022 18:00:00 // first round uint256 public constant firstRoundSupply = 5000; uint256 public constant firstRoundPrice = 0.02 ether; // ETH uint256 public constant firstRoundMaxWlPerUser = 3; // second round uint256 public constant secondRoundSupply = 800; uint256 public secondRoundPrice = 1 ether; // ETH // third round uint256 public thirdRoundPrice = 500 ether; // CITY uint256 public constant ratChance = 10; // percentage uint256 public maxSupply = 15_800; // open / close rounds bool public firstRoundOpen = true; bool public secondRoundOpen = false; bool public thirdRoundOpen = false; // wl bool public wlOnly = true; // saving for max per round mapping(address => uint256) public firstRoundWlMints; mapping(address => bool) public secondRoundMinted; // number of tokens that have been minted uint16 public totalSupply; // mapping from tokenId to an array containing the token's traits mapping(uint256 => uint256[]) private tokenTraits; // mapping from tokenId to bool isZen mapping(uint256 => bool) private isZens; // mapping from hashed(tokenTrait) to the tokenId it's associated with // used to ensure there are no duplicates mapping(uint256 => uint256) public existingCombinations; // mint block per token id mapping(uint256 => uint256) public mintBlocks; // allowed to add traits after mint in game / shop mapping(address => bool) public controllers; // allowed to sign whitelist addresses mapping(address => bool) private signers; // reference to $CITY for mint CITY public city; // reference to Traits ITraits public traits; /// @dev instantiates contract and rarity tables constructor(address _city, address _traits) ERC721Opensea("MetaCity", 'METACITY') { city = CITY(_city); traits = ITraits(_traits); } /** EXTERNAL */ function mintGen0(uint256 amount, bytes memory sig) external payable nonReentrant whenNotPaused { require(block.timestamp >= startTime, "Sale haven't started yet"); require(firstRoundOpen, "Round is closed"); require(amount > 0 && totalSupply + amount <= firstRoundSupply, "Round ended"); require(amount * firstRoundPrice == msg.value, "Invalid payment amount"); if (wlOnly) { require(isWhitelisted(_msgSender(), sig), "Address is not whitelisted"); require(amount + firstRoundWlMints[_msgSender()] <= firstRoundMaxWlPerUser, "Invalid mint amount"); // max per mint firstRoundWlMints[_msgSender()] += amount; } _mint(amount, ratChance); } function mintGen1(bytes memory sig) external payable nonReentrant whenNotPaused { require(totalSupply >= firstRoundSupply, "Round not started yet"); require(secondRoundOpen, "Round is closed"); require(totalSupply + 1 <= (firstRoundSupply + secondRoundSupply), "Round ended"); require(secondRoundPrice == msg.value, "Invalid payment amount"); require(!secondRoundMinted[_msgSender()], "Already minted"); if (wlOnly) { require(isWhitelisted(_msgSender(), sig), "Address is not whitelisted"); } secondRoundMinted[_msgSender()] = true; _mint(1, 100); } function mintGen2(uint256 amount) external nonReentrant whenNotPaused { require(thirdRoundOpen, "Round is closed"); require(totalSupply >= (firstRoundSupply + secondRoundSupply), "Round not started yet"); require(amount > 0 && totalSupply + amount <= maxSupply, "Round ended"); // payment uint256 totalCityCost = amount * thirdRoundPrice; city.transferFrom(_msgSender(), address(this), totalCityCost); _mint(amount, ratChance); } function _mint(uint256 amount, uint256 _ratChance) internal { uint256 seed; for (uint i = 0; i < amount; i++) { totalSupply++; seed = Helpers.random(totalSupply); bool _isZen = (seed & 0xFFFF) % 100 >= _ratChance; // % getting a rat generate(totalSupply, seed, _isZen); mintBlocks[totalSupply] = block.number; _safeMint(_msgSender(), totalSupply); } } /** INTERNAL */ /** * generates traits for a specific token, checking to make sure it's unique * @param tokenId the id of the token to generate traits for * @param seed a pseudorandom 256 bit number to derive traits from */ function generate(uint256 tokenId, uint256 seed, bool _isZen) internal { uint256[] memory t = traits.selectTraits(seed, _isZen); isZens[tokenId] = _isZen; if (_isZen) { // zens are unique uint256 traitsHash = uint256(keccak256(abi.encodePacked(t))); if (existingCombinations[traitsHash] == 0) { tokenTraits[tokenId] = t; existingCombinations[traitsHash] = tokenId; return; } else { return generate(tokenId, Helpers.random(seed), _isZen); } } else { tokenTraits[tokenId] = t; return; } } function setTrait(uint256 tokenId, uint256 traitIdx, uint256 traitValue) external { require(controllers[_msgSender()], "Only controllers can add traits"); require(tokenTraits[tokenId].length >= traitIdx, "Trait index invalid"); if (tokenTraits[tokenId].length == traitIdx) { // new trait tokenTraits[tokenId].push(traitValue); } else { // edit trait tokenTraits[tokenId][traitIdx] = traitValue; } } function getTokenTraits(uint256 tokenId) external view override returns (uint256[] memory) { require(mintBlocks[tokenId] < block.number, "Reavel only the next block"); return tokenTraits[tokenId]; } function tokenURI(uint256 tokenId) public view override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); require(mintBlocks[tokenId] < block.number, "Reavel only the next block"); return traits.tokenURI(tokenId); } function level(uint256 tokenId) public view returns (uint256) { require(_exists(tokenId), "Query for nonexistent token"); require(mintBlocks[tokenId] < block.number, "Reavel only the next block"); return traits.level(tokenId); } function isZen(uint256 tokenId) public view override returns (bool) { require(_exists(tokenId), "Query for nonexistent token"); require(mintBlocks[tokenId] < block.number, "Reavel only the next block"); return isZens[tokenId]; } /// @dev check if an address was off chain whitelisted /// @param account the address to check /// @return isValid boolean function isWhitelisted(address account, bytes memory sig) public view returns (bool isValid) { return signers[keccak256(abi.encodePacked(account)).toEthSignedMessageHash().recover(sig)]; } /** ADMIN */ /** * @param _traits the address of the Traits */ function setTraits(address _traits) external onlyOwner { traits = ITraits(_traits); } /** * allows owner to withdraw funds from minting */ function withdraw(address token) external onlyOwner { if (token == address(0)) payable(owner()).transfer(address(this).balance); else CITY(token).transfer(owner(), CITY(token).balanceOf(address(this))); } /** * enables owner to pause / unpause minting */ function setPaused(bool _paused) external onlyOwner { if (_paused) _pause(); else _unpause(); } /// @dev // add list of addresses that can sign /// @param accounts list of addresses function addSigners(address[] memory accounts) external onlyOwner { for (uint i = 0; i < accounts.length; i++) { if (accounts[i] != address(0)) { signers[accounts[i]] = true; } } } /// @dev // remove address that can sign /// @param account address to remove from signers function removeSigner(address account) external onlyOwner { signers[account] = false; } /** * enables an address to mint / burn * @param controller the address to enable */ function addController(address controller) external onlyOwner { controllers[controller] = true; } /** * disables an address from minting / burning * @param controller the address to disbale */ function removeController(address controller) external onlyOwner { controllers[controller] = false; } function setFirstRoundOpen(bool _isOpen) external onlyOwner { firstRoundOpen = _isOpen; } function setSecondRoundOpen(bool _isOpen) external onlyOwner { secondRoundOpen = _isOpen; } function setThirdRoundOpen(bool _isOpen) external onlyOwner { thirdRoundOpen = _isOpen; } function setWlOnly(bool _wlOnly) external onlyOwner { wlOnly = _wlOnly; } function setStartTime(uint256 _startTime) external onlyOwner { startTime = _startTime; } function setSecondRoundPrice(uint256 _secondRoundPrice) external onlyOwner { secondRoundPrice = _secondRoundPrice; } function setThirdRoundPrice(uint256 _thirdRoundPrice) external onlyOwner { thirdRoundPrice = _thirdRoundPrice; } function setMaxSupply(uint256 _maxSupply) external onlyOwner { require(_maxSupply < maxSupply, "max supply can only be reduced"); maxSupply = _maxSupply; } }
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.13; interface ITraits { function selectTraits(uint256 seed, bool _isZen) external view returns (uint256[] memory t); function tokenURI(uint256 tokenId) external view returns (string memory); function level(uint256 tokenId) external view returns (uint256); }
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.13; interface IMetacity { function getTokenTraits(uint256 tokenId) external view returns (uint256[] memory); function isZen(uint256 tokenId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "operator-filter-registry/src/DefaultOperatorFilterer.sol"; /** * @title ExampleERC721 * @notice This example contract is configured to use the DefaultOperatorFilterer, which automatically registers the * token and subscribes it to OpenSea's curated filters. * Adding the onlyAllowedOperator modifier to the transferFrom and both safeTransferFrom methods ensures that * the msg.sender (operator) is allowed by the OperatorFilterRegistry. Adding the onlyAllowedOperatorApproval * modifier to the approval methods ensures that owners do not approve operators that are not allowed. */ abstract contract ERC721Opensea is ERC721, DefaultOperatorFilterer { constructor(string memory _name, string memory _symbol) ERC721(_name, _symbol) {} function transferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) { super.transferFrom(from, to, tokenId); } function safeTransferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId); } function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public override onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, data); } }
// SPDX-License-Identifier: MIT LICENSE pragma solidity ^0.8.13; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; contract CITY is ERC20, Ownable { uint256 public constant MAXIMUM_SUPPLY = 1000000000 ether; mapping(address => bool) minters; constructor() ERC20("MetaCity", "CITY") { } /** * mints $CITY to a recipient * @param to the recipient of the $CITY * @param amount the amount of $CITY to mint */ function mint(address to, uint256 amount) external { require(minters[msg.sender], "Only minters can mint"); require(totalSupply() + amount <= MAXIMUM_SUPPLY, "Can't go above Max supply"); _mint(to, amount); } /** * enables an address to mint / burn * @param minter the address to enable */ function addMinter(address minter) external onlyOwner { minters[minter] = true; } /** * disables an address from minting / burning * @param minter the address to disbale */ function removeMinter(address minter) external onlyOwner { minters[minter] = false; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol"; abstract contract OperatorFilterer { error OperatorNotAllowed(address operator); IOperatorFilterRegistry constant operatorFilterRegistry = IOperatorFilterRegistry(0x000000000000AAeB6D7670E522A718067333cd4E); constructor(address subscriptionOrRegistrantToCopy, bool subscribe) { // If an inheriting token contract is deployed to a network without the registry deployed, the modifier // will not revert, but the contract will need to be registered with the registry once it is deployed in // order for the modifier to filter addresses. if (address(operatorFilterRegistry).code.length > 0) { if (subscribe) { operatorFilterRegistry.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); } else { if (subscriptionOrRegistrantToCopy != address(0)) { operatorFilterRegistry.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy); } else { operatorFilterRegistry.register(address(this)); } } } } modifier onlyAllowedOperator(address from) virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (address(operatorFilterRegistry).code.length > 0) { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. if (from == msg.sender) { _; return; } if ( !( operatorFilterRegistry.isOperatorAllowed(address(this), msg.sender) && operatorFilterRegistry.isOperatorAllowed(address(this), from) ) ) { revert OperatorNotAllowed(msg.sender); } } _; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IOperatorFilterRegistry { function isOperatorAllowed(address registrant, address operator) external view returns (bool); function register(address registrant) external; function registerAndSubscribe(address registrant, address subscription) external; function registerAndCopyEntries(address registrant, address registrantToCopy) external; function updateOperator(address registrant, address operator, bool filtered) external; function updateOperators(address registrant, address[] calldata operators, bool filtered) external; function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external; function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external; function subscribe(address registrant, address registrantToSubscribe) external; function unsubscribe(address registrant, bool copyExistingEntries) external; function subscriptionOf(address addr) external returns (address registrant); function subscribers(address registrant) external returns (address[] memory); function subscriberAt(address registrant, uint256 index) external returns (address); function copyEntriesOf(address registrant, address registrantToCopy) external; function isOperatorFiltered(address registrant, address operator) external returns (bool); function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); function filteredOperators(address addr) external returns (address[] memory); function filteredCodeHashes(address addr) external returns (bytes32[] memory); function filteredOperatorAt(address registrant, uint256 index) external returns (address); function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); function isRegistered(address addr) external returns (bool); function codeHashOf(address addr) external returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {OperatorFilterer} from "./OperatorFilterer.sol"; abstract contract DefaultOperatorFilterer is OperatorFilterer { address constant DEFAULT_SUBSCRIPTION = address(0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6); constructor() OperatorFilterer(DEFAULT_SUBSCRIPTION, true) {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/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 (last updated v4.7.3) (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) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (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 // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // 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); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: address zero is not a valid owner"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: invalid token ID"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { _requireMinted(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not token owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: caller is not token owner nor approved"); _safeTransfer(from, to, tokenId, data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { address owner = ERC721.ownerOf(tokenId); return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} /** * @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. * - `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 tokenId ) internal virtual {} }
// 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 // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.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, allowance(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 = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * 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 Updates `owner` s allowance for `spender` based on spent `amount`. * * 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 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "london", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_metacity","type":"address"},{"internalType":"address","name":"_city","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"earned","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cityTax","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ratTax","type":"uint256"}],"name":"NFTClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"NFTStaked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"zenTokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"attackAmount","type":"uint256"},{"indexed":false,"internalType":"bool","name":"success","type":"bool"}],"name":"RatAttacked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[],"name":"CITY_TAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DAILY_EARN_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAXIMUM_CITY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POWER_GAIN_RATE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"POWER_STARTING_POINT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RATS_TAX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RAT_FREEZE_TIME","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ZEN_VACATION_TIME","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"tokenIds","type":"uint16[]"}],"name":"addCityZensAndRats","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"cityOwnerAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"cityZens","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"earned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numOfRats","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"from","type":"address"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"onERC721Received","outputs":[{"internalType":"bytes4","name":"","type":"bytes4"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ratActions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ratAttack","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ratPower","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ratsClaimAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"tokenIds","type":"uint16[]"}],"name":"rescue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"rescueEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_cityOwnerAddress","type":"address"}],"name":"setCityOwnerAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"dailyEarnRate","type":"uint256"},{"internalType":"uint256","name":"powerGainRate","type":"uint256"},{"internalType":"uint256","name":"powerStartingPoint","type":"uint256"},{"internalType":"uint256","name":"zenVacationTime","type":"uint256"},{"internalType":"uint256","name":"ratFreezeTime","type":"uint256"},{"internalType":"uint256","name":"cityTax","type":"uint256"},{"internalType":"uint256","name":"ratsTax","type":"uint256"},{"internalType":"uint256","name":"maximumCity","type":"uint256"}],"name":"setCityParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_paused","type":"bool"}],"name":"setPaused","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_ratsClaimAddress","type":"address"}],"name":"setRatsClaimAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_enabled","type":"bool"}],"name":"setRescueEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"totalCityEarned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16[]","name":"tokenIds","type":"uint16[]"}],"name":"vacationCityZensAndRats","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"vacations","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040526000600c556064600d5561012c600e556014600f8190556202a300601055610e10601155600a601255601e6013556a52b7d2dcc80cd2e400000090556016805460ff191690553480156200005757600080fd5b5060405162002687380380620026878339810160408190526200007a9162000135565b6200008533620000c8565b6000805460ff60a01b1916905560018055600280546001600160a01b039384166001600160a01b031991821617909155600380549290931691161790556200016d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200013057600080fd5b919050565b600080604083850312156200014957600080fd5b620001548362000118565b9150620001646020840162000118565b90509250929050565b61250a806200017d6000396000f3fe608060405234801561001057600080fd5b50600436106101f05760003560e01c8063715018a61161010f5780639159d872116100a2578063ebf2905e11610071578063ebf2905e14610415578063f2fde38b1461041e578063f5738b8914610431578063ffa8a9511461045757600080fd5b80639159d872146103c6578063b35df75c146103e6578063badd7fcd146103ef578063d022b3df1461040257600080fd5b806380e8a71e116100de57806380e8a71e1461039057806383b9a141146103995780638da5cb5b146103a2578063913b6ff4146103b357600080fd5b8063715018a614610359578063765310081461036157806377a3c550146103745780637d1533801461038757600080fd5b806339db714f116101875780635059f5d0116101565780635059f5d0146103185780635288d387146103215780635c975abb146103345780635d6ae2e91461034657600080fd5b806339db714f146102cc5780634112db68146102e95780634b2a9178146102fc5780634d6ed8c41461030557600080fd5b80631f982bb5116101c35780631f982bb51461027257806321c443321461029d57806321c8da9a146102b0578063386b5b3a146102c357600080fd5b806306fbb1e7146101f5578063150b7a021461022857806315f832971461025457806316c38b3c1461025d575b600080fd5b6102156102033660046120de565b600a6020526000908152604090205481565b6040519081526020015b60405180910390f35b61023b61023636600461210c565b610460565b6040516001600160e01b0319909116815260200161021f565b61021560145481565b61027061026b3660046121b9565b6104e0565b005b600554610285906001600160a01b031681565b6040516001600160a01b03909116815260200161021f565b6102706102ab3660046121d6565b610501565b6102706102be3660046121d6565b610af7565b61021560115481565b6016546102d99060ff1681565b604051901515815260200161021f565b6102706102f73660046121d6565b610dab565b61021560135481565b6102156103133660046120de565b611480565b61021560075481565b61027061032f36600461224b565b6116af565b600054600160a01b900460ff166102d9565b6102706103543660046120de565b6116d9565b610270611a52565b61027061036f3660046121b9565b611a66565b600454610285906001600160a01b031681565b610215600d5481565b61021560125481565b610215600f5481565b6000546001600160a01b0316610285565b6102706103c1366004612268565b611a81565b6102156103d43660046120de565b600b6020526000908152604090205481565b61021560155481565b6102156103fd3660046120de565b611aaf565b61027061041036600461224b565b611cab565b61021560105481565b61027061042c36600461224b565b611cd5565b61044461043f3660046120de565b611d4b565b60405161ffff909116815260200161021f565b610215600e5481565b60006001600160a01b038516156104ce5760405162461bcd60e51b815260206004820152602760248201527f43616e6e6f742073656e6420746f6b656e7320746f204d65746143697479206460448201526669726563746c7960c81b60648201526084015b60405180910390fd5b50630a85bd0160e11b95945050505050565b6104e8611d83565b80156104f9576104f6611ddd565b50565b6104f6611e3d565b610509611e79565b60026001540361052b5760405162461bcd60e51b81526004016104c5906122bd565b6002600155333b15801561053e57503233145b61055a5760405162461bcd60e51b81526004016104c5906122f4565b60005b81811015610aee57600c80549060006105758361232c565b91905055506105813390565b6002546001600160a01b039182169116636352211e8585858181106105a8576105a8612345565b90506020020160208101906105bd919061235b565b6040516001600160e01b031960e084901b16815261ffff9091166004820152602401602060405180830381865afa1580156105fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610620919061237f565b6001600160a01b0316146106665760405162461bcd60e51b815260206004820152600d60248201526c2737ba103a34329037bbb732b960991b60448201526064016104c5565b42600a600085858581811061067d5761067d612345565b9050602002016020810190610692919061235b565b61ffff16815260200190815260200160002054106106e05760405162461bcd60e51b815260206004820152600b60248201526a27b7103b30b1b0ba34b7b760a91b60448201526064016104c5565b42600b60008585858181106106f7576106f7612345565b905060200201602081019061070c919061235b565b61ffff168152602001908152602001600020541061073c5760405162461bcd60e51b81526004016104c59061239c565b6002546001600160a01b03166323b872dd333086868681811061076157610761612345565b9050602002016020810190610776919061235b565b6040518463ffffffff1660e01b8152600401610794939291906123be565b600060405180830381600087803b1580156107ae57600080fd5b505af11580156107c2573d6000803e3d6000fd5b5050505060405180608001604052808484848181106107e3576107e3612345565b90506020020160208101906107f8919061235b565b61ffff168152602001336001600160a01b03168152602001426001600160501b0316815260200160008152506008600085858581811061083a5761083a612345565b905060200201602081019061084f919061235b565b61ffff9081168252602080830193909352604091820160002084518154948601519386015192166001600160b01b031990941693909317620100006001600160a01b0393841602176001600160b01b0316600160b01b6001600160501b03909216919091021782556060909201516001909101556002541663d007029d8484848181106108de576108de612345565b90506020020160208101906108f3919061235b565b6040516001600160e01b031960e084901b16815261ffff9091166004820152602401602060405180830381865afa158015610932573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095691906123e5565b15610a1457600683838381811061096f5761096f612345565b9050602002016020810190610984919061235b565b8154600180820184556000938452602090932060108204018054600f9092166002026101000a61ffff8181021990931693909216919091029190911790556006546109cf9190612402565b600960008585858181106109e5576109e5612345565b90506020020160208101906109fa919061235b565b61ffff168152602081019190915260400160002055610a7b565b601154610a219042612419565b600b6000858585818110610a3757610a37612345565b9050602002016020810190610a4c919061235b565b61ffff1681526020019081526020016000208190555060076000815480929190610a759061232c565b91905055505b828282818110610a8d57610a8d612345565b9050602002016020810190610aa2919061235b565b61ffff16336001600160a01b03167f0cda5cf38f6592672c7b4a22ff3d50874d1913629bd5ffedc27b7b40503d60fd60405160405180910390a380610ae68161232c565b91505061055d565b50506001805550565b610aff611ec6565b600260015403610b215760405162461bcd60e51b81526004016104c5906122bd565b6002600155333b158015610b3457503233145b610b505760405162461bcd60e51b81526004016104c5906122f4565b60165460ff16610b9a5760405162461bcd60e51b81526020600482015260156024820152741c995cd8dd59481a5cc81b9bdd08195b98589b1959605a1b60448201526064016104c5565b60005b81811015610aee57600060086000858585818110610bbd57610bbd612345565b9050602002016020810190610bd2919061235b565b61ffff908116825260208083019390935260409182016000208251608081018452815492831681526201000083046001600160a01b0316948101859052600160b01b9092046001600160501b031692820192909252600190910154606082015291503314610c825760405162461bcd60e51b815260206004820152601f60248201527f4d6574616369747920776173206e6f74207374616b656420627920757365720060448201526064016104c5565b60086000858585818110610c9857610c98612345565b9050602002016020810190610cad919061235b565b61ffff16815260208101919091526040016000908120818155600101819055600990858585818110610ce157610ce1612345565b9050602002016020810190610cf6919061235b565b61ffff16815260208101919091526040016000908120556002546001600160a01b03166342842e0e3033878787818110610d3257610d32612345565b9050602002016020810190610d47919061235b565b6040518463ffffffff1660e01b8152600401610d65939291906123be565b600060405180830381600087803b158015610d7f57600080fd5b505af1158015610d93573d6000803e3d6000fd5b50505050508080610da39061232c565b915050610b9d565b610db3611e79565b600260015403610dd55760405162461bcd60e51b81526004016104c5906122bd565b6002600155333b158015610de857503233145b610e045760405162461bcd60e51b81526004016104c5906122f4565b6000806000805b8481101561131957600c8054906000610e238361232c565b9190505550600060086000888885818110610e4057610e40612345565b9050602002016020810190610e55919061235b565b61ffff908116825260208083019390935260409182016000208251608081018452815492831681526201000083046001600160a01b0316948101859052600160b01b9092046001600160501b031692820192909252600190910154606082015291503314610f055760405162461bcd60e51b815260206004820152601f60248201527f4d6574616369747920776173206e6f74207374616b656420627920757365720060448201526064016104c5565b60008060006014546015541015610f8d57610f498a8a87818110610f2b57610f2b612345565b9050602002016020810190610f40919061235b565b61ffff16611480565b9250601554601454610f5b9190612402565b831115610f7557601554601454610f729190612402565b92505b8260156000828254610f879190612419565b90915550505b6002546001600160a01b031663d007029d8b8b88818110610fb057610fb0612345565b9050602002016020810190610fc5919061235b565b6040516001600160e01b031960e084901b16815261ffff9091166004820152602401602060405180830381865afa158015611004573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102891906123e5565b156110d75760105461103a9042612419565b600a60008c8c8981811061105057611050612345565b9050602002016020810190611065919061235b565b61ffff16815260208101919091526040016000205561108384611f16565b6064601254846110939190612431565b61109d9190612466565b91506064601354846110af9190612431565b6110b99190612466565b9050806110c68385612402565b6110d09190612402565b925061119a565b42600b60008c8c898181106110ee576110ee612345565b9050602002016020810190611103919061235b565b61ffff16815260200190815260200160002054106111335760405162461bcd60e51b81526004016104c59061239c565b6011546111409042612419565b600b60008c8c8981811061115657611156612345565b905060200201602081019061116b919061235b565b61ffff16815260200190815260200160002081905550600760008154809291906111949061247a565b91905055505b600860008b8b888181106111b0576111b0612345565b90506020020160208101906111c5919061235b565b61ffff16815260208101919091526040016000908120818155600101556002546001600160a01b03166342842e0e30338d8d8a81811061120757611207612345565b905060200201602081019061121c919061235b565b6040518463ffffffff1660e01b815260040161123a939291906123be565b600060405180830381600087803b15801561125457600080fd5b505af1158015611268573d6000803e3d6000fd5b5050505082886112789190612419565b97506112848288612419565b96506112908187612419565b95508989868181106112a4576112a4612345565b90506020020160208101906112b9919061235b565b604080518581526020810185905290810183905261ffff91909116907fe85f2302c3b16712681b883e83d986dc21e8720d2894687aeb0c43fe05777b269060600160405180910390a25050505080806113119061232c565b915050610e0b565b508215611393576003546001600160a01b03166340c10f19336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101869052604401600060405180830381600087803b15801561137a57600080fd5b505af115801561138e573d6000803e3d6000fd5b505050505b811561140657600354600480546040516340c10f1960e01b81526001600160a01b039182169281019290925260248201859052909116906340c10f1990604401600060405180830381600087803b1580156113ed57600080fd5b505af1158015611401573d6000803e3d6000fd5b505050505b8015611475576003546005546040516340c10f1960e01b81526001600160a01b039182166004820152602481018490529116906340c10f1990604401600060405180830381600087803b15801561145c57600080fd5b505af1158015611470573d6000803e3d6000fd5b505050505b505060018055505050565b60008181526008602090815260408083208151608081018352815461ffff811682526201000081046001600160a01b031694820194909452600160b01b9093046001600160501b031691830182905260010154606083015242116115425760405162461bcd60e51b815260206004820152603360248201527f43616e277420676574206561726e696e6773206f6e207468652061747461636b604482015272696e67202f207374616b696e6720626c6f636b60681b60648201526084016104c5565b805161ffff1683146115575750600092915050565b60025460405163d007029d60e01b8152600481018590526001600160a01b039091169063d007029d90602401602060405180830381865afa1580156115a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c491906123e5565b6115df576000838152600860205260409020600101546116a8565b60646201518082604001516001600160501b0316426115fe9190612402565b600d546002546040516302e2c6f960e11b8152600481018990526001600160a01b03909116906305c58df290602401602060405180830381865afa15801561164a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166e9190612491565b6116789190612431565b61168a90670de0b6b3a7640000612431565b6116949190612431565b61169e9190612466565b6116a89190612466565b9392505050565b6116b7611d83565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6116e1611e79565b6002600154036117035760405162461bcd60e51b81526004016104c5906122bd565b6002600155333b15801561171657503233145b6117325760405162461bcd60e51b81526004016104c5906122f4565b6000818152600860205260409020546001600160a01b036201000090910416331461178f5760405162461bcd60e51b815260206004820152600d60248201526c2737ba103a34329037bbb732b960991b60448201526064016104c5565b6000818152600b602052604090205442116117bc5760405162461bcd60e51b81526004016104c59061239c565b60025460405163d007029d60e01b8152600481018390526001600160a01b039091169063d007029d90602401602060405180830381865afa158015611805573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061182991906123e5565b1561186d5760405162461bcd60e51b81526020600482015260146024820152734f6e6c7920726174732063616e2061747461636b60601b60448201526064016104c5565b600c805490600061187d8361232c565b9190505550600061188d82611aaf565b9050600061189c600c54612029565b90506000826118ac6064846124aa565b60065460109490941c9391101591506000906118c890846124aa565b90506000600682815481106118df576118df612345565b600091825260208220601082040154600f9091166002026101000a900461ffff16915061190b82611480565b90506011544261191b9190612419565b6000888152600b6020908152604080832093909355600890522080546001600160b01b0316600160b01b426001600160501b03160217905583156119ae5761ffff821660009081526008602052604080822080546001600160b01b0316600160b01b426001600160501b031602179055888252812060010180548392906119a3908490612419565b90915550611a039050565b61ffff821660009081526008602052604080822080546001600160b01b038116600160b01b918290046001600160501b03169091021790558882528120600101805482906119fd908290612419565b90915550505b60408051828152851515602082015261ffff84169189917f8fbd8a9ad563a0b2ff1398161b21358de498ecdc5677ca73c57682709719b1f1910160405180910390a35050600180555050505050565b611a5a611d83565b611a64600061208e565b565b611a6e611d83565b6016805460ff1916911515919091179055565b611a89611d83565b600d97909755600e95909555600f93909355601091909155601155601255601355601455565b60025460405163d007029d60e01b8152600481018390526000916001600160a01b03169063d007029d90602401602060405180830381865afa158015611af9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b1d91906123e5565b15611b615760405162461bcd60e51b815260206004820152601460248201527327b7363c903930ba39903430bb32903837bbb2b960611b60448201526064016104c5565b6000828152600860209081526040918290208251608081018452815461ffff81168083526201000082046001600160a01b031694830194909452600160b01b90046001600160501b0316938101939093526001015460608301528314611bca5750600092915050565b600060646201518083604001516001600160501b031642611beb9190612402565b600e546002546040516302e2c6f960e11b8152600481018a90526001600160a01b03909116906305c58df290602401602060405180830381865afa158015611c37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c5b9190612491565b611c659190612431565b611c6f9190612431565b611c799190612466565b611c839190612466565b600f54611c909190612419565b905060648111611ca05780611ca3565b60645b949350505050565b611cb3611d83565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b611cdd611d83565b6001600160a01b038116611d425760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c5565b6104f68161208e565b60068181548110611d5b57600080fd5b9060005260206000209060109182820401919006600202915054906101000a900461ffff1681565b6000546001600160a01b03163314611a645760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104c5565b611de5611e79565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611e203390565b6040516001600160a01b03909116815260200160405180910390a1565b611e45611ec6565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611e20565b600054600160a01b900460ff1615611a645760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016104c5565b600054600160a01b900460ff16611a645760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016104c5565b6006805460009190611f2a90600190612402565b81548110611f3a57611f3a612345565b90600052602060002090601091828204019190066002029054906101000a900461ffff1661ffff16905080600660096000856000015161ffff1681526020019081526020016000205481548110611f9357611f93612345565b6000918252602080832060108304018054600f9093166002026101000a61ffff81810219909416958416029490941790935584518116825260099092526040808220548483528183205584519092168152908120556006805480611ff957611ff96124be565b600082815260209020601060001990920191820401805461ffff6002600f8516026101000a021916905590555050565b600032612037600143612402565b60405160609290921b6bffffffffffffffffffffffff191660208301524060348201524460548201524260748201526094810183905260b40160408051601f19818403018152919052805160209091012092915050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156120f057600080fd5b5035919050565b6001600160a01b03811681146104f657600080fd5b60008060008060006080868803121561212457600080fd5b853561212f816120f7565b9450602086013561213f816120f7565b935060408601359250606086013567ffffffffffffffff8082111561216357600080fd5b818801915088601f83011261217757600080fd5b81358181111561218657600080fd5b89602082850101111561219857600080fd5b9699959850939650602001949392505050565b80151581146104f657600080fd5b6000602082840312156121cb57600080fd5b81356116a8816121ab565b600080602083850312156121e957600080fd5b823567ffffffffffffffff8082111561220157600080fd5b818501915085601f83011261221557600080fd5b81358181111561222457600080fd5b8660208260051b850101111561223957600080fd5b60209290920196919550909350505050565b60006020828403121561225d57600080fd5b81356116a8816120f7565b600080600080600080600080610100898b03121561228557600080fd5b505086359860208801359850604088013597606081013597506080810135965060a0810135955060c0810135945060e0013592509050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252600890820152674f6e6c7920454f4160c01b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60006001820161233e5761233e612316565b5060010190565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561236d57600080fd5b813561ffff811681146116a857600080fd5b60006020828403121561239157600080fd5b81516116a8816120f7565b6020808252600890820152672a37b79039b7b7b760c11b604082015260600190565b6001600160a01b03938416815291909216602082015261ffff909116604082015260600190565b6000602082840312156123f757600080fd5b81516116a8816121ab565b60008282101561241457612414612316565b500390565b6000821982111561242c5761242c612316565b500190565b600081600019048311821515161561244b5761244b612316565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261247557612475612450565b500490565b60008161248957612489612316565b506000190190565b6000602082840312156124a357600080fd5b5051919050565b6000826124b9576124b9612450565b500690565b634e487b7160e01b600052603160045260246000fdfea264697066735822122024250a76860d985b99a8661659e829a6a058cece0e747c9af5d1c70d507e441f64736f6c634300080d00330000000000000000000000001fa912cfdc9ad3773550aeaa72727c66a60e01b6000000000000000000000000d2af8c0f53a4308b628c6e9409326314ed2cf6d4
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101f05760003560e01c8063715018a61161010f5780639159d872116100a2578063ebf2905e11610071578063ebf2905e14610415578063f2fde38b1461041e578063f5738b8914610431578063ffa8a9511461045757600080fd5b80639159d872146103c6578063b35df75c146103e6578063badd7fcd146103ef578063d022b3df1461040257600080fd5b806380e8a71e116100de57806380e8a71e1461039057806383b9a141146103995780638da5cb5b146103a2578063913b6ff4146103b357600080fd5b8063715018a614610359578063765310081461036157806377a3c550146103745780637d1533801461038757600080fd5b806339db714f116101875780635059f5d0116101565780635059f5d0146103185780635288d387146103215780635c975abb146103345780635d6ae2e91461034657600080fd5b806339db714f146102cc5780634112db68146102e95780634b2a9178146102fc5780634d6ed8c41461030557600080fd5b80631f982bb5116101c35780631f982bb51461027257806321c443321461029d57806321c8da9a146102b0578063386b5b3a146102c357600080fd5b806306fbb1e7146101f5578063150b7a021461022857806315f832971461025457806316c38b3c1461025d575b600080fd5b6102156102033660046120de565b600a6020526000908152604090205481565b6040519081526020015b60405180910390f35b61023b61023636600461210c565b610460565b6040516001600160e01b0319909116815260200161021f565b61021560145481565b61027061026b3660046121b9565b6104e0565b005b600554610285906001600160a01b031681565b6040516001600160a01b03909116815260200161021f565b6102706102ab3660046121d6565b610501565b6102706102be3660046121d6565b610af7565b61021560115481565b6016546102d99060ff1681565b604051901515815260200161021f565b6102706102f73660046121d6565b610dab565b61021560135481565b6102156103133660046120de565b611480565b61021560075481565b61027061032f36600461224b565b6116af565b600054600160a01b900460ff166102d9565b6102706103543660046120de565b6116d9565b610270611a52565b61027061036f3660046121b9565b611a66565b600454610285906001600160a01b031681565b610215600d5481565b61021560125481565b610215600f5481565b6000546001600160a01b0316610285565b6102706103c1366004612268565b611a81565b6102156103d43660046120de565b600b6020526000908152604090205481565b61021560155481565b6102156103fd3660046120de565b611aaf565b61027061041036600461224b565b611cab565b61021560105481565b61027061042c36600461224b565b611cd5565b61044461043f3660046120de565b611d4b565b60405161ffff909116815260200161021f565b610215600e5481565b60006001600160a01b038516156104ce5760405162461bcd60e51b815260206004820152602760248201527f43616e6e6f742073656e6420746f6b656e7320746f204d65746143697479206460448201526669726563746c7960c81b60648201526084015b60405180910390fd5b50630a85bd0160e11b95945050505050565b6104e8611d83565b80156104f9576104f6611ddd565b50565b6104f6611e3d565b610509611e79565b60026001540361052b5760405162461bcd60e51b81526004016104c5906122bd565b6002600155333b15801561053e57503233145b61055a5760405162461bcd60e51b81526004016104c5906122f4565b60005b81811015610aee57600c80549060006105758361232c565b91905055506105813390565b6002546001600160a01b039182169116636352211e8585858181106105a8576105a8612345565b90506020020160208101906105bd919061235b565b6040516001600160e01b031960e084901b16815261ffff9091166004820152602401602060405180830381865afa1580156105fc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610620919061237f565b6001600160a01b0316146106665760405162461bcd60e51b815260206004820152600d60248201526c2737ba103a34329037bbb732b960991b60448201526064016104c5565b42600a600085858581811061067d5761067d612345565b9050602002016020810190610692919061235b565b61ffff16815260200190815260200160002054106106e05760405162461bcd60e51b815260206004820152600b60248201526a27b7103b30b1b0ba34b7b760a91b60448201526064016104c5565b42600b60008585858181106106f7576106f7612345565b905060200201602081019061070c919061235b565b61ffff168152602001908152602001600020541061073c5760405162461bcd60e51b81526004016104c59061239c565b6002546001600160a01b03166323b872dd333086868681811061076157610761612345565b9050602002016020810190610776919061235b565b6040518463ffffffff1660e01b8152600401610794939291906123be565b600060405180830381600087803b1580156107ae57600080fd5b505af11580156107c2573d6000803e3d6000fd5b5050505060405180608001604052808484848181106107e3576107e3612345565b90506020020160208101906107f8919061235b565b61ffff168152602001336001600160a01b03168152602001426001600160501b0316815260200160008152506008600085858581811061083a5761083a612345565b905060200201602081019061084f919061235b565b61ffff9081168252602080830193909352604091820160002084518154948601519386015192166001600160b01b031990941693909317620100006001600160a01b0393841602176001600160b01b0316600160b01b6001600160501b03909216919091021782556060909201516001909101556002541663d007029d8484848181106108de576108de612345565b90506020020160208101906108f3919061235b565b6040516001600160e01b031960e084901b16815261ffff9091166004820152602401602060405180830381865afa158015610932573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061095691906123e5565b15610a1457600683838381811061096f5761096f612345565b9050602002016020810190610984919061235b565b8154600180820184556000938452602090932060108204018054600f9092166002026101000a61ffff8181021990931693909216919091029190911790556006546109cf9190612402565b600960008585858181106109e5576109e5612345565b90506020020160208101906109fa919061235b565b61ffff168152602081019190915260400160002055610a7b565b601154610a219042612419565b600b6000858585818110610a3757610a37612345565b9050602002016020810190610a4c919061235b565b61ffff1681526020019081526020016000208190555060076000815480929190610a759061232c565b91905055505b828282818110610a8d57610a8d612345565b9050602002016020810190610aa2919061235b565b61ffff16336001600160a01b03167f0cda5cf38f6592672c7b4a22ff3d50874d1913629bd5ffedc27b7b40503d60fd60405160405180910390a380610ae68161232c565b91505061055d565b50506001805550565b610aff611ec6565b600260015403610b215760405162461bcd60e51b81526004016104c5906122bd565b6002600155333b158015610b3457503233145b610b505760405162461bcd60e51b81526004016104c5906122f4565b60165460ff16610b9a5760405162461bcd60e51b81526020600482015260156024820152741c995cd8dd59481a5cc81b9bdd08195b98589b1959605a1b60448201526064016104c5565b60005b81811015610aee57600060086000858585818110610bbd57610bbd612345565b9050602002016020810190610bd2919061235b565b61ffff908116825260208083019390935260409182016000208251608081018452815492831681526201000083046001600160a01b0316948101859052600160b01b9092046001600160501b031692820192909252600190910154606082015291503314610c825760405162461bcd60e51b815260206004820152601f60248201527f4d6574616369747920776173206e6f74207374616b656420627920757365720060448201526064016104c5565b60086000858585818110610c9857610c98612345565b9050602002016020810190610cad919061235b565b61ffff16815260208101919091526040016000908120818155600101819055600990858585818110610ce157610ce1612345565b9050602002016020810190610cf6919061235b565b61ffff16815260208101919091526040016000908120556002546001600160a01b03166342842e0e3033878787818110610d3257610d32612345565b9050602002016020810190610d47919061235b565b6040518463ffffffff1660e01b8152600401610d65939291906123be565b600060405180830381600087803b158015610d7f57600080fd5b505af1158015610d93573d6000803e3d6000fd5b50505050508080610da39061232c565b915050610b9d565b610db3611e79565b600260015403610dd55760405162461bcd60e51b81526004016104c5906122bd565b6002600155333b158015610de857503233145b610e045760405162461bcd60e51b81526004016104c5906122f4565b6000806000805b8481101561131957600c8054906000610e238361232c565b9190505550600060086000888885818110610e4057610e40612345565b9050602002016020810190610e55919061235b565b61ffff908116825260208083019390935260409182016000208251608081018452815492831681526201000083046001600160a01b0316948101859052600160b01b9092046001600160501b031692820192909252600190910154606082015291503314610f055760405162461bcd60e51b815260206004820152601f60248201527f4d6574616369747920776173206e6f74207374616b656420627920757365720060448201526064016104c5565b60008060006014546015541015610f8d57610f498a8a87818110610f2b57610f2b612345565b9050602002016020810190610f40919061235b565b61ffff16611480565b9250601554601454610f5b9190612402565b831115610f7557601554601454610f729190612402565b92505b8260156000828254610f879190612419565b90915550505b6002546001600160a01b031663d007029d8b8b88818110610fb057610fb0612345565b9050602002016020810190610fc5919061235b565b6040516001600160e01b031960e084901b16815261ffff9091166004820152602401602060405180830381865afa158015611004573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061102891906123e5565b156110d75760105461103a9042612419565b600a60008c8c8981811061105057611050612345565b9050602002016020810190611065919061235b565b61ffff16815260208101919091526040016000205561108384611f16565b6064601254846110939190612431565b61109d9190612466565b91506064601354846110af9190612431565b6110b99190612466565b9050806110c68385612402565b6110d09190612402565b925061119a565b42600b60008c8c898181106110ee576110ee612345565b9050602002016020810190611103919061235b565b61ffff16815260200190815260200160002054106111335760405162461bcd60e51b81526004016104c59061239c565b6011546111409042612419565b600b60008c8c8981811061115657611156612345565b905060200201602081019061116b919061235b565b61ffff16815260200190815260200160002081905550600760008154809291906111949061247a565b91905055505b600860008b8b888181106111b0576111b0612345565b90506020020160208101906111c5919061235b565b61ffff16815260208101919091526040016000908120818155600101556002546001600160a01b03166342842e0e30338d8d8a81811061120757611207612345565b905060200201602081019061121c919061235b565b6040518463ffffffff1660e01b815260040161123a939291906123be565b600060405180830381600087803b15801561125457600080fd5b505af1158015611268573d6000803e3d6000fd5b5050505082886112789190612419565b97506112848288612419565b96506112908187612419565b95508989868181106112a4576112a4612345565b90506020020160208101906112b9919061235b565b604080518581526020810185905290810183905261ffff91909116907fe85f2302c3b16712681b883e83d986dc21e8720d2894687aeb0c43fe05777b269060600160405180910390a25050505080806113119061232c565b915050610e0b565b508215611393576003546001600160a01b03166340c10f19336040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260248101869052604401600060405180830381600087803b15801561137a57600080fd5b505af115801561138e573d6000803e3d6000fd5b505050505b811561140657600354600480546040516340c10f1960e01b81526001600160a01b039182169281019290925260248201859052909116906340c10f1990604401600060405180830381600087803b1580156113ed57600080fd5b505af1158015611401573d6000803e3d6000fd5b505050505b8015611475576003546005546040516340c10f1960e01b81526001600160a01b039182166004820152602481018490529116906340c10f1990604401600060405180830381600087803b15801561145c57600080fd5b505af1158015611470573d6000803e3d6000fd5b505050505b505060018055505050565b60008181526008602090815260408083208151608081018352815461ffff811682526201000081046001600160a01b031694820194909452600160b01b9093046001600160501b031691830182905260010154606083015242116115425760405162461bcd60e51b815260206004820152603360248201527f43616e277420676574206561726e696e6773206f6e207468652061747461636b604482015272696e67202f207374616b696e6720626c6f636b60681b60648201526084016104c5565b805161ffff1683146115575750600092915050565b60025460405163d007029d60e01b8152600481018590526001600160a01b039091169063d007029d90602401602060405180830381865afa1580156115a0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115c491906123e5565b6115df576000838152600860205260409020600101546116a8565b60646201518082604001516001600160501b0316426115fe9190612402565b600d546002546040516302e2c6f960e11b8152600481018990526001600160a01b03909116906305c58df290602401602060405180830381865afa15801561164a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061166e9190612491565b6116789190612431565b61168a90670de0b6b3a7640000612431565b6116949190612431565b61169e9190612466565b6116a89190612466565b9392505050565b6116b7611d83565b600480546001600160a01b0319166001600160a01b0392909216919091179055565b6116e1611e79565b6002600154036117035760405162461bcd60e51b81526004016104c5906122bd565b6002600155333b15801561171657503233145b6117325760405162461bcd60e51b81526004016104c5906122f4565b6000818152600860205260409020546001600160a01b036201000090910416331461178f5760405162461bcd60e51b815260206004820152600d60248201526c2737ba103a34329037bbb732b960991b60448201526064016104c5565b6000818152600b602052604090205442116117bc5760405162461bcd60e51b81526004016104c59061239c565b60025460405163d007029d60e01b8152600481018390526001600160a01b039091169063d007029d90602401602060405180830381865afa158015611805573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061182991906123e5565b1561186d5760405162461bcd60e51b81526020600482015260146024820152734f6e6c7920726174732063616e2061747461636b60601b60448201526064016104c5565b600c805490600061187d8361232c565b9190505550600061188d82611aaf565b9050600061189c600c54612029565b90506000826118ac6064846124aa565b60065460109490941c9391101591506000906118c890846124aa565b90506000600682815481106118df576118df612345565b600091825260208220601082040154600f9091166002026101000a900461ffff16915061190b82611480565b90506011544261191b9190612419565b6000888152600b6020908152604080832093909355600890522080546001600160b01b0316600160b01b426001600160501b03160217905583156119ae5761ffff821660009081526008602052604080822080546001600160b01b0316600160b01b426001600160501b031602179055888252812060010180548392906119a3908490612419565b90915550611a039050565b61ffff821660009081526008602052604080822080546001600160b01b038116600160b01b918290046001600160501b03169091021790558882528120600101805482906119fd908290612419565b90915550505b60408051828152851515602082015261ffff84169189917f8fbd8a9ad563a0b2ff1398161b21358de498ecdc5677ca73c57682709719b1f1910160405180910390a35050600180555050505050565b611a5a611d83565b611a64600061208e565b565b611a6e611d83565b6016805460ff1916911515919091179055565b611a89611d83565b600d97909755600e95909555600f93909355601091909155601155601255601355601455565b60025460405163d007029d60e01b8152600481018390526000916001600160a01b03169063d007029d90602401602060405180830381865afa158015611af9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b1d91906123e5565b15611b615760405162461bcd60e51b815260206004820152601460248201527327b7363c903930ba39903430bb32903837bbb2b960611b60448201526064016104c5565b6000828152600860209081526040918290208251608081018452815461ffff81168083526201000082046001600160a01b031694830194909452600160b01b90046001600160501b0316938101939093526001015460608301528314611bca5750600092915050565b600060646201518083604001516001600160501b031642611beb9190612402565b600e546002546040516302e2c6f960e11b8152600481018a90526001600160a01b03909116906305c58df290602401602060405180830381865afa158015611c37573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c5b9190612491565b611c659190612431565b611c6f9190612431565b611c799190612466565b611c839190612466565b600f54611c909190612419565b905060648111611ca05780611ca3565b60645b949350505050565b611cb3611d83565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b611cdd611d83565b6001600160a01b038116611d425760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104c5565b6104f68161208e565b60068181548110611d5b57600080fd5b9060005260206000209060109182820401919006600202915054906101000a900461ffff1681565b6000546001600160a01b03163314611a645760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104c5565b611de5611e79565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611e203390565b6040516001600160a01b03909116815260200160405180910390a1565b611e45611ec6565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa33611e20565b600054600160a01b900460ff1615611a645760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b60448201526064016104c5565b600054600160a01b900460ff16611a645760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b60448201526064016104c5565b6006805460009190611f2a90600190612402565b81548110611f3a57611f3a612345565b90600052602060002090601091828204019190066002029054906101000a900461ffff1661ffff16905080600660096000856000015161ffff1681526020019081526020016000205481548110611f9357611f93612345565b6000918252602080832060108304018054600f9093166002026101000a61ffff81810219909416958416029490941790935584518116825260099092526040808220548483528183205584519092168152908120556006805480611ff957611ff96124be565b600082815260209020601060001990920191820401805461ffff6002600f8516026101000a021916905590555050565b600032612037600143612402565b60405160609290921b6bffffffffffffffffffffffff191660208301524060348201524460548201524260748201526094810183905260b40160408051601f19818403018152919052805160209091012092915050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000602082840312156120f057600080fd5b5035919050565b6001600160a01b03811681146104f657600080fd5b60008060008060006080868803121561212457600080fd5b853561212f816120f7565b9450602086013561213f816120f7565b935060408601359250606086013567ffffffffffffffff8082111561216357600080fd5b818801915088601f83011261217757600080fd5b81358181111561218657600080fd5b89602082850101111561219857600080fd5b9699959850939650602001949392505050565b80151581146104f657600080fd5b6000602082840312156121cb57600080fd5b81356116a8816121ab565b600080602083850312156121e957600080fd5b823567ffffffffffffffff8082111561220157600080fd5b818501915085601f83011261221557600080fd5b81358181111561222457600080fd5b8660208260051b850101111561223957600080fd5b60209290920196919550909350505050565b60006020828403121561225d57600080fd5b81356116a8816120f7565b600080600080600080600080610100898b03121561228557600080fd5b505086359860208801359850604088013597606081013597506080810135965060a0810135955060c0810135945060e0013592509050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252600890820152674f6e6c7920454f4160c01b604082015260600190565b634e487b7160e01b600052601160045260246000fd5b60006001820161233e5761233e612316565b5060010190565b634e487b7160e01b600052603260045260246000fd5b60006020828403121561236d57600080fd5b813561ffff811681146116a857600080fd5b60006020828403121561239157600080fd5b81516116a8816120f7565b6020808252600890820152672a37b79039b7b7b760c11b604082015260600190565b6001600160a01b03938416815291909216602082015261ffff909116604082015260600190565b6000602082840312156123f757600080fd5b81516116a8816121ab565b60008282101561241457612414612316565b500390565b6000821982111561242c5761242c612316565b500190565b600081600019048311821515161561244b5761244b612316565b500290565b634e487b7160e01b600052601260045260246000fd5b60008261247557612475612450565b500490565b60008161248957612489612316565b506000190190565b6000602082840312156124a357600080fd5b5051919050565b6000826124b9576124b9612450565b500690565b634e487b7160e01b600052603160045260246000fdfea264697066735822122024250a76860d985b99a8661659e829a6a058cece0e747c9af5d1c70d507e441f64736f6c634300080d0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000001fa912cfdc9ad3773550aeaa72727c66a60e01b6000000000000000000000000d2af8c0f53a4308b628c6e9409326314ed2cf6d4
-----Decoded View---------------
Arg [0] : _metacity (address): 0x1fA912cFDC9AD3773550aeAa72727C66A60E01b6
Arg [1] : _city (address): 0xD2Af8c0F53a4308b628C6e9409326314ED2cF6d4
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000001fa912cfdc9ad3773550aeaa72727c66a60e01b6
Arg [1] : 000000000000000000000000d2af8c0f53a4308b628c6e9409326314ed2cf6d4
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.