Source Code
Overview
ETH Balance
10.70965 ETH
More Info
ContractCreator
Multichain Info
N/A
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
88753567 | 190 days ago | 0.00315 ETH | ||||
88753560 | 190 days ago | 0.00315 ETH | ||||
88753554 | 190 days ago | 0.00315 ETH | ||||
88753545 | 190 days ago | 0.00315 ETH | ||||
88753497 | 190 days ago | 0.0021 ETH | ||||
88753489 | 190 days ago | 0.0021 ETH | ||||
88753477 | 190 days ago | 0.0021 ETH | ||||
88753466 | 190 days ago | 0.0021 ETH | ||||
88753442 | 190 days ago | 0.0014 ETH | ||||
88753431 | 190 days ago | 0.0014 ETH | ||||
88753426 | 190 days ago | 0.0014 ETH | ||||
88753419 | 190 days ago | 0.0014 ETH | ||||
88597754 | 190 days ago | 0.0014 ETH | ||||
88597272 | 190 days ago | 0.0014 ETH | ||||
88557315 | 191 days ago | 0.00315 ETH | ||||
88557269 | 191 days ago | 0.0021 ETH | ||||
88557106 | 191 days ago | 0.0014 ETH | ||||
88556695 | 191 days ago | 0.00315 ETH | ||||
88556675 | 191 days ago | 0.00315 ETH | ||||
88556658 | 191 days ago | 0.00315 ETH | ||||
88556640 | 191 days ago | 0.00315 ETH | ||||
88556628 | 191 days ago | 0.0021 ETH | ||||
88556605 | 191 days ago | 0.0021 ETH | ||||
88556580 | 191 days ago | 0.0021 ETH | ||||
88556549 | 191 days ago | 0.0021 ETH |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x3c35E224...799860077 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
MonsterTower
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/utils/cryptography/EIP712.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "../../store/IHeroPowerProxy.sol"; import "../../store/heroes/interfaces/IHeroStats.sol"; import "../../store/resources/interfaces/IGold.sol"; import "./IMonsterTowerProxy.sol"; import "../../store/resources/interfaces/IFoFItemResources.sol"; import "../../libs/TransferHelper.sol"; contract MonsterTower is EIP712, Ownable, AccessControl { using ECDSA for bytes32; bytes32 public constant MONSTER_TOWER_ADMIN = keccak256("MONSTER_TOWER_ADMIN"); bytes32 public constant MONSTER_TOWER_SIGNER = keccak256("MONSTER_TOWER_SIGNER"); using SafeMath for uint256; using EnumerableSet for EnumerableSet.UintSet; struct TowerInfo { uint16 lvl; // Current tower level uint8 dailyRepeated; uint256 nextDay; uint8 dailySpecialRepeated; uint256 heroBasePower; uint256 heroPower; uint256 recoverRate; uint256 battleTimestamp; uint16 dailyHelpRequested; uint256 requestHelpId; uint256 dailyHelpAttack; uint256 extraRepeat; uint256 extraPackagePrice; uint256 nextResetPrice; uint256 extraPackageDailyBuy; uint256 recoverTimeNeeded; } struct HelpRequest { address owner; uint256 hero; uint16 requestLvl; uint256 createdAt; uint256 winnerHero; uint256 wonAt; } uint256 _helpRequestId; // mapping heroId => tower infos mapping(uint256 => TowerInfo) _heroes; // mapping requestId => Help Request mapping(uint256 => HelpRequest) _helpRequests; //mapping hero => floor => helpID mapping(uint256 => mapping(uint256 => uint256)) _heroFloorRequested; EnumerableSet.UintSet _towersId; EnumerableSet.UintSet _helpRequestedIds; mapping(bytes => bool) public signatures; IHeroStats heroStats; IGold goldRecource; IMonsterTowerProxy towerProxy; uint256 public packagePriceInit = 0.0014 ether; uint256 public packagePriceIncreasePercentage = 1500; event AttackTower( uint256 heroId, uint256[] greas, uint256[] units, uint256 pet, uint16 floor, bool indexed battleResult, uint256 monsterPower, uint256 teamPower, uint256 goldDrop, uint256 expDrop, uint256 chestRewards, TowerInfo updatedTower ); event NewTower(uint256 indexed heroId, TowerInfo tower); event HelpRequested( uint256 indexed heroId, address owner, uint256 level, uint256 indexed requestId, uint16 dailyHelpRequested ); event RemoveHelpRequested(uint256 indexed requestId); event AddExtraBattleRepeat(uint256 indexed heroId, TowerInfo tower); event HelpAttack( uint256 requestId, uint256 heroId, uint256[] greas, uint256[] units, uint256 pet, bool result, uint256 monsterPower, uint256 teamPower, uint256 goldDrop, uint256 expDrop, HelpRequest req, TowerInfo attackerTower ); event RecoverPower( uint256 indexed heroId, uint256 recoverTime, TowerInfo tower ); constructor( address _heroStats, address _goldRecource, address _towerProxy ) EIP712("MonsterTower", "1") { heroStats = IHeroStats(_heroStats); goldRecource = IGold(_goldRecource); towerProxy = IMonsterTowerProxy(_towerProxy); _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); } // ================ MODIFIER ===================== // modifier onlyHeroOwner(uint256 _heroId) { towerProxy.onlyHeroOwner(_heroId, msg.sender); _; } modifier onlyAdminRole() { require(hasRole(MONSTER_TOWER_ADMIN, msg.sender), "ROLE: only admin"); _; } // ================ ADMIN FUNCTIONS =====================// function updatePackagePriceIncreasePercentage( uint256 _p ) external onlyAdminRole { packagePriceIncreasePercentage = _p; } function updateHeroStats(address _to) external onlyAdminRole { heroStats = IHeroStats(_to); } function updateGold(address _to) external onlyAdminRole { goldRecource = IGold(_to); } function updateTowerProxy(address _to) external onlyAdminRole { towerProxy = IMonsterTowerProxy(_to); } // ================ PUBLIC SEND FUNCTIONS =====================// function newTower(uint256 _heroId) external onlyHeroOwner(_heroId) { require(!_towersId.contains(_heroId), "Tower is already created"); _newTower(_heroId); } function requestHelp(uint256 _heroId) external onlyHeroOwner(_heroId) { uint256 _lastRequest = _heroes[_heroId].requestHelpId; uint256 _lastRequestCreatedAt = _helpRequests[_lastRequest].createdAt; if (nextDayFrom(_lastRequestCreatedAt) < block.timestamp) { _heroes[_heroId].dailyHelpRequested = 0; } require( _heroes[_heroId].dailyHelpRequested < towerProxy.getHelpRequestDailyRepeat(), "HELP_REQUEST_DAILY_REPEAT" ); ++_helpRequestId; // Get moster tower infos of this hero TowerInfo storage towerInfos_ = _heroes[_heroId]; uint16 _towerLvl = towerInfos_.lvl; require( _heroFloorRequested[_heroId][_towerLvl] == 0, "Invalid request" ); _helpRequests[_helpRequestId] = HelpRequest({ owner: msg.sender, hero: _heroId, requestLvl: _towerLvl, createdAt: block.timestamp, winnerHero: 0, wonAt: 0 }); _heroes[_heroId].requestHelpId = _helpRequestId; _heroes[_heroId].dailyHelpRequested++; _helpRequestedIds.add(_helpRequestId); _heroFloorRequested[_heroId][_towerLvl] = _helpRequestId; emit HelpRequested( _heroId, msg.sender, _towerLvl, _helpRequestId, _heroes[_heroId].dailyHelpRequested ); } function helpAttack( uint256 _requestId, uint256 _heroId, uint256[] memory _gears, uint256[] memory _units, uint256 _pet, bytes32 _noneHash, bytes memory _signature ) external onlyHeroOwner(_heroId) { unchecked { require(!signatures[_signature], "HelpAtk: signature reused"); signatures[_signature] = true; address _signer = _verifyHelpAtk( _requestId, _heroId, _gears, _units, _pet, _signature, _noneHash ); require( hasRole(MONSTER_TOWER_SIGNER, _signer), "HelpAtk: only signer" ); _helpAttack(_requestId, _heroId, _gears, _units, _pet); } } function recoverPower( uint256 _heroId, uint256 _time ) external onlyAdminRole returns (uint256) { uint256 _recoverTime = _recoverPower(_heroId, _time); emit RecoverPower(_heroId, _recoverTime, _heroes[_heroId]); return _recoverTime; } function addExtraBattleRepeat( uint256 _heroId ) external payable onlyHeroOwner(_heroId) { unchecked { if (!_towersId.contains(_heroId)) { _newTower(_heroId); } TowerInfo storage _towerInfos = _heroes[_heroId]; if (_towerInfos.nextResetPrice < block.timestamp) { _towerInfos.nextResetPrice = nextDay(); _towerInfos.extraPackagePrice = packagePriceInit; _towerInfos.extraPackageDailyBuy = 0; } require(_towerInfos.extraPackageDailyBuy < 3, "Daily limit buy"); _towerInfos.extraPackageDailyBuy ++; uint256 _cost = _towerInfos.extraPackagePrice; require(msg.value >= _cost, "Not enough balance"); _towerInfos.extraRepeat += 6; _towerInfos.extraPackagePrice = _cost .mul(packagePriceIncreasePercentage) .div(1000); if (msg.value > _cost) { TransferHelper.safeTransferNative( msg.sender, msg.value - _cost ); } emit AddExtraBattleRepeat(_heroId, _towerInfos); } } function attackTower( uint256 _heroId, uint16 _floor, uint256[] memory _gears, uint256[] memory _units, uint256 _pet, bytes32 _noneHash, bytes memory _signature ) external onlyHeroOwner(_heroId) { require(!signatures[_signature], "AttackTower: signature reused"); signatures[_signature] = true; address _signer = _verifyAtk( _heroId, _floor, _gears, _units, _pet, _signature, _noneHash ); require( hasRole(MONSTER_TOWER_SIGNER, _signer), "AttackTower: only signer" ); _attackTower(_heroId, _floor, _gears, _units, _pet); } function getHelpRequestById( uint256 _heroId, uint256 _towerLvl ) external view returns (uint256) { return _heroFloorRequested[_heroId][_towerLvl]; } // ================ INTERNAL FUNCTIONS =====================// function hashAtk( uint256 _heroId, uint16 _floor, uint256[] memory _gears, uint256[] memory _units, uint256 _pet, bytes32 _noneHash ) public view returns (bytes32) { return _hashTypedDataV4( keccak256( abi.encode( _heroId, _floor, _gears, _units, _pet, address(this), _noneHash ) ) ); } function hashHelpAtk( uint256 _requestId, uint256 _heroId, uint256[] memory _gears, uint256[] memory _units, uint256 _pet, bytes32 _noneHash ) public view returns (bytes32) { return _hashTypedDataV4( keccak256( abi.encode( _requestId, _heroId, _gears, _units, _pet, address(this), _noneHash ) ) ); } function verifyAtk( uint256 _heroId, uint16 _floor, uint256[] memory _gears, uint256[] memory _units, uint256 _pet, bytes memory _signature, bytes32 _noneHash ) public view returns (address) { return _verifyAtk( _heroId, _floor, _gears, _units, _pet, _signature, _noneHash ); } function verifyHelpAtk( uint256 _requestId, uint256 _heroId, uint256[] memory _gears, uint256[] memory _units, uint256 _pet, bytes memory _signature, bytes32 _noneHash ) public view returns (address) { return _verifyHelpAtk( _requestId, _heroId, _gears, _units, _pet, _signature, _noneHash ); } function computePower(uint256 _heroId) external returns (uint256) { return _computePower(_heroId); } function _newTower(uint256 _heroId) internal { (uint256 _heroBasePow, , , , ) = heroStats.getHero(_heroId); _heroes[_heroId] = TowerInfo({ lvl: 1, dailyRepeated: 0, nextDay: nextDay(), dailySpecialRepeated: 0, heroBasePower: _heroBasePow, heroPower: _heroBasePow, recoverRate: towerProxy.computeRecoverRate(_heroBasePow), battleTimestamp: block.timestamp, dailyHelpRequested: 0, requestHelpId: 0, dailyHelpAttack: 0, extraRepeat: 0, extraPackagePrice: packagePriceInit, nextResetPrice: nextDay(), extraPackageDailyBuy: 0, recoverTimeNeeded: 0 }); _towersId.add(_heroId); emit NewTower(_heroId, _heroes[_heroId]); } function _verifyHelpAtk( uint256 _requestId, uint256 _heroId, uint256[] memory _gears, uint256[] memory _units, uint256 _pet, bytes memory _signature, bytes32 _noneHash ) private view returns (address) { bytes32 digest = hashHelpAtk( _requestId, _heroId, _gears, _units, _pet, _noneHash ); return digest.toEthSignedMessageHash().recover(_signature); } function _verifyAtk( uint256 _heroId, uint16 _floor, uint256[] memory _gears, uint256[] memory _units, uint256 _pet, bytes memory _signature, bytes32 _noneHash ) private view returns (address) { bytes32 digest = hashAtk( _heroId, _floor, _gears, _units, _pet, _noneHash ); return digest.toEthSignedMessageHash().recover(_signature); } function _helpAttack( uint256 _requestId, uint256 _heroId, uint256[] memory _gears, uint256[] memory _units, uint256 _pet ) internal { unchecked { if (!_towersId.contains(_heroId)) { _newTower(_heroId); } require( _helpRequestedIds.contains(_requestId), "Request id is invalid" ); towerProxy.verifyCharacters( _heroId, _gears, _pet, _units, msg.sender ); HelpRequest storage request_ = _helpRequests[_requestId]; require(_heroId != request_.hero, "Cannot help itself"); TowerInfo storage towerInfos_ = _heroes[request_.hero]; TowerInfo storage towerOfAttacker_ = _heroes[_heroId]; if (towerOfAttacker_.nextDay < block.timestamp) { towerOfAttacker_.nextDay = nextDay(); towerOfAttacker_.dailyHelpAttack = 0; } require( towerOfAttacker_.dailyHelpAttack < towerProxy.getHelpAttackDailyRepeat(), "Max help attack" ); ( uint256 _monsterPower, uint256 _monsterGoldDrop, uint256 _monsterExpDrop ) = towerProxy.getMosterPower(request_.requestLvl); uint256 _heroPowerUpdated = _computePower(_heroId); uint256 _teamPower = towerProxy.computeHeroPower( _heroPowerUpdated, _gears, _pet, _units ); bool _battleResult = towerProxy.fight(_teamPower, _monsterPower); if (_battleResult) { heroStats.increaseExp( _heroId, _monsterExpDrop.mul(700).div(1000) ); goldRecource.mint( msg.sender, _monsterGoldDrop.mul(700).div(1000) ); goldRecource.mint( request_.owner, _monsterGoldDrop.mul(300).div(1000) ); towerInfos_.lvl++; _computePowerAfterAtk(_heroId, true); request_.wonAt = block.timestamp; request_.winnerHero = _heroId; _helpRequestedIds.remove(_requestId); delete _heroFloorRequested[_heroId][request_.requestLvl]; emit RemoveHelpRequested(_requestId); } else { _computePowerAfterAtk(_heroId, false); } towerOfAttacker_.battleTimestamp = block.timestamp; towerOfAttacker_.dailyHelpAttack++; emit HelpAttack( _requestId, _heroId, _gears, _units, _pet, _battleResult, _monsterPower, _teamPower, _monsterGoldDrop, _monsterExpDrop, request_, towerOfAttacker_ ); } } function _computePowerAfterAtk(uint256 _heroId, bool _isWin) internal { TowerInfo storage tower_ = _heroes[_heroId]; uint256 _decreasePower; if (_isWin) { _decreasePower = tower_ .heroBasePower .mul(towerProxy.getWinPowerDecreasePercentage()) .div(1000); } else { _decreasePower = tower_ .heroBasePower .mul(towerProxy.getDefeatPowerDecreasePercentage()) .div(1000); } tower_.heroPower -= _decreasePower; tower_.recoverTimeNeeded += _decreasePower.div( tower_.recoverRate ); } function _attackTower( uint256 _heroId, uint16 _floor, uint256[] memory _gears, uint256[] memory _units, uint256 _pet ) internal { unchecked { if (!_towersId.contains(_heroId)) { _newTower(_heroId); } towerProxy.verifyCharacters( _heroId, _gears, _pet, _units, msg.sender ); // Get moster tower infos of this hero TowerInfo storage towerInfos_ = _heroes[_heroId]; require(_floor <= towerInfos_.lvl, "Wrong monster tower level"); if (towerInfos_.nextDay < block.timestamp) { towerInfos_.nextDay = nextDay(); towerInfos_.dailyRepeated = 0; towerInfos_.dailySpecialRepeated = 0; } ( uint256 _monsterPower, uint256 _monsterGoldDrop, uint256 _monsterExpDrop ) = towerProxy.getMosterPower(_floor); if (_floor < towerInfos_.lvl) { if (!_computeBatleTimes( towerInfos_.dailyRepeated, towerInfos_.dailySpecialRepeated )) { require(towerInfos_.extraRepeat > 0, "Daily battle filled"); towerInfos_.extraRepeat--; } if (_floor > 0 && _floor % 10 == 0) { require( towerInfos_.dailySpecialRepeated < towerProxy.getSpecialFloorClearedRepeat(), "Daily special battle filled" ); towerInfos_.dailySpecialRepeated += 1; } towerInfos_.dailyRepeated++; _monsterExpDrop = _monsterExpDrop.mul(900).div(1000); } uint256 _heroPowerUpdated = _computePower(_heroId); uint256 _teamPower = towerProxy.computeHeroPower( _heroPowerUpdated, _gears, _pet, _units ); bool _battleResult = towerProxy.fight(_teamPower, _monsterPower); uint256 _chestRewards; if (_battleResult) { heroStats.increaseExp(_heroId, _monsterExpDrop); goldRecource.mint(msg.sender, _monsterGoldDrop); _computePowerAfterAtk(_heroId, true); if (_floor == towerInfos_.lvl) { towerInfos_.lvl++; } uint256 _hasRequestedID = _heroFloorRequested[_heroId][_floor]; if (_hasRequestedID > 0) { _helpRequestedIds.remove(_hasRequestedID); delete _heroFloorRequested[_heroId][_floor]; emit RemoveHelpRequested(_hasRequestedID); } if (_floor > 0 && _floor % 10 == 0) { // TODO: Chest rewards (uint256 _chestAmount, uint256 _chestId) = towerProxy .getChestReward(); _chestRewards = _chestAmount; IFoFItemResources(towerProxy.getIngameResourceAddress()) .mint(msg.sender, _chestId, _chestAmount); } } else { _computePowerAfterAtk(_heroId, false); } towerInfos_.battleTimestamp = block.timestamp; emit AttackTower( _heroId, _gears, _units, _pet, _floor, _battleResult, _monsterPower, _teamPower, _monsterGoldDrop, _monsterExpDrop, _chestRewards, towerInfos_ ); } } function _recoverPower( uint256 _heroId, uint256 _time ) internal returns (uint256) { unchecked { if (!_towersId.contains(_heroId)) { _newTower(_heroId); return 0; } TowerInfo storage _towerInfos = _heroes[_heroId]; (uint256 _heroBasePower, , , , ) = heroStats.getHero(_heroId); uint256 _recoverRate = towerProxy.computeRecoverRate( _heroBasePower ); uint256 _recoverTimeNeeded = _towerInfos.recoverTimeNeeded; uint256 _recoverTime; if (_time >= _recoverTimeNeeded) { _recoverTime = _recoverTimeNeeded; _towerInfos.heroPower = _heroBasePower; _towerInfos.recoverTimeNeeded = 0; } else { _recoverTime = _time; _towerInfos.heroPower += _recoverTime.mul(_recoverRate); if (_towerInfos.heroPower > _heroBasePower) { _towerInfos.heroPower = _heroBasePower; } _towerInfos.recoverTimeNeeded -= _recoverTime; } _towerInfos.recoverRate = _recoverRate; _towerInfos.heroBasePower = _heroBasePower; return _recoverTime; } } function _computePower(uint256 _heroId) internal returns (uint256) { unchecked { uint256 _time = block.timestamp - _heroes[_heroId].battleTimestamp; uint256 recoverTime = _recoverPower(_heroId, _time); return _heroes[_heroId].heroPower; } } function _computeBatleTimes( uint8 _repeated, uint8 _specialRepeated ) internal view returns (bool) { return towerProxy.getNormalFloorClearedRepeat() > _repeated + _specialRepeated; } // ================ PUBLIC VIEW FUNCTIONS =====================// function getMonsterOfHero( uint256 _heroId ) external view returns (TowerInfo memory) { return _heroes[_heroId]; } function getHelpRequestsLength() external view returns (uint256) { return _helpRequestId; } function getHelpRequest( uint256 _id ) external view returns (HelpRequest memory) { return _helpRequests[_id]; } function nextDay() public view returns (uint256) { uint256 oneDay = 24 hours; return block.timestamp - (block.timestamp % oneDay) + oneDay; } function nextDayFrom(uint256 _from) public pure returns (uint256) { uint256 oneDay = 24 hours; return _from - (_from % oneDay) + oneDay; } function getTowersLength() external view returns (uint256) { return _towersId.length(); } function isTowerCreated(uint256 _heroId) external view returns (bool) { return _towersId.contains(_heroId); } function withdrawTo(address _to) external onlyAdminRole { TransferHelper.safeTransferNative(_to, address(this).balance); } receive() external payable {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ```solidity * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ```solidity * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules} * to enforce additional security measures for this role. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(account), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleGranted} event. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. * * May emit a {RoleRevoked} event. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. * * May emit a {RoleRevoked} event. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * May emit a {RoleGranted} event. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. * * May emit a {RoleGranted} event. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. * * May emit a {RoleRevoked} event. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling 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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol) pragma solidity ^0.8.0; interface IERC5267 { /** * @dev MAY be emitted to signal that the domain could have changed. */ event EIP712DomainChanged(); /** * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712 * signature. */ function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (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; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.8; import "./ECDSA.sol"; import "../ShortStrings.sol"; import "../../interfaces/IERC5267.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the * separator from the immutable values, which is cheaper than accessing a cached version in cold storage. * * _Available since v3.4._ * * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment */ abstract contract EIP712 is IERC5267 { using ShortStrings for *; bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _cachedDomainSeparator; uint256 private immutable _cachedChainId; address private immutable _cachedThis; bytes32 private immutable _hashedName; bytes32 private immutable _hashedVersion; ShortString private immutable _name; ShortString private immutable _version; string private _nameFallback; string private _versionFallback; /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { _name = name.toShortStringWithFallback(_nameFallback); _version = version.toShortStringWithFallback(_versionFallback); _hashedName = keccak256(bytes(name)); _hashedVersion = keccak256(bytes(version)); _cachedChainId = block.chainid; _cachedDomainSeparator = _buildDomainSeparator(); _cachedThis = address(this); } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _cachedThis && block.chainid == _cachedChainId) { return _cachedDomainSeparator; } else { return _buildDomainSeparator(); } } function _buildDomainSeparator() private view returns (bytes32) { return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {EIP-5267}. * * _Available since v4.9._ */ function eip712Domain() public view virtual override returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { return ( hex"0f", // 01111 _name.toStringWithFallback(_nameFallback), _version.toStringWithFallback(_versionFallback), block.chainid, address(this), bytes32(0), new uint256[](0) ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol) pragma solidity ^0.8.8; import "./StorageSlot.sol"; // | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | // | length | 0x BB | type ShortString is bytes32; /** * @dev This library provides functions to convert short memory strings * into a `ShortString` type that can be used as an immutable variable. * * Strings of arbitrary length can be optimized using this library if * they are short enough (up to 31 bytes) by packing them with their * length (1 byte) in a single EVM word (32 bytes). Additionally, a * fallback mechanism can be used for every other case. * * Usage example: * * ```solidity * contract Named { * using ShortStrings for *; * * ShortString private immutable _name; * string private _nameFallback; * * constructor(string memory contractName) { * _name = contractName.toShortStringWithFallback(_nameFallback); * } * * function name() external view returns (string memory) { * return _name.toStringWithFallback(_nameFallback); * } * } * ``` */ library ShortStrings { // Used as an identifier for strings longer than 31 bytes. bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF; error StringTooLong(string str); error InvalidShortString(); /** * @dev Encode a string of at most 31 chars into a `ShortString`. * * This will trigger a `StringTooLong` error is the input string is too long. */ function toShortString(string memory str) internal pure returns (ShortString) { bytes memory bstr = bytes(str); if (bstr.length > 31) { revert StringTooLong(str); } return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length)); } /** * @dev Decode a `ShortString` back to a "normal" string. */ function toString(ShortString sstr) internal pure returns (string memory) { uint256 len = byteLength(sstr); // using `new string(len)` would work locally but is not memory safe. string memory str = new string(32); /// @solidity memory-safe-assembly assembly { mstore(str, len) mstore(add(str, 0x20), sstr) } return str; } /** * @dev Return the length of a `ShortString`. */ function byteLength(ShortString sstr) internal pure returns (uint256) { uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF; if (result > 31) { revert InvalidShortString(); } return result; } /** * @dev Encode a string into a `ShortString`, or write it to storage if it is too long. */ function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) { if (bytes(value).length < 32) { return toShortString(value); } else { StorageSlot.getStringSlot(store).value = value; return ShortString.wrap(_FALLBACK_SENTINEL); } } /** * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}. */ function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) { if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) { return toString(value); } else { return store; } } /** * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}. * * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of * actual characters as the UTF-8 encoding of a single character can span over multiple bytes. */ function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) { if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) { return byteLength(value); } else { return bytes(store).length; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._ * _Available since v4.9 for `string`, `bytes`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; import "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IMonsterTowerProxy { function verifyCharacters( uint256 _heroId, uint256[] memory _gears, uint256 _petId, uint256[] memory _units, address _ownerAddr ) external; function getMosterPower( uint16 _lvl ) external view returns (uint256, uint256, uint256); function fight( uint256 _heroPower, uint256 _monsterPower ) external returns (bool); function getNormalFloorClearedRepeat() external pure returns (uint8); function getSpecialFloorClearedRepeat() external pure returns (uint8); function getHelpRequestDailyRepeat() external pure returns (uint8); function getHelpAttackDailyRepeat() external pure returns (uint8); function computeRecoverRate( uint256 _basePower ) external pure returns (uint256); function onlyHeroOwner(uint256 _heroId, address _owner) external view; function getDefeatPowerDecreasePercentage() external pure returns (uint16); function getWinPowerDecreasePercentage() external pure returns (uint16); function computeHeroPower( uint256 _heroPow, uint256[] memory _gears, uint256 _petId, uint256[] memory _uints ) external view returns (uint256); function getNormalChestID () external pure returns(uint256); function getIngameResourceAddress () external view returns (address); function getChestReward () external returns(uint256, uint256); function getHeroGear () external view returns(address); }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.0; // helper methods for interacting with ERC20 tokens and sending ETH that do not consistently return true/false library TransferHelper { function safeApprove( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('approve(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x095ea7b3, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: APPROVE_FAILED'); } function safeTransfer( address token, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transfer(address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0xa9059cbb, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FAILED'); } function safeTransferFrom( address token, address from, address to, uint256 value ) internal { // bytes4(keccak256(bytes('transferFrom(address,address,uint256)'))); (bool success, bytes memory data) = token.call(abi.encodeWithSelector(0x23b872dd, from, to, value)); require(success && (data.length == 0 || abi.decode(data, (bool))), 'TransferHelper: TRANSFER_FROM_FAILED'); } function safeTransferNative(address to, uint256 value) internal { (bool success, ) = to.call{value: value}(new bytes(0)); require(success, 'TransferHelper: NATIVE_COIN_TRANSFER_FAILED'); } }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IHeroStats { function newHero( address _owner, uint256 _heroId, uint256 _power, uint8 _element ) external; function increaseExp( uint256 _heroId, uint256 _exp ) external; function levelUp (uint256 _heroId) external; function getHero(uint256 _id) external view returns (uint256, uint8, uint16, uint256, uint256); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IHeroPowerProxy { function getHeroPower( uint256 _heroId, uint256[] memory gears, uint256 _petId ) external view returns (uint256); function computeHeroPower( uint256 _heroPow, uint256[] memory gears, uint256 _petId, uint256[] memory _uints ) external view returns (uint256); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IFoFItemResources { function mint( address _owner, uint256 _id, uint256 _amount ) external; }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; interface IGold { function mint (address _to, uint256 _amount) external; }
{ "optimizer": { "enabled": true, "runs": 200 }, "viaIR": true, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_heroStats","type":"address"},{"internalType":"address","name":"_goldRecource","type":"address"},{"internalType":"address","name":"_towerProxy","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidShortString","type":"error"},{"inputs":[{"internalType":"string","name":"str","type":"string"}],"name":"StringTooLong","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"heroId","type":"uint256"},{"components":[{"internalType":"uint16","name":"lvl","type":"uint16"},{"internalType":"uint8","name":"dailyRepeated","type":"uint8"},{"internalType":"uint256","name":"nextDay","type":"uint256"},{"internalType":"uint8","name":"dailySpecialRepeated","type":"uint8"},{"internalType":"uint256","name":"heroBasePower","type":"uint256"},{"internalType":"uint256","name":"heroPower","type":"uint256"},{"internalType":"uint256","name":"recoverRate","type":"uint256"},{"internalType":"uint256","name":"battleTimestamp","type":"uint256"},{"internalType":"uint16","name":"dailyHelpRequested","type":"uint16"},{"internalType":"uint256","name":"requestHelpId","type":"uint256"},{"internalType":"uint256","name":"dailyHelpAttack","type":"uint256"},{"internalType":"uint256","name":"extraRepeat","type":"uint256"},{"internalType":"uint256","name":"extraPackagePrice","type":"uint256"},{"internalType":"uint256","name":"nextResetPrice","type":"uint256"},{"internalType":"uint256","name":"extraPackageDailyBuy","type":"uint256"},{"internalType":"uint256","name":"recoverTimeNeeded","type":"uint256"}],"indexed":false,"internalType":"struct MonsterTower.TowerInfo","name":"tower","type":"tuple"}],"name":"AddExtraBattleRepeat","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"heroId","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"greas","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"units","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"pet","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"floor","type":"uint16"},{"indexed":true,"internalType":"bool","name":"battleResult","type":"bool"},{"indexed":false,"internalType":"uint256","name":"monsterPower","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"teamPower","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"goldDrop","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"expDrop","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"chestRewards","type":"uint256"},{"components":[{"internalType":"uint16","name":"lvl","type":"uint16"},{"internalType":"uint8","name":"dailyRepeated","type":"uint8"},{"internalType":"uint256","name":"nextDay","type":"uint256"},{"internalType":"uint8","name":"dailySpecialRepeated","type":"uint8"},{"internalType":"uint256","name":"heroBasePower","type":"uint256"},{"internalType":"uint256","name":"heroPower","type":"uint256"},{"internalType":"uint256","name":"recoverRate","type":"uint256"},{"internalType":"uint256","name":"battleTimestamp","type":"uint256"},{"internalType":"uint16","name":"dailyHelpRequested","type":"uint16"},{"internalType":"uint256","name":"requestHelpId","type":"uint256"},{"internalType":"uint256","name":"dailyHelpAttack","type":"uint256"},{"internalType":"uint256","name":"extraRepeat","type":"uint256"},{"internalType":"uint256","name":"extraPackagePrice","type":"uint256"},{"internalType":"uint256","name":"nextResetPrice","type":"uint256"},{"internalType":"uint256","name":"extraPackageDailyBuy","type":"uint256"},{"internalType":"uint256","name":"recoverTimeNeeded","type":"uint256"}],"indexed":false,"internalType":"struct MonsterTower.TowerInfo","name":"updatedTower","type":"tuple"}],"name":"AttackTower","type":"event"},{"anonymous":false,"inputs":[],"name":"EIP712DomainChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"heroId","type":"uint256"},{"indexed":false,"internalType":"uint256[]","name":"greas","type":"uint256[]"},{"indexed":false,"internalType":"uint256[]","name":"units","type":"uint256[]"},{"indexed":false,"internalType":"uint256","name":"pet","type":"uint256"},{"indexed":false,"internalType":"bool","name":"result","type":"bool"},{"indexed":false,"internalType":"uint256","name":"monsterPower","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"teamPower","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"goldDrop","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"expDrop","type":"uint256"},{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"hero","type":"uint256"},{"internalType":"uint16","name":"requestLvl","type":"uint16"},{"internalType":"uint256","name":"createdAt","type":"uint256"},{"internalType":"uint256","name":"winnerHero","type":"uint256"},{"internalType":"uint256","name":"wonAt","type":"uint256"}],"indexed":false,"internalType":"struct MonsterTower.HelpRequest","name":"req","type":"tuple"},{"components":[{"internalType":"uint16","name":"lvl","type":"uint16"},{"internalType":"uint8","name":"dailyRepeated","type":"uint8"},{"internalType":"uint256","name":"nextDay","type":"uint256"},{"internalType":"uint8","name":"dailySpecialRepeated","type":"uint8"},{"internalType":"uint256","name":"heroBasePower","type":"uint256"},{"internalType":"uint256","name":"heroPower","type":"uint256"},{"internalType":"uint256","name":"recoverRate","type":"uint256"},{"internalType":"uint256","name":"battleTimestamp","type":"uint256"},{"internalType":"uint16","name":"dailyHelpRequested","type":"uint16"},{"internalType":"uint256","name":"requestHelpId","type":"uint256"},{"internalType":"uint256","name":"dailyHelpAttack","type":"uint256"},{"internalType":"uint256","name":"extraRepeat","type":"uint256"},{"internalType":"uint256","name":"extraPackagePrice","type":"uint256"},{"internalType":"uint256","name":"nextResetPrice","type":"uint256"},{"internalType":"uint256","name":"extraPackageDailyBuy","type":"uint256"},{"internalType":"uint256","name":"recoverTimeNeeded","type":"uint256"}],"indexed":false,"internalType":"struct MonsterTower.TowerInfo","name":"attackerTower","type":"tuple"}],"name":"HelpAttack","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"heroId","type":"uint256"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"level","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"requestId","type":"uint256"},{"indexed":false,"internalType":"uint16","name":"dailyHelpRequested","type":"uint16"}],"name":"HelpRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"heroId","type":"uint256"},{"components":[{"internalType":"uint16","name":"lvl","type":"uint16"},{"internalType":"uint8","name":"dailyRepeated","type":"uint8"},{"internalType":"uint256","name":"nextDay","type":"uint256"},{"internalType":"uint8","name":"dailySpecialRepeated","type":"uint8"},{"internalType":"uint256","name":"heroBasePower","type":"uint256"},{"internalType":"uint256","name":"heroPower","type":"uint256"},{"internalType":"uint256","name":"recoverRate","type":"uint256"},{"internalType":"uint256","name":"battleTimestamp","type":"uint256"},{"internalType":"uint16","name":"dailyHelpRequested","type":"uint16"},{"internalType":"uint256","name":"requestHelpId","type":"uint256"},{"internalType":"uint256","name":"dailyHelpAttack","type":"uint256"},{"internalType":"uint256","name":"extraRepeat","type":"uint256"},{"internalType":"uint256","name":"extraPackagePrice","type":"uint256"},{"internalType":"uint256","name":"nextResetPrice","type":"uint256"},{"internalType":"uint256","name":"extraPackageDailyBuy","type":"uint256"},{"internalType":"uint256","name":"recoverTimeNeeded","type":"uint256"}],"indexed":false,"internalType":"struct MonsterTower.TowerInfo","name":"tower","type":"tuple"}],"name":"NewTower","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"heroId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"recoverTime","type":"uint256"},{"components":[{"internalType":"uint16","name":"lvl","type":"uint16"},{"internalType":"uint8","name":"dailyRepeated","type":"uint8"},{"internalType":"uint256","name":"nextDay","type":"uint256"},{"internalType":"uint8","name":"dailySpecialRepeated","type":"uint8"},{"internalType":"uint256","name":"heroBasePower","type":"uint256"},{"internalType":"uint256","name":"heroPower","type":"uint256"},{"internalType":"uint256","name":"recoverRate","type":"uint256"},{"internalType":"uint256","name":"battleTimestamp","type":"uint256"},{"internalType":"uint16","name":"dailyHelpRequested","type":"uint16"},{"internalType":"uint256","name":"requestHelpId","type":"uint256"},{"internalType":"uint256","name":"dailyHelpAttack","type":"uint256"},{"internalType":"uint256","name":"extraRepeat","type":"uint256"},{"internalType":"uint256","name":"extraPackagePrice","type":"uint256"},{"internalType":"uint256","name":"nextResetPrice","type":"uint256"},{"internalType":"uint256","name":"extraPackageDailyBuy","type":"uint256"},{"internalType":"uint256","name":"recoverTimeNeeded","type":"uint256"}],"indexed":false,"internalType":"struct MonsterTower.TowerInfo","name":"tower","type":"tuple"}],"name":"RecoverPower","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"requestId","type":"uint256"}],"name":"RemoveHelpRequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MONSTER_TOWER_ADMIN","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MONSTER_TOWER_SIGNER","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_heroId","type":"uint256"}],"name":"addExtraBattleRepeat","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_heroId","type":"uint256"},{"internalType":"uint16","name":"_floor","type":"uint16"},{"internalType":"uint256[]","name":"_gears","type":"uint256[]"},{"internalType":"uint256[]","name":"_units","type":"uint256[]"},{"internalType":"uint256","name":"_pet","type":"uint256"},{"internalType":"bytes32","name":"_noneHash","type":"bytes32"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"attackTower","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_heroId","type":"uint256"}],"name":"computePower","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"eip712Domain","outputs":[{"internalType":"bytes1","name":"fields","type":"bytes1"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"address","name":"verifyingContract","type":"address"},{"internalType":"bytes32","name":"salt","type":"bytes32"},{"internalType":"uint256[]","name":"extensions","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_id","type":"uint256"}],"name":"getHelpRequest","outputs":[{"components":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"hero","type":"uint256"},{"internalType":"uint16","name":"requestLvl","type":"uint16"},{"internalType":"uint256","name":"createdAt","type":"uint256"},{"internalType":"uint256","name":"winnerHero","type":"uint256"},{"internalType":"uint256","name":"wonAt","type":"uint256"}],"internalType":"struct MonsterTower.HelpRequest","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_heroId","type":"uint256"},{"internalType":"uint256","name":"_towerLvl","type":"uint256"}],"name":"getHelpRequestById","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getHelpRequestsLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_heroId","type":"uint256"}],"name":"getMonsterOfHero","outputs":[{"components":[{"internalType":"uint16","name":"lvl","type":"uint16"},{"internalType":"uint8","name":"dailyRepeated","type":"uint8"},{"internalType":"uint256","name":"nextDay","type":"uint256"},{"internalType":"uint8","name":"dailySpecialRepeated","type":"uint8"},{"internalType":"uint256","name":"heroBasePower","type":"uint256"},{"internalType":"uint256","name":"heroPower","type":"uint256"},{"internalType":"uint256","name":"recoverRate","type":"uint256"},{"internalType":"uint256","name":"battleTimestamp","type":"uint256"},{"internalType":"uint16","name":"dailyHelpRequested","type":"uint16"},{"internalType":"uint256","name":"requestHelpId","type":"uint256"},{"internalType":"uint256","name":"dailyHelpAttack","type":"uint256"},{"internalType":"uint256","name":"extraRepeat","type":"uint256"},{"internalType":"uint256","name":"extraPackagePrice","type":"uint256"},{"internalType":"uint256","name":"nextResetPrice","type":"uint256"},{"internalType":"uint256","name":"extraPackageDailyBuy","type":"uint256"},{"internalType":"uint256","name":"recoverTimeNeeded","type":"uint256"}],"internalType":"struct MonsterTower.TowerInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTowersLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_heroId","type":"uint256"},{"internalType":"uint16","name":"_floor","type":"uint16"},{"internalType":"uint256[]","name":"_gears","type":"uint256[]"},{"internalType":"uint256[]","name":"_units","type":"uint256[]"},{"internalType":"uint256","name":"_pet","type":"uint256"},{"internalType":"bytes32","name":"_noneHash","type":"bytes32"}],"name":"hashAtk","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"},{"internalType":"uint256","name":"_heroId","type":"uint256"},{"internalType":"uint256[]","name":"_gears","type":"uint256[]"},{"internalType":"uint256[]","name":"_units","type":"uint256[]"},{"internalType":"uint256","name":"_pet","type":"uint256"},{"internalType":"bytes32","name":"_noneHash","type":"bytes32"}],"name":"hashHelpAtk","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"},{"internalType":"uint256","name":"_heroId","type":"uint256"},{"internalType":"uint256[]","name":"_gears","type":"uint256[]"},{"internalType":"uint256[]","name":"_units","type":"uint256[]"},{"internalType":"uint256","name":"_pet","type":"uint256"},{"internalType":"bytes32","name":"_noneHash","type":"bytes32"},{"internalType":"bytes","name":"_signature","type":"bytes"}],"name":"helpAttack","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_heroId","type":"uint256"}],"name":"isTowerCreated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_heroId","type":"uint256"}],"name":"newTower","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nextDay","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_from","type":"uint256"}],"name":"nextDayFrom","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"packagePriceIncreasePercentage","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"packagePriceInit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_heroId","type":"uint256"},{"internalType":"uint256","name":"_time","type":"uint256"}],"name":"recoverPower","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_heroId","type":"uint256"}],"name":"requestHelp","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"","type":"bytes"}],"name":"signatures","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"updateGold","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"updateHeroStats","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_p","type":"uint256"}],"name":"updatePackagePriceIncreasePercentage","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"updateTowerProxy","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_heroId","type":"uint256"},{"internalType":"uint16","name":"_floor","type":"uint16"},{"internalType":"uint256[]","name":"_gears","type":"uint256[]"},{"internalType":"uint256[]","name":"_units","type":"uint256[]"},{"internalType":"uint256","name":"_pet","type":"uint256"},{"internalType":"bytes","name":"_signature","type":"bytes"},{"internalType":"bytes32","name":"_noneHash","type":"bytes32"}],"name":"verifyAtk","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_requestId","type":"uint256"},{"internalType":"uint256","name":"_heroId","type":"uint256"},{"internalType":"uint256[]","name":"_gears","type":"uint256[]"},{"internalType":"uint256[]","name":"_units","type":"uint256[]"},{"internalType":"uint256","name":"_pet","type":"uint256"},{"internalType":"bytes","name":"_signature","type":"bytes"},{"internalType":"bytes32","name":"_noneHash","type":"bytes32"}],"name":"verifyHelpAtk","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"}],"name":"withdrawTo","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Deployed Bytecode
0x608080604052600436101561001d575b50361561001b57600080fd5b005b600090813560e01c90816301ffc9a714612a00575080630328d525146127fa57806307895f421461272b5780631449c54914611c0f578063248a9ca314611be25780632cd9e36514611bc45780632d1558aa14611ba95780632f2ff15d14611af657806333f888de14611a8d57806336568abe146119fa5780634361ec7e146119ce5780634b61e709146119b057806358bec7bd14611987578063620a7d1c1461191d57806363bea5ac146118f05780637062dff414611859578063715018a6146117fb57806372b0d90c146117a5578063799b6b13146117585780637aa865f61461173957806384b0196e1461166c57806389ad78041461164e5780638da5cb5b1461162557806391d14854146115d95780639458b46d146115515780639ca6a4e6146114e75780639e620db81461147d578063a217fddf14611461578063ac64d5331461129a578063b03d06e81461127c578063b12d698414610f38578063b98edd5f146105d2578063c4a64201146105b3578063d31e22de14610551578063d547741f14610513578063e697cf7f1461042e578063f2fde38b14610368578063fb1492cb146102f8578063fd7cba68146102bd5763ff68804e0361000f57346102ba5760e03660031901126102ba576101f7612a55565b6001600160401b03906044358281116102b657610218903690600401612b1d565b906064358381116102b257610231903690600401612b1d565b9260a4359081116102b25760209461026c610298946102a0969461025b603c953690600401612b9e565b9560c4359260843592600435613538565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008252601c5220613b1c565b919091613a02565b6040516001600160a01b039091168152f35b8480fd5b8380fd5b80fd5b50346102ba57806003193601126102ba5760206040517fd38f97effa3571380914d595b453f1743e262e7ab47c77e5495c5470769da5708152f35b50346102ba5760c03660031901126102ba576001600160401b036044358181116103645761032a903690600401612b1d565b916064359182116102ba57602061035c846103483660048701612b1d565b9060a43591608435916024356004356136e5565b604051908152f35b8280fd5b50346102ba5760203660031901126102ba57610382612bfb565b61038a61303a565b6001600160a01b039081169081156103da57600254826001600160601b0360a01b821617600255167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a380f35b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b50346102ba5760203660031901126102ba57600f546004359082906001600160a01b0316803b1561050457604051635c9b7c1960e11b815260048101849052336024820152908290829060449082905afa8015610508576104f0575b50508060005260096020526040600020546104ab576104a89061375f565b80f35b60405162461bcd60e51b815260206004820152601860248201527f546f77657220697320616c7265616479206372656174656400000000000000006044820152606490fd5b6104f990612ab3565b61050457813861048a565b5080fd5b6040513d84823e3d90fd5b50346102ba5760403660031901126102ba576104a8600435610533612be5565b90808452600360205261054c6001604086200154612ca3565b612fc4565b50346102ba5760203660031901126102ba57600435906001600160401b0382116102ba57602060ff61059d8261058a3660048801612b9e565b8160405193828580945193849201612c27565b8101600c81520301902054166040519015158152f35b50346102ba5760203660031901126102ba57602061035c600435614071565b50346102ba5760e03660031901126102ba576001600160401b0360443581811161036457610604903690600401612b1d565b6064358281116102b65761061c903690600401612b1d565b9160c4359081116102b657610635903690600401612b9e565b600f5484906001600160a01b0316803b1561050457604051635c9b7c1960e11b81526024803560048301523390820152908290829060449082905afa801561050857610f24575b505060405160ff82519160208181860194610698818388612c27565b8101600c8152030190205416610edf57610720916106c6602061029893604051809381928651928391612c27565b8101600c815203019020600160ff198254161790556106f160a43560843587876024356004356136e5565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008752601c52603c8620613b1c565b7fd38f97effa3571380914d595b453f1743e262e7ab47c77e5495c5470769da57084526003602052604084209060018060a01b031660005260205260ff6040600020541615610ea35760243583526009602052604083205415610e93575b6004358352600b602052604083205415610e5657600f5483906001600160a01b0316803b15610504578160405180926306c7573960e01b82528183816107cf338b6084358c60243560048701613bd6565b03925af1801561050857610e42575b505060043583526006602052604083209160018301548060243514610e0857845260056020526040842092602435855260408520906001820180544211610df2575b506009820154600f54604051633f344aef60e11b81526001600160a01b039091169691906020816004818b5afa8015610d2f578990610db4575b60ff9150161115610d7d578693606061ffff6002850154166024604051809a819363694088cd60e11b835260048301525afa918215610d7257859086988794610d3a575b5082906108ac602435614022565b602060018060a01b03600f5416918b6108dd60405198899384936348313c8360e01b85526084359160048601613c36565b0381845afa948515610d2f578995610cf1575b506020906044604051809b819363ca39e5ef60e01b83528960048401528860248401525af1978815610ce6578b98610cb5575b508715610c6f57600d546001600160a01b031685156102bc808802889004141715610c4757808c913b1561050457816102bc604489836103e895604051968795869463c429a77360e01b86526024356004870152020460248401525af1801561050857610c5b575b5050600e546001600160a01b03168a156102bc808d028d9004141715610c4757808c913b15610504576040516340c10f1960e01b81523360048201526103e86102bc8e020460248201529082908290604490829084905af1801561050857610c2f575b5050600e5486546001600160a01b03908116911661012c8c158d82028e900482141715610c1b57908d939291813b156102b2576040516340c10f1960e01b81526001600160a01b039390931660048401526103e8908e0204602483015283908290604490829084905af18015610c1057610be7575b5093610be19693610b67610b599b9a9997947fdd387f55a9c18739f278783a485b31c872abf98379cf5edcb3475c596198d2529d94886005995461ffff600181831601169061ffff1916179055610abb602435613e5f565b42898901556024356004890155610ad3600435613c8b565b50602435815260076020526040812061ffff60028a0154168252602052600060408220557f930c13ed64e5b4b337e15309306865bcae5585d247be7bfea0c8e4449447f3c36004359180a25b4260068a0155600160098a01540160098a01556040519c8d9c8d60043590528d60206024359101528d610400908160408201520190612c6f565b8c810360608e015290612c6f565b60843560808c015298151560a08b015260c08a015260e089015261010088015261012087015280546001600160a01b03166101408701526001810154610160870152600281015461ffff1661018087015260038101546101a087015260048101546101c087015201546101e0850152610200840190613468565b0390a180f35b91610bfc8196929b9a99979498959c93612ab3565b6102b2579390999295919496979838610a63565b6040513d85823e3d90fd5b634e487b7160e01b8e52601160045260248efd5b610c3890612ab3565b610c43578a386109ee565b8a80fd5b634e487b7160e01b8c52601160045260248cfd5b610c6490612ab3565b610c43578a3861098b565b50927fdd387f55a9c18739f278783a485b31c872abf98379cf5edcb3475c596198d25298600593610be19693610b67610b599b9a9997610cb0602435613d75565b610b1f565b610cd891985060203d602011610cdf575b610cd08183612afc565b810190613c66565b9638610923565b503d610cc6565b6040513d8d823e3d90fd5b985093506020883d602011610d27575b81610d0e60209383612afc565b81010312610d225760208b985194906108f0565b600080fd5b3d9150610d01565b6040513d8b823e3d90fd5b909350829850610d61915060603d8111610d6b575b610d598183612afc565b810190613c1b565b989098939061089e565b503d610d4f565b6040513d87823e3d90fd5b60405162461bcd60e51b815260206004820152600f60248201526e4d61782068656c702061747461636b60881b6044820152606490fd5b506020813d602011610dea575b81610dce60209383612afc565b81010312610de657610de160ff91613327565b61085a565b8880fd5b3d9150610dc1565b610dfa614054565b905585600983015538610820565b60405162461bcd60e51b815260206004820152601260248201527121b0b73737ba103432b6381034ba39b2b63360711b6044820152606490fd5b610e4b90612ab3565b6103645782386107de565b60405162461bcd60e51b815260206004820152601560248201527414995c5d595cdd081a59081a5cc81a5b9d985b1a59605a1b6044820152606490fd5b610e9e60243561375f565b61077e565b60405162461bcd60e51b81526020600482015260146024820152732432b63820ba359d1037b7363c9039b4b3b732b960611b6044820152606490fd5b60405162461bcd60e51b815260206004820152601960248201527f48656c7041746b3a207369676e617475726520726575736564000000000000006044820152606490fd5b610f2d90612ab3565b6102b657833861067c565b50346102ba5760208060031936011261050457600f546001600160a01b03916004359184908416803b1561050457604051635c9b7c1960e11b815260048101859052336024820152908290829060449082905afa801561050857611268575b508290526005928382526008604086200154855260068252610fbf6003604087200154614071565b421161124d575b82855283825261ffff8060076040882001541660048484600f5416604051928380926314b14b1b60e11b82525afa8015611242578890611209575b60ff91501611156111c45760045460001981146111b0576001019182600455848752858452816040882054169260078552604088208489528552604088205461117957866040519161105283612a98565b3383528987840194898652604085019588875260608601914283526040608088019480865260a0890196818852815260068d52209651166001600160601b0360a01b87541617865551600186015586600286019651169561ffff199687825416179055516003850155516004840155519101556007600454868952878652604089209060088201550190815490838216848114611165579160609593918560017f047443bd54ef9972cc3b35d5566a2fd3b19ad43a0d40af05f097293d66f813d09997950116911617905561112860045461336c565b50600454968689526007845260408920838a5284528760408a2055868952835260076040892001541690604051923384528301526040820152a380f35b634e487b7160e01b8a52601160045260248afd5b60405162461bcd60e51b815260048101869052600f60248201526e125b9d985b1a59081c995c5d595cdd608a1b6044820152606490fd5b634e487b7160e01b87526011600452602487fd5b60405162461bcd60e51b815260048101849052601960248201527f48454c505f524551554553545f4441494c595f524550454154000000000000006044820152606490fd5b508481813d831161123b575b61121f8183612afc565b810103126112375761123260ff91613327565b611001565b8780fd5b503d611215565b6040513d8a823e3d90fd5b82855283825260408520600701805461ffff19169055610fc6565b61127190612ab3565b6102b6578338610f97565b50346102ba57806003193601126102ba576020600854604051908152f35b5060203660031901126102ba57600f546004359082906001600160a01b0316803b1561050457604051635c9b7c1960e11b815260048101849052336024820152908290829060449082905afa80156105085761144d575b50819052600960205260408220541561143f575b808252600560205260408220600c810180544211611421575b50600d8101805460038110156113ea576001019055600b81018054918234106113b0577f32c1a9f323217b6906bcc5cbf470f12fd60dcb76c34028190506b6f970ef38169261020092600a8301600681540190556103e861138160115484613092565b04905580341161139e575b5061139a6040518092613468565ba280f35b6113aa90340333614082565b3861138c565b60405162461bcd60e51b81526020600482015260126024820152714e6f7420656e6f7567682062616c616e636560701b6044820152606490fd5b60405162461bcd60e51b815260206004820152600f60248201526e4461696c79206c696d69742062757960881b6044820152606490fd5b611429614054565b9055601054600b82015582600d8201553861131e565b6114488161375f565b611305565b61145690612ab3565b6105045781386112f1565b50346102ba57806003193601126102ba57602090604051908152f35b50346102ba5760203660031901126102ba57611497612bfb565b60008051602061412b8339815191528252600360205260408220336000526020526114c960ff604060002054166132e8565b60018060a01b03166001600160601b0360a01b600f541617600f5580f35b50346102ba5760203660031901126102ba57611501612bfb565b60008051602061412b83398151915282526003602052604082203360005260205261153360ff604060002054166132e8565b60018060a01b03166001600160601b0360a01b600e541617600e5580f35b50346102ba5760e03660031901126102ba576001600160401b0360443581811161036457611583903690600401612b1d565b906064358181116102b65761159c903690600401612b1d565b9060a4359081116102b65791603c60209461026c610298946115c56102a0973690600401612b9e565b9460c43591608435916024356004356136e5565b50346102ba5760403660031901126102ba5760406115f5612be5565b9160043581526003602052209060018060a01b0316600052602052602060ff604060002054166040519015158152f35b50346102ba57806003193601126102ba576002546040516001600160a01b039091168152602090f35b50346102ba57806003193601126102ba576020600454604051908152f35b50346102ba57806003193601126102ba57611708906117356116ad7f4d6f6e73746572546f776572000000000000000000000000000000000000000c6130ef565b916116d77f3100000000000000000000000000000000000000000000000000000000000001613215565b611716604051916116e783612ac6565b838352604051968796600f60f81b885260e0602089015260e0880190612c4a565b908682036040880152612c4a565b9146606086015230608086015260a085015283820360c0850152612c6f565b0390f35b50346102ba5760203660031901126102ba57602061035c600435614022565b50346102ba5760203660031901126102ba5760008051602061412b83398151915281526003602052604081203360005260205261179c60ff604060002054166132e8565b60043560115580f35b50346102ba5760203660031901126102ba576104a86117c2612bfb565b60008051602061412b8339815191528352600360205260408320336000526020526117f460ff604060002054166132e8565b4790614082565b50346102ba57806003193601126102ba5761181461303a565b600280546001600160a01b031981169091556000906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50346102ba576020906118cb7fdf390cde600d25041bc02162f4d1107fe9f7d758f300779465ca23b592efdd77610220604061189436612c11565b60008051602061412b8339815191528796929652600388528287203360005288526118c560ff8460002054166132e8565b85613ebf565b9484815260058752206118e76040519186835287830190613468565ba2604051908152f35b50346102ba57604060209161190436612c11565b9082526007845282822090825283522054604051908152f35b50346102ba5760203660031901126102ba57611937612bfb565b60008051602061412b83398151915282526003602052604082203360005260205261196960ff604060002054166132e8565b60018060a01b03166001600160601b0360a01b600d541617600d5580f35b50346102ba57806003193601126102ba57602060405160008051602061412b8339815191528152f35b50346102ba57806003193601126102ba576020601154604051908152f35b50346102ba5760203660031901126102ba57604060209160043581526009835220541515604051908152f35b50346102ba5760403660031901126102ba57611a14612be5565b336001600160a01b03821603611a30576104a890600435612fc4565b60405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608490fd5b50346102ba5760c03660031901126102ba57611aa7612a55565b6001600160401b036044358181116102b657611ac7903690600401612b1d565b926064359182116102ba57602061035c8585611ae63660048801612b1d565b60a4359260843592600435613538565b50346102ba5760403660031901126102ba57600435611b13612be5565b8183526003602052611b2b6001604085200154612ca3565b8183526003602052604083209060018060a01b0316908160005260205260ff6040600020541615611b5a578280f35b818352600360205260408320816000526020526040600020600160ff1982541617905533917f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d8480a438808280f35b50346102ba57806003193601126102ba57602061035c614054565b50346102ba57806003193601126102ba576020601054604051908152f35b50346102ba5760203660031901126102ba5760016040602092600435815260038452200154604051908152f35b50346102ba5760e03660031901126102ba57611c29612a55565b6001600160401b036044358181116102b657611c49903690600401612b1d565b906064358181116102b257611c62903690600401612b1d565b9060c4359081116102b257611c7b903690600401612b9e565b600f546001600160a01b0316803b1561272757604051635c9b7c1960e11b81526004803590820152336024820152908690829060449082905afa801561271c57612709575b5060405160ff82519160208181860194611cdb818388612c27565b8101600c81520301902054166126c457611d6191611d09602061029893604051809381928651928391612c27565b8101600c815203019020600160ff19825416179055611d3260a43560843586888a600435613538565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008852601c52603c8720613b1c565b7fd38f97effa3571380914d595b453f1743e262e7ab47c77e5495c5470769da57085526003602052604085209060018060a01b031660005260205260ff604060002054161561267f576004358452600960205260408420541561266f575b600f5484906001600160a01b0316803b15610504578160405180926306c7573960e01b8252818381611dfc338a6084358d60043560048701613bd6565b03925af180156105085761265b575b5050600435845260056020526040842080549161ffff831661ffff86161161261657859260018301805442116125f1575b5050600f5460405163694088cd60e11b815261ffff871660048201526001600160a01b0390911690606081602481855afa8015610d72578590869287916125cd575b50809386549061ffff821661ffff8c1610612374575b5050508390611ea4600435614022565b602060018060a01b03600f5416918a611ed560405196879384936348313c8360e01b85526084359160048601613c36565b0381845afa92831561124257889361233b575b506020906044604051809a819363ca39e5ef60e01b83528760048401528660248401525af1968715612330578a9761230f575b50899487156122c957600d548b906001600160a01b0316803b156105045781809160446040518094819363c429a77360e01b835260043560048401528c60248401525af18015610508576122b5575b50600e546001600160a01b0316803b15610504576040516340c10f1960e01b8152336004820152602481018790529082908290604490829084905af18015610508576122a1575b5050611fbe600435613e5f565b865461ffff81168061ffff8d1614612289575b50506004358b52600760205260408b2061ffff8b168c5260205260408b205480612236575b508a61ffff8b16151580612225575b6120b2575b50926120669795926120a9959261ffff6120747fa387e390fa656264a63b0c9e4bededdd77920905b74a2ba4bf580af74474eec09c9a975b4260068a01556040519c8d9c8d60043590528d610340908160208201520190612c6f565b8c810360408e015290612c6f565b9c60843560608c01521660808a015260a089015260c088015260e0870152610100860152610120850152610140840190613468565b1515930390a280f35b600f546040805163eedee1ad60e01b81529850908890600490829085906001600160a01b03165af196871561221857819082986121dc575b5080976004602060018060a01b03600f5416604051928380926303f2e9e360e41b82525afa9081156121d157849161218f575b506001600160a01b031691823b156102b65760648492836040519586948593630ab714fb60e11b8552336004860152602485015260448401525af1801561050857612169575b5061200a565b61217c909a98959296939997949a612ab3565b610c435792959791949690938a38612163565b90506020813d6020116121c9575b816121aa60209383612afc565b810103126102b657516001600160a01b03811681036102b6573861211d565b3d915061219d565b6040513d86823e3d90fd5b975050506040863d604011612210575b816121f960409383612afc565b81010312610c43578a6020875197015196386120ea565b3d91506121ec565b50604051903d90823e3d90fd5b5061ffff600a818d16061615612005565b61223f81613c8b565b506004358c52600760205260408c2061ffff8c168d52602052600060408d20557f930c13ed64e5b4b337e15309306865bcae5585d247be7bfea0c8e4449447f3c38c80a238611ff6565b600161ffff9101169061ffff19161787553880611fd1565b6122aa90612ab3565b610c43578a38611fb1565b6122be90612ab3565b610c43578a38611f6a565b926120669795926120a9959261ffff6120747fa387e390fa656264a63b0c9e4bededdd77920905b74a2ba4bf580af74474eec09c9a9761230a600435613d75565b612042565b61232991975060203d602011610cdf57610cd08183612afc565b9538611f1b565b6040513d8c823e3d90fd5b975091506020873d60201161236c575b8161235860209383612afc565b81010312610d225760208a97519290611ee8565b3d915061234b565b919394509194959650600460206002890154926040519283809263e18907dd60e01b82525afa908115610ce6578b91612593575b5060ff808316818560101c16011161257f5760ff80808416818660101c1601169116111561252b575b61ffff891615158061251a575b61243f575b50855462ff00001916601091821c60ff1660010190911b62ff00001617855561038490808281020482148115171561242b57936103e8819493928a9796020492903880611e94565b634e487b7160e01b89526011600452602489fd5b600f54604051639505956b60e01b815290602090829060049082906001600160a01b03165afa8015610ce6578b906124e0575b60ff91501660ff8216101561249b5760ff19811660ff91821660010182161760028801556123e3565b60405162461bcd60e51b815260206004820152601b60248201527f4461696c79207370656369616c20626174746c652066696c6c656400000000006044820152606490fd5b506020813d602011612512575b816124fa60209383612afc565b81010312610c435761250d60ff91613327565b612472565b3d91506124ed565b5061ffff600a818b160616156123de565b600a87015480156125445760001901600a8801556123d1565b60405162461bcd60e51b815260206004820152601360248201527211185a5b1e4818985d1d1b1948199a5b1b1959606a1b6044820152606490fd5b634e487b7160e01b8b52601160045260248bfd5b90506020813d6020116125c5575b816125ae60209383612afc565b81010312610c43576125bf90613327565b386123a8565b3d91506125a1565b9150506125e8915060603d8111610d6b57610d598183612afc565b91909138611e7e565b6125f9614054565b905562ff00001916825560028201805460ff191690553880611e3c565b60405162461bcd60e51b815260206004820152601960248201527f57726f6e67206d6f6e7374657220746f776572206c6576656c000000000000006044820152606490fd5b61266490612ab3565b6102b6578338611e0b565b61267a60043561375f565b611dbf565b60405162461bcd60e51b815260206004820152601860248201527f41747461636b546f7765723a206f6e6c79207369676e657200000000000000006044820152606490fd5b60405162461bcd60e51b815260206004820152601d60248201527f41747461636b546f7765723a207369676e6174757265207265757365640000006044820152606490fd5b61271590959195612ab3565b9338611cc0565b6040513d88823e3d90fd5b8580fd5b50346102ba5760203660031901126102ba5760408160c09260a0835161275081612a98565b82815282602082015282858201528260608201528260808201520152600435815260066020522060405161278381612a98565b60018060a01b038254169182825260018101546020830190815261ffff80600284015416604085019081526003840154926060860193845260a060056004870154966080890197885201549601958652604051968752516020870152511660408501525160608401525160808301525160a0820152f35b50346102ba5760203660031901126102ba57604081610200926101e0835161282181612a66565b82815282602082015282858201528260608201528260808201528260a08201528260c08201528260e08201528261010082015282610120820152826101408201528261016082015282610180820152826101a0820152826101c0820152015260043581526005602052206101e060405161289a81612a66565b600e83549361ffff8516835260ff8560101c1660208401526001810154604084015260ff600282015416606084015260038101546080840152600481015460a0840152600581015460c0840152600681015460e084015261ffff60078201541661010084015260088101546101208401526009810154610140840152600a810154610160840152600b810154610180840152600c8101546101a0840152600d8101546101c084015201548282015261ffff6040519316835260ff60208201511660208401526040810151604084015260ff60608201511660608401526080810151608084015260a081015160a084015260c081015160c084015260e081015160e084015261ffff610100820151166101008401526101208101516101208401526101408101516101408401526101608101516101608401526101808101516101808401526101a08101516101a08401526101c08101516101c084015201516101e0820152f35b9050346105045760203660031901126105045760043563ffffffff60e01b81168091036103645760209250637965db0b60e01b8114908115612a44575b5015158152f35b6301ffc9a760e01b14905038612a3d565b6024359061ffff82168203610d2257565b61020081019081106001600160401b03821117612a8257604052565b634e487b7160e01b600052604160045260246000fd5b60c081019081106001600160401b03821117612a8257604052565b6001600160401b038111612a8257604052565b602081019081106001600160401b03821117612a8257604052565b604081019081106001600160401b03821117612a8257604052565b90601f801991011681019081106001600160401b03821117612a8257604052565b9080601f83011215610d22578135906001600160401b038211612a82578160051b60405193602093612b5185840187612afc565b85528380860192820101928311610d22578301905b828210612b74575050505090565b81358152908301908301612b66565b6001600160401b038111612a8257601f01601f191660200190565b81601f82011215610d2257803590612bb582612b83565b92612bc36040519485612afc565b82845260208383010111610d2257816000926020809301838601378301015290565b602435906001600160a01b0382168203610d2257565b600435906001600160a01b0382168203610d2257565b6040906003190112610d22576004359060243590565b60005b838110612c3a5750506000910152565b8181015183820152602001612c2a565b90602091612c6381518092818552858086019101612c27565b601f01601f1916010190565b90815180825260208080930193019160005b828110612c8f575050505090565b835185529381019392810192600101612c81565b60009080825260209060038252604092838120338252835260ff848220541615612ccd5750505050565b8351916001600160401b0390336060850183811186821017612fb0578752602a85528585019187368437855115612f9c5760308353855191600192831015612f88576078602188015360295b838111612f325750612ef05790875193608085019085821090821117612edc57885260428452868401946060368737845115612ec857603086538451821015612ec85790607860218601536041915b818311612e5a57505050612e1857612e14938693612df893612de9604894612dc09a519a8b957f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008c8801525180926037880190612c27565b8401917001034b99036b4b9b9b4b733903937b6329607d1b603784015251809386840190612c27565b01036028810187520185612afc565b5192839262461bcd60e51b845260048401526024830190612c4a565b0390fd5b60648587519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b909192600f81166010811015612eb4576f181899199a1a9b1b9c1cb0b131b232b360811b901a612e8a85886130c8565b5360041c928015612ea057600019019190612d68565b634e487b7160e01b82526011600452602482fd5b634e487b7160e01b83526032600452602483fd5b634e487b7160e01b81526032600452602490fd5b634e487b7160e01b86526041600452602486fd5b60648789519062461bcd60e51b825280600483015260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152fd5b90600f81166010811015612f74576f181899199a1a9b1b9c1cb0b131b232b360811b901a612f60838a6130c8565b5360041c9080156111b05760001901612d19565b634e487b7160e01b88526032600452602488fd5b634e487b7160e01b86526032600452602486fd5b634e487b7160e01b85526032600452602485fd5b634e487b7160e01b85526041600452602485fd5b906000918083526003602052604083209160018060a01b03169182845260205260ff604084205416612ff557505050565b8083526003602052604083208284526020526040832060ff1981541690557ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b339380a4565b6002546001600160a01b0316330361304e57565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b818102929181159184041417156130a557565b634e487b7160e01b600052601160045260246000fd5b919082018092116130a557565b9081518110156130d9570160200190565b634e487b7160e01b600052603260045260246000fd5b60ff811461312d5760ff811690601f821161311b576040519161311183612ae1565b8252602082015290565b604051632cd44ac360e21b8152600490fd5b506040516000805490600182811c9080841693841561320b575b60209485841081146131f757838752869493929181156131d7575060011461317b575b505061317892500382612afc565b90565b60008080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56395935091905b8183106131bf5750506131789350820101388061316a565b855487840185015294850194869450918301916131a7565b91505061317894925060ff191682840152151560051b820101388061316a565b634e487b7160e01b85526022600452602485fd5b91607f1691613147565b60ff81146132375760ff811690601f821161311b576040519161311183612ae1565b50604051600060019081549182811c908084169384156132de575b60209485841081146131f757838752869493929181156131d7575060011461328257505061317892500382612afc565b60008181527fb10e2d527612073b26eecdfd717e6a320cf44b4afac2b0732d9fcbe2b7fa0cf695935091905b8183106132c65750506131789350820101388061316a565b855487840185015294850194869450918301916132ae565b91607f1691613252565b156132ef57565b60405162461bcd60e51b815260206004820152601060248201526f2927a6229d1037b7363c9030b236b4b760811b6044820152606490fd5b519060ff82168203610d2257565b600a548110156130d957600a6000527fc65a7bb8d6351c1cf70c95a316cc6a92839c986682d98bc35f958f4883f9d2a80190600090565b6000818152600b60205260408120546133e457600a54600160401b8110156133d05790826133bc6133a584600160409601600a55613335565b819391549060031b91821b91600019901b19161790565b9055600a54928152600b6020522055600190565b634e487b7160e01b82526041600452602482fd5b905090565b6000818152600960205260408120546133e457600854600160401b8110156133d05760018101806008558110156134545790826040927ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee3015560085492815260096020522055600190565b634e487b7160e01b82526032600452602482fd5b600e6101e091805460ff61ffff91828116875260101c1660208601526001820154604086015260ff600283015416606086015260038201546080860152600482015460a0860152600582015460c0860152600682015460e086015260078201541661010085015260088101546101208501526009810154610140850152600a810154610160850152600b810154610180850152600c8101546101a0850152600d8101546101c08501520154910152565b8115613522570490565b634e487b7160e01b600052601260045260246000fd5b939061ffff9391613178966135856135726135a296604051988996602088019b8c5216604087015260e06060870152610100860190612c6f565b601f199586868303016080870152612c6f565b9160a08401523060c084015260e083015203908101835282612afc565b5190206042906135b06135cb565b906040519161190160f01b8352600283015260228201522090565b307f000000000000000000000000d2fbfeba9c751b78df29a72a17b82013b0f89f9a6001600160a01b031614806136bc575b15613626577fe2d6cb7d9c6659c84bace176ff32c509d23d9bc338f9e70e4646d030c061226e90565b60405160208101907f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f82527f0a1b09ab472d40f64c0c38028db0c0ef9b42d333e4ded7800627a8709d8b937e60408201527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260a081526136b681612a98565b51902090565b507f0000000000000000000000000000000000000000000000000000000000066eee46146135fd565b93906135a292939161317896613585613572604051978895602087019a8b52604087015260e06060870152610100860190612c6f565b519061ffff82168203610d2257565b908160a0910312610d225780519161374460208301613327565b916137516040820161371b565b916080606083015192015190565b600d546040516321d8011160e01b8152600481018390526001600160a01b039160a0908290602490829086165afa9081156139c4576000916139d0575b50602460206137a9614054565b93600f5416604051928380926349d8e7fb60e01b82528660048301525afa9081156139c457600091613992575b50601054906137e3614054565b92604051946137f186612a66565b600186526000602087015260408601526000606086015280608086015260a085015260c08401524260e084015260006101008401526000610120840152600061014084015260006101608401526101808301526101a082015260006101c082015260006101e0820152816000526005602052600e6101e060406000209261ffff8082511661ffff1990818754161786556138a560ff602085015116879062ff000082549160101b169062ff00001916179055565b604083015160018701556002860160ff60608501511660ff198254161790556080830151600387015560a0830151600487015560c0830151600587015560e083015160068701556007860191610100840151169082541617905561012081015160088501556101408101516009850155610160810151600a850155610180810151600b8501556101a0810151600c8501556101c0810151600d850155015191015561394f816133e9565b508060005260056020527f6da6fad51ad6439c3c88575116c10eba8705469a9cddd0dbc35defb264217c79610200604060002061398f6040518092613468565ba2565b906020823d6020116139bc575b816139ac60209383612afc565b810103126102ba575051386137d6565b3d915061399f565b6040513d6000823e3d90fd5b6139f1915060a03d81116139fb575b6139e98183612afc565b81019061372a565b505050503861379c565b503d6139df565b6005811015613b065780613a135750565b60018103613a605760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e617475726500000000000000006044820152606490fd5b60028103613aad5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606490fd5b600314613ab657565b60405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608490fd5b634e487b7160e01b600052602160045260246000fd5b906041815114600014613b4a57613b46916020820151906060604084015193015160001a90613b54565b9091565b5050600090600290565b9291907f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a08311613bca5791608094939160ff602094604051948552168484015260408301526060820152600093849182805260015afa156122185781516001600160a01b03811615613bc4579190565b50600190565b50505050600090600390565b93613bf8613c0b9360809593989798875260a0602088015260a0870190612c6f565b9160408601528482036060860152612c6f565b6001600160a01b03909416910152565b90816060910312610d22578051916040602083015192015190565b906131789492613c53918352608060208401526080830190612c6f565b9260408201526060818403910152612c6f565b90816020910312610d2257518015158103610d225790565b919082039182116130a557565b6000818152600b60205260408120549091908015613d705760001990808201818111613d5c57600a5490838201918211613d4857808203613d14575b505050600a548015613d0057810190613cdf82613335565b909182549160031b1b19169055600a558152600b6020526040812055600190565b634e487b7160e01b84526031600452602484fd5b613d32613d236133a593613335565b90549060031b1c928392613335565b90558452600b6020526040842055388080613cc7565b634e487b7160e01b86526011600452602486fd5b634e487b7160e01b85526011600452602485fd5b505090565b6000908152600560205260408120906003820154906004602060018060a01b03600f541660405192838092631d41121560e01b82525afa918215613e53578092613e01575b5050613df36103e8613dd6613dfd9461ffff600e951690613092565b0460048501613de6828254613c7e565b9055600585015490613518565b92019182546130bb565b9055565b9091506020823d8211613e4b575b81613e1c60209383612afc565b810103126102ba5750613df36103e8613dd6613dfd9461ffff613e40600e9661371b565b955050945050613dba565b3d9150613e0f565b604051903d90823e3d90fd5b6000908152600560205260408120906003820154906004602060018060a01b03600f5416604051928380926353b855cf60e11b82525afa918215613e53578092613e01575050613df36103e8613dd6613dfd9461ffff600e951690613092565b6000908082526020600981526040808420541561401557828452600582528084209160018060a01b0360a081600d54169560248551809881936321d8011160e01b835260048301525afa94851561400b578695613fe0575b509080602492600f54168451938480926349d8e7fb60e01b82528960048301525afa928315613fd757508592613fa9575b5050600e8201805495909490868110613f72575060039394856004850155555b6005820155015590565b600394959150809686613f858584613092565b81600488019182540180835511613fa1575b5050039055613f68565b558638613f97565b90809250813d8311613fd0575b613fc08183612afc565b810103126102b657513880613f48565b503d613fb6565b513d87823e3d90fd5b8291955091613ffe60249360a03d81116139fb576139e98183612afc565b5050505095919250613f17565b83513d88823e3d90fd5b505061317891925061375f565b80600052600560205261403f600660406000200154420382613ebf565b50600052600560205260046040600020015490565b6201518061406481420642613c7e565b9081018091116130a55790565b614064620151809182810690613c7e565b60405161408e81612ac6565b60008080948194828095525af1903d15614124573d906140ad82612b83565b916140bb6040519384612afc565b825260203d92013e5b156140cb57565b60405162461bcd60e51b815260206004820152602b60248201527f5472616e7366657248656c7065723a204e41544956455f434f494e5f5452414e60448201526a14d1915497d1905253115160aa1b6064820152608490fd5b506140c456fe0b524691e985e4b1e498a12785781a856d83d461ce212872f406b7a02f5c28f0a26469706673582212208ee69c839aed052036ad01209fc162b09db8cec5f5d83568e7df1028b4e5e76064736f6c63430008130033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ 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.