Feature Tip: Add private address tag to any address under My Name Tag !
Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 2,752 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Move | 20900678 | 56 days ago | IN | 0 ETH | 0.00017952 | ||||
Identify And Doc... | 17453532 | 538 days ago | IN | 0 ETH | 0.00367716 | ||||
Move | 17405163 | 545 days ago | IN | 0 ETH | 0.00075505 | ||||
Undock Extract A... | 17115032 | 586 days ago | IN | 0 ETH | 0.0029839 | ||||
Extract | 17115011 | 586 days ago | IN | 0 ETH | 0.00396285 | ||||
Identify And Doc... | 17059403 | 594 days ago | IN | 0 ETH | 0.00530554 | ||||
Multicall | 17004066 | 602 days ago | IN | 0 ETH | 0.00342902 | ||||
Undock Extract A... | 17001208 | 602 days ago | IN | 0 ETH | 0.00194392 | ||||
Extract | 17001179 | 602 days ago | IN | 0 ETH | 0.00190381 | ||||
Move | 17000984 | 602 days ago | IN | 0 ETH | 0.00084469 | ||||
Dock | 16981123 | 605 days ago | IN | 0 ETH | 0.00278069 | ||||
Dock | 16981122 | 605 days ago | IN | 0 ETH | 0.00284304 | ||||
Dock | 16981120 | 605 days ago | IN | 0 ETH | 0.00084635 | ||||
Dock | 16981118 | 605 days ago | IN | 0 ETH | 0.00295264 | ||||
Identify And Doc... | 16972371 | 606 days ago | IN | 0 ETH | 0.00498889 | ||||
Undock Extract A... | 16954341 | 609 days ago | IN | 0 ETH | 0.00153524 | ||||
Undock Extract A... | 16954340 | 609 days ago | IN | 0 ETH | 0.00153252 | ||||
Undock Extract A... | 16954339 | 609 days ago | IN | 0 ETH | 0.00154859 | ||||
Undock Extract A... | 16943872 | 610 days ago | IN | 0 ETH | 0.00222748 | ||||
Multicall | 16928806 | 613 days ago | IN | 0 ETH | 0.00435234 | ||||
Identify And Doc... | 16917887 | 614 days ago | IN | 0 ETH | 0.00344517 | ||||
Undock Extract A... | 16893225 | 618 days ago | IN | 0 ETH | 0.0019867 | ||||
Multicall | 16885727 | 619 days ago | IN | 0 ETH | 0.0140037 | ||||
Extract | 16885689 | 619 days ago | IN | 0 ETH | 0.00183358 | ||||
Extract | 16885688 | 619 days ago | IN | 0 ETH | 0.00163092 |
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
16472180 | 677 days ago | Contract Creation | 0 ETH |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
GenesisGalaxy
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/utils/Multicall.sol"; import "./utils/EntityUtils.sol"; import "./utils/Sample.sol"; import "./systems/SpatialSystem.sol"; import "./systems/MiningSystem.sol"; import "./IERC20Resource.sol"; import "./IMiaocraft.sol"; import "./constants.sol"; struct EmissionInfo { uint128 seed; uint128 amount; } struct AsteroidInfo { address resource; uint256 initialSupply; uint256 rewardPerSecond; int256 x; int256 y; } struct AsteroidInfoExtended { uint256 id; uint128 emissionId; uint32 index; bool identified; AsteroidInfo asteroidInfo; MineInfo mineInfo; } contract GenesisGalaxy is SpatialSystem, MiningSystem, Initializable, Ownable, Multicall { uint256 public immutable ASTEROIDS_PER_EMISSION; uint256 public immutable MAX_DEPLETION_INTERVAL; uint256 public immutable MAX_RADIUS; uint256 public immutable SPEED; // per second IERC20Resource public butter; IMiaocraft public miaocraft; address public sbh; EmissionInfo[] public _emissionInfos; mapping(uint256 => uint256) public identifiedBitmaps; constructor( uint256 asteroidsPerEmission, uint256 maxDepletionInterval, uint256 maxRadius, uint256 speed ) { ASTEROIDS_PER_EMISSION = asteroidsPerEmission; MAX_DEPLETION_INTERVAL = maxDepletionInterval; MAX_RADIUS = maxRadius; SPEED = speed; } function initialize( address butter_, address miaocraft_, address sbh_ ) public initializer { butter = IERC20Resource(butter_); miaocraft = IMiaocraft(miaocraft_); sbh = sbh_; // initialize the origin _add(getOrigin()); _transferOwnership(msg.sender); } function getEmission(uint256 emissionId) public view returns (EmissionInfo memory emissionInfo) { emissionInfo = _emissionInfos[emissionId]; } function getEmissionCount() public view returns (uint256) { return _emissionInfos.length; } function getAsteroids(uint256 emissionId) public view returns (AsteroidInfo[] memory asteroidInfos) { asteroidInfos = new AsteroidInfo[](ASTEROIDS_PER_EMISSION); for (uint256 i = 0; i < ASTEROIDS_PER_EMISSION; i++) { asteroidInfos[i] = getAsteroid(emissionId, i); } } function getAsteroid(uint256 emissionId, uint256 index) public view returns (AsteroidInfo memory asteroidInfo) { uint256 seed = uint256( keccak256(abi.encodePacked(_emissionInfos[emissionId].seed, index)) ); // Although sqrt(1/(1e-18 + x)) is bounded, a manipulated vrf can force // the multiplier to go to 1e9, which destroys the econmomy in an // instant. So use sqrt(1/(1e-15 + x)) to cap the multiplier at 31.6 uint256 initialSupply = (sampleInvSqrt(seed++, 1e15) * _emissionInfos[emissionId].amount) / 1e18 / ASTEROIDS_PER_EMISSION; // min reward rate is 1/2 the supply / depletion interval. Multiply b 2 // so that the min reward rate is supply / depletion interval. uint256 rewardPerSecond = (2 * (sampleInvSqrt(seed++, 1e15) * initialSupply)) / 1e18 / MAX_DEPLETION_INTERVAL; (int256 x, int256 y) = sampleCircle( seed, MAX_RADIUS / ASTEROID_COORD_PRECISION ); asteroidInfo = AsteroidInfo({ resource: address(butter), initialSupply: initialSupply, rewardPerSecond: rewardPerSecond, x: x * int256(ASTEROID_COORD_PRECISION), y: y * int256(ASTEROID_COORD_PRECISION) }); } function getAsteroidExtended(uint256 emissionId, uint256 index) public view returns (AsteroidInfoExtended memory) { return _getAsteroidExtended( emissionId, index, identifiedBitmaps[emissionId] ); } function getOrigin() public view returns (AsteroidInfo memory) { uint256 genesisCost = GENESIS_SUPPLY * miaocraft.buildCost(SPINS_PRECISION); return AsteroidInfo({ resource: address(butter), initialSupply: 100 * genesisCost, rewardPerSecond: genesisCost / MAX_DEPLETION_INTERVAL, x: 0, y: 0 }); } function getOriginExtended() public view returns (AsteroidInfoExtended memory) { return AsteroidInfoExtended({ id: 0, emissionId: 0, index: uint32(ASTEROIDS_PER_EMISSION), identified: true, asteroidInfo: getOrigin(), mineInfo: getMineInfo(tokenToEntity(address(this), 0)) }); } function coordinateToAsteroidId(int256 x, int256 y) public pure returns (uint256) { x /= int256(ASTEROID_COORD_PRECISION); y /= int256(ASTEROID_COORD_PRECISION); return (uint256(x < 0 ? -x + ASTEROID_COORD_NEG_FLAG : x) * uint256(ASTEROID_COORD_NEG_FLAG * 10)) + (uint256(y < 0 ? -y + ASTEROID_COORD_NEG_FLAG : y)); } function asteroidIdToCoordinate(uint256 asteroidId) public pure returns (int256 x, int256 y) { x = int256(asteroidId) / ASTEROID_COORD_NEG_FLAG / 10; y = int256(asteroidId) - x * ASTEROID_COORD_NEG_FLAG * 10; x = ( x / ASTEROID_COORD_NEG_FLAG == 0 ? x : -(x - ASTEROID_COORD_NEG_FLAG) ) * int256(ASTEROID_COORD_PRECISION); y = ( y / ASTEROID_COORD_NEG_FLAG == 0 ? y : -(y - ASTEROID_COORD_NEG_FLAG) ) * int256(ASTEROID_COORD_PRECISION); } function identified(uint256 emissionId, uint256 index) public view returns (bool) { return _mapped(identifiedBitmaps[emissionId], index); } function _getAsteroidExtended( uint256 emissionId, uint256 index, uint256 identifiedBitmap ) internal view returns (AsteroidInfoExtended memory info) { AsteroidInfo memory asteroidInfo = getAsteroid(emissionId, index); uint256 asteroidId = coordinateToAsteroidId( asteroidInfo.x, asteroidInfo.y ); return AsteroidInfoExtended({ id: asteroidId, emissionId: uint128(emissionId), index: uint32(index), identified: _mapped(identifiedBitmap, index), asteroidInfo: asteroidInfo, mineInfo: getMineInfo(tokenToEntity(address(this), asteroidId)) }); } function _getAsteroidId(uint256 emissionId, uint256 index) internal view returns (uint256) { AsteroidInfo memory info = getAsteroid(emissionId, index); return coordinateToAsteroidId(info.x, info.y); } function _mapped(uint256 bitmap, uint256 index) private pure returns (bool) { return bitmap & (1 << index) != 0; } function _requireDocked(uint256 shipEntityId, uint256 asteroidEntityId) internal view { require(locked(shipEntityId), "Not docked"); require(collocated(asteroidEntityId, shipEntityId), "Not docked here"); } function addEmission(uint256 seed, uint256 amount) public { require(msg.sender == sbh, "Only sbh"); _emissionInfos.push( EmissionInfo({seed: uint128(seed), amount: uint128(amount)}) ); } function identifyMultiple(uint256 emissionId, uint256[] memory indices) public { for (uint256 i = 0; i < indices.length; i++) { identify(emissionId, indices[i]); } } function identifyAll(uint256 emissionId) public { uint256 bitmap = identifiedBitmaps[emissionId]; for (uint256 i = 0; i < ASTEROIDS_PER_EMISSION; i++) { if (!_mapped(bitmap, i)) identify(emissionId, i); } } function identify(uint256 emissionId, uint256 index) public returns (uint256 asteroidId) { require(emissionId < _emissionInfos.length, "Invalid emissionId"); require(index < ASTEROIDS_PER_EMISSION, "Invalid index"); require(!identified(emissionId, index), "Already identified"); identifiedBitmaps[emissionId] |= 1 << index; asteroidId = _add(getAsteroid(emissionId, index)); } function dock(uint256 shipId, uint256 asteroidId) public onlyApprovedOrShipOwner(shipId) { uint256 shipEntityId = tokenToEntity(address(miaocraft), shipId); uint256 asteroidEntityId = tokenToEntity(address(this), asteroidId); require(!locked(shipEntityId), "Already docked"); _updateLocation(shipEntityId); require(collocated(asteroidEntityId, shipEntityId), "Out of orbit"); _lock(shipEntityId); _dock(shipEntityId, asteroidEntityId, miaocraft.spinsOf(shipId)); } function redock(uint256 shipId, uint256 asteroidId) public { uint256 shipEntityId = tokenToEntity(address(miaocraft), shipId); uint256 asteroidEntityId = tokenToEntity(address(this), asteroidId); _requireDocked(shipEntityId, asteroidEntityId); uint256 sharesBefore = getExtractorInfo(asteroidEntityId, shipEntityId) .shares; uint256 sharesAfter = miaocraft.spinsOf(shipId); if (sharesBefore > sharesAfter) { _undock(shipEntityId, asteroidEntityId, sharesBefore - sharesAfter); } else { _dock(shipEntityId, asteroidEntityId, sharesAfter - sharesBefore); } } function extract(uint256 shipId, uint256 asteroidId) public { _extract( tokenToEntity(address(miaocraft), shipId), tokenToEntity(address(this), asteroidId) ); } function identifyAndDock( uint256 emissionId, uint256 index, uint256 shipId ) public { uint256 asteroidId; if (!identified(emissionId, index)) { asteroidId = identify(emissionId, index); } else { asteroidId = _getAsteroidId(emissionId, index); } dock(shipId, asteroidId); } function undockAndExtract(uint256 shipId, uint256 asteroidId) public onlyApprovedOrShipOwner(shipId) { uint256 shipEntityId = tokenToEntity(address(miaocraft), shipId); uint256 asteroidEntityId = tokenToEntity(address(this), asteroidId); _requireDocked(shipEntityId, asteroidEntityId); _undockAndExtract( shipEntityId, asteroidEntityId, getExtractorInfo(asteroidEntityId, shipEntityId).shares ); _unlock(shipEntityId); } function emergencyUndock(uint256 shipId, uint256 asteroidId) public onlyApprovedOrShipOwner(shipId) { uint256 shipEntityId = tokenToEntity(address(miaocraft), shipId); _emergencyUndock( shipEntityId, tokenToEntity(address(this), asteroidId) ); _unlock(shipEntityId); } function undockExtractAndMove( uint256 shipId, uint256 fromAsteroidId, uint256 toAsteroidId ) public { (int256 x, int256 y) = coordinate( tokenToEntity(address(this), toAsteroidId) ); undockExtractAndMove(shipId, fromAsteroidId, x, y); } function undockExtractAndMove( uint256 shipId, uint256 asteroidId, int256 xDest, int256 yDest ) public onlyApprovedOrShipOwner(shipId) { uint256 shipEntityId = tokenToEntity(address(miaocraft), shipId); uint256 asteroidEntityId = tokenToEntity(address(this), asteroidId); _requireDocked(shipEntityId, asteroidEntityId); _undockAndExtract( shipEntityId, asteroidEntityId, getExtractorInfo(asteroidEntityId, shipEntityId).shares ); _unlock(shipEntityId); _move(shipEntityId, xDest, yDest, SPEED); } function move(uint256 shipId, uint256 asteroidId) public { (int256 x, int256 y) = coordinate( tokenToEntity(address(this), asteroidId) ); move(shipId, x, y); } function move( uint256 shipId, int256 xDest, int256 yDest ) public onlyApprovedOrShipOwner(shipId) { _move(tokenToEntity(address(miaocraft), shipId), xDest, yDest, SPEED); } function remove(uint256 shipId, uint256 asteroidId) public { try miaocraft.ownerOf(shipId) { revert("Ship exists"); } catch Error(string memory reason) { require( keccak256(abi.encodePacked(reason)) == keccak256("ERC721: invalid token ID"), "Invalid reason" ); _destroyExtractor( tokenToEntity(address(this), asteroidId), tokenToEntity(address(miaocraft), shipId) ); } } function _add(AsteroidInfo memory asteroidInfo) internal returns (uint256 asteroidId) { asteroidId = coordinateToAsteroidId(asteroidInfo.x, asteroidInfo.y); uint256 asteroidEntityId = tokenToEntity(address(this), asteroidId); IERC20Resource(asteroidInfo.resource).mint( asteroidEntityId, asteroidInfo.initialSupply ); _setCoordinate(asteroidEntityId, asteroidInfo.x, asteroidInfo.y); _add( asteroidEntityId, asteroidInfo.resource, asteroidInfo.rewardPerSecond ); } modifier onlyApprovedOrShipOwner(uint256 shipId) { require( miaocraft.isApprovedOrOwner(msg.sender, shipId), "Only approved or owner" ); _; } /* DATA QUERY FUNCTIONS */ function paginateEmissions(uint256 offset, uint256 limit) public view returns (EmissionInfo[] memory emissionInfos_) { limit = Math.min(limit, _emissionInfos.length - offset); emissionInfos_ = new EmissionInfo[](limit); uint256 start = _emissionInfos.length - offset - 1; for (uint256 i = 0; i < limit; i++) { emissionInfos_[i] = _emissionInfos[start - i]; } } function paginateAsteroids(uint256 offset, uint256 limit) public view returns (AsteroidInfoExtended[] memory asteroidInfos) { limit = Math.min(limit, _emissionInfos.length - offset); asteroidInfos = new AsteroidInfoExtended[]( limit * ASTEROIDS_PER_EMISSION ); uint256 start = _emissionInfos.length - offset - 1; for (uint256 i = 0; i < limit; i++) { uint256 emissionId = start - i; uint256 bitmap = identifiedBitmaps[i]; asteroidInfos[ emissionId * ASTEROIDS_PER_EMISSION + 0 ] = _getAsteroidExtended(emissionId, 0, bitmap); asteroidInfos[ emissionId * ASTEROIDS_PER_EMISSION + 1 ] = _getAsteroidExtended(emissionId, 1, bitmap); asteroidInfos[ emissionId * ASTEROIDS_PER_EMISSION + 2 ] = _getAsteroidExtended(emissionId, 2, bitmap); asteroidInfos[ emissionId * ASTEROIDS_PER_EMISSION + 3 ] = _getAsteroidExtended(emissionId, 3, bitmap); asteroidInfos[ emissionId * ASTEROIDS_PER_EMISSION + 4 ] = _getAsteroidExtended(emissionId, 4, bitmap); asteroidInfos[ emissionId * ASTEROIDS_PER_EMISSION + 5 ] = _getAsteroidExtended(emissionId, 5, bitmap); asteroidInfos[ emissionId * ASTEROIDS_PER_EMISSION + 6 ] = _getAsteroidExtended(emissionId, 6, bitmap); asteroidInfos[ emissionId * ASTEROIDS_PER_EMISSION + 7 ] = _getAsteroidExtended(emissionId, 7, bitmap); asteroidInfos[ emissionId * ASTEROIDS_PER_EMISSION + 8 ] = _getAsteroidExtended(emissionId, 8, bitmap); asteroidInfos[ emissionId * ASTEROIDS_PER_EMISSION + 9 ] = _getAsteroidExtended(emissionId, 9, bitmap); asteroidInfos[ emissionId * ASTEROIDS_PER_EMISSION + 10 ] = _getAsteroidExtended(emissionId, 10, bitmap); } } /* OWNER FUNCTIONS */ function setButter(IERC20Resource butter_) public onlyOwner { butter = butter_; } function setMiaocraft(IMiaocraft miaocraft_) public onlyOwner { miaocraft = miaocraft_; } function setSbh(address sbh_) public onlyOwner { sbh = sbh_; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC1363.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./IERC165.sol"; interface IERC1363 is IERC165, IERC20 { /* * Note: the ERC-165 identifier for this interface is 0x4bbee2df. * 0x4bbee2df === * bytes4(keccak256('transferAndCall(address,uint256)')) ^ * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) */ /* * Note: the ERC-165 identifier for this interface is 0xfb9ec8ce. * 0xfb9ec8ce === * bytes4(keccak256('approveAndCall(address,uint256)')) ^ * bytes4(keccak256('approveAndCall(address,uint256,bytes)')) */ /** * @dev Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver * @param to address The address which you want to transfer to * @param value uint256 The amount of tokens to be transferred * @return true unless throwing */ function transferAndCall(address to, uint256 value) external returns (bool); /** * @dev Transfer tokens from `msg.sender` to another address and then call `onTransferReceived` on receiver * @param to address The address which you want to transfer to * @param value uint256 The amount of tokens to be transferred * @param data bytes Additional data with no specified format, sent in call to `to` * @return true unless throwing */ function transferAndCall( address to, uint256 value, bytes memory data ) external returns (bool); /** * @dev Transfer tokens from one address to another and then call `onTransferReceived` on receiver * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 The amount of tokens to be transferred * @return true unless throwing */ function transferFromAndCall( address from, address to, uint256 value ) external returns (bool); /** * @dev Transfer tokens from one address to another and then call `onTransferReceived` on receiver * @param from address The address which you want to send tokens from * @param to address The address which you want to transfer to * @param value uint256 The amount of tokens to be transferred * @param data bytes Additional data with no specified format, sent in call to `to` * @return true unless throwing */ function transferFromAndCall( address from, address to, uint256 value, bytes memory data ) external returns (bool); /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender * and then call `onApprovalReceived` on spender. * @param spender address The address which will spend the funds * @param value uint256 The amount of tokens to be spent */ function approveAndCall(address spender, uint256 value) external returns (bool); /** * @dev Approve the passed address to spend the specified amount of tokens on behalf of msg.sender * and then call `onApprovalReceived` on spender. * @param spender address The address which will spend the funds * @param value uint256 The amount of tokens to be spent * @param data bytes Additional data with no specified format, sent in call to `spender` */ function approveAndCall( address spender, uint256 value, bytes memory data ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol) pragma solidity ^0.8.0; import "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/Address.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a * constructor. * * Emits an {Initialized} event. */ modifier initializer() { bool isTopLevelCall = !_initializing; require( (isTopLevelCall && _initialized < 1) || (!Address.isContract(address(this)) && _initialized == 1), "Initializable: contract is already initialized" ); _initialized = 1; if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: setting the version to 255 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint8 version) { require(!_initializing && _initialized < version, "Initializable: contract is already initialized"); _initialized = version; _initializing = true; _; _initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } /** * @dev Internal function that returns the initialized version. Returns `_initialized` */ function _getInitializedVersion() internal view returns (uint8) { return _initialized; } /** * @dev Internal function that returns the initialized version. Returns `_initializing` */ function _isInitializing() internal view returns (bool) { return _initializing; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.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.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/Multicall.sol) pragma solidity ^0.8.0; import "./Address.sol"; /** * @dev Provides a function to batch together multiple calls in a single external call. * * _Available since v4.1._ */ abstract contract Multicall { /** * @dev Receives and executes a batch of function calls on this contract. */ function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { results[i] = Address.functionDelegateCall(address(this), data[i]); } return results; } }
// 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.8.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) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 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 10, 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 * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; /// @notice Signed 18 decimal fixed point (wad) arithmetic library. /// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SignedWadMath.sol) /// @author Modified from Remco Bloemen (https://xn--2-umb.com/22/exp-ln/index.html) /// @dev Will not revert on overflow, only use where overflow is not possible. function toWadUnsafe(uint256 x) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Multiply x by 1e18. r := mul(x, 1000000000000000000) } } /// @dev Takes an integer amount of seconds and converts it to a wad amount of days. /// @dev Will not revert on overflow, only use where overflow is not possible. /// @dev Not meant for negative second amounts, it assumes x is positive. function toDaysWadUnsafe(uint256 x) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Multiply x by 1e18 and then divide it by 86400. r := div(mul(x, 1000000000000000000), 86400) } } /// @dev Takes a wad amount of days and converts it to an integer amount of seconds. /// @dev Will not revert on overflow, only use where overflow is not possible. /// @dev Not meant for negative day amounts, it assumes x is positive. function fromDaysWadUnsafe(int256 x) pure returns (uint256 r) { /// @solidity memory-safe-assembly assembly { // Multiply x by 86400 and then divide it by 1e18. r := div(mul(x, 86400), 1000000000000000000) } } /// @dev Will not revert on overflow, only use where overflow is not possible. function unsafeWadMul(int256 x, int256 y) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Multiply x by y and divide by 1e18. r := sdiv(mul(x, y), 1000000000000000000) } } /// @dev Will return 0 instead of reverting if y is zero and will /// not revert on overflow, only use where overflow is not possible. function unsafeWadDiv(int256 x, int256 y) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Multiply x by 1e18 and divide it by y. r := sdiv(mul(x, 1000000000000000000), y) } } function wadMul(int256 x, int256 y) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Store x * y in r for now. r := mul(x, y) // Equivalent to require(x == 0 || (x * y) / x == y) if iszero(or(iszero(x), eq(sdiv(r, x), y))) { revert(0, 0) } // Scale the result down by 1e18. r := sdiv(r, 1000000000000000000) } } function wadDiv(int256 x, int256 y) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Store x * 1e18 in r for now. r := mul(x, 1000000000000000000) // Equivalent to require(y != 0 && ((x * 1e18) / 1e18 == x)) if iszero(and(iszero(iszero(y)), eq(sdiv(r, 1000000000000000000), x))) { revert(0, 0) } // Divide r by y. r := sdiv(r, y) } } /// @dev Will not work with negative bases, only use when x is positive. function wadPow(int256 x, int256 y) pure returns (int256) { // Equivalent to x to the power of y because x ** y = (e ** ln(x)) ** y = e ** (ln(x) * y) return wadExp((wadLn(x) * y) / 1e18); // Using ln(x) means x must be greater than 0. } function wadExp(int256 x) pure returns (int256 r) { unchecked { // When the result is < 0.5 we return zero. This happens when // x <= floor(log(0.5e18) * 1e18) ~ -42e18 if (x <= -42139678854452767551) return 0; // When the result is > (2**255 - 1) / 1e18 we can not represent it as an // int. This happens when x >= floor(log((2**255 - 1) / 1e18) * 1e18) ~ 135. if (x >= 135305999368893231589) revert("EXP_OVERFLOW"); // x is now in the range (-42, 136) * 1e18. Convert to (-42, 136) * 2**96 // for more intermediate precision and a binary basis. This base conversion // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78. x = (x << 78) / 5**18; // Reduce range of x to (-½ ln 2, ½ ln 2) * 2**96 by factoring out powers // of two such that exp(x) = exp(x') * 2**k, where k is an integer. // Solving this gives k = round(x / log(2)) and x' = x - k * log(2). int256 k = ((x << 96) / 54916777467707473351141471128 + 2**95) >> 96; x = x - k * 54916777467707473351141471128; // k is in the range [-61, 195]. // Evaluate using a (6, 7)-term rational approximation. // p is made monic, we'll multiply by a scale factor later. int256 y = x + 1346386616545796478920950773328; y = ((y * x) >> 96) + 57155421227552351082224309758442; int256 p = y + x - 94201549194550492254356042504812; p = ((p * y) >> 96) + 28719021644029726153956944680412240; p = p * x + (4385272521454847904659076985693276 << 96); // We leave p in 2**192 basis so we don't need to scale it back up for the division. int256 q = x - 2855989394907223263936484059900; q = ((q * x) >> 96) + 50020603652535783019961831881945; q = ((q * x) >> 96) - 533845033583426703283633433725380; q = ((q * x) >> 96) + 3604857256930695427073651918091429; q = ((q * x) >> 96) - 14423608567350463180887372962807573; q = ((q * x) >> 96) + 26449188498355588339934803723976023; /// @solidity memory-safe-assembly assembly { // Div in assembly because solidity adds a zero check despite the unchecked. // The q polynomial won't have zeros in the domain as all its roots are complex. // No scaling is necessary because p is already 2**96 too large. r := sdiv(p, q) } // r should be in the range (0.09, 0.25) * 2**96. // We now need to multiply r by: // * the scale factor s = ~6.031367120. // * the 2**k factor from the range reduction. // * the 1e18 / 2**96 factor for base conversion. // We do this all at once, with an intermediate result in 2**213 // basis, so the final right shift is always by a positive amount. r = int256((uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k)); } } function wadLn(int256 x) pure returns (int256 r) { unchecked { require(x > 0, "UNDEFINED"); // We want to convert x from 10**18 fixed point to 2**96 fixed point. // We do this by multiplying by 2**96 / 10**18. But since // ln(x * C) = ln(x) + ln(C), we can simply do nothing here // and add ln(2**96 / 10**18) at the end. /// @solidity memory-safe-assembly assembly { r := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) r := or(r, shl(6, lt(0xffffffffffffffff, shr(r, x)))) r := or(r, shl(5, lt(0xffffffff, shr(r, x)))) r := or(r, shl(4, lt(0xffff, shr(r, x)))) r := or(r, shl(3, lt(0xff, shr(r, x)))) r := or(r, shl(2, lt(0xf, shr(r, x)))) r := or(r, shl(1, lt(0x3, shr(r, x)))) r := or(r, lt(0x1, shr(r, x))) } // Reduce range of x to (1, 2) * 2**96 // ln(2^k * x) = k * ln(2) + ln(x) int256 k = r - 96; x <<= uint256(159 - k); x = int256(uint256(x) >> 159); // Evaluate using a (8, 8)-term rational approximation. // p is made monic, we will multiply by a scale factor later. int256 p = x + 3273285459638523848632254066296; p = ((p * x) >> 96) + 24828157081833163892658089445524; p = ((p * x) >> 96) + 43456485725739037958740375743393; p = ((p * x) >> 96) - 11111509109440967052023855526967; p = ((p * x) >> 96) - 45023709667254063763336534515857; p = ((p * x) >> 96) - 14706773417378608786704636184526; p = p * x - (795164235651350426258249787498 << 96); // We leave p in 2**192 basis so we don't need to scale it back up for the division. // q is monic by convention. int256 q = x + 5573035233440673466300451813936; q = ((q * x) >> 96) + 71694874799317883764090561454958; q = ((q * x) >> 96) + 283447036172924575727196451306956; q = ((q * x) >> 96) + 401686690394027663651624208769553; q = ((q * x) >> 96) + 204048457590392012362485061816622; q = ((q * x) >> 96) + 31853899698501571402653359427138; q = ((q * x) >> 96) + 909429971244387300277376558375; /// @solidity memory-safe-assembly assembly { // Div in assembly because solidity adds a zero check despite the unchecked. // The q polynomial is known not to have zeros in the domain. // No scaling required because p is already 2**96 too large. r := sdiv(p, q) } // r is in the range (0, 0.125) * 2**96 // Finalization, we need to: // * multiply by the scale factor s = 5.549… // * add ln(2**96 / 10**18) // * add k * ln(2) // * multiply by 10**18 / 2**96 = 5**18 >> 78 // mul s * 5e18 * 2**96, base is now 5**18 * 2**192 r *= 1677202110996718588342820967067443963516166; // add ln(2) * k * 5e18 * 2**192 r += 16597577552685614221487285958193947469193820559219878177908093499208371 * k; // add ln(2**96 / 10**18) * 5e18 * 2**192 r += 600920179829731861736702779321621459595472258049074101567377883020018308; // base conversion: mul 2**18 / 2**192 r >>= 174; } } /// @dev Will return 0 instead of reverting if y is zero. function unsafeDiv(int256 x, int256 y) pure returns (int256 r) { /// @solidity memory-safe-assembly assembly { // Divide x by y. r := sdiv(x, y) } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "./extensions/IERC20EntityBurnable.sol"; interface IERC20Resource is IERC20EntityBurnable { function mint(address to, uint256 amount) external; function mint(uint256 to, uint256 amount) external; function mintAndCall(address to, uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; struct ShipInfo { uint96 spins; uint96 spinsBurned; uint40 lastServiceTime; string name; } interface IMiaocraft is IERC721 { event Build( address indexed owner, uint256 indexed id, uint256 spins, string name ); event Upgrade(address indexed owner, uint256 indexed id, uint256 spins); event Merge( address indexed owner, uint256 indexed id1, uint256 indexed id2, uint256 spins ); event Scrap( address indexed scavengerOwner, uint256 indexed scavengerId, uint256 indexed targetId ); event Service( address indexed owner, uint256 indexed id, uint256 spins, uint256 cost ); event Rename(address indexed owner, uint256 indexed id, string name); function spinsOf(uint256 id) external view returns (uint256); function spinsDecayOf(uint256 id) external view returns (uint256); function buildCost(uint256 spins_) external view returns (uint256); function serviceCostOf(uint256 id) external view returns (uint256); function getShipInfo(uint256 id) external view returns (ShipInfo memory); function build(uint256 spins_, string calldata name_) external; function upgrade(uint256 id, uint256 spins_) external; function merge(uint256 id1, uint256 id2) external; function scrap(uint256 scavengerId, uint256 targetId) external; function service(uint256 id) external; function rename(uint256 id, string calldata name_) external; function isApprovedOrOwner(address spender, uint256 id) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; uint16 constant VRF_MIN_BLOCKS = 3; uint32 constant VRF_GAS_LIMIT = 300000; uint256 constant SPINS_PRECISION = 1e18; uint256 constant GENESIS_SUPPLY = 2000; uint256 constant ASTEROID_COORD_PRECISION = 1e3; int256 constant ASTEROID_COORD_NEG_FLAG = 1e3;
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/contracts/Interfaces/IERC1363.sol"; /// @title ERC20 with entity-based ownership and allowances. /// @author boffee /// @author Modified from openzeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol) interface IERC20Entity is IERC1363 { /** * @dev Emitted when `value` tokens are moved from one entity (`from`) to * another (`to`). * * Note that `value` may be zero. */ event EntityTransfer( uint256 indexed from, uint256 indexed to, uint256 value ); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event EntityApproval( uint256 indexed owner, uint256 indexed spender, uint256 value ); /** * @dev Returns the amount of tokens owned by `entity`. */ function balanceOf(uint256 entity) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's entity to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {EntityTransfer} event. */ function transfer(uint256 to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(uint256 owner, uint256 spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(uint256 spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {EntityTransfer} event. */ function transferFrom( uint256 from, uint256 to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "./IERC20Entity.sol"; interface IERC20EntityBurnable is IERC20Entity { function burn(uint256 amount) external; function burnFrom(uint256 entity, uint256 amount) external; function burnFrom(address account, uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; struct LocationInfo { int40 xOrigin; int40 yOrigin; int40 xDest; int40 yDest; uint40 speed; uint40 departureTime; bool locked; } interface ISpatialSystem { event UpdateLocation( uint256 indexed entityId, int256 xOrigin, int256 yOrigin, int256 xDest, int256 yDest, uint256 speed, uint256 departureTime ); event Move( uint256 indexed entityId, int256 xOrigin, int256 yOrigin, int256 xDest, int256 yDest, uint256 speed, uint256 departureTime ); event SetLocation( uint256 indexed entityId, int256 xOrigin, int256 yOrigin, int256 xDest, int256 yDest, uint256 speed, uint256 departureTime ); event SetCoordinate(uint256 indexed entityId, int256 x, int256 y); event Locked(uint256 indexed entityId); event Unlocked(uint256 indexed entityId); function coordinate(uint256 entityId) external view returns (int256 x, int256 y); function collocated(uint256 entityId1, uint256 entityId2) external view returns (bool); function collocated( uint256 entityId1, uint256 entityId2, uint256 radius ) external view returns (bool); function getLocationInfo(uint256 entityId) external view returns (LocationInfo memory); function locked(uint256 entityId) external view returns (bool); function updateLocation(uint256 entityId) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/contracts/utils/math/Math.sol"; import "../extensions/IERC20Entity.sol"; struct ExtractorInfo { uint128 shares; int128 rewardDebt; } struct MineInfo { uint128 rewardPerShare; uint64 lastRewardTimestamp; uint64 rewardPerSecond; uint128 totalShares; uint128 totalReward; } /// @title Mining System /// @author boffee /// @author Modified fro MasterChef V2 (https://github.com/sushiswap/sushiswap/blob/master/protocols/masterchef/contracts/MasterChefV2.sol) /// @notice This contract is used to manage mining. contract MiningSystem { event Dock( uint256 indexed extractorId, uint256 indexed mineId, uint256 shares ); event Undock( uint256 indexed extractorId, uint256 indexed mineId, uint256 shares ); event EmergencyUndock( uint256 indexed extractorId, uint256 indexed mineId, uint256 shares ); event Extract( uint256 indexed extractorId, uint256 indexed mineId, uint256 reward ); event AddMine( uint256 indexed mineId, address indexed rewardToken, uint256 rewardPerSecond, uint256 rewardPool ); event SetMine( uint256 indexed mineId, address indexed rewardToken, uint256 rewardPerSecond, uint256 rewardPool ); event UpdateMine( uint256 indexed mineId, uint64 lastRewardTimestamp, uint256 totalShares, uint256 rewardPerShare ); event DestroyMine(uint256 indexed mineId); uint256 public constant REWARD_PER_SHARE_PRECISION = 1e12; /// @notice Info of each mine. mapping(uint256 => MineInfo) private _mineInfos; /// @notice Info of each extractor at each mine. mapping(uint256 => mapping(uint256 => ExtractorInfo)) private _extractorInfos; /// @notice Mine reward token address. mapping(uint256 => IERC20Entity) public rewardTokens; function exists(uint256 mineId) public view returns (bool) { return address(rewardTokens[mineId]) != address(0); } /// @notice View function to see pending reward on frontend. /// @param extractorId Address of extractor. /// @param mineId id of the mine. See `_mineInfos`. /// @return pending reward for a given extractor. function pendingReward(uint256 extractorId, uint256 mineId) external view returns (uint256 pending) { MineInfo memory mineInfo = _mineInfos[mineId]; ExtractorInfo storage extractorInfo = _extractorInfos[mineId][ extractorId ]; uint256 rewardPerShare = mineInfo.rewardPerShare; if ( block.timestamp > mineInfo.lastRewardTimestamp && mineInfo.totalShares != 0 ) { uint256 duration = block.timestamp - mineInfo.lastRewardTimestamp; uint256 reward = Math.min( duration * mineInfo.rewardPerSecond, rewardTokens[mineId].balanceOf(mineId) - mineInfo.totalReward ); // total reward cannot excceed mine balance rewardPerShare += (reward * REWARD_PER_SHARE_PRECISION) / mineInfo.totalShares; } pending = uint256( int256( (extractorInfo.shares * rewardPerShare) / REWARD_PER_SHARE_PRECISION ) - extractorInfo.rewardDebt ); } /// @notice get mine info /// @param mineId id of the mine. See `_mineInfos`. /// @return mineInfo function getMineInfo(uint256 mineId) public view returns (MineInfo memory) { return _mineInfos[mineId]; } /// @notice get extractor info /// @param mineId id of the mine. See `_mineInfos`. /// @param extractorId id of the extractor. See `_extractorInfos`. /// @return extractorInfo function getExtractorInfo(uint256 mineId, uint256 extractorId) public view returns (ExtractorInfo memory) { return _extractorInfos[mineId][extractorId]; } /// @notice Update reward variables for all mines. /// @param mineIds Mine IDs of all to be updated. function massUpdateMines(uint256[] calldata mineIds) external { uint256 len = mineIds.length; for (uint256 i = 0; i < len; ++i) { updateMine(mineIds[i]); } } /// @notice Update reward variables of the given mine. /// @param mineId id of the mine. See `_mineInfos`. /// @return mineInfo Returns the mine that was updated. function updateMine(uint256 mineId) public returns (MineInfo memory mineInfo) { mineInfo = _mineInfos[mineId]; if (block.timestamp > mineInfo.lastRewardTimestamp) { if (mineInfo.totalShares > 0) { uint256 duration = block.timestamp - mineInfo.lastRewardTimestamp; uint256 reward = Math.min( duration * mineInfo.rewardPerSecond, rewardTokens[mineId].balanceOf(mineId) - mineInfo.totalReward ); mineInfo.totalReward += uint128(reward); // total reward cannot excceed mine balance mineInfo.rewardPerShare += uint128( (reward * REWARD_PER_SHARE_PRECISION) / mineInfo.totalShares ); } mineInfo.lastRewardTimestamp = uint64(block.timestamp); _mineInfos[mineId] = mineInfo; emit UpdateMine( mineId, mineInfo.lastRewardTimestamp, mineInfo.totalShares, mineInfo.rewardPerShare ); } } /// @notice Dock extractor to mine for BUTTER allocation. /// @param extractorId The receiver of `shares` dock benefit. /// @param mineId id of the mine. See `_mineInfos`. /// @param shares The amount of shares to be docked. function _dock( uint256 extractorId, uint256 mineId, uint256 shares ) internal { MineInfo memory mineInfo = updateMine(mineId); require( (mineInfo.totalShares * uint256(mineInfo.rewardPerShare)) / REWARD_PER_SHARE_PRECISION < rewardTokens[mineId].balanceOf(mineId), "Mine depleted" ); ExtractorInfo storage extractorInfo = _extractorInfos[mineId][ extractorId ]; // Effects extractorInfo.shares += uint128(shares); extractorInfo.rewardDebt += int128( uint128( (shares * mineInfo.rewardPerShare) / REWARD_PER_SHARE_PRECISION ) ); _mineInfos[mineId].totalShares += uint128(shares); emit Dock(extractorId, mineId, shares); } /// @notice Undock extractor from mine. /// @param extractorId Receiver of the reward. /// @param mineId id of the mine. See `_mineInfos`. /// @param shares Extractor shares to undock. function _undock( uint256 extractorId, uint256 mineId, uint256 shares ) internal { MineInfo memory mineInfo = updateMine(mineId); ExtractorInfo storage extractorInfo = _extractorInfos[mineId][ extractorId ]; // Effects extractorInfo.rewardDebt -= int128( uint128( (shares * mineInfo.rewardPerShare) / REWARD_PER_SHARE_PRECISION ) ); extractorInfo.shares -= uint128(shares); _mineInfos[mineId].totalShares -= uint128(shares); _tryDestroy(mineId); emit Undock(extractorId, mineId, shares); } /// @notice Extract proceeds for extractor. /// @param extractorId Receiver of rewards. /// @param mineId id of the mine. See `_mineInfos`. function _extract(uint256 extractorId, uint256 mineId) internal { MineInfo memory mineInfo = updateMine(mineId); ExtractorInfo storage extractorInfo = _extractorInfos[mineId][ extractorId ]; int256 accumulatedReward = int256( (extractorInfo.shares * uint256(mineInfo.rewardPerShare)) / REWARD_PER_SHARE_PRECISION ); uint256 _pendingReward = uint256( accumulatedReward - extractorInfo.rewardDebt ); // Effects extractorInfo.rewardDebt = int128(accumulatedReward); _mineInfos[mineId].totalReward -= uint128(_pendingReward); rewardTokens[mineId].transferFrom(mineId, extractorId, _pendingReward); _tryDestroy(mineId); emit Extract(extractorId, mineId, _pendingReward); } /// @notice Undock extractor from mine and extract proceeds. /// @param extractorId Receiver of the rewards. /// @param mineId id of the mine. See `_mineInfos`. /// @param shares Extractor shares to undock. function _undockAndExtract( uint256 extractorId, uint256 mineId, uint256 shares ) internal { MineInfo memory mineInfo = updateMine(mineId); ExtractorInfo storage extractorInfo = _extractorInfos[mineId][ extractorId ]; int256 accumulatedReward = int256( (extractorInfo.shares * uint256(mineInfo.rewardPerShare)) / REWARD_PER_SHARE_PRECISION ); uint256 _pendingReward = uint256( accumulatedReward - extractorInfo.rewardDebt ); // Effects extractorInfo.rewardDebt = int128( accumulatedReward - int256( (shares * mineInfo.rewardPerShare) / REWARD_PER_SHARE_PRECISION ) ); extractorInfo.shares -= uint128(shares); _mineInfos[mineId].totalShares -= uint128(shares); _mineInfos[mineId].totalReward -= uint128(_pendingReward); rewardTokens[mineId].transferFrom(mineId, extractorId, _pendingReward); _tryDestroy(mineId); emit Undock(extractorId, mineId, shares); emit Extract(extractorId, mineId, _pendingReward); } /// @notice Undock without caring about rewards. EMERGENCY ONLY. /// @param extractorId Receiver of the reward. /// @param mineId id of the mine. See `_mineInfos`. function _emergencyUndock(uint256 extractorId, uint256 mineId) internal { ExtractorInfo storage extractorInfo = _extractorInfos[mineId][ extractorId ]; uint256 shares = extractorInfo.shares; if (_mineInfos[mineId].totalShares >= shares) { _mineInfos[mineId].totalShares -= uint128(shares); } delete _extractorInfos[mineId][extractorId]; emit EmergencyUndock(extractorId, mineId, shares); } /// @notice Add a new mine. /// @param mineId The id of the mine. /// @param rewardToken The address of the reward token. /// @param rewardPerSecond reward rate of the new mine. function _add( uint256 mineId, address rewardToken, uint256 rewardPerSecond ) internal { require( _mineInfos[mineId].lastRewardTimestamp == 0, "Mine already exists" ); _mineInfos[mineId] = MineInfo({ rewardPerSecond: uint64(rewardPerSecond), lastRewardTimestamp: uint64(block.timestamp), rewardPerShare: 0, totalShares: 0, totalReward: 0 }); rewardTokens[mineId] = IERC20Entity(rewardToken); emit AddMine( mineId, rewardToken, rewardPerSecond, IERC20Entity(rewardToken).balanceOf(mineId) ); } /// @notice Update the given mine's reward rate. /// @param mineId The entity id of the mine. /// @param rewardPerSecond New reward rate of the mine. function _set(uint256 mineId, uint256 rewardPerSecond) internal { _mineInfos[mineId].rewardPerSecond = uint64(rewardPerSecond); IERC20Entity rewardToken = rewardTokens[mineId]; emit SetMine( mineId, address(rewardToken), rewardPerSecond, rewardToken.balanceOf(mineId) ); } /// @notice Destroy the given mine if its depleted and has no shares. /// @param mineId The entity id of the mine. function _tryDestroy(uint256 mineId) internal { if ( rewardTokens[mineId].balanceOf(mineId) < 1e15 && _mineInfos[mineId].totalShares < 1e15 ) { _destroy(mineId); } } /// @notice Destroy the given mine. /// @param mineId The entity id of the mine. function _destroy(uint256 mineId) internal { delete _mineInfos[mineId]; delete rewardTokens[mineId]; emit DestroyMine(mineId); } function _destroyExtractor(uint256 mineId, uint256 extractorId) internal { ExtractorInfo memory extractorInfo = _extractorInfos[mineId][ extractorId ]; _mineInfos[mineId].totalShares -= uint128(extractorInfo.shares); _mineInfos[mineId].totalReward -= uint128( uint256( int256( (extractorInfo.shares * uint256(_mineInfos[mineId].rewardPerShare)) / REWARD_PER_SHARE_PRECISION ) - extractorInfo.rewardDebt ) ); delete _extractorInfos[mineId][extractorId]; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "../utils/VectorWadMath.sol"; import "../utils/EntityUtils.sol"; import "./ISpatialSystem.sol"; contract SpatialSystem is ISpatialSystem { mapping(uint256 => LocationInfo) private _locationInfos; function coordinate(uint256 entityId) public view virtual override returns (int256 x, int256 y) { return _coordinate(entityId); } function coordinate(address token, uint256 id) public view virtual returns (int256 x, int256 y) { return _coordinate(tokenToEntity(token, id)); } function locked(uint256 entityId) public view virtual override returns (bool) { return _locationInfos[entityId].locked; } function collocated(uint256 entityId1, uint256 entityId2) public view virtual override returns (bool) { (int256 x1, int256 y1) = _coordinate(entityId1); (int256 x2, int256 y2) = _coordinate(entityId2); return x1 == x2 && y1 == y2; } function collocated( uint256 entityId1, uint256 entityId2, uint256 radius ) public view virtual override returns (bool) { (int256 x1, int256 y1) = _coordinate(entityId1); (int256 x2, int256 y2) = _coordinate(entityId2); return VectorWadMath.distance(x1 * 1e18, y1 * 1e18, x2 * 1e18, y2 * 1e18) <= radius * 1e18; } function getLocationInfo(uint256 entityId) public view virtual override returns (LocationInfo memory) { return _locationInfos[entityId]; } function _coordinate(uint256 entityId) internal view virtual returns (int256 x, int256 y) { LocationInfo memory info = _locationInfos[entityId]; // ship is only not moving if it's at its destination if (info.speed == 0) { return (info.xOrigin, info.yOrigin); } uint256 distance = VectorWadMath.distance( info.xOrigin, info.yOrigin, info.xDest, info.yDest ); uint256 distanceTraveled = (block.timestamp - info.departureTime) * info.speed; // reached destination already if (distanceTraveled >= distance) { return (info.xDest, info.yDest); } (x, y) = VectorWadMath.scaleVector( info.xOrigin, info.yOrigin, info.xDest, info.yDest, int256((distanceTraveled * 1e18) / distance) ); } function updateLocation(uint256 entityId) public virtual override { _updateLocation(entityId); } function updateLocation(address token, uint256 id) public virtual { _updateLocation(tokenToEntity(token, id)); } function _move( uint256 entityId, int256 xDest, int256 yDest, uint256 speed ) internal virtual { require(!_locationInfos[entityId].locked, "Locked"); (int256 x, int256 y) = _coordinate(entityId); _locationInfos[entityId] = LocationInfo({ // update origin to current coordinate xOrigin: int40(x), yOrigin: int40(y), // set destination xDest: int40(xDest), yDest: int40(yDest), speed: uint40(speed), departureTime: uint40(block.timestamp), locked: false }); emit Move( entityId, x, y, xDest, yDest, speed, block.timestamp ); } function _updateLocation(uint256 entityId) internal virtual { (int256 x, int256 y) = _coordinate(entityId); LocationInfo memory info = _locationInfos[entityId]; // arrived, so set speed to 0 if ( x == info.xDest && y == info.yDest ) { info.speed = 0; } // update origin to current coordinate info.xOrigin = int40(x); info.yOrigin = int40(y); info.departureTime = uint40(block.timestamp); _locationInfos[entityId] = info; emit UpdateLocation( entityId, x, y, info.xDest, info.yDest, info.speed, block.timestamp ); } function _setLocation( uint256 entityId, LocationInfo memory info ) internal virtual { _locationInfos[entityId] = info; emit SetLocation( entityId, info.xOrigin, info.yOrigin, info.xDest, info.yDest, info.speed, info.departureTime ); } function _setCoordinate( uint256 entityId, int256 x, int256 y ) internal virtual { _locationInfos[entityId] = LocationInfo({ xOrigin: int40(x), yOrigin: int40(y), xDest: int40(x), yDest: int40(y), speed: 0, departureTime: uint40(block.timestamp), locked: false }); emit SetCoordinate(entityId, x, y); } function _lock( uint256 entityId ) internal virtual { require(_locationInfos[entityId].speed == 0, "Moving"); _locationInfos[entityId].locked = true; emit Locked(entityId); } function _unlock( uint256 entityId ) internal virtual { _locationInfos[entityId].locked = false; emit Unlocked(entityId); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; function tokenToEntity(address token, uint256 id) pure returns (uint256) { return (uint256(uint160(token)) << 96) | id; } function entityToToken(uint256 entity) pure returns (address token, uint256 id) { token = address(uint160(entity >> 96)); id = entity & 0xffffffffffffffffffffffff; } function accountToEntity(address account) pure returns (uint256) { return (uint256(uint160(account))); } function entityToAccount(uint256 entity) pure returns (address account) { account = address(uint160(entity)); } function entityIsAccount(uint256 entity) pure returns (bool) { return entity >> 160 == 0; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/contracts/utils/math/Math.sol"; import "solmate/utils/SignedWadMath.sol"; function wadSigmoid(int256 x) pure returns (uint256) { return uint256(unsafeWadDiv(1e18, 1e18 + wadExp(-x))); } function random(uint256 seed, uint256 max) pure returns (uint256) { return uint256(keccak256(abi.encodePacked(seed))) % max; } function sampleCircle(uint256 seed, uint256 radius) pure returns (int256 x, int256 y) { unchecked { seed = uint256(keccak256(abi.encodePacked(seed))); int256 r = int256(random(seed++, radius)) + 1; int256 xUnit = int256(random(seed++, 2e18)) - 1e18; int256 yUnit = int256(Math.sqrt(1e36 - uint256(xUnit * xUnit))); x = int256((xUnit * r) / 1e18); y = int256((yUnit * r) / 1e18); if (random(seed, 2) == 0) { y = -y; } } } function sampleInvSqrt(uint256 seed, uint256 e) pure returns (uint256) { return wadInvSqrt(random(seed, 1e18), e) / 2; } function wadInvSqrt(uint256 x, uint256 e) pure returns (uint256) { return Math.sqrt(1e54 / (e + x)); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; import "@openzeppelin/contracts/utils/math/SignedMath.sol"; import "@openzeppelin/contracts/utils/math/Math.sol"; library VectorWadMath { using Math for uint256; using SignedMath for int256; int256 constant PRECISION = 1e18; int256 constant PRECISION_UINT = 1e18; function distance( int256 x1, int256 y1, int256 x2, int256 y2 ) internal pure returns (uint256) { return ((x2 - x1).abs()**2 + (y2 - y1).abs()**2).sqrt(); } function unitVector( int256 x1, int256 y1, int256 x2, int256 y2 ) internal pure returns (int256, int256) { int256 dist = int256(distance(x1, y1, x2, y2)); return (((x2 - x1) * PRECISION) / dist, ((y2 - y1) * PRECISION) / dist); } function scaleVector( int256 x1, int256 y1, int256 x2, int256 y2, int256 scale ) internal pure returns (int256, int256) { return ( x1 + ((x2 - x1) * scale) / PRECISION, y1 + ((y2 - y1) * scale) / PRECISION ); } }
{ "remappings": [ "@chainlink/=lib/chainlink/contracts/src/", "@openzeppelin/=lib/openzeppelin-contracts/", "chainlink/=lib/chainlink/integration-tests/contracts/ethereum/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/", "miaocraft/=src/", "solmate/=lib/solmate/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint256","name":"asteroidsPerEmission","type":"uint256"},{"internalType":"uint256","name":"maxDepletionInterval","type":"uint256"},{"internalType":"uint256","name":"maxRadius","type":"uint256"},{"internalType":"uint256","name":"speed","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"mineId","type":"uint256"},{"indexed":true,"internalType":"address","name":"rewardToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardPerSecond","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardPool","type":"uint256"}],"name":"AddMine","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"mineId","type":"uint256"}],"name":"DestroyMine","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"extractorId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"mineId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Dock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"extractorId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"mineId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"EmergencyUndock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"extractorId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"mineId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"Extract","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"entityId","type":"uint256"}],"name":"Locked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"entityId","type":"uint256"},{"indexed":false,"internalType":"int256","name":"xOrigin","type":"int256"},{"indexed":false,"internalType":"int256","name":"yOrigin","type":"int256"},{"indexed":false,"internalType":"int256","name":"xDest","type":"int256"},{"indexed":false,"internalType":"int256","name":"yDest","type":"int256"},{"indexed":false,"internalType":"uint256","name":"speed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"departureTime","type":"uint256"}],"name":"Move","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":"entityId","type":"uint256"},{"indexed":false,"internalType":"int256","name":"x","type":"int256"},{"indexed":false,"internalType":"int256","name":"y","type":"int256"}],"name":"SetCoordinate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"entityId","type":"uint256"},{"indexed":false,"internalType":"int256","name":"xOrigin","type":"int256"},{"indexed":false,"internalType":"int256","name":"yOrigin","type":"int256"},{"indexed":false,"internalType":"int256","name":"xDest","type":"int256"},{"indexed":false,"internalType":"int256","name":"yDest","type":"int256"},{"indexed":false,"internalType":"uint256","name":"speed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"departureTime","type":"uint256"}],"name":"SetLocation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"mineId","type":"uint256"},{"indexed":true,"internalType":"address","name":"rewardToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardPerSecond","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardPool","type":"uint256"}],"name":"SetMine","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"extractorId","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"mineId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"}],"name":"Undock","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"entityId","type":"uint256"}],"name":"Unlocked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"entityId","type":"uint256"},{"indexed":false,"internalType":"int256","name":"xOrigin","type":"int256"},{"indexed":false,"internalType":"int256","name":"yOrigin","type":"int256"},{"indexed":false,"internalType":"int256","name":"xDest","type":"int256"},{"indexed":false,"internalType":"int256","name":"yDest","type":"int256"},{"indexed":false,"internalType":"uint256","name":"speed","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"departureTime","type":"uint256"}],"name":"UpdateLocation","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"mineId","type":"uint256"},{"indexed":false,"internalType":"uint64","name":"lastRewardTimestamp","type":"uint64"},{"indexed":false,"internalType":"uint256","name":"totalShares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardPerShare","type":"uint256"}],"name":"UpdateMine","type":"event"},{"inputs":[],"name":"ASTEROIDS_PER_EMISSION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_DEPLETION_INTERVAL","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_RADIUS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"REWARD_PER_SHARE_PRECISION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SPEED","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"_emissionInfos","outputs":[{"internalType":"uint128","name":"seed","type":"uint128"},{"internalType":"uint128","name":"amount","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"seed","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"addEmission","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"asteroidId","type":"uint256"}],"name":"asteroidIdToCoordinate","outputs":[{"internalType":"int256","name":"x","type":"int256"},{"internalType":"int256","name":"y","type":"int256"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"butter","outputs":[{"internalType":"contract IERC20Resource","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"entityId1","type":"uint256"},{"internalType":"uint256","name":"entityId2","type":"uint256"},{"internalType":"uint256","name":"radius","type":"uint256"}],"name":"collocated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"entityId1","type":"uint256"},{"internalType":"uint256","name":"entityId2","type":"uint256"}],"name":"collocated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"entityId","type":"uint256"}],"name":"coordinate","outputs":[{"internalType":"int256","name":"x","type":"int256"},{"internalType":"int256","name":"y","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"coordinate","outputs":[{"internalType":"int256","name":"x","type":"int256"},{"internalType":"int256","name":"y","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int256","name":"x","type":"int256"},{"internalType":"int256","name":"y","type":"int256"}],"name":"coordinateToAsteroidId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"shipId","type":"uint256"},{"internalType":"uint256","name":"asteroidId","type":"uint256"}],"name":"dock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shipId","type":"uint256"},{"internalType":"uint256","name":"asteroidId","type":"uint256"}],"name":"emergencyUndock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mineId","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shipId","type":"uint256"},{"internalType":"uint256","name":"asteroidId","type":"uint256"}],"name":"extract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"emissionId","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getAsteroid","outputs":[{"components":[{"internalType":"address","name":"resource","type":"address"},{"internalType":"uint256","name":"initialSupply","type":"uint256"},{"internalType":"uint256","name":"rewardPerSecond","type":"uint256"},{"internalType":"int256","name":"x","type":"int256"},{"internalType":"int256","name":"y","type":"int256"}],"internalType":"struct AsteroidInfo","name":"asteroidInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"emissionId","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getAsteroidExtended","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint128","name":"emissionId","type":"uint128"},{"internalType":"uint32","name":"index","type":"uint32"},{"internalType":"bool","name":"identified","type":"bool"},{"components":[{"internalType":"address","name":"resource","type":"address"},{"internalType":"uint256","name":"initialSupply","type":"uint256"},{"internalType":"uint256","name":"rewardPerSecond","type":"uint256"},{"internalType":"int256","name":"x","type":"int256"},{"internalType":"int256","name":"y","type":"int256"}],"internalType":"struct AsteroidInfo","name":"asteroidInfo","type":"tuple"},{"components":[{"internalType":"uint128","name":"rewardPerShare","type":"uint128"},{"internalType":"uint64","name":"lastRewardTimestamp","type":"uint64"},{"internalType":"uint64","name":"rewardPerSecond","type":"uint64"},{"internalType":"uint128","name":"totalShares","type":"uint128"},{"internalType":"uint128","name":"totalReward","type":"uint128"}],"internalType":"struct MineInfo","name":"mineInfo","type":"tuple"}],"internalType":"struct AsteroidInfoExtended","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"emissionId","type":"uint256"}],"name":"getAsteroids","outputs":[{"components":[{"internalType":"address","name":"resource","type":"address"},{"internalType":"uint256","name":"initialSupply","type":"uint256"},{"internalType":"uint256","name":"rewardPerSecond","type":"uint256"},{"internalType":"int256","name":"x","type":"int256"},{"internalType":"int256","name":"y","type":"int256"}],"internalType":"struct AsteroidInfo[]","name":"asteroidInfos","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"emissionId","type":"uint256"}],"name":"getEmission","outputs":[{"components":[{"internalType":"uint128","name":"seed","type":"uint128"},{"internalType":"uint128","name":"amount","type":"uint128"}],"internalType":"struct EmissionInfo","name":"emissionInfo","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getEmissionCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"mineId","type":"uint256"},{"internalType":"uint256","name":"extractorId","type":"uint256"}],"name":"getExtractorInfo","outputs":[{"components":[{"internalType":"uint128","name":"shares","type":"uint128"},{"internalType":"int128","name":"rewardDebt","type":"int128"}],"internalType":"struct ExtractorInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"entityId","type":"uint256"}],"name":"getLocationInfo","outputs":[{"components":[{"internalType":"int40","name":"xOrigin","type":"int40"},{"internalType":"int40","name":"yOrigin","type":"int40"},{"internalType":"int40","name":"xDest","type":"int40"},{"internalType":"int40","name":"yDest","type":"int40"},{"internalType":"uint40","name":"speed","type":"uint40"},{"internalType":"uint40","name":"departureTime","type":"uint40"},{"internalType":"bool","name":"locked","type":"bool"}],"internalType":"struct LocationInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"mineId","type":"uint256"}],"name":"getMineInfo","outputs":[{"components":[{"internalType":"uint128","name":"rewardPerShare","type":"uint128"},{"internalType":"uint64","name":"lastRewardTimestamp","type":"uint64"},{"internalType":"uint64","name":"rewardPerSecond","type":"uint64"},{"internalType":"uint128","name":"totalShares","type":"uint128"},{"internalType":"uint128","name":"totalReward","type":"uint128"}],"internalType":"struct MineInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOrigin","outputs":[{"components":[{"internalType":"address","name":"resource","type":"address"},{"internalType":"uint256","name":"initialSupply","type":"uint256"},{"internalType":"uint256","name":"rewardPerSecond","type":"uint256"},{"internalType":"int256","name":"x","type":"int256"},{"internalType":"int256","name":"y","type":"int256"}],"internalType":"struct AsteroidInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getOriginExtended","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint128","name":"emissionId","type":"uint128"},{"internalType":"uint32","name":"index","type":"uint32"},{"internalType":"bool","name":"identified","type":"bool"},{"components":[{"internalType":"address","name":"resource","type":"address"},{"internalType":"uint256","name":"initialSupply","type":"uint256"},{"internalType":"uint256","name":"rewardPerSecond","type":"uint256"},{"internalType":"int256","name":"x","type":"int256"},{"internalType":"int256","name":"y","type":"int256"}],"internalType":"struct AsteroidInfo","name":"asteroidInfo","type":"tuple"},{"components":[{"internalType":"uint128","name":"rewardPerShare","type":"uint128"},{"internalType":"uint64","name":"lastRewardTimestamp","type":"uint64"},{"internalType":"uint64","name":"rewardPerSecond","type":"uint64"},{"internalType":"uint128","name":"totalShares","type":"uint128"},{"internalType":"uint128","name":"totalReward","type":"uint128"}],"internalType":"struct MineInfo","name":"mineInfo","type":"tuple"}],"internalType":"struct AsteroidInfoExtended","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"emissionId","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"identified","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"identifiedBitmaps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"emissionId","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"identify","outputs":[{"internalType":"uint256","name":"asteroidId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"emissionId","type":"uint256"}],"name":"identifyAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"emissionId","type":"uint256"},{"internalType":"uint256","name":"index","type":"uint256"},{"internalType":"uint256","name":"shipId","type":"uint256"}],"name":"identifyAndDock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"emissionId","type":"uint256"},{"internalType":"uint256[]","name":"indices","type":"uint256[]"}],"name":"identifyMultiple","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"butter_","type":"address"},{"internalType":"address","name":"miaocraft_","type":"address"},{"internalType":"address","name":"sbh_","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"entityId","type":"uint256"}],"name":"locked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"mineIds","type":"uint256[]"}],"name":"massUpdateMines","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"miaocraft","outputs":[{"internalType":"contract IMiaocraft","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shipId","type":"uint256"},{"internalType":"uint256","name":"asteroidId","type":"uint256"}],"name":"move","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shipId","type":"uint256"},{"internalType":"int256","name":"xDest","type":"int256"},{"internalType":"int256","name":"yDest","type":"int256"}],"name":"move","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offset","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"paginateAsteroids","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"uint128","name":"emissionId","type":"uint128"},{"internalType":"uint32","name":"index","type":"uint32"},{"internalType":"bool","name":"identified","type":"bool"},{"components":[{"internalType":"address","name":"resource","type":"address"},{"internalType":"uint256","name":"initialSupply","type":"uint256"},{"internalType":"uint256","name":"rewardPerSecond","type":"uint256"},{"internalType":"int256","name":"x","type":"int256"},{"internalType":"int256","name":"y","type":"int256"}],"internalType":"struct AsteroidInfo","name":"asteroidInfo","type":"tuple"},{"components":[{"internalType":"uint128","name":"rewardPerShare","type":"uint128"},{"internalType":"uint64","name":"lastRewardTimestamp","type":"uint64"},{"internalType":"uint64","name":"rewardPerSecond","type":"uint64"},{"internalType":"uint128","name":"totalShares","type":"uint128"},{"internalType":"uint128","name":"totalReward","type":"uint128"}],"internalType":"struct MineInfo","name":"mineInfo","type":"tuple"}],"internalType":"struct AsteroidInfoExtended[]","name":"asteroidInfos","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"offset","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"}],"name":"paginateEmissions","outputs":[{"components":[{"internalType":"uint128","name":"seed","type":"uint128"},{"internalType":"uint128","name":"amount","type":"uint128"}],"internalType":"struct EmissionInfo[]","name":"emissionInfos_","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"extractorId","type":"uint256"},{"internalType":"uint256","name":"mineId","type":"uint256"}],"name":"pendingReward","outputs":[{"internalType":"uint256","name":"pending","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shipId","type":"uint256"},{"internalType":"uint256","name":"asteroidId","type":"uint256"}],"name":"redock","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shipId","type":"uint256"},{"internalType":"uint256","name":"asteroidId","type":"uint256"}],"name":"remove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardTokens","outputs":[{"internalType":"contract IERC20Entity","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sbh","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Resource","name":"butter_","type":"address"}],"name":"setButter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IMiaocraft","name":"miaocraft_","type":"address"}],"name":"setMiaocraft","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"sbh_","type":"address"}],"name":"setSbh","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shipId","type":"uint256"},{"internalType":"uint256","name":"asteroidId","type":"uint256"}],"name":"undockAndExtract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shipId","type":"uint256"},{"internalType":"uint256","name":"fromAsteroidId","type":"uint256"},{"internalType":"uint256","name":"toAsteroidId","type":"uint256"}],"name":"undockExtractAndMove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"shipId","type":"uint256"},{"internalType":"uint256","name":"asteroidId","type":"uint256"},{"internalType":"int256","name":"xDest","type":"int256"},{"internalType":"int256","name":"yDest","type":"int256"}],"name":"undockExtractAndMove","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"entityId","type":"uint256"}],"name":"updateLocation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"updateLocation","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"mineId","type":"uint256"}],"name":"updateMine","outputs":[{"components":[{"internalType":"uint128","name":"rewardPerShare","type":"uint128"},{"internalType":"uint64","name":"lastRewardTimestamp","type":"uint64"},{"internalType":"uint64","name":"rewardPerSecond","type":"uint64"},{"internalType":"uint128","name":"totalShares","type":"uint128"},{"internalType":"uint128","name":"totalReward","type":"uint128"}],"internalType":"struct MineInfo","name":"mineInfo","type":"tuple"}],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6101006040523480156200001257600080fd5b50604051620056e6380380620056e68339810160408190526200003591620000b4565b620000403362000058565b60809390935260a09190915260c05260e052620000eb565b600480546001600160a01b038381166201000081810262010000600160b01b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60008060008060808587031215620000cb57600080fd5b505082516020840151604085015160609095015191969095509092509050565b60805160a05160c05160e051615520620001c660003960008181610719015281816119690152612c500152600081816105b10152611774015260008181610526015281816116f501526125bf0152600081816108580152818161117c0152818161165e015281816119bf01528181611a9301528181611af001528181611b4d01528181611baa01528181611c0701528181611c6401528181611cc101528181611d1e01528181611d7b01528181611dd801528181611e3501528181611fa2015281816121eb0152818161278601526127fd01526155206000f3fe608060405234801561001057600080fd5b50600436106103a45760003560e01c80637ad345c7116101e9578063b91ef87f1161010f578063e24f8b27116100ad578063f2fde38b1161007c578063f2fde38b146109c0578063f3f9082f146109d3578063f546326414610b13578063f65c26ac14610b2657600080fd5b8063e24f8b271461095a578063e3df11301461097a578063e7eaf27b1461098d578063e7ef34fc146109ad57600080fd5b8063d88423c0116100e9578063d88423c0146108f9578063dbc2d0c41461090c578063df1f29ee1461091f578063e22000521461092757600080fd5b8063b91ef87f146108c0578063c0c53b8b146108d3578063d419c9ee146108e657600080fd5b806392071d7a11610187578063ac70438411610156578063ac70438414610853578063ac9650d81461087a578063b45a3c0e1461089a578063b64e80b6146108ad57600080fd5b806392071d7a146107e75780639cef7a2b146107fa5780639e8907df1461080d578063ab27b4e71461084757600080fd5b80638139e0f6116101c35780638139e0f6146107975780638263d56e146107aa5780638cb4d01c146107bd5780638da5cb5b146107d057600080fd5b80637ad345c71461073b5780637b1d39e61461075b5780637bb7bed11461076e57600080fd5b80633d5b0465116102ce578063648414a51161026c5780636b8326441161023b5780636b832644146106e65780636e6ef6cf146106f9578063715018a61461070c57806372c6e9051461071457600080fd5b8063648414a5146106985780636526db7a146106ab578063694e7162146106be5780636a63c1f5146106c657600080fd5b80634f558e79116102a85780634f558e7914610634578063594a8aee1461065f578063596b9a5d146106725780635dd70ad91461068557600080fd5b80633d5b0465146105f957806342fca82e1461060e57806347baf0e91461062157600080fd5b80631d37b241116103465780632746547a116103155780632746547a146105815780632c2d5381146105ac5780633185c0bd146105d35780633c36ccae146105e657600080fd5b80631d37b2411461052157806323df57fe146105485780632620b11e1461055b5780632733b1e81461056e57600080fd5b806307a966021161038257806307a966021461041f5780630867408f146104475780631147ff0b1461045c578063114840cf1461050e57600080fd5b8063019c68d8146103a957806301e2f65f146103d157806303e7b4e9146103ff575b600080fd5b6103bc6103b7366004614a8d565b610b39565b60405190151581526020015b60405180910390f35b6103f16103df366004614aaf565b60096020526000908152604090205481565b6040519081526020016103c8565b61041261040d366004614aaf565b610b59565b6040516103c89190614ac8565b61043261042d366004614aaf565b610bbb565b604080519283526020830191909152016103c8565b61045a610455366004614a8d565b610c74565b005b61050161046a366004614aaf565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915250600090815260016020818152604092839020835160a08101855281546001600160801b0380821683526001600160401b03600160801b808404821696850196909652600160c01b90920490911695820195909552920154808416606084015204909116608082015290565b6040516103c89190614b3a565b61045a61051c366004614a8d565b610c99565b6103f17f000000000000000000000000000000000000000000000000000000000000000081565b61045a610556366004614a8d565b610d92565b6103bc610569366004614b48565b610e8e565b61043261057c366004614aaf565b610f21565b600654610594906001600160a01b031681565b6040516001600160a01b0390911681526020016103c8565b6103f17f000000000000000000000000000000000000000000000000000000000000000081565b6103f16105e1366004614a8d565b610f36565b6104326105f4366004614b89565b61112f565b610601611150565b6040516103c89190614c44565b61045a61061c366004614c53565b6111d1565b61045a61062f366004614aaf565b6111fb565b6103bc610642366004614aaf565b6000908152600360205260409020546001600160a01b0316151590565b61045a61066d366004614a8d565b611207565b61045a610680366004614b48565b6113d0565b610601610693366004614a8d565b6113f0565b6103bc6106a6366004614a8d565b611414565b61045a6106b9366004614a8d565b61144f565b6008546103f1565b6106d96106d4366004614a8d565b6115d9565b6040516103c89190614c70565b61045a6106f4366004614a8d565b6117f6565b61045a610707366004614b48565b6118bc565b61045a61198d565b6103f17f000000000000000000000000000000000000000000000000000000000000000081565b61074e610749366004614a8d565b6119a1565b6040516103c89190614c7e565b61045a610769366004614d0f565b611e9d565b61059461077c366004614aaf565b6003602052600090815260409020546001600160a01b031681565b61045a6107a5366004614a8d565b611edf565b6103f16107b8366004614a8d565b611f08565b61045a6107cb366004614aaf565b611f8f565b6004546201000090046001600160a01b0316610594565b600754610594906001600160a01b031681565b61045a610808366004614e05565b611ff0565b61082061081b366004614a8d565b61202e565b6040805182516001600160801b03168152602092830151600f0b92810192909252016103c8565b6103f164e8d4a5100081565b6103f17f000000000000000000000000000000000000000000000000000000000000000081565b61088d610888366004614e05565b61207e565b6040516103c89190614e96565b6103bc6108a8366004614aaf565b612172565b61045a6108bb366004614b89565b61218e565b6103f16108ce366004614a8d565b6121a0565b61045a6108e1366004614ef8565b6122bd565b600554610594906001600160a01b031681565b61045a610907366004614a8d565b61241a565b61045a61091a366004614b48565b6124c9565b6106d9612501565b61093a610935366004614aaf565b6125fb565b604080516001600160801b039384168152929091166020830152016103c8565b61096d610968366004614a8d565b612630565b6040516103c89190614f43565b61045a610988366004614c53565b612758565b6109a061099b366004614aaf565b612782565b6040516103c89190614fa6565b61045a6109bb366004614c53565b612863565b61045a6109ce366004614c53565b61288d565b610aa26109e1366004614aaf565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c08101919091525060009081526020818152604091829020825160e0810184529054600481810b8352600160281b8204810b93830193909352600160501b8104830b93820193909352600160781b830490910b6060820152600160a01b820464ffffffffff9081166080830152600160c81b83041660a0820152600160f01b90910460ff16151560c082015290565b6040516103c89190600060e082019050825160040b8252602083015160040b6020830152604083015160040b6040830152606083015160040b6060830152608083015164ffffffffff80821660808501528060a08601511660a0850152505060c0830151151560c083015292915050565b610501610b21366004614aaf565b612903565b61045a610b34366004614fe8565b612b6e565b6000828152600960205260408120546001831b1615155b90505b92915050565b604080518082019091526000808252602082015260088281548110610b8057610b8061501a565b6000918252602091829020604080518082019091529101546001600160801b038082168352600160801b909104169181019190915292915050565b600080600a610bcc6103e88561505c565b610bd6919061505c565b9150610be46103e88361508a565b610bef90600a61508a565b610bf990846150ba565b90506103e8610c08818461505c565b15610c2757610c196103e8846150ba565b610c22906150da565b610c29565b825b610c33919061508a565b91506103e8610c42818361505c565b15610c6157610c536103e8836150ba565b610c5c906150da565b610c63565b815b610c6d919061508a565b9050915091565b600080610c8461057c3085612c7d565b91509150610c938483836118bc565b50505050565b60065460405163430c208160e01b81523360048201526024810184905283916001600160a01b03169063430c208190604401602060405180830381865afa158015610ce8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0c91906150f6565b610d315760405162461bcd60e51b8152600401610d2890615118565b60405180910390fd5b600654600090610d4a906001600160a01b031685612c7d565b90506000610d583085612c7d565b9050610d648282612c96565b610d828282610d73848661202e565b516001600160801b0316612d20565b610d8b82612fc8565b5050505050565b600654600090610dab906001600160a01b031684612c7d565b90506000610db93084612c7d565b9050610dc58282612c96565b6000610dd1828461202e565b51600654604051631404cb3b60e11b8152600481018890526001600160801b0390921692506000916001600160a01b0390911690632809967690602401602060405180830381865afa158015610e2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4f9190615148565b905080821115610e7257610e6d8484610e688486615161565b61300b565b610e86565b610e868484610e818585615161565b61315e565b505050505050565b6000806000610e9c86613391565b91509150600080610eac87613391565b9092509050610ec386670de0b6b3a7640000615174565b610f13610ed886670de0b6b3a764000061508a565b610eea86670de0b6b3a764000061508a565b610efc86670de0b6b3a764000061508a565b610f0e86670de0b6b3a764000061508a565b61350c565b111598975050505050505050565b600080610f2d83613391565b91509150915091565b6000818152600160208181526040808420815160a08101835281546001600160801b038082168352600160801b8083046001600160401b03908116858901908152600160c01b90940481168588015294909701548082166060850152969096048616608083015287875260028552838720898852909452918520825193519294909316911642118015610fd5575060608301516001600160801b031615155b156110e957600083602001516001600160401b031642610ff59190615161565b905060006110b085604001516001600160401b0316836110159190615174565b608087015160008a81526003602052604090819020549051631398fee160e31b8152600481018c90526001600160801b03909216916001600160a01b0390911690639cc7f708906024015b602060405180830381865afa15801561107d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a19190615148565b6110ab9190615161565b613562565b60608601519091506001600160801b03166110d064e8d4a5100083615174565b6110da919061518b565b6110e4908461519f565b925050505b8154600160801b8104600f0b9064e8d4a51000906111119084906001600160801b0316615174565b61111b919061518b565b61112591906150ba565b9695505050505050565b60008061114461113f8585612c7d565b613391565b915091505b9250929050565b6111586149e4565b6040518060c001604052806000815260200160006001600160801b031681526020017f000000000000000000000000000000000000000000000000000000000000000063ffffffff1681526020016001151581526020016111b7612501565b81526020016111ca61046a306000612c7d565b9052919050565b6111d9613578565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b611204816135d9565b50565b60065460405163430c208160e01b81523360048201526024810184905283916001600160a01b03169063430c208190604401602060405180830381865afa158015611256573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127a91906150f6565b6112965760405162461bcd60e51b8152600401610d2890615118565b6006546000906112af906001600160a01b031685612c7d565b905060006112bd3085612c7d565b90506112c882612172565b156113065760405162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e48191bd8dad95960921b6044820152606401610d28565b61130f826135d9565b6113198183611414565b6113545760405162461bcd60e51b815260206004820152600c60248201526b13dd5d081bd9881bdc989a5d60a21b6044820152606401610d28565b61135d82613887565b600654604051631404cb3b60e11b815260048101879052610d8b91849184916001600160a01b031690632809967690602401602060405180830381865afa1580156113ac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e819190615148565b6000806113e061057c3085612c7d565b91509150610d8b85858484612b6e565b6113f86149e4565b600083815260096020526040902054610b509084908490613923565b600080600061142285613391565b9150915060008061143286613391565b91509150818414801561144457508083145b979650505050505050565b6006546040516331a9108f60e11b8152600481018490526001600160a01b0390911690636352211e90602401602060405180830381865afa9250505080156114b4575060408051601f3d908101601f191682019092526114b1918101906151b2565b60015b61159e576114c06151cf565b806308c379a00361159257506114d46151eb565b806114df5750611594565b7fb08d2b0fec7cc108ab049809a8beb42779d969a49299d0c317c907d9db22974f816040516020016115119190615274565b60405160208183030381529060405280519060200120146115655760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b2103932b0b9b7b760911b6044820152606401610d28565b61158d6115723084612c7d565b600654611588906001600160a01b031686612c7d565b6139b0565b505050565b505b3d6000803e3d6000fd5b5060405162461bcd60e51b815260206004820152600b60248201526a536869702065786973747360a81b6044820152606401610d28565b5050565b6115e1614a55565b6000600884815481106115f6576115f661501a565b6000918252602091829020015460405161163f926001600160801b039092169186910160809290921b6fffffffffffffffffffffffffffffffff19168252601082015260300190565b6040516020818303038152906040528051906020012060001c905060007f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a7640000600887815481106116995761169961501a565b600091825260209091200154600160801b90046001600160801b03166116d1856116c281615290565b965066038d7ea4c68000613aed565b6116db9190615174565b6116e5919061518b565b6116ef919061518b565b905060007f0000000000000000000000000000000000000000000000000000000000000000670de0b6b3a76400008361173a8661172b81615290565b975066038d7ea4c68000613aed565b6117449190615174565b61174f906002615174565b611759919061518b565b611763919061518b565b905060008061179d856117986103e87f000000000000000000000000000000000000000000000000000000000000000061518b565b613b16565b6040805160a0810182526005546001600160a01b03168152602081018890529081018690529193509150606081016117d76103e88561508a565b81526020016117e86103e88461508a565b905298975050505050505050565b60065460405163430c208160e01b81523360048201526024810184905283916001600160a01b03169063430c208190604401602060405180830381865afa158015611845573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061186991906150f6565b6118855760405162461bcd60e51b8152600401610d2890615118565b60065460009061189e906001600160a01b031685612c7d565b90506118b3816118ae3086612c7d565b613be3565b610c9381612fc8565b60065460405163430c208160e01b81523360048201526024810185905284916001600160a01b03169063430c208190604401602060405180830381865afa15801561190b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061192f91906150f6565b61194b5760405162461bcd60e51b8152600401610d2890615118565b600654610c9390611965906001600160a01b031686612c7d565b84847f0000000000000000000000000000000000000000000000000000000000000000613cc8565b611995613578565b61199f6000613f1b565b565b60606119b882846008805490506110ab9190615161565b91506119e47f000000000000000000000000000000000000000000000000000000000000000083615174565b6001600160401b038111156119fb576119fb614ccd565b604051908082528060200260200182016040528015611a3457816020015b611a216149e4565b815260200190600190039081611a195790505b5090506000600184600880549050611a4c9190615161565b611a569190615161565b905060005b83811015611e95576000611a6f8284615161565b600083815260096020526040812054919250611a8d90839083613923565b85611ab87f000000000000000000000000000000000000000000000000000000000000000085615174565b611ac390600061519f565b81518110611ad357611ad361501a565b6020026020010181905250611aea82600183613923565b85611b157f000000000000000000000000000000000000000000000000000000000000000085615174565b611b2090600161519f565b81518110611b3057611b3061501a565b6020026020010181905250611b4782600283613923565b85611b727f000000000000000000000000000000000000000000000000000000000000000085615174565b611b7d90600261519f565b81518110611b8d57611b8d61501a565b6020026020010181905250611ba482600383613923565b85611bcf7f000000000000000000000000000000000000000000000000000000000000000085615174565b611bda90600361519f565b81518110611bea57611bea61501a565b6020026020010181905250611c0182600483613923565b85611c2c7f000000000000000000000000000000000000000000000000000000000000000085615174565b611c3790600461519f565b81518110611c4757611c4761501a565b6020026020010181905250611c5e82600583613923565b85611c897f000000000000000000000000000000000000000000000000000000000000000085615174565b611c9490600561519f565b81518110611ca457611ca461501a565b6020026020010181905250611cbb82600683613923565b85611ce67f000000000000000000000000000000000000000000000000000000000000000085615174565b611cf190600661519f565b81518110611d0157611d0161501a565b6020026020010181905250611d1882600783613923565b85611d437f000000000000000000000000000000000000000000000000000000000000000085615174565b611d4e90600761519f565b81518110611d5e57611d5e61501a565b6020026020010181905250611d7582600883613923565b85611da07f000000000000000000000000000000000000000000000000000000000000000085615174565b611dab90600861519f565b81518110611dbb57611dbb61501a565b6020026020010181905250611dd282600983613923565b85611dfd7f000000000000000000000000000000000000000000000000000000000000000085615174565b611e0890600961519f565b81518110611e1857611e1861501a565b6020026020010181905250611e2f82600a83613923565b85611e5a7f000000000000000000000000000000000000000000000000000000000000000085615174565b611e6590600a61519f565b81518110611e7557611e7561501a565b602002602001018190525050508080611e8d90615290565b915050611a5b565b505092915050565b60005b815181101561158d57611ecc83838381518110611ebf57611ebf61501a565b60200260200101516121a0565b5080611ed781615290565b915050611ea0565b6006546115d590611ef9906001600160a01b031684612c7d565b611f033084612c7d565b613f77565b6000611f166103e88461505c565b9250611f246103e88361505c565b915060008212611f345781611f4a565b6103e8611f40836150da565b611f4a91906152a9565b611f576103e8600a61508a565b60008512611f655784611f7b565b6103e8611f71866150da565b611f7b91906152a9565b611f859190615174565b610b50919061519f565b600081815260096020526040812054905b7f000000000000000000000000000000000000000000000000000000000000000081101561158d576001811b8216611fde57611fdc83826121a0565b505b80611fe881615290565b915050611fa0565b8060005b81811015610c935761201d8484838181106120115761201161501a565b90506020020135612903565b5061202781615290565b9050611ff4565b6040805180820182526000808252602091820181905293845260028152818420928452918252918290208251808401909352546001600160801b0381168352600160801b9004600f0b9082015290565b6060816001600160401b0381111561209857612098614ccd565b6040519080825280602002602001820160405280156120cb57816020015b60608152602001906001900390816120b65790505b50905060005b8281101561216b5761213b308585848181106120ef576120ef61501a565b905060200281019061210191906152c9565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061412b92505050565b82828151811061214d5761214d61501a565b6020026020010181905250808061216390615290565b9150506120d1565b5092915050565b600090815260208190526040902054600160f01b900460ff1690565b6115d561219b8383612c7d565b6135d9565b60085460009083106121e95760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a5908195b5a5cdcda5bdb925960721b6044820152606401610d28565b7f000000000000000000000000000000000000000000000000000000000000000082106122485760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b6044820152606401610d28565b6122528383610b39565b156122945760405162461bcd60e51b8152602060048201526012602482015271105b1c9958591e481a59195b9d1a599a595960721b6044820152606401610d28565b600083815260096020526040902080546001841b179055610b506122b884846115d9565b614150565b600454610100900460ff16158080156122dd5750600454600160ff909116105b806122f75750303b1580156122f7575060045460ff166001145b61235a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610d28565b6004805460ff19166001179055801561237d576004805461ff0019166101001790555b600580546001600160a01b038087166001600160a01b0319928316179092556006805486841690831617905560078054928516929091169190911790556123c56122b8612501565b506123cf33613f1b565b8015610c93576004805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050565b6007546001600160a01b0316331461245f5760405162461bcd60e51b815260206004820152600860248201526709edcd8f240e6c4d60c31b6044820152606401610d28565b604080518082019091526001600160801b0392831681529082166020820190815260088054600181018255600091909152915190518316600160801b029216919091177ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee390910155565b60006124d58484610b39565b6124ea576124e384846121a0565b90506124f7565b6124f48484614203565b90505b610c938282611207565b612509614a55565b60065460405163137f41fb60e11b8152670de0b6b3a764000060048201526000916001600160a01b0316906326fe83f690602401602060405180830381865afa15801561255a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257e9190615148565b61258a906107d0615174565b6040805160a081019091526005546001600160a01b03168152909150602081016125b5836064615174565b81526020016125e47f00000000000000000000000000000000000000000000000000000000000000008461518b565b815260200160008152602001600081525091505090565b6008818154811061260b57600080fd5b6000918252602090912001546001600160801b038082169250600160801b9091041682565b606061264782846008805490506110ab9190615161565b9150816001600160401b0381111561266157612661614ccd565b6040519080825280602002602001820160405280156126a657816020015b604080518082019091526000808252602082015281526020019060019003908161267f5790505b50905060006001846008805490506126be9190615161565b6126c89190615161565b905060005b83811015611e955760086126e18284615161565b815481106126f1576126f161501a565b6000918252602091829020604080518082019091529101546001600160801b038082168352600160801b9091041691810191909152835184908390811061273a5761273a61501a565b6020026020010181905250808061275090615290565b9150506126cd565b612760613578565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60607f00000000000000000000000000000000000000000000000000000000000000006001600160401b038111156127bc576127bc614ccd565b6040519080825280602002602001820160405280156127f557816020015b6127e2614a55565b8152602001906001900390816127da5790505b50905060005b7f000000000000000000000000000000000000000000000000000000000000000081101561285d5761282d83826115d9565b82828151811061283f5761283f61501a565b6020026020010181905250808061285590615290565b9150506127fb565b50919050565b61286b613578565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b612895613578565b6001600160a01b0381166128fa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d28565b61120481613f1b565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915250600081815260016020818152604092839020835160a08101855281546001600160801b0380821683526001600160401b03600160801b8084048216968501879052600160c01b90930416968301969096529190930154808516606085015204909216608082015290421115612b695760608101516001600160801b031615612a9c57600081602001516001600160401b0316426129cc9190615161565b90506000612a3b83604001516001600160401b0316836129ec9190615174565b608085015160008781526003602052604090819020549051631398fee160e31b8152600481018990526001600160801b03909216916001600160a01b0390911690639cc7f70890602401611060565b90508083608001818151612a4f919061530f565b6001600160801b039081169091526060850151169050612a7464e8d4a5100083615174565b612a7e919061518b565b83518490612a8d90839061530f565b6001600160801b031690525050505b6001600160401b03428116602083810191825260008581526001808352604091829020865181549551848901518816600160c01b026001600160c01b0391909816600160801b8181026001600160c01b03199099166001600160801b0394851690811799909917929092169890981783556060808a015160808b0151841690920291909216908117929093019190915582519586529285015283019190915283917fec4a9a305ed16b1675f19bff6fbc6252ba69985b3faad56dbd67dc47b2a0480f910160405180910390a25b919050565b60065460405163430c208160e01b81523360048201526024810186905285916001600160a01b03169063430c208190604401602060405180830381865afa158015612bbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612be191906150f6565b612bfd5760405162461bcd60e51b8152600401610d2890615118565b600654600090612c16906001600160a01b031687612c7d565b90506000612c243087612c7d565b9050612c308282612c96565b612c3f8282610d73848661202e565b612c4882612fc8565b612c748286867f0000000000000000000000000000000000000000000000000000000000000000613cc8565b50505050505050565b60609190911b6bffffffffffffffffffffffff19161790565b612c9f82612172565b612cd85760405162461bcd60e51b815260206004820152600a602482015269139bdd08191bd8dad95960b21b6044820152606401610d28565b612ce28183611414565b6115d55760405162461bcd60e51b815260206004820152600f60248201526e4e6f7420646f636b6564206865726560881b6044820152606401610d28565b6000612d2b83612903565b6000848152600260209081526040808320888452909152812082518154939450909264e8d4a5100091612d6a916001600160801b039182169116615174565b612d74919061518b565b8254909150600090612d9090600160801b9004600f0b836150ba565b845190915064e8d4a5100090612daf906001600160801b031687615174565b612db9919061518b565b612dc390836150ba565b83546001600160801b03918216600160801b02908216818117865587928692600092612df2928692161761532f565b82546101009290920a6001600160801b03818102199093169183160217909155600088815260016020819052604082200180548994509092612e369185911661532f565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550806001600088815260200190815260200160002060010160108282829054906101000a90046001600160801b0316612e92919061532f565b82546001600160801b039182166101009390930a92830291909202199091161790555060008681526003602052604090819020549051630310ed7f60e41b81526004810188905260248101899052604481018390526001600160a01b039091169063310ed7f0906064016020604051808303816000875af1158015612f1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f3f91906150f6565b50612f4986614224565b85877fea60e598f902d5beafc44ccc67bba328a4fe00e698d6e26b558b651ebcc7437d87604051612f7c91815260200190565b60405180910390a385877f74e86a761791746cd52a08e3196ef8180505d5469ab6fa728b9a88ceb9e2948583604051612fb791815260200190565b60405180910390a350505050505050565b600081815260208190526040808220805460ff60f01b191690555182917ff27b6ce5b2f5e68ddb2fd95a8a909d4ecf1daaac270935fff052feacb24f184291a250565b600061301683612903565b6000848152600260209081526040808320888452909152902081519192509064e8d4a510009061304f906001600160801b031685615174565b613059919061518b565b81548290601090613075908490600160801b9004600f0b61534f565b82546101009290920a6001600160801b03818102199093169183160217909155825485925083916000916130ab9185911661532f565b82546101009290920a6001600160801b038181021990931691831602179091556000868152600160208190526040822001805487945090926130ef9185911661532f565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555061311c84614224565b83857fea60e598f902d5beafc44ccc67bba328a4fe00e698d6e26b558b651ebcc7437d8560405161314f91815260200190565b60405180910390a35050505050565b600061316983612903565b60008481526003602052604090819020549051631398fee160e31b8152600481018690529192506001600160a01b031690639cc7f70890602401602060405180830381865afa1580156131c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131e49190615148565b64e8d4a5100082600001516001600160801b031683606001516001600160801b03166132109190615174565b61321a919061518b565b106132575760405162461bcd60e51b815260206004820152600d60248201526c135a5b994819195c1b195d1959609a1b6044820152606401610d28565b6000838152600260209081526040808320878452909152812080549091849183919061328d9084906001600160801b031661530f565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555064e8d4a5100082600001516001600160801b0316846132d09190615174565b6132da919061518b565b815482906010906132f6908490600160801b9004600f0b61537c565b82546101009290920a6001600160801b0381810219909316918316021790915560008681526001602081905260408220018054879450909261333a9185911661530f565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555083857f605db19fa369dc40d69a9ab9234c0f0ab1e8545706eb74f9f20d81cd74546b3e8560405161314f91815260200190565b600081815260208181526040808320815160e0810183529054600481810b8352600160281b8204810b94830194909452600160501b8104840b92820192909252600160781b820490920b6060830152600160a01b810464ffffffffff90811660808401819052600160c81b830490911660a0840152600160f01b90910460ff16151560c08301528291908203613438578051602090910151600491820b95910b9350915050565b6000613462826000015160040b836020015160040b846040015160040b856060015160040b61350c565b90506000826080015164ffffffffff168360a0015164ffffffffff16426134899190615161565b6134939190615174565b90508181106134b85750506040810151606090910151600491820b95910b9350915050565b6134ff836000015160040b846020015160040b856040015160040b866060015160040b8686670de0b6b3a76400006134f09190615174565b6134fa919061518b565b6142e3565b9097909650945050505050565b6000613557600261352561352087866150ba565b614358565b61352f919061548d565b600261353e61352089886150ba565b613548919061548d565b613552919061519f565b61436f565b90505b949350505050565b60008183106135715781610b50565b5090919050565b6004546001600160a01b036201000090910416331461199f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d28565b6000806135e583613391565b60008581526020818152604091829020825160e0810184529054600481810b8352600160281b8204810b93830193909352600160501b8104830b938201849052600160781b810490920b6060820152600160a01b820464ffffffffff9081166080830152600160c81b83041660a0820152600160f01b90910460ff16151560c0820152929450909250831480156136825750806060015160040b82145b1561368f57600060808201525b82816000019060040b908160040b8152505081816020019060040b908160040b81525050428160a0019064ffffffffff16908164ffffffffff16815250508060008086815260200190815260200160002060008201518160000160006101000a81548164ffffffffff021916908360040b64ffffffffff16021790555060208201518160000160056101000a81548164ffffffffff021916908360040b64ffffffffff160217905550604082015181600001600a6101000a81548164ffffffffff021916908360040b64ffffffffff160217905550606082015181600001600f6101000a81548164ffffffffff021916908360040b64ffffffffff16021790555060808201518160000160146101000a81548164ffffffffff021916908364ffffffffff16021790555060a08201518160000160196101000a81548164ffffffffff021916908364ffffffffff16021790555060c082015181600001601e6101000a81548160ff021916908315150217905550905050837fc2b72a72b829e54e1994275116751ed5670843cf738bf226f3b86ad28935cdb0848484604001518560600151866080015142604051613879969594939291909586526020860194909452600492830b6040860152910b606084015264ffffffffff16608083015260a082015260c00190565b60405180910390a250505050565b600081815260208190526040902054600160a01b900464ffffffffff16156138da5760405162461bcd60e51b81526020600482015260066024820152654d6f76696e6760d01b6044820152606401610d28565b600081815260208190526040808220805460ff60f01b1916600160f01b1790555182917f032bc66be43dbccb7487781d168eb7bda224628a3b2c3388bdf69b532a3a161191a250565b61392b6149e4565b600061393785856115d9565b9050600061394d82606001518360800151611f08565b90506040518060c00160405280828152602001876001600160801b031681526020018663ffffffff16815260200161398a86886001901b16151590565b151581526020018381526020016139a461046a3085612c7d565b90529695505050505050565b600082815260026020908152604080832084845282528083208151808301835290546001600160801b03808216808452600160801b909204600f0b838601528786526001948590529285209093018054919490929091613a129185911661532f565b82546101009290920a6001600160801b03818102199093169183160217909155602083810151600087815260019092526040909120548451600f9290920b935064e8d4a5100092613a67929181169116615174565b613a71919061518b565b613a7b91906150ba565b6000848152600160208190526040909120018054601090613aad908490600160801b90046001600160801b031661532f565b82546001600160801b039182166101009390930a928302919092021990911617905550506000918252600260209081526040808420928452919052812055565b60006002613b0c613b0685670de0b6b3a764000061445e565b84614497565b610b50919061518b565b60008083604051602001613b2c91815260200190565b60408051601f198184030181529190528051602090910120600181019450600090613b57908561445e565b60010190506000670de0b6b3a7640000613b7f87806001019850671bc16d674ec8000061445e565b0390506000613ba08283026ec097ce7bc90715b34b9f10000000000361436f565b9050670de0b6b3a7640000828402059450670de0b6b3a7640000818402059350613bcb87600261445e565b600003613bd9578360000393505b5050509250929050565b60008181526002602090815260408083208584528252808320805485855260019384905291909320909101546001600160801b0391821691168111613c715760008381526001602081905260408220018054839290613c4c9084906001600160801b031661532f565b92506101000a8154816001600160801b0302191690836001600160801b031602179055505b60008381526002602090815260408083208784528252808320929092559051828152849186917ffb493172de738b8709e302a0c98e1493db5c2216b76248dac8f1b6f70851128b910160405180910390a350505050565b600084815260208190526040902054600160f01b900460ff1615613d175760405162461bcd60e51b8152602060048201526006602482015265131bd8dad95960d21b6044820152606401610d28565b600080613d2386613391565b915091506040518060e001604052808360040b81526020018260040b81526020018660040b81526020018560040b81526020018464ffffffffff1681526020014264ffffffffff1681526020016000151581525060008088815260200190815260200160002060008201518160000160006101000a81548164ffffffffff021916908360040b64ffffffffff16021790555060208201518160000160056101000a81548164ffffffffff021916908360040b64ffffffffff160217905550604082015181600001600a6101000a81548164ffffffffff021916908360040b64ffffffffff160217905550606082015181600001600f6101000a81548164ffffffffff021916908360040b64ffffffffff16021790555060808201518160000160146101000a81548164ffffffffff021916908364ffffffffff16021790555060a08201518160000160196101000a81548164ffffffffff021916908364ffffffffff16021790555060c082015181600001601e6101000a81548160ff021916908315150217905550905050857fb5597581fb670ec8e458e332014b85e275c9e16f2f9515b880828f1bd69314d0838388888842604051613f0b96959493929190958652602086019490945260408501929092526060840152608083015260a082015260c00190565b60405180910390a2505050505050565b600480546001600160a01b038381166201000081810262010000600160b01b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000613f8282612903565b6000838152600260209081526040808320878452909152812082518154939450909264e8d4a5100091613fc1916001600160801b039182169116615174565b613fcb919061518b565b8254909150600090613fe790600160801b9004600f0b836150ba565b83546001600160801b03808516600160801b90810292821692909217865560008881526001602081905260409091200180549394508493909260109261403192869290041661532f565b82546001600160801b039182166101009390930a92830291909202199091161790555060008581526003602052604090819020549051630310ed7f60e41b81526004810187905260248101889052604481018390526001600160a01b039091169063310ed7f0906064016020604051808303816000875af11580156140ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140de91906150f6565b506140e885614224565b84867f74e86a761791746cd52a08e3196ef8180505d5469ab6fa728b9a88ceb9e294858360405161411b91815260200190565b60405180910390a3505050505050565b6060610b5083836040518060600160405280602781526020016154c4602791396144c7565b600061416482606001518360800151611f08565b905060006141723083612c7d565b83516020850151604051630d9778e560e11b81526004810184905260248101919091529192506001600160a01b031690631b2ef1ca90604401600060405180830381600087803b1580156141c557600080fd5b505af11580156141d9573d6000803e3d6000fd5b505050506141f08184606001518560800151614535565b61285d818460000151856040015161468d565b60008061421084846115d9565b905061355a81606001518260800151611f08565b60008181526003602052604090819020549051631398fee160e31b81526004810183905266038d7ea4c68000916001600160a01b031690639cc7f70890602401602060405180830381865afa158015614281573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142a59190615148565b1080156142d557506000818152600160208190526040909120015466038d7ea4c680006001600160801b03909116105b15611204576112048161485a565b600080670de0b6b3a7640000836142fa89886150ba565b614304919061508a565b61430e919061505c565b61431890886152a9565b670de0b6b3a76400008461432c89886150ba565b614336919061508a565b614340919061505c565b61434a90886152a9565b915091509550959350505050565b60008082121561436b5781600003610b53565b5090565b60008160000361438157506000919050565b6000600161438e846148b2565b901c6001901b905060018184816143a7576143a7615030565b048201901c905060018184816143bf576143bf615030565b048201901c905060018184816143d7576143d7615030565b048201901c905060018184816143ef576143ef615030565b048201901c9050600181848161440757614407615030565b048201901c9050600181848161441f5761441f615030565b048201901c9050600181848161443757614437615030565b048201901c90506144578182858161445157614451615030565b04613562565b9392505050565b6000818360405160200161447491815260200190565b6040516020818303038152906040528051906020012060001c610b50919061549c565b6000610b506144a6848461519f565b61355290760a70c3c40a64e6c51999090b65f67d924000000000000061518b565b6060600080856001600160a01b0316856040516144e49190615274565b600060405180830381855af49150503d806000811461451f576040519150601f19603f3d011682016040523d82523d6000602084013e614524565b606091505b509150915061112586838387614946565b6040805160e081018252600484810b8083529084900b6020808401828152848601938452606085019283526000608086018181524264ffffffffff90811660a0890190815260c089018481528d85529584905292899020975188549451975196519251935195511515600160f01b0260ff60f01b19968316600160c81b0264ffffffffff60c81b19958416600160a01b029590951669ffffffffffffffffffff60a01b19948416600160781b0264ffffffffff60781b19998516600160501b029990991669ffffffffffffffffffff60501b199a8516600160281b0269ffffffffffffffffffff19909816939094169290921795909517979097161794909417939093169390931791909117161790555183907fc436d211465bf21c221b75f4553f01fc9f0a1c4ead04308064c71a868a598e93906146809085908590918252602082015260400190565b60405180910390a2505050565b600083815260016020526040902054600160801b90046001600160401b0316156146ef5760405162461bcd60e51b81526020600482015260136024820152724d696e6520616c72656164792065786973747360681b6044820152606401610d28565b6040805160a0810182526000808252426001600160401b03908116602080850191825286831685870190815260608601858152608087018681528b8752600180855289882098518954965194516001600160801b039182166001600160c01b031990981697909717600160801b9589168602176001600160c01b0316600160c01b979098169690960296909617885590519051908416931602919091179390910192909255600390915281902080546001600160a01b0319166001600160a01b0385169081179091559051631398fee160e31b81526004810185905284907f99c179fd67e39ab9893328cef67f170cab6b52bc55495277389f4e10f43144c99084908490639cc7f70890602401602060405180830381865afa158015614819573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061483d9190615148565b6040805192835260208301919091520160405180910390a3505050565b60008181526001602081815260408084208481559092018390556003905280822080546001600160a01b03191690555182917fa82ccc89e3370925dca7b35d9962409ba3fc37a1e6b89747aa9ec2c2dc31581491a250565b600080608083901c156148c757608092831c92015b604083901c156148d957604092831c92015b602083901c156148eb57602092831c92015b601083901c156148fd57601092831c92015b600883901c1561490f57600892831c92015b600483901c1561492157600492831c92015b600283901c1561493357600292831c92015b600183901c15610b535760010192915050565b606083156149b55782516000036149ae576001600160a01b0385163b6149ae5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d28565b508161355a565b61355a83838151156149ca5781518083602001fd5b8060405162461bcd60e51b8152600401610d2891906154b0565b6040518060c001604052806000815260200160006001600160801b03168152602001600063ffffffff168152602001600015158152602001614a24614a55565b81526040805160a0810182526000808252602082810182905292820181905260608201819052608082015291015290565b6040518060a0016040528060006001600160a01b03168152602001600081526020016000815260200160008152602001600081525090565b60008060408385031215614aa057600080fd5b50508035926020909101359150565b600060208284031215614ac157600080fd5b5035919050565b60408101610b53828480516001600160801b03908116835260209182015116910152565b6001600160801b0380825116835260208201516001600160401b0380821660208601528060408501511660408601525050806060830151166060840152806080830151166080840152505050565b60a08101610b538284614aec565b600080600060608486031215614b5d57600080fd5b505081359360208301359350604090920135919050565b6001600160a01b038116811461120457600080fd5b60008060408385031215614b9c57600080fd5b8235614ba781614b74565b946020939093013593505050565b80516001600160a01b03168252602080820151908301526040808201519083015260608082015190830152608090810151910152565b805182526001600160801b03602082015116602083015263ffffffff60408201511660408301526060810151151560608301526080810151614c306080840182614bb5565b5060a081015161158d610120840182614aec565b6101c08101610b538284614beb565b600060208284031215614c6557600080fd5b813561445781614b74565b60a08101610b538284614bb5565b6020808252825182820181905260009190848201906040850190845b81811015614cc157614cad838551614beb565b928401926101c09290920191600101614c9a565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b0381118282101715614d0857614d08614ccd565b6040525050565b60008060408385031215614d2257600080fd5b823591506020808401356001600160401b0380821115614d4157600080fd5b818601915086601f830112614d5557600080fd5b813581811115614d6757614d67614ccd565b8060051b9150604051614d7c85840182614ce3565b81815291830184019184810189841115614d9557600080fd5b938501935b83851015614db15784358152938501938501614d9a565b5080955050505050509250929050565b60008083601f840112614dd357600080fd5b5081356001600160401b03811115614dea57600080fd5b6020830191508360208260051b850101111561114957600080fd5b60008060208385031215614e1857600080fd5b82356001600160401b03811115614e2e57600080fd5b614e3a85828601614dc1565b90969095509350505050565b60005b83811015614e61578181015183820152602001614e49565b50506000910152565b60008151808452614e82816020860160208601614e46565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015614eeb57603f19888603018452614ed9858351614e6a565b94509285019290850190600101614ebd565b5092979650505050505050565b600080600060608486031215614f0d57600080fd5b8335614f1881614b74565b92506020840135614f2881614b74565b91506040840135614f3881614b74565b809150509250925092565b602080825282518282018190526000919060409081850190868401855b82811015614f9957614f8984835180516001600160801b03908116835260209182015116910152565b9284019290850190600101614f60565b5091979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015614cc157614fd5838551614bb5565b9284019260a09290920191600101614fc2565b60008060008060808587031215614ffe57600080fd5b5050823594602084013594506040840135936060013592509050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008261506b5761506b615030565b600160ff1b82146000198414161561508557615085615046565b500590565b80820260008212600160ff1b841416156150a6576150a6615046565b8181058314821517610b5357610b53615046565b818103600083128015838313168383128216171561216b5761216b615046565b6000600160ff1b82016150ef576150ef615046565b5060000390565b60006020828403121561510857600080fd5b8151801515811461445757600080fd5b60208082526016908201527527b7363c9030b8383937bb32b21037b91037bbb732b960511b604082015260600190565b60006020828403121561515a57600080fd5b5051919050565b81810381811115610b5357610b53615046565b8082028115828204841417610b5357610b53615046565b60008261519a5761519a615030565b500490565b80820180821115610b5357610b53615046565b6000602082840312156151c457600080fd5b815161445781614b74565b600060033d11156151e85760046000803e5060005160e01c5b90565b600060443d10156151f95790565b6040516003193d81016004833e81513d6001600160401b03816024840111818411171561522857505050505090565b82850191508151818111156152405750505050505090565b843d870101602082850101111561525a5750505050505090565b61526960208286010187614ce3565b509095945050505050565b60008251615286818460208701614e46565b9190910192915050565b6000600182016152a2576152a2615046565b5060010190565b8082018281126000831280158216821582161715611e9557611e95615046565b6000808335601e198436030181126152e057600080fd5b8301803591506001600160401b038211156152fa57600080fd5b60200191503681900382131561114957600080fd5b6001600160801b0381811683821601908082111561216b5761216b615046565b6001600160801b0382811682821603908082111561216b5761216b615046565b600f82810b9082900b0360016001607f1b0319811260016001607f1b0382131715610b5357610b53615046565b600f81810b9083900b0160016001607f1b03811360016001607f1b031982121715610b5357610b53615046565b600181815b808511156153e45781600019048211156153ca576153ca615046565b808516156153d757918102915b93841c93908002906153ae565b509250929050565b6000826153fb57506001610b53565b8161540857506000610b53565b816001811461541e576002811461542857615444565b6001915050610b53565b60ff84111561543957615439615046565b50506001821b610b53565b5060208310610133831016604e8410600b8410161715615467575081810a610b53565b61547183836153a9565b806000190482111561548557615485615046565b029392505050565b6000610b5060ff8416836153ec565b6000826154ab576154ab615030565b500690565b602081526000610b506020830184614e6a56fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220d76454c2203906e35e794f2a2b800371509040d861eae6c7b6169e2b976da20464736f6c63430008110033000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000000000000000000000000000000000000007d0000000000000000000000000000000000000000000000000000000000000000001
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106103a45760003560e01c80637ad345c7116101e9578063b91ef87f1161010f578063e24f8b27116100ad578063f2fde38b1161007c578063f2fde38b146109c0578063f3f9082f146109d3578063f546326414610b13578063f65c26ac14610b2657600080fd5b8063e24f8b271461095a578063e3df11301461097a578063e7eaf27b1461098d578063e7ef34fc146109ad57600080fd5b8063d88423c0116100e9578063d88423c0146108f9578063dbc2d0c41461090c578063df1f29ee1461091f578063e22000521461092757600080fd5b8063b91ef87f146108c0578063c0c53b8b146108d3578063d419c9ee146108e657600080fd5b806392071d7a11610187578063ac70438411610156578063ac70438414610853578063ac9650d81461087a578063b45a3c0e1461089a578063b64e80b6146108ad57600080fd5b806392071d7a146107e75780639cef7a2b146107fa5780639e8907df1461080d578063ab27b4e71461084757600080fd5b80638139e0f6116101c35780638139e0f6146107975780638263d56e146107aa5780638cb4d01c146107bd5780638da5cb5b146107d057600080fd5b80637ad345c71461073b5780637b1d39e61461075b5780637bb7bed11461076e57600080fd5b80633d5b0465116102ce578063648414a51161026c5780636b8326441161023b5780636b832644146106e65780636e6ef6cf146106f9578063715018a61461070c57806372c6e9051461071457600080fd5b8063648414a5146106985780636526db7a146106ab578063694e7162146106be5780636a63c1f5146106c657600080fd5b80634f558e79116102a85780634f558e7914610634578063594a8aee1461065f578063596b9a5d146106725780635dd70ad91461068557600080fd5b80633d5b0465146105f957806342fca82e1461060e57806347baf0e91461062157600080fd5b80631d37b241116103465780632746547a116103155780632746547a146105815780632c2d5381146105ac5780633185c0bd146105d35780633c36ccae146105e657600080fd5b80631d37b2411461052157806323df57fe146105485780632620b11e1461055b5780632733b1e81461056e57600080fd5b806307a966021161038257806307a966021461041f5780630867408f146104475780631147ff0b1461045c578063114840cf1461050e57600080fd5b8063019c68d8146103a957806301e2f65f146103d157806303e7b4e9146103ff575b600080fd5b6103bc6103b7366004614a8d565b610b39565b60405190151581526020015b60405180910390f35b6103f16103df366004614aaf565b60096020526000908152604090205481565b6040519081526020016103c8565b61041261040d366004614aaf565b610b59565b6040516103c89190614ac8565b61043261042d366004614aaf565b610bbb565b604080519283526020830191909152016103c8565b61045a610455366004614a8d565b610c74565b005b61050161046a366004614aaf565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915250600090815260016020818152604092839020835160a08101855281546001600160801b0380821683526001600160401b03600160801b808404821696850196909652600160c01b90920490911695820195909552920154808416606084015204909116608082015290565b6040516103c89190614b3a565b61045a61051c366004614a8d565b610c99565b6103f17f0000000000000000000000000000000000000000000000000000000000278d0081565b61045a610556366004614a8d565b610d92565b6103bc610569366004614b48565b610e8e565b61043261057c366004614aaf565b610f21565b600654610594906001600160a01b031681565b6040516001600160a01b0390911681526020016103c8565b6103f17f000000000000000000000000000000000000000000000000000000000007d00081565b6103f16105e1366004614a8d565b610f36565b6104326105f4366004614b89565b61112f565b610601611150565b6040516103c89190614c44565b61045a61061c366004614c53565b6111d1565b61045a61062f366004614aaf565b6111fb565b6103bc610642366004614aaf565b6000908152600360205260409020546001600160a01b0316151590565b61045a61066d366004614a8d565b611207565b61045a610680366004614b48565b6113d0565b610601610693366004614a8d565b6113f0565b6103bc6106a6366004614a8d565b611414565b61045a6106b9366004614a8d565b61144f565b6008546103f1565b6106d96106d4366004614a8d565b6115d9565b6040516103c89190614c70565b61045a6106f4366004614a8d565b6117f6565b61045a610707366004614b48565b6118bc565b61045a61198d565b6103f17f000000000000000000000000000000000000000000000000000000000000000181565b61074e610749366004614a8d565b6119a1565b6040516103c89190614c7e565b61045a610769366004614d0f565b611e9d565b61059461077c366004614aaf565b6003602052600090815260409020546001600160a01b031681565b61045a6107a5366004614a8d565b611edf565b6103f16107b8366004614a8d565b611f08565b61045a6107cb366004614aaf565b611f8f565b6004546201000090046001600160a01b0316610594565b600754610594906001600160a01b031681565b61045a610808366004614e05565b611ff0565b61082061081b366004614a8d565b61202e565b6040805182516001600160801b03168152602092830151600f0b92810192909252016103c8565b6103f164e8d4a5100081565b6103f17f000000000000000000000000000000000000000000000000000000000000000b81565b61088d610888366004614e05565b61207e565b6040516103c89190614e96565b6103bc6108a8366004614aaf565b612172565b61045a6108bb366004614b89565b61218e565b6103f16108ce366004614a8d565b6121a0565b61045a6108e1366004614ef8565b6122bd565b600554610594906001600160a01b031681565b61045a610907366004614a8d565b61241a565b61045a61091a366004614b48565b6124c9565b6106d9612501565b61093a610935366004614aaf565b6125fb565b604080516001600160801b039384168152929091166020830152016103c8565b61096d610968366004614a8d565b612630565b6040516103c89190614f43565b61045a610988366004614c53565b612758565b6109a061099b366004614aaf565b612782565b6040516103c89190614fa6565b61045a6109bb366004614c53565b612863565b61045a6109ce366004614c53565b61288d565b610aa26109e1366004614aaf565b6040805160e081018252600080825260208201819052918101829052606081018290526080810182905260a0810182905260c08101919091525060009081526020818152604091829020825160e0810184529054600481810b8352600160281b8204810b93830193909352600160501b8104830b93820193909352600160781b830490910b6060820152600160a01b820464ffffffffff9081166080830152600160c81b83041660a0820152600160f01b90910460ff16151560c082015290565b6040516103c89190600060e082019050825160040b8252602083015160040b6020830152604083015160040b6040830152606083015160040b6060830152608083015164ffffffffff80821660808501528060a08601511660a0850152505060c0830151151560c083015292915050565b610501610b21366004614aaf565b612903565b61045a610b34366004614fe8565b612b6e565b6000828152600960205260408120546001831b1615155b90505b92915050565b604080518082019091526000808252602082015260088281548110610b8057610b8061501a565b6000918252602091829020604080518082019091529101546001600160801b038082168352600160801b909104169181019190915292915050565b600080600a610bcc6103e88561505c565b610bd6919061505c565b9150610be46103e88361508a565b610bef90600a61508a565b610bf990846150ba565b90506103e8610c08818461505c565b15610c2757610c196103e8846150ba565b610c22906150da565b610c29565b825b610c33919061508a565b91506103e8610c42818361505c565b15610c6157610c536103e8836150ba565b610c5c906150da565b610c63565b815b610c6d919061508a565b9050915091565b600080610c8461057c3085612c7d565b91509150610c938483836118bc565b50505050565b60065460405163430c208160e01b81523360048201526024810184905283916001600160a01b03169063430c208190604401602060405180830381865afa158015610ce8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0c91906150f6565b610d315760405162461bcd60e51b8152600401610d2890615118565b60405180910390fd5b600654600090610d4a906001600160a01b031685612c7d565b90506000610d583085612c7d565b9050610d648282612c96565b610d828282610d73848661202e565b516001600160801b0316612d20565b610d8b82612fc8565b5050505050565b600654600090610dab906001600160a01b031684612c7d565b90506000610db93084612c7d565b9050610dc58282612c96565b6000610dd1828461202e565b51600654604051631404cb3b60e11b8152600481018890526001600160801b0390921692506000916001600160a01b0390911690632809967690602401602060405180830381865afa158015610e2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4f9190615148565b905080821115610e7257610e6d8484610e688486615161565b61300b565b610e86565b610e868484610e818585615161565b61315e565b505050505050565b6000806000610e9c86613391565b91509150600080610eac87613391565b9092509050610ec386670de0b6b3a7640000615174565b610f13610ed886670de0b6b3a764000061508a565b610eea86670de0b6b3a764000061508a565b610efc86670de0b6b3a764000061508a565b610f0e86670de0b6b3a764000061508a565b61350c565b111598975050505050505050565b600080610f2d83613391565b91509150915091565b6000818152600160208181526040808420815160a08101835281546001600160801b038082168352600160801b8083046001600160401b03908116858901908152600160c01b90940481168588015294909701548082166060850152969096048616608083015287875260028552838720898852909452918520825193519294909316911642118015610fd5575060608301516001600160801b031615155b156110e957600083602001516001600160401b031642610ff59190615161565b905060006110b085604001516001600160401b0316836110159190615174565b608087015160008a81526003602052604090819020549051631398fee160e31b8152600481018c90526001600160801b03909216916001600160a01b0390911690639cc7f708906024015b602060405180830381865afa15801561107d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a19190615148565b6110ab9190615161565b613562565b60608601519091506001600160801b03166110d064e8d4a5100083615174565b6110da919061518b565b6110e4908461519f565b925050505b8154600160801b8104600f0b9064e8d4a51000906111119084906001600160801b0316615174565b61111b919061518b565b61112591906150ba565b9695505050505050565b60008061114461113f8585612c7d565b613391565b915091505b9250929050565b6111586149e4565b6040518060c001604052806000815260200160006001600160801b031681526020017f000000000000000000000000000000000000000000000000000000000000000b63ffffffff1681526020016001151581526020016111b7612501565b81526020016111ca61046a306000612c7d565b9052919050565b6111d9613578565b600580546001600160a01b0319166001600160a01b0392909216919091179055565b611204816135d9565b50565b60065460405163430c208160e01b81523360048201526024810184905283916001600160a01b03169063430c208190604401602060405180830381865afa158015611256573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061127a91906150f6565b6112965760405162461bcd60e51b8152600401610d2890615118565b6006546000906112af906001600160a01b031685612c7d565b905060006112bd3085612c7d565b90506112c882612172565b156113065760405162461bcd60e51b815260206004820152600e60248201526d105b1c9958591e48191bd8dad95960921b6044820152606401610d28565b61130f826135d9565b6113198183611414565b6113545760405162461bcd60e51b815260206004820152600c60248201526b13dd5d081bd9881bdc989a5d60a21b6044820152606401610d28565b61135d82613887565b600654604051631404cb3b60e11b815260048101879052610d8b91849184916001600160a01b031690632809967690602401602060405180830381865afa1580156113ac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e819190615148565b6000806113e061057c3085612c7d565b91509150610d8b85858484612b6e565b6113f86149e4565b600083815260096020526040902054610b509084908490613923565b600080600061142285613391565b9150915060008061143286613391565b91509150818414801561144457508083145b979650505050505050565b6006546040516331a9108f60e11b8152600481018490526001600160a01b0390911690636352211e90602401602060405180830381865afa9250505080156114b4575060408051601f3d908101601f191682019092526114b1918101906151b2565b60015b61159e576114c06151cf565b806308c379a00361159257506114d46151eb565b806114df5750611594565b7fb08d2b0fec7cc108ab049809a8beb42779d969a49299d0c317c907d9db22974f816040516020016115119190615274565b60405160208183030381529060405280519060200120146115655760405162461bcd60e51b815260206004820152600e60248201526d24b73b30b634b2103932b0b9b7b760911b6044820152606401610d28565b61158d6115723084612c7d565b600654611588906001600160a01b031686612c7d565b6139b0565b505050565b505b3d6000803e3d6000fd5b5060405162461bcd60e51b815260206004820152600b60248201526a536869702065786973747360a81b6044820152606401610d28565b5050565b6115e1614a55565b6000600884815481106115f6576115f661501a565b6000918252602091829020015460405161163f926001600160801b039092169186910160809290921b6fffffffffffffffffffffffffffffffff19168252601082015260300190565b6040516020818303038152906040528051906020012060001c905060007f000000000000000000000000000000000000000000000000000000000000000b670de0b6b3a7640000600887815481106116995761169961501a565b600091825260209091200154600160801b90046001600160801b03166116d1856116c281615290565b965066038d7ea4c68000613aed565b6116db9190615174565b6116e5919061518b565b6116ef919061518b565b905060007f0000000000000000000000000000000000000000000000000000000000278d00670de0b6b3a76400008361173a8661172b81615290565b975066038d7ea4c68000613aed565b6117449190615174565b61174f906002615174565b611759919061518b565b611763919061518b565b905060008061179d856117986103e87f000000000000000000000000000000000000000000000000000000000007d00061518b565b613b16565b6040805160a0810182526005546001600160a01b03168152602081018890529081018690529193509150606081016117d76103e88561508a565b81526020016117e86103e88461508a565b905298975050505050505050565b60065460405163430c208160e01b81523360048201526024810184905283916001600160a01b03169063430c208190604401602060405180830381865afa158015611845573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061186991906150f6565b6118855760405162461bcd60e51b8152600401610d2890615118565b60065460009061189e906001600160a01b031685612c7d565b90506118b3816118ae3086612c7d565b613be3565b610c9381612fc8565b60065460405163430c208160e01b81523360048201526024810185905284916001600160a01b03169063430c208190604401602060405180830381865afa15801561190b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061192f91906150f6565b61194b5760405162461bcd60e51b8152600401610d2890615118565b600654610c9390611965906001600160a01b031686612c7d565b84847f0000000000000000000000000000000000000000000000000000000000000001613cc8565b611995613578565b61199f6000613f1b565b565b60606119b882846008805490506110ab9190615161565b91506119e47f000000000000000000000000000000000000000000000000000000000000000b83615174565b6001600160401b038111156119fb576119fb614ccd565b604051908082528060200260200182016040528015611a3457816020015b611a216149e4565b815260200190600190039081611a195790505b5090506000600184600880549050611a4c9190615161565b611a569190615161565b905060005b83811015611e95576000611a6f8284615161565b600083815260096020526040812054919250611a8d90839083613923565b85611ab87f000000000000000000000000000000000000000000000000000000000000000b85615174565b611ac390600061519f565b81518110611ad357611ad361501a565b6020026020010181905250611aea82600183613923565b85611b157f000000000000000000000000000000000000000000000000000000000000000b85615174565b611b2090600161519f565b81518110611b3057611b3061501a565b6020026020010181905250611b4782600283613923565b85611b727f000000000000000000000000000000000000000000000000000000000000000b85615174565b611b7d90600261519f565b81518110611b8d57611b8d61501a565b6020026020010181905250611ba482600383613923565b85611bcf7f000000000000000000000000000000000000000000000000000000000000000b85615174565b611bda90600361519f565b81518110611bea57611bea61501a565b6020026020010181905250611c0182600483613923565b85611c2c7f000000000000000000000000000000000000000000000000000000000000000b85615174565b611c3790600461519f565b81518110611c4757611c4761501a565b6020026020010181905250611c5e82600583613923565b85611c897f000000000000000000000000000000000000000000000000000000000000000b85615174565b611c9490600561519f565b81518110611ca457611ca461501a565b6020026020010181905250611cbb82600683613923565b85611ce67f000000000000000000000000000000000000000000000000000000000000000b85615174565b611cf190600661519f565b81518110611d0157611d0161501a565b6020026020010181905250611d1882600783613923565b85611d437f000000000000000000000000000000000000000000000000000000000000000b85615174565b611d4e90600761519f565b81518110611d5e57611d5e61501a565b6020026020010181905250611d7582600883613923565b85611da07f000000000000000000000000000000000000000000000000000000000000000b85615174565b611dab90600861519f565b81518110611dbb57611dbb61501a565b6020026020010181905250611dd282600983613923565b85611dfd7f000000000000000000000000000000000000000000000000000000000000000b85615174565b611e0890600961519f565b81518110611e1857611e1861501a565b6020026020010181905250611e2f82600a83613923565b85611e5a7f000000000000000000000000000000000000000000000000000000000000000b85615174565b611e6590600a61519f565b81518110611e7557611e7561501a565b602002602001018190525050508080611e8d90615290565b915050611a5b565b505092915050565b60005b815181101561158d57611ecc83838381518110611ebf57611ebf61501a565b60200260200101516121a0565b5080611ed781615290565b915050611ea0565b6006546115d590611ef9906001600160a01b031684612c7d565b611f033084612c7d565b613f77565b6000611f166103e88461505c565b9250611f246103e88361505c565b915060008212611f345781611f4a565b6103e8611f40836150da565b611f4a91906152a9565b611f576103e8600a61508a565b60008512611f655784611f7b565b6103e8611f71866150da565b611f7b91906152a9565b611f859190615174565b610b50919061519f565b600081815260096020526040812054905b7f000000000000000000000000000000000000000000000000000000000000000b81101561158d576001811b8216611fde57611fdc83826121a0565b505b80611fe881615290565b915050611fa0565b8060005b81811015610c935761201d8484838181106120115761201161501a565b90506020020135612903565b5061202781615290565b9050611ff4565b6040805180820182526000808252602091820181905293845260028152818420928452918252918290208251808401909352546001600160801b0381168352600160801b9004600f0b9082015290565b6060816001600160401b0381111561209857612098614ccd565b6040519080825280602002602001820160405280156120cb57816020015b60608152602001906001900390816120b65790505b50905060005b8281101561216b5761213b308585848181106120ef576120ef61501a565b905060200281019061210191906152c9565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061412b92505050565b82828151811061214d5761214d61501a565b6020026020010181905250808061216390615290565b9150506120d1565b5092915050565b600090815260208190526040902054600160f01b900460ff1690565b6115d561219b8383612c7d565b6135d9565b60085460009083106121e95760405162461bcd60e51b8152602060048201526012602482015271125b9d985b1a5908195b5a5cdcda5bdb925960721b6044820152606401610d28565b7f000000000000000000000000000000000000000000000000000000000000000b82106122485760405162461bcd60e51b815260206004820152600d60248201526c092dcecc2d8d2c840d2dcc8caf609b1b6044820152606401610d28565b6122528383610b39565b156122945760405162461bcd60e51b8152602060048201526012602482015271105b1c9958591e481a59195b9d1a599a595960721b6044820152606401610d28565b600083815260096020526040902080546001841b179055610b506122b884846115d9565b614150565b600454610100900460ff16158080156122dd5750600454600160ff909116105b806122f75750303b1580156122f7575060045460ff166001145b61235a5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610d28565b6004805460ff19166001179055801561237d576004805461ff0019166101001790555b600580546001600160a01b038087166001600160a01b0319928316179092556006805486841690831617905560078054928516929091169190911790556123c56122b8612501565b506123cf33613f1b565b8015610c93576004805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a150505050565b6007546001600160a01b0316331461245f5760405162461bcd60e51b815260206004820152600860248201526709edcd8f240e6c4d60c31b6044820152606401610d28565b604080518082019091526001600160801b0392831681529082166020820190815260088054600181018255600091909152915190518316600160801b029216919091177ff3f7a9fe364faab93b216da50a3214154f22a0a2b415b23a84c8169e8b636ee390910155565b60006124d58484610b39565b6124ea576124e384846121a0565b90506124f7565b6124f48484614203565b90505b610c938282611207565b612509614a55565b60065460405163137f41fb60e11b8152670de0b6b3a764000060048201526000916001600160a01b0316906326fe83f690602401602060405180830381865afa15801561255a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061257e9190615148565b61258a906107d0615174565b6040805160a081019091526005546001600160a01b03168152909150602081016125b5836064615174565b81526020016125e47f0000000000000000000000000000000000000000000000000000000000278d008461518b565b815260200160008152602001600081525091505090565b6008818154811061260b57600080fd5b6000918252602090912001546001600160801b038082169250600160801b9091041682565b606061264782846008805490506110ab9190615161565b9150816001600160401b0381111561266157612661614ccd565b6040519080825280602002602001820160405280156126a657816020015b604080518082019091526000808252602082015281526020019060019003908161267f5790505b50905060006001846008805490506126be9190615161565b6126c89190615161565b905060005b83811015611e955760086126e18284615161565b815481106126f1576126f161501a565b6000918252602091829020604080518082019091529101546001600160801b038082168352600160801b9091041691810191909152835184908390811061273a5761273a61501a565b6020026020010181905250808061275090615290565b9150506126cd565b612760613578565b600780546001600160a01b0319166001600160a01b0392909216919091179055565b60607f000000000000000000000000000000000000000000000000000000000000000b6001600160401b038111156127bc576127bc614ccd565b6040519080825280602002602001820160405280156127f557816020015b6127e2614a55565b8152602001906001900390816127da5790505b50905060005b7f000000000000000000000000000000000000000000000000000000000000000b81101561285d5761282d83826115d9565b82828151811061283f5761283f61501a565b6020026020010181905250808061285590615290565b9150506127fb565b50919050565b61286b613578565b600680546001600160a01b0319166001600160a01b0392909216919091179055565b612895613578565b6001600160a01b0381166128fa5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d28565b61120481613f1b565b6040805160a08101825260008082526020820181905291810182905260608101829052608081019190915250600081815260016020818152604092839020835160a08101855281546001600160801b0380821683526001600160401b03600160801b8084048216968501879052600160c01b90930416968301969096529190930154808516606085015204909216608082015290421115612b695760608101516001600160801b031615612a9c57600081602001516001600160401b0316426129cc9190615161565b90506000612a3b83604001516001600160401b0316836129ec9190615174565b608085015160008781526003602052604090819020549051631398fee160e31b8152600481018990526001600160801b03909216916001600160a01b0390911690639cc7f70890602401611060565b90508083608001818151612a4f919061530f565b6001600160801b039081169091526060850151169050612a7464e8d4a5100083615174565b612a7e919061518b565b83518490612a8d90839061530f565b6001600160801b031690525050505b6001600160401b03428116602083810191825260008581526001808352604091829020865181549551848901518816600160c01b026001600160c01b0391909816600160801b8181026001600160c01b03199099166001600160801b0394851690811799909917929092169890981783556060808a015160808b0151841690920291909216908117929093019190915582519586529285015283019190915283917fec4a9a305ed16b1675f19bff6fbc6252ba69985b3faad56dbd67dc47b2a0480f910160405180910390a25b919050565b60065460405163430c208160e01b81523360048201526024810186905285916001600160a01b03169063430c208190604401602060405180830381865afa158015612bbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612be191906150f6565b612bfd5760405162461bcd60e51b8152600401610d2890615118565b600654600090612c16906001600160a01b031687612c7d565b90506000612c243087612c7d565b9050612c308282612c96565b612c3f8282610d73848661202e565b612c4882612fc8565b612c748286867f0000000000000000000000000000000000000000000000000000000000000001613cc8565b50505050505050565b60609190911b6bffffffffffffffffffffffff19161790565b612c9f82612172565b612cd85760405162461bcd60e51b815260206004820152600a602482015269139bdd08191bd8dad95960b21b6044820152606401610d28565b612ce28183611414565b6115d55760405162461bcd60e51b815260206004820152600f60248201526e4e6f7420646f636b6564206865726560881b6044820152606401610d28565b6000612d2b83612903565b6000848152600260209081526040808320888452909152812082518154939450909264e8d4a5100091612d6a916001600160801b039182169116615174565b612d74919061518b565b8254909150600090612d9090600160801b9004600f0b836150ba565b845190915064e8d4a5100090612daf906001600160801b031687615174565b612db9919061518b565b612dc390836150ba565b83546001600160801b03918216600160801b02908216818117865587928692600092612df2928692161761532f565b82546101009290920a6001600160801b03818102199093169183160217909155600088815260016020819052604082200180548994509092612e369185911661532f565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550806001600088815260200190815260200160002060010160108282829054906101000a90046001600160801b0316612e92919061532f565b82546001600160801b039182166101009390930a92830291909202199091161790555060008681526003602052604090819020549051630310ed7f60e41b81526004810188905260248101899052604481018390526001600160a01b039091169063310ed7f0906064016020604051808303816000875af1158015612f1b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f3f91906150f6565b50612f4986614224565b85877fea60e598f902d5beafc44ccc67bba328a4fe00e698d6e26b558b651ebcc7437d87604051612f7c91815260200190565b60405180910390a385877f74e86a761791746cd52a08e3196ef8180505d5469ab6fa728b9a88ceb9e2948583604051612fb791815260200190565b60405180910390a350505050505050565b600081815260208190526040808220805460ff60f01b191690555182917ff27b6ce5b2f5e68ddb2fd95a8a909d4ecf1daaac270935fff052feacb24f184291a250565b600061301683612903565b6000848152600260209081526040808320888452909152902081519192509064e8d4a510009061304f906001600160801b031685615174565b613059919061518b565b81548290601090613075908490600160801b9004600f0b61534f565b82546101009290920a6001600160801b03818102199093169183160217909155825485925083916000916130ab9185911661532f565b82546101009290920a6001600160801b038181021990931691831602179091556000868152600160208190526040822001805487945090926130ef9185911661532f565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555061311c84614224565b83857fea60e598f902d5beafc44ccc67bba328a4fe00e698d6e26b558b651ebcc7437d8560405161314f91815260200190565b60405180910390a35050505050565b600061316983612903565b60008481526003602052604090819020549051631398fee160e31b8152600481018690529192506001600160a01b031690639cc7f70890602401602060405180830381865afa1580156131c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131e49190615148565b64e8d4a5100082600001516001600160801b031683606001516001600160801b03166132109190615174565b61321a919061518b565b106132575760405162461bcd60e51b815260206004820152600d60248201526c135a5b994819195c1b195d1959609a1b6044820152606401610d28565b6000838152600260209081526040808320878452909152812080549091849183919061328d9084906001600160801b031661530f565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555064e8d4a5100082600001516001600160801b0316846132d09190615174565b6132da919061518b565b815482906010906132f6908490600160801b9004600f0b61537c565b82546101009290920a6001600160801b0381810219909316918316021790915560008681526001602081905260408220018054879450909261333a9185911661530f565b92506101000a8154816001600160801b0302191690836001600160801b0316021790555083857f605db19fa369dc40d69a9ab9234c0f0ab1e8545706eb74f9f20d81cd74546b3e8560405161314f91815260200190565b600081815260208181526040808320815160e0810183529054600481810b8352600160281b8204810b94830194909452600160501b8104840b92820192909252600160781b820490920b6060830152600160a01b810464ffffffffff90811660808401819052600160c81b830490911660a0840152600160f01b90910460ff16151560c08301528291908203613438578051602090910151600491820b95910b9350915050565b6000613462826000015160040b836020015160040b846040015160040b856060015160040b61350c565b90506000826080015164ffffffffff168360a0015164ffffffffff16426134899190615161565b6134939190615174565b90508181106134b85750506040810151606090910151600491820b95910b9350915050565b6134ff836000015160040b846020015160040b856040015160040b866060015160040b8686670de0b6b3a76400006134f09190615174565b6134fa919061518b565b6142e3565b9097909650945050505050565b6000613557600261352561352087866150ba565b614358565b61352f919061548d565b600261353e61352089886150ba565b613548919061548d565b613552919061519f565b61436f565b90505b949350505050565b60008183106135715781610b50565b5090919050565b6004546001600160a01b036201000090910416331461199f5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d28565b6000806135e583613391565b60008581526020818152604091829020825160e0810184529054600481810b8352600160281b8204810b93830193909352600160501b8104830b938201849052600160781b810490920b6060820152600160a01b820464ffffffffff9081166080830152600160c81b83041660a0820152600160f01b90910460ff16151560c0820152929450909250831480156136825750806060015160040b82145b1561368f57600060808201525b82816000019060040b908160040b8152505081816020019060040b908160040b81525050428160a0019064ffffffffff16908164ffffffffff16815250508060008086815260200190815260200160002060008201518160000160006101000a81548164ffffffffff021916908360040b64ffffffffff16021790555060208201518160000160056101000a81548164ffffffffff021916908360040b64ffffffffff160217905550604082015181600001600a6101000a81548164ffffffffff021916908360040b64ffffffffff160217905550606082015181600001600f6101000a81548164ffffffffff021916908360040b64ffffffffff16021790555060808201518160000160146101000a81548164ffffffffff021916908364ffffffffff16021790555060a08201518160000160196101000a81548164ffffffffff021916908364ffffffffff16021790555060c082015181600001601e6101000a81548160ff021916908315150217905550905050837fc2b72a72b829e54e1994275116751ed5670843cf738bf226f3b86ad28935cdb0848484604001518560600151866080015142604051613879969594939291909586526020860194909452600492830b6040860152910b606084015264ffffffffff16608083015260a082015260c00190565b60405180910390a250505050565b600081815260208190526040902054600160a01b900464ffffffffff16156138da5760405162461bcd60e51b81526020600482015260066024820152654d6f76696e6760d01b6044820152606401610d28565b600081815260208190526040808220805460ff60f01b1916600160f01b1790555182917f032bc66be43dbccb7487781d168eb7bda224628a3b2c3388bdf69b532a3a161191a250565b61392b6149e4565b600061393785856115d9565b9050600061394d82606001518360800151611f08565b90506040518060c00160405280828152602001876001600160801b031681526020018663ffffffff16815260200161398a86886001901b16151590565b151581526020018381526020016139a461046a3085612c7d565b90529695505050505050565b600082815260026020908152604080832084845282528083208151808301835290546001600160801b03808216808452600160801b909204600f0b838601528786526001948590529285209093018054919490929091613a129185911661532f565b82546101009290920a6001600160801b03818102199093169183160217909155602083810151600087815260019092526040909120548451600f9290920b935064e8d4a5100092613a67929181169116615174565b613a71919061518b565b613a7b91906150ba565b6000848152600160208190526040909120018054601090613aad908490600160801b90046001600160801b031661532f565b82546001600160801b039182166101009390930a928302919092021990911617905550506000918252600260209081526040808420928452919052812055565b60006002613b0c613b0685670de0b6b3a764000061445e565b84614497565b610b50919061518b565b60008083604051602001613b2c91815260200190565b60408051601f198184030181529190528051602090910120600181019450600090613b57908561445e565b60010190506000670de0b6b3a7640000613b7f87806001019850671bc16d674ec8000061445e565b0390506000613ba08283026ec097ce7bc90715b34b9f10000000000361436f565b9050670de0b6b3a7640000828402059450670de0b6b3a7640000818402059350613bcb87600261445e565b600003613bd9578360000393505b5050509250929050565b60008181526002602090815260408083208584528252808320805485855260019384905291909320909101546001600160801b0391821691168111613c715760008381526001602081905260408220018054839290613c4c9084906001600160801b031661532f565b92506101000a8154816001600160801b0302191690836001600160801b031602179055505b60008381526002602090815260408083208784528252808320929092559051828152849186917ffb493172de738b8709e302a0c98e1493db5c2216b76248dac8f1b6f70851128b910160405180910390a350505050565b600084815260208190526040902054600160f01b900460ff1615613d175760405162461bcd60e51b8152602060048201526006602482015265131bd8dad95960d21b6044820152606401610d28565b600080613d2386613391565b915091506040518060e001604052808360040b81526020018260040b81526020018660040b81526020018560040b81526020018464ffffffffff1681526020014264ffffffffff1681526020016000151581525060008088815260200190815260200160002060008201518160000160006101000a81548164ffffffffff021916908360040b64ffffffffff16021790555060208201518160000160056101000a81548164ffffffffff021916908360040b64ffffffffff160217905550604082015181600001600a6101000a81548164ffffffffff021916908360040b64ffffffffff160217905550606082015181600001600f6101000a81548164ffffffffff021916908360040b64ffffffffff16021790555060808201518160000160146101000a81548164ffffffffff021916908364ffffffffff16021790555060a08201518160000160196101000a81548164ffffffffff021916908364ffffffffff16021790555060c082015181600001601e6101000a81548160ff021916908315150217905550905050857fb5597581fb670ec8e458e332014b85e275c9e16f2f9515b880828f1bd69314d0838388888842604051613f0b96959493929190958652602086019490945260408501929092526060840152608083015260a082015260c00190565b60405180910390a2505050505050565b600480546001600160a01b038381166201000081810262010000600160b01b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000613f8282612903565b6000838152600260209081526040808320878452909152812082518154939450909264e8d4a5100091613fc1916001600160801b039182169116615174565b613fcb919061518b565b8254909150600090613fe790600160801b9004600f0b836150ba565b83546001600160801b03808516600160801b90810292821692909217865560008881526001602081905260409091200180549394508493909260109261403192869290041661532f565b82546001600160801b039182166101009390930a92830291909202199091161790555060008581526003602052604090819020549051630310ed7f60e41b81526004810187905260248101889052604481018390526001600160a01b039091169063310ed7f0906064016020604051808303816000875af11580156140ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140de91906150f6565b506140e885614224565b84867f74e86a761791746cd52a08e3196ef8180505d5469ab6fa728b9a88ceb9e294858360405161411b91815260200190565b60405180910390a3505050505050565b6060610b5083836040518060600160405280602781526020016154c4602791396144c7565b600061416482606001518360800151611f08565b905060006141723083612c7d565b83516020850151604051630d9778e560e11b81526004810184905260248101919091529192506001600160a01b031690631b2ef1ca90604401600060405180830381600087803b1580156141c557600080fd5b505af11580156141d9573d6000803e3d6000fd5b505050506141f08184606001518560800151614535565b61285d818460000151856040015161468d565b60008061421084846115d9565b905061355a81606001518260800151611f08565b60008181526003602052604090819020549051631398fee160e31b81526004810183905266038d7ea4c68000916001600160a01b031690639cc7f70890602401602060405180830381865afa158015614281573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142a59190615148565b1080156142d557506000818152600160208190526040909120015466038d7ea4c680006001600160801b03909116105b15611204576112048161485a565b600080670de0b6b3a7640000836142fa89886150ba565b614304919061508a565b61430e919061505c565b61431890886152a9565b670de0b6b3a76400008461432c89886150ba565b614336919061508a565b614340919061505c565b61434a90886152a9565b915091509550959350505050565b60008082121561436b5781600003610b53565b5090565b60008160000361438157506000919050565b6000600161438e846148b2565b901c6001901b905060018184816143a7576143a7615030565b048201901c905060018184816143bf576143bf615030565b048201901c905060018184816143d7576143d7615030565b048201901c905060018184816143ef576143ef615030565b048201901c9050600181848161440757614407615030565b048201901c9050600181848161441f5761441f615030565b048201901c9050600181848161443757614437615030565b048201901c90506144578182858161445157614451615030565b04613562565b9392505050565b6000818360405160200161447491815260200190565b6040516020818303038152906040528051906020012060001c610b50919061549c565b6000610b506144a6848461519f565b61355290760a70c3c40a64e6c51999090b65f67d924000000000000061518b565b6060600080856001600160a01b0316856040516144e49190615274565b600060405180830381855af49150503d806000811461451f576040519150601f19603f3d011682016040523d82523d6000602084013e614524565b606091505b509150915061112586838387614946565b6040805160e081018252600484810b8083529084900b6020808401828152848601938452606085019283526000608086018181524264ffffffffff90811660a0890190815260c089018481528d85529584905292899020975188549451975196519251935195511515600160f01b0260ff60f01b19968316600160c81b0264ffffffffff60c81b19958416600160a01b029590951669ffffffffffffffffffff60a01b19948416600160781b0264ffffffffff60781b19998516600160501b029990991669ffffffffffffffffffff60501b199a8516600160281b0269ffffffffffffffffffff19909816939094169290921795909517979097161794909417939093169390931791909117161790555183907fc436d211465bf21c221b75f4553f01fc9f0a1c4ead04308064c71a868a598e93906146809085908590918252602082015260400190565b60405180910390a2505050565b600083815260016020526040902054600160801b90046001600160401b0316156146ef5760405162461bcd60e51b81526020600482015260136024820152724d696e6520616c72656164792065786973747360681b6044820152606401610d28565b6040805160a0810182526000808252426001600160401b03908116602080850191825286831685870190815260608601858152608087018681528b8752600180855289882098518954965194516001600160801b039182166001600160c01b031990981697909717600160801b9589168602176001600160c01b0316600160c01b979098169690960296909617885590519051908416931602919091179390910192909255600390915281902080546001600160a01b0319166001600160a01b0385169081179091559051631398fee160e31b81526004810185905284907f99c179fd67e39ab9893328cef67f170cab6b52bc55495277389f4e10f43144c99084908490639cc7f70890602401602060405180830381865afa158015614819573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061483d9190615148565b6040805192835260208301919091520160405180910390a3505050565b60008181526001602081815260408084208481559092018390556003905280822080546001600160a01b03191690555182917fa82ccc89e3370925dca7b35d9962409ba3fc37a1e6b89747aa9ec2c2dc31581491a250565b600080608083901c156148c757608092831c92015b604083901c156148d957604092831c92015b602083901c156148eb57602092831c92015b601083901c156148fd57601092831c92015b600883901c1561490f57600892831c92015b600483901c1561492157600492831c92015b600283901c1561493357600292831c92015b600183901c15610b535760010192915050565b606083156149b55782516000036149ae576001600160a01b0385163b6149ae5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d28565b508161355a565b61355a83838151156149ca5781518083602001fd5b8060405162461bcd60e51b8152600401610d2891906154b0565b6040518060c001604052806000815260200160006001600160801b03168152602001600063ffffffff168152602001600015158152602001614a24614a55565b81526040805160a0810182526000808252602082810182905292820181905260608201819052608082015291015290565b6040518060a0016040528060006001600160a01b03168152602001600081526020016000815260200160008152602001600081525090565b60008060408385031215614aa057600080fd5b50508035926020909101359150565b600060208284031215614ac157600080fd5b5035919050565b60408101610b53828480516001600160801b03908116835260209182015116910152565b6001600160801b0380825116835260208201516001600160401b0380821660208601528060408501511660408601525050806060830151166060840152806080830151166080840152505050565b60a08101610b538284614aec565b600080600060608486031215614b5d57600080fd5b505081359360208301359350604090920135919050565b6001600160a01b038116811461120457600080fd5b60008060408385031215614b9c57600080fd5b8235614ba781614b74565b946020939093013593505050565b80516001600160a01b03168252602080820151908301526040808201519083015260608082015190830152608090810151910152565b805182526001600160801b03602082015116602083015263ffffffff60408201511660408301526060810151151560608301526080810151614c306080840182614bb5565b5060a081015161158d610120840182614aec565b6101c08101610b538284614beb565b600060208284031215614c6557600080fd5b813561445781614b74565b60a08101610b538284614bb5565b6020808252825182820181905260009190848201906040850190845b81811015614cc157614cad838551614beb565b928401926101c09290920191600101614c9a565b50909695505050505050565b634e487b7160e01b600052604160045260246000fd5b601f8201601f191681016001600160401b0381118282101715614d0857614d08614ccd565b6040525050565b60008060408385031215614d2257600080fd5b823591506020808401356001600160401b0380821115614d4157600080fd5b818601915086601f830112614d5557600080fd5b813581811115614d6757614d67614ccd565b8060051b9150604051614d7c85840182614ce3565b81815291830184019184810189841115614d9557600080fd5b938501935b83851015614db15784358152938501938501614d9a565b5080955050505050509250929050565b60008083601f840112614dd357600080fd5b5081356001600160401b03811115614dea57600080fd5b6020830191508360208260051b850101111561114957600080fd5b60008060208385031215614e1857600080fd5b82356001600160401b03811115614e2e57600080fd5b614e3a85828601614dc1565b90969095509350505050565b60005b83811015614e61578181015183820152602001614e49565b50506000910152565b60008151808452614e82816020860160208601614e46565b601f01601f19169290920160200192915050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b82811015614eeb57603f19888603018452614ed9858351614e6a565b94509285019290850190600101614ebd565b5092979650505050505050565b600080600060608486031215614f0d57600080fd5b8335614f1881614b74565b92506020840135614f2881614b74565b91506040840135614f3881614b74565b809150509250925092565b602080825282518282018190526000919060409081850190868401855b82811015614f9957614f8984835180516001600160801b03908116835260209182015116910152565b9284019290850190600101614f60565b5091979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015614cc157614fd5838551614bb5565b9284019260a09290920191600101614fc2565b60008060008060808587031215614ffe57600080fd5b5050823594602084013594506040840135936060013592509050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b60008261506b5761506b615030565b600160ff1b82146000198414161561508557615085615046565b500590565b80820260008212600160ff1b841416156150a6576150a6615046565b8181058314821517610b5357610b53615046565b818103600083128015838313168383128216171561216b5761216b615046565b6000600160ff1b82016150ef576150ef615046565b5060000390565b60006020828403121561510857600080fd5b8151801515811461445757600080fd5b60208082526016908201527527b7363c9030b8383937bb32b21037b91037bbb732b960511b604082015260600190565b60006020828403121561515a57600080fd5b5051919050565b81810381811115610b5357610b53615046565b8082028115828204841417610b5357610b53615046565b60008261519a5761519a615030565b500490565b80820180821115610b5357610b53615046565b6000602082840312156151c457600080fd5b815161445781614b74565b600060033d11156151e85760046000803e5060005160e01c5b90565b600060443d10156151f95790565b6040516003193d81016004833e81513d6001600160401b03816024840111818411171561522857505050505090565b82850191508151818111156152405750505050505090565b843d870101602082850101111561525a5750505050505090565b61526960208286010187614ce3565b509095945050505050565b60008251615286818460208701614e46565b9190910192915050565b6000600182016152a2576152a2615046565b5060010190565b8082018281126000831280158216821582161715611e9557611e95615046565b6000808335601e198436030181126152e057600080fd5b8301803591506001600160401b038211156152fa57600080fd5b60200191503681900382131561114957600080fd5b6001600160801b0381811683821601908082111561216b5761216b615046565b6001600160801b0382811682821603908082111561216b5761216b615046565b600f82810b9082900b0360016001607f1b0319811260016001607f1b0382131715610b5357610b53615046565b600f81810b9083900b0160016001607f1b03811360016001607f1b031982121715610b5357610b53615046565b600181815b808511156153e45781600019048211156153ca576153ca615046565b808516156153d757918102915b93841c93908002906153ae565b509250929050565b6000826153fb57506001610b53565b8161540857506000610b53565b816001811461541e576002811461542857615444565b6001915050610b53565b60ff84111561543957615439615046565b50506001821b610b53565b5060208310610133831016604e8410600b8410161715615467575081810a610b53565b61547183836153a9565b806000190482111561548557615485615046565b029392505050565b6000610b5060ff8416836153ec565b6000826154ab576154ab615030565b500690565b602081526000610b506020830184614e6a56fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a2646970667358221220d76454c2203906e35e794f2a2b800371509040d861eae6c7b6169e2b976da20464736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000000b0000000000000000000000000000000000000000000000000000000000278d00000000000000000000000000000000000000000000000000000000000007d0000000000000000000000000000000000000000000000000000000000000000001
-----Decoded View---------------
Arg [0] : asteroidsPerEmission (uint256): 11
Arg [1] : maxDepletionInterval (uint256): 2592000
Arg [2] : maxRadius (uint256): 512000
Arg [3] : speed (uint256): 1
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000000000000000000000000000000000b
Arg [1] : 0000000000000000000000000000000000000000000000000000000000278d00
Arg [2] : 000000000000000000000000000000000000000000000000000000000007d000
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000001
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.