Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 16,563 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
Finalize Scan | 19409830 | 120 days ago | IN | 0 ETH | 0.00316019 | ||||
Start Scan | 19409817 | 120 days ago | IN | 0 ETH | 0.00164038 | ||||
Finalize Scan | 17793680 | 346 days ago | IN | 0 ETH | 0.00256134 | ||||
Start Scan | 17793674 | 346 days ago | IN | 0 ETH | 0.00141822 | ||||
Finalize Scan | 17792808 | 346 days ago | IN | 0 ETH | 0.00835231 | ||||
Start Scan | 17792722 | 346 days ago | IN | 0 ETH | 0.00748591 | ||||
Finalize Scan | 17777753 | 348 days ago | IN | 0 ETH | 0.00327174 | ||||
Start Scan | 17777728 | 348 days ago | IN | 0 ETH | 0.00173355 | ||||
Finalize Scan | 17777722 | 348 days ago | IN | 0 ETH | 0.00358215 | ||||
Start Scan | 17777586 | 348 days ago | IN | 0 ETH | 0.00119133 | ||||
Finalize Scan | 17777580 | 348 days ago | IN | 0 ETH | 0.00227363 | ||||
Start Scan | 17777569 | 348 days ago | IN | 0 ETH | 0.00123755 | ||||
Finalize Scan | 17777244 | 348 days ago | IN | 0 ETH | 0.00225485 | ||||
Start Scan | 17777236 | 348 days ago | IN | 0 ETH | 0.00096313 | ||||
Start Scan | 17766109 | 350 days ago | IN | 0 ETH | 0.00103256 | ||||
Finalize Scan | 17765939 | 350 days ago | IN | 0 ETH | 0.00177981 | ||||
Start Scan | 17765933 | 350 days ago | IN | 0 ETH | 0.00094297 | ||||
Finalize Scan | 17765346 | 350 days ago | IN | 0 ETH | 0.00290504 | ||||
Start Scan | 17765337 | 350 days ago | IN | 0 ETH | 0.0015918 | ||||
Finalize Scan | 17706623 | 358 days ago | IN | 0 ETH | 0.00137074 | ||||
Start Scan | 17706618 | 358 days ago | IN | 0 ETH | 0.00070169 | ||||
Finalize Scan | 17681417 | 362 days ago | IN | 0 ETH | 0.00125394 | ||||
Start Scan | 17681411 | 362 days ago | IN | 0 ETH | 0.00073652 | ||||
Finalize Scan | 17638247 | 368 days ago | IN | 0 ETH | 0.00337438 | ||||
Start Scan | 17638238 | 368 days ago | IN | 0 ETH | 0.00200796 |
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers. Name tag integration is not available in advanced view.
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | Value | |||
---|---|---|---|---|---|---|---|
20261435 | 24 hrs ago | 0 ETH | |||||
20261435 | 24 hrs ago | 0 ETH | |||||
20261435 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH | |||||
20261410 | 24 hrs ago | 0 ETH |
Loading...
Loading
This contract contains unverified libraries: Procedural
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:
AsteroidScans
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
No with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.7.6; import "@openzeppelin/contracts/utils/Pausable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./lib/InfluenceSettings.sol"; import "./lib/Procedural.sol"; import "./interfaces/IAsteroidToken.sol"; import "./interfaces/IAsteroidFeatures.sol"; /** * @dev Contract that generates randomized perks based on when the asteroid is "scanned" by its owner. Perks * are specific to certain types of asteroids, have varying degrees of rarity and can stack. */ contract AsteroidScans is Pausable, Ownable { using Procedural for bytes32; IAsteroidToken internal token; IAsteroidFeatures internal features; // Mapping indicating allowed managers mapping (address => bool) private _managers; /** * @dev This is a bit-packed set of: * << 0: the order purchased for scan boosts * << 64: Bit-packed number with 15 bits. The first indicates whether the asteroid * has been scanned, with the remainder pertaining to specific bonuses. * << 128: The block number to use for the randomization hash */ mapping (uint => uint) internal scanInfo; /** * @dev Tracks the scan order to manage awarding early boosts to bonuses */ uint public scanOrderCount = 0; event ScanStarted(uint indexed asteroidId); event AsteroidScanned(uint indexed asteroidId, uint bonuses); constructor(IAsteroidToken _token, IAsteroidFeatures _features) { token = _token; features = _features; } // Modifier to check if calling contract has the correct minting role modifier onlyManagers { require(isManager(_msgSender()), "Only managers can call this function"); _; } /** * @dev Add a new account / contract that can mint / burn asteroids * @param _manager Address of the new manager */ function addManager(address _manager) external onlyOwner { _managers[_manager] = true; } /** * @dev Remove a current manager * @param _manager Address of the manager to be removed */ function removeManager(address _manager) external onlyOwner { _managers[_manager] = false; } /** * @dev Checks if an address is a manager * @param _manager Address of contract / account to check */ function isManager(address _manager) public view returns (bool) { return _managers[_manager]; } /** * @dev Sets the order the asteroid should receive boosts to bonuses * @param _asteroidId The ERC721 token ID of the asteroid */ function recordScanOrder(uint _asteroidId) external onlyManagers { scanOrderCount += 1; scanInfo[_asteroidId] = scanOrderCount; } /** * @dev Returns the scan order for managing boosts for a particular asteroid * @param _asteroidId The ERC721 token ID of the asteroid */ function getScanOrder(uint _asteroidId) external view returns(uint) { return uint(uint64(scanInfo[_asteroidId])); } /** * @dev Method to pre-scan a set of asteroids to be offered during pre-sale. This method may only be run * before any sale purchases have been made. * @param _asteroidIds An array of asteroid ERC721 token IDs * @param _bonuses An array of bit-packed bonuses corresponding to _asteroidIds */ function setInitialBonuses(uint[] calldata _asteroidIds, uint[] calldata _bonuses) external onlyOwner { require(scanOrderCount == 0); require(_asteroidIds.length == _bonuses.length); for (uint i = 0; i < _asteroidIds.length; i++) { scanInfo[_asteroidIds[i]] |= _bonuses[i] << 64; emit AsteroidScanned(_asteroidIds[i], _bonuses[i]); } } /** * @dev Starts the scan and defines the future blockhash to use for * @param _asteroidId The ERC721 token ID of the asteroid */ function startScan(uint _asteroidId) external whenNotPaused { require(token.ownerOf(_asteroidId) == _msgSender(), "Only owner can scan asteroid"); require(uint(uint64(scanInfo[_asteroidId] >> 64)) == 0, "Asteroid has already been scanned"); require(uint(uint64(scanInfo[_asteroidId] >> 128)) == 0, "Asteroid scanning has already started"); scanInfo[_asteroidId] |= (block.number + 1) << 128; emit ScanStarted(_asteroidId); } /** * @dev Returns a set of 0 or more perks for the asteroid randomized by time / owner address * @param _asteroidId The ERC721 token ID of the asteroid */ function finalizeScan(uint _asteroidId) external whenNotPaused { uint blockForHash = uint(uint64(scanInfo[_asteroidId] >> 128)); require(uint(uint64(scanInfo[_asteroidId] >> 64)) == 0, "Asteroid has already been scanned"); require(blockForHash != block.number && blockForHash > 0, "Must wait at least one block after starting"); // Capture the bonuses bitpacked into a uint. The first bit is set to indicate the asteroid has been scanned. uint bonuses = 1; uint purchaseOrder = uint(uint64(scanInfo[_asteroidId])); uint bonusTest; bytes32 seed = features.getAsteroidSeed(_asteroidId); uint spectralType = features.getSpectralTypeBySeed(seed); // Add some randomness to the bonuses outcome uint bhash = uint(blockhash(blockForHash)); // bhash == 0 if we're later than 256 blocks after startScan, this will default to no bonus if (bhash != 0) { seed = seed.derive(bhash); // Array of possible bonuses (0 or 1) per spectral type (same order as spectral types in AsteroidFeatures) uint8[6][11] memory bonusRates = [ [ 1, 1, 0, 1, 0, 0 ], [ 1, 1, 1, 1, 0, 1 ], [ 1, 1, 0, 1, 0, 0 ], [ 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1 ], [ 1, 1, 1, 1, 1, 1 ], [ 1, 0, 1, 0, 1, 1 ], [ 1, 0, 1, 0, 1, 1 ], [ 1, 1, 1, 0, 1, 1 ], [ 1, 0, 1, 0, 0, 1 ], [ 1, 1, 0, 0, 0, 0 ] ]; // Boosts the bonus chances based on early scan tranches int128 rollMax = 10001; if (purchaseOrder < 100) { rollMax = 3441; // 4x increase } else if (purchaseOrder < 1100) { rollMax = 4143; // 3x increase } else if (purchaseOrder < 11100) { rollMax = 5588; // 2x increase } // Loop over the possible bonuses for the spectral class for (uint i = 0; i < 6; i++) { // Handles the case for regular bonuses if (i < 4 && bonusRates[spectralType][i] == 1) { bonusTest = uint(seed.derive(i).getIntBetween(0, rollMax)); if (bonusTest <= 2100) { if (bonusTest > 600) { bonuses = bonuses | (1 << (i * 3 + 1)); // Tier 1 regular bonus (15% of asteroids) } else if (bonusTest > 100) { bonuses = bonuses | (1 << (i * 3 + 2)); // Tier 2 regular bonus (5% of asteroids) } else { bonuses = bonuses | (1 << (i * 3 + 3)); // Tier 3 regular bonus (1% of asteroids) } } } // Handle the case for the special bonuses if (i >= 4 && bonusRates[spectralType][i] == 1) { bonusTest = uint(seed.derive(i).getIntBetween(0, rollMax)); if (bonusTest <= 250) { bonuses = bonuses | (1 << (i + 9)); // Single tier special bonus (2.5% of asteroids) } } } // Guarantees at least a level 1 yield bonus for the early adopters if (purchaseOrder < 11100 && bonuses == 1) { bonuses = 3; } } scanInfo[_asteroidId] |= bonuses << 64; emit AsteroidScanned(_asteroidId, bonuses); } /** * @dev Query for the results of an asteroid scan * @param _asteroidId The ERC721 token ID of the asteroid */ function retrieveScan(uint _asteroidId) external view returns (uint) { return uint(uint64(scanInfo[_asteroidId] >> 64)); } }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.7.6; interface IAsteroidFeatures { function getAsteroidSeed(uint _asteroidId) external pure returns (bytes32); function getRadius(uint _asteroidId) external pure returns (uint); function getSpectralType(uint _asteroidId) external pure returns (uint); function getSpectralTypeBySeed(bytes32 _seed) external pure returns (uint); function getOrbitalElements(uint _asteroidId) external pure returns (uint[6] memory orbitalElements); function getOrbitalElementsBySeed(bytes32 _seed) external pure returns (uint[6] memory orbitalElements); }
// SPDX-License-Identifier: UNLICENSED pragma solidity 0.7.6; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; interface IAsteroidToken is IERC721 { function addManager(address _manager) external; function removeManager(address _manager) external; function isManager(address _manager) external view returns (bool); function mint(address _to, uint256 _tokenId) external; function burn(address _owner, uint256 _tokenId) external; }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.7.0; library InfluenceSettings { // Game constants bytes32 public constant MASTER_SEED = "influence"; uint32 public constant MAX_RADIUS = 375142; // in meters uint32 public constant START_TIMESTAMP = 1609459200; // Zero date timestamp for orbits uint public constant TOTAL_ASTEROIDS = 250000; }
// SPDX-License-Identifier: UNLICENSED // Portions licensed under NovakDistribute license (ref LICENSE file) pragma solidity ^0.7.0; import "abdk-libraries-solidity/ABDKMath64x64.sol"; library Procedural { using ABDKMath64x64 for *; /** * @dev Mix string data into a hash and return a new one. */ function derive(bytes32 _self, string memory _entropy) public pure returns (bytes32) { return sha256(abi.encodePacked(_self, _entropy)); } /** * @dev Mix signed int data into a hash and return a new one. */ function derive(bytes32 _self, int256 _entropy) public pure returns (bytes32) { return sha256(abi.encodePacked(_self, _entropy)); } /** * @dev Mix unsigned int data into a hash and return a new one. */ function derive(bytes32 _self, uint _entropy) public pure returns (bytes32) { return sha256(abi.encodePacked(_self, _entropy)); } /** * @dev Returns the base pseudorandom hash for the given RandNode. Does another round of hashing * in case an un-encoded string was passed. */ function getHash(bytes32 _self) public pure returns (bytes32) { return sha256(abi.encodePacked(_self)); } /** * @dev Get an int128 full of random bits. */ function getInt128(bytes32 _self) public pure returns (int128) { return int128(int256(getHash(_self))); } /** * @dev Get a 64.64 fixed point (see ABDK math) where: 0 <= return value < 1 */ function getReal(bytes32 _self) public pure returns (int128) { int128 fixedOne = int128(1 << 64); return getInt128(_self).abs() % fixedOne; } /** * @dev Get an integer between low, inclusive, and high, exclusive. Represented as a normal int, not a real. */ function getIntBetween(bytes32 _self, int128 _low, int128 _high) public pure returns (int64) { _low = _low.fromInt(); _high = _high.fromInt(); int128 range = _high.sub(_low); int128 result = getReal(_self).mul(range).add(_low); return result.toInt(); } /** * @dev Returns a normal int (roughly) normally distributed value between low and high */ function getNormalIntBetween(bytes32 _self, int128 _low, int128 _high) public pure returns (int64) { int128 accumulator = 0; for (uint i = 0; i < 5; i++) { accumulator += getIntBetween(derive(_self, i), _low, _high); } return accumulator.fromInt().div(5.fromUInt()).toInt(); } /** * @dev "Folds" a normal int distribution in half to generate an approx decay function * Only takes a high value (exclusive) as the simplistic approximation relies on low being zero * Returns a normal int, not a real */ function getDecayingIntBelow(bytes32 _self, uint _high) public pure returns (int64) { require(_high < uint(1 << 64)); int64 normalInt = getNormalIntBetween(_self, 0, int128(_high * 2 - 1)); int128 adjusted = int128(normalInt) - int128(_high); return adjusted.fromInt().abs().toInt(); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <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 () internal { address msgSender = _msgSender(); _owner = msgSender; emit OwnershipTransferred(address(0), msgSender); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { 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 { emit OwnershipTransferred(_owner, address(0)); _owner = 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"); emit OwnershipTransferred(_owner, newOwner); _owner = newOwner; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <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 pragma solidity >=0.6.2 <0.8.0; import "../../introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <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 GSN 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 payable) { return msg.sender; } function _msgData() internal view virtual returns (bytes memory) { this; // silence state mutability warning without generating bytecode - see https://github.com/ethereum/solidity/issues/2691 return msg.data; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor () internal { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: BSD-4-Clause /* * ABDK Math 64.64 Smart Contract Library. Copyright © 2019 by ABDK Consulting. * Author: Mikhail Vladimirov <[email protected]> */ pragma solidity ^0.5.0 || ^0.6.0 || ^0.7.0; /** * Smart contract library of mathematical functions operating with signed * 64.64-bit fixed point numbers. Signed 64.64-bit fixed point number is * basically a simple fraction whose numerator is signed 128-bit integer and * denominator is 2^64. As long as denominator is always the same, there is no * need to store it, thus in Solidity signed 64.64-bit fixed point numbers are * represented by int128 type holding only the numerator. */ library ABDKMath64x64 { /* * Minimum value signed 64.64-bit fixed point number may have. */ int128 private constant MIN_64x64 = -0x80000000000000000000000000000000; /* * Maximum value signed 64.64-bit fixed point number may have. */ int128 private constant MAX_64x64 = 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF; /** * Convert signed 256-bit integer number into signed 64.64-bit fixed point * number. Revert on overflow. * * @param x signed 256-bit integer number * @return signed 64.64-bit fixed point number */ function fromInt (int256 x) internal pure returns (int128) { require (x >= -0x8000000000000000 && x <= 0x7FFFFFFFFFFFFFFF); return int128 (x << 64); } /** * Convert signed 64.64 fixed point number into signed 64-bit integer number * rounding down. * * @param x signed 64.64-bit fixed point number * @return signed 64-bit integer number */ function toInt (int128 x) internal pure returns (int64) { return int64 (x >> 64); } /** * Convert unsigned 256-bit integer number into signed 64.64-bit fixed point * number. Revert on overflow. * * @param x unsigned 256-bit integer number * @return signed 64.64-bit fixed point number */ function fromUInt (uint256 x) internal pure returns (int128) { require (x <= 0x7FFFFFFFFFFFFFFF); return int128 (x << 64); } /** * Convert signed 64.64 fixed point number into unsigned 64-bit integer * number rounding down. Revert on underflow. * * @param x signed 64.64-bit fixed point number * @return unsigned 64-bit integer number */ function toUInt (int128 x) internal pure returns (uint64) { require (x >= 0); return uint64 (x >> 64); } /** * Convert signed 128.128 fixed point number into signed 64.64-bit fixed point * number rounding down. Revert on overflow. * * @param x signed 128.128-bin fixed point number * @return signed 64.64-bit fixed point number */ function from128x128 (int256 x) internal pure returns (int128) { int256 result = x >> 64; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } /** * Convert signed 64.64 fixed point number into signed 128.128 fixed point * number. * * @param x signed 64.64-bit fixed point number * @return signed 128.128 fixed point number */ function to128x128 (int128 x) internal pure returns (int256) { return int256 (x) << 64; } /** * Calculate x + y. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function add (int128 x, int128 y) internal pure returns (int128) { int256 result = int256(x) + y; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } /** * Calculate x - y. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function sub (int128 x, int128 y) internal pure returns (int128) { int256 result = int256(x) - y; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } /** * Calculate x * y rounding down. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function mul (int128 x, int128 y) internal pure returns (int128) { int256 result = int256(x) * y >> 64; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } /** * Calculate x * y rounding towards zero, where x is signed 64.64 fixed point * number and y is signed 256-bit integer number. Revert on overflow. * * @param x signed 64.64 fixed point number * @param y signed 256-bit integer number * @return signed 256-bit integer number */ function muli (int128 x, int256 y) internal pure returns (int256) { if (x == MIN_64x64) { require (y >= -0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF && y <= 0x1000000000000000000000000000000000000000000000000); return -y << 63; } else { bool negativeResult = false; if (x < 0) { x = -x; negativeResult = true; } if (y < 0) { y = -y; // We rely on overflow behavior here negativeResult = !negativeResult; } uint256 absoluteResult = mulu (x, uint256 (y)); if (negativeResult) { require (absoluteResult <= 0x8000000000000000000000000000000000000000000000000000000000000000); return -int256 (absoluteResult); // We rely on overflow behavior here } else { require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return int256 (absoluteResult); } } } /** * Calculate x * y rounding down, where x is signed 64.64 fixed point number * and y is unsigned 256-bit integer number. Revert on overflow. * * @param x signed 64.64 fixed point number * @param y unsigned 256-bit integer number * @return unsigned 256-bit integer number */ function mulu (int128 x, uint256 y) internal pure returns (uint256) { if (y == 0) return 0; require (x >= 0); uint256 lo = (uint256 (x) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64; uint256 hi = uint256 (x) * (y >> 128); require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); hi <<= 64; require (hi <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF - lo); return hi + lo; } /** * Calculate x / y rounding towards zero. Revert on overflow or when y is * zero. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function div (int128 x, int128 y) internal pure returns (int128) { require (y != 0); int256 result = (int256 (x) << 64) / y; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } /** * Calculate x / y rounding towards zero, where x and y are signed 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x signed 256-bit integer number * @param y signed 256-bit integer number * @return signed 64.64-bit fixed point number */ function divi (int256 x, int256 y) internal pure returns (int128) { require (y != 0); bool negativeResult = false; if (x < 0) { x = -x; // We rely on overflow behavior here negativeResult = true; } if (y < 0) { y = -y; // We rely on overflow behavior here negativeResult = !negativeResult; } uint128 absoluteResult = divuu (uint256 (x), uint256 (y)); if (negativeResult) { require (absoluteResult <= 0x80000000000000000000000000000000); return -int128 (absoluteResult); // We rely on overflow behavior here } else { require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return int128 (absoluteResult); // We rely on overflow behavior here } } /** * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x unsigned 256-bit integer number * @param y unsigned 256-bit integer number * @return signed 64.64-bit fixed point number */ function divu (uint256 x, uint256 y) internal pure returns (int128) { require (y != 0); uint128 result = divuu (x, y); require (result <= uint128 (MAX_64x64)); return int128 (result); } /** * Calculate -x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function neg (int128 x) internal pure returns (int128) { require (x != MIN_64x64); return -x; } /** * Calculate |x|. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function abs (int128 x) internal pure returns (int128) { require (x != MIN_64x64); return x < 0 ? -x : x; } /** * Calculate 1 / x rounding towards zero. Revert on overflow or when x is * zero. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function inv (int128 x) internal pure returns (int128) { require (x != 0); int256 result = int256 (0x100000000000000000000000000000000) / x; require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } /** * Calculate arithmetics average of x and y, i.e. (x + y) / 2 rounding down. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function avg (int128 x, int128 y) internal pure returns (int128) { return int128 ((int256 (x) + int256 (y)) >> 1); } /** * Calculate geometric average of x and y, i.e. sqrt (x * y) rounding down. * Revert on overflow or in case x * y is negative. * * @param x signed 64.64-bit fixed point number * @param y signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function gavg (int128 x, int128 y) internal pure returns (int128) { int256 m = int256 (x) * int256 (y); require (m >= 0); require (m < 0x4000000000000000000000000000000000000000000000000000000000000000); return int128 (sqrtu (uint256 (m))); } /** * Calculate x^y assuming 0^0 is 1, where x is signed 64.64 fixed point number * and y is unsigned 256-bit integer number. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @param y uint256 value * @return signed 64.64-bit fixed point number */ function pow (int128 x, uint256 y) internal pure returns (int128) { uint256 absoluteResult; bool negativeResult = false; if (x >= 0) { absoluteResult = powu (uint256 (x) << 63, y); } else { // We rely on overflow behavior here absoluteResult = powu (uint256 (uint128 (-x)) << 63, y); negativeResult = y & 1 > 0; } absoluteResult >>= 63; if (negativeResult) { require (absoluteResult <= 0x80000000000000000000000000000000); return -int128 (absoluteResult); // We rely on overflow behavior here } else { require (absoluteResult <= 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return int128 (absoluteResult); // We rely on overflow behavior here } } /** * Calculate sqrt (x) rounding down. Revert if x < 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function sqrt (int128 x) internal pure returns (int128) { require (x >= 0); return int128 (sqrtu (uint256 (x) << 64)); } /** * Calculate binary logarithm of x. Revert if x <= 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function log_2 (int128 x) internal pure returns (int128) { require (x > 0); int256 msb = 0; int256 xc = x; if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; } if (xc >= 0x100000000) { xc >>= 32; msb += 32; } if (xc >= 0x10000) { xc >>= 16; msb += 16; } if (xc >= 0x100) { xc >>= 8; msb += 8; } if (xc >= 0x10) { xc >>= 4; msb += 4; } if (xc >= 0x4) { xc >>= 2; msb += 2; } if (xc >= 0x2) msb += 1; // No need to shift xc anymore int256 result = msb - 64 << 64; uint256 ux = uint256 (x) << uint256 (127 - msb); for (int256 bit = 0x8000000000000000; bit > 0; bit >>= 1) { ux *= ux; uint256 b = ux >> 255; ux >>= 127 + b; result += bit * int256 (b); } return int128 (result); } /** * Calculate natural logarithm of x. Revert if x <= 0. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function ln (int128 x) internal pure returns (int128) { require (x > 0); return int128 ( uint256 (log_2 (x)) * 0xB17217F7D1CF79ABC9E3B39803F2F6AF >> 128); } /** * Calculate binary exponent of x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function exp_2 (int128 x) internal pure returns (int128) { require (x < 0x400000000000000000); // Overflow if (x < -0x400000000000000000) return 0; // Underflow uint256 result = 0x80000000000000000000000000000000; if (x & 0x8000000000000000 > 0) result = result * 0x16A09E667F3BCC908B2FB1366EA957D3E >> 128; if (x & 0x4000000000000000 > 0) result = result * 0x1306FE0A31B7152DE8D5A46305C85EDEC >> 128; if (x & 0x2000000000000000 > 0) result = result * 0x1172B83C7D517ADCDF7C8C50EB14A791F >> 128; if (x & 0x1000000000000000 > 0) result = result * 0x10B5586CF9890F6298B92B71842A98363 >> 128; if (x & 0x800000000000000 > 0) result = result * 0x1059B0D31585743AE7C548EB68CA417FD >> 128; if (x & 0x400000000000000 > 0) result = result * 0x102C9A3E778060EE6F7CACA4F7A29BDE8 >> 128; if (x & 0x200000000000000 > 0) result = result * 0x10163DA9FB33356D84A66AE336DCDFA3F >> 128; if (x & 0x100000000000000 > 0) result = result * 0x100B1AFA5ABCBED6129AB13EC11DC9543 >> 128; if (x & 0x80000000000000 > 0) result = result * 0x10058C86DA1C09EA1FF19D294CF2F679B >> 128; if (x & 0x40000000000000 > 0) result = result * 0x1002C605E2E8CEC506D21BFC89A23A00F >> 128; if (x & 0x20000000000000 > 0) result = result * 0x100162F3904051FA128BCA9C55C31E5DF >> 128; if (x & 0x10000000000000 > 0) result = result * 0x1000B175EFFDC76BA38E31671CA939725 >> 128; if (x & 0x8000000000000 > 0) result = result * 0x100058BA01FB9F96D6CACD4B180917C3D >> 128; if (x & 0x4000000000000 > 0) result = result * 0x10002C5CC37DA9491D0985C348C68E7B3 >> 128; if (x & 0x2000000000000 > 0) result = result * 0x1000162E525EE054754457D5995292026 >> 128; if (x & 0x1000000000000 > 0) result = result * 0x10000B17255775C040618BF4A4ADE83FC >> 128; if (x & 0x800000000000 > 0) result = result * 0x1000058B91B5BC9AE2EED81E9B7D4CFAB >> 128; if (x & 0x400000000000 > 0) result = result * 0x100002C5C89D5EC6CA4D7C8ACC017B7C9 >> 128; if (x & 0x200000000000 > 0) result = result * 0x10000162E43F4F831060E02D839A9D16D >> 128; if (x & 0x100000000000 > 0) result = result * 0x100000B1721BCFC99D9F890EA06911763 >> 128; if (x & 0x80000000000 > 0) result = result * 0x10000058B90CF1E6D97F9CA14DBCC1628 >> 128; if (x & 0x40000000000 > 0) result = result * 0x1000002C5C863B73F016468F6BAC5CA2B >> 128; if (x & 0x20000000000 > 0) result = result * 0x100000162E430E5A18F6119E3C02282A5 >> 128; if (x & 0x10000000000 > 0) result = result * 0x1000000B1721835514B86E6D96EFD1BFE >> 128; if (x & 0x8000000000 > 0) result = result * 0x100000058B90C0B48C6BE5DF846C5B2EF >> 128; if (x & 0x4000000000 > 0) result = result * 0x10000002C5C8601CC6B9E94213C72737A >> 128; if (x & 0x2000000000 > 0) result = result * 0x1000000162E42FFF037DF38AA2B219F06 >> 128; if (x & 0x1000000000 > 0) result = result * 0x10000000B17217FBA9C739AA5819F44F9 >> 128; if (x & 0x800000000 > 0) result = result * 0x1000000058B90BFCDEE5ACD3C1CEDC823 >> 128; if (x & 0x400000000 > 0) result = result * 0x100000002C5C85FE31F35A6A30DA1BE50 >> 128; if (x & 0x200000000 > 0) result = result * 0x10000000162E42FF0999CE3541B9FFFCF >> 128; if (x & 0x100000000 > 0) result = result * 0x100000000B17217F80F4EF5AADDA45554 >> 128; if (x & 0x80000000 > 0) result = result * 0x10000000058B90BFBF8479BD5A81B51AD >> 128; if (x & 0x40000000 > 0) result = result * 0x1000000002C5C85FDF84BD62AE30A74CC >> 128; if (x & 0x20000000 > 0) result = result * 0x100000000162E42FEFB2FED257559BDAA >> 128; if (x & 0x10000000 > 0) result = result * 0x1000000000B17217F7D5A7716BBA4A9AE >> 128; if (x & 0x8000000 > 0) result = result * 0x100000000058B90BFBE9DDBAC5E109CCE >> 128; if (x & 0x4000000 > 0) result = result * 0x10000000002C5C85FDF4B15DE6F17EB0D >> 128; if (x & 0x2000000 > 0) result = result * 0x1000000000162E42FEFA494F1478FDE05 >> 128; if (x & 0x1000000 > 0) result = result * 0x10000000000B17217F7D20CF927C8E94C >> 128; if (x & 0x800000 > 0) result = result * 0x1000000000058B90BFBE8F71CB4E4B33D >> 128; if (x & 0x400000 > 0) result = result * 0x100000000002C5C85FDF477B662B26945 >> 128; if (x & 0x200000 > 0) result = result * 0x10000000000162E42FEFA3AE53369388C >> 128; if (x & 0x100000 > 0) result = result * 0x100000000000B17217F7D1D351A389D40 >> 128; if (x & 0x80000 > 0) result = result * 0x10000000000058B90BFBE8E8B2D3D4EDE >> 128; if (x & 0x40000 > 0) result = result * 0x1000000000002C5C85FDF4741BEA6E77E >> 128; if (x & 0x20000 > 0) result = result * 0x100000000000162E42FEFA39FE95583C2 >> 128; if (x & 0x10000 > 0) result = result * 0x1000000000000B17217F7D1CFB72B45E1 >> 128; if (x & 0x8000 > 0) result = result * 0x100000000000058B90BFBE8E7CC35C3F0 >> 128; if (x & 0x4000 > 0) result = result * 0x10000000000002C5C85FDF473E242EA38 >> 128; if (x & 0x2000 > 0) result = result * 0x1000000000000162E42FEFA39F02B772C >> 128; if (x & 0x1000 > 0) result = result * 0x10000000000000B17217F7D1CF7D83C1A >> 128; if (x & 0x800 > 0) result = result * 0x1000000000000058B90BFBE8E7BDCBE2E >> 128; if (x & 0x400 > 0) result = result * 0x100000000000002C5C85FDF473DEA871F >> 128; if (x & 0x200 > 0) result = result * 0x10000000000000162E42FEFA39EF44D91 >> 128; if (x & 0x100 > 0) result = result * 0x100000000000000B17217F7D1CF79E949 >> 128; if (x & 0x80 > 0) result = result * 0x10000000000000058B90BFBE8E7BCE544 >> 128; if (x & 0x40 > 0) result = result * 0x1000000000000002C5C85FDF473DE6ECA >> 128; if (x & 0x20 > 0) result = result * 0x100000000000000162E42FEFA39EF366F >> 128; if (x & 0x10 > 0) result = result * 0x1000000000000000B17217F7D1CF79AFA >> 128; if (x & 0x8 > 0) result = result * 0x100000000000000058B90BFBE8E7BCD6D >> 128; if (x & 0x4 > 0) result = result * 0x10000000000000002C5C85FDF473DE6B2 >> 128; if (x & 0x2 > 0) result = result * 0x1000000000000000162E42FEFA39EF358 >> 128; if (x & 0x1 > 0) result = result * 0x10000000000000000B17217F7D1CF79AB >> 128; result >>= uint256 (63 - (x >> 64)); require (result <= uint256 (MAX_64x64)); return int128 (result); } /** * Calculate natural exponent of x. Revert on overflow. * * @param x signed 64.64-bit fixed point number * @return signed 64.64-bit fixed point number */ function exp (int128 x) internal pure returns (int128) { require (x < 0x400000000000000000); // Overflow if (x < -0x400000000000000000) return 0; // Underflow return exp_2 ( int128 (int256 (x) * 0x171547652B82FE1777D0FFDA0D23A7D12 >> 128)); } /** * Calculate x / y rounding towards zero, where x and y are unsigned 256-bit * integer numbers. Revert on overflow or when y is zero. * * @param x unsigned 256-bit integer number * @param y unsigned 256-bit integer number * @return unsigned 64.64-bit fixed point number */ function divuu (uint256 x, uint256 y) private pure returns (uint128) { require (y != 0); uint256 result; if (x <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF) result = (x << 64) / y; else { uint256 msb = 192; uint256 xc = x >> 192; if (xc >= 0x100000000) { xc >>= 32; msb += 32; } if (xc >= 0x10000) { xc >>= 16; msb += 16; } if (xc >= 0x100) { xc >>= 8; msb += 8; } if (xc >= 0x10) { xc >>= 4; msb += 4; } if (xc >= 0x4) { xc >>= 2; msb += 2; } if (xc >= 0x2) msb += 1; // No need to shift xc anymore result = (x << 255 - msb) / ((y - 1 >> msb - 191) + 1); require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); uint256 hi = result * (y >> 128); uint256 lo = result * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); uint256 xh = x >> 192; uint256 xl = x << 64; if (xl < lo) xh -= 1; xl -= lo; // We rely on overflow behavior here lo = hi << 128; if (xl < lo) xh -= 1; xl -= lo; // We rely on overflow behavior here assert (xh == hi >> 128); result += xl / y; } require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return uint128 (result); } /** * Calculate x^y assuming 0^0 is 1, where x is unsigned 129.127 fixed point * number and y is unsigned 256-bit integer number. Revert on overflow. * * @param x unsigned 129.127-bit fixed point number * @param y uint256 value * @return unsigned 129.127-bit fixed point number */ function powu (uint256 x, uint256 y) private pure returns (uint256) { if (y == 0) return 0x80000000000000000000000000000000; else if (x == 0) return 0; else { int256 msb = 0; uint256 xc = x; if (xc >= 0x100000000000000000000000000000000) { xc >>= 128; msb += 128; } if (xc >= 0x10000000000000000) { xc >>= 64; msb += 64; } if (xc >= 0x100000000) { xc >>= 32; msb += 32; } if (xc >= 0x10000) { xc >>= 16; msb += 16; } if (xc >= 0x100) { xc >>= 8; msb += 8; } if (xc >= 0x10) { xc >>= 4; msb += 4; } if (xc >= 0x4) { xc >>= 2; msb += 2; } if (xc >= 0x2) msb += 1; // No need to shift xc anymore int256 xe = msb - 127; if (xe > 0) x >>= uint256 (xe); else x <<= uint256 (-xe); uint256 result = 0x80000000000000000000000000000000; int256 re = 0; while (y > 0) { if (y & 1 > 0) { result = result * x; y -= 1; re += xe; if (result >= 0x8000000000000000000000000000000000000000000000000000000000000000) { result >>= 128; re += 1; } else result >>= 127; if (re < -127) return 0; // Underflow require (re < 128); // Overflow } else { x = x * x; y >>= 1; xe <<= 1; if (x >= 0x8000000000000000000000000000000000000000000000000000000000000000) { x >>= 128; xe += 1; } else x >>= 127; if (xe < -127) return 0; // Underflow require (xe < 128); // Overflow } } if (re > 0) result <<= uint256 (re); else if (re < 0) result >>= uint256 (-re); return result; } } /** * Calculate sqrt (x) rounding down, where x is unsigned 256-bit integer * number. * * @param x unsigned 256-bit integer number * @return unsigned 128-bit integer number */ function sqrtu (uint256 x) private pure returns (uint128) { if (x == 0) return 0; else { uint256 xx = x; uint256 r = 1; if (xx >= 0x100000000000000000000000000000000) { xx >>= 128; r <<= 64; } if (xx >= 0x10000000000000000) { xx >>= 64; r <<= 32; } if (xx >= 0x100000000) { xx >>= 32; r <<= 16; } if (xx >= 0x10000) { xx >>= 16; r <<= 8; } if (xx >= 0x100) { xx >>= 8; r <<= 4; } if (xx >= 0x10) { xx >>= 4; r <<= 2; } if (xx >= 0x8) { r <<= 1; } r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; r = (r + x / r) >> 1; // Seven iterations should be enough uint256 r1 = x / r; return uint128 (r < r1 ? r : r1); } } }
{ "remappings": [], "optimizer": { "enabled": false, "runs": 200 }, "evmVersion": "istanbul", "libraries": { "/Users/clexmond/projects/influence/influence-dapp/contracts/lib/Procedural.sol": { "Procedural": "0xa06f481a2b8cb004ac50701e375ea9022d33Eef3" } }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IAsteroidToken","name":"_token","type":"address"},{"internalType":"contract IAsteroidFeatures","name":"_features","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"asteroidId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"bonuses","type":"uint256"}],"name":"AsteroidScanned","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"asteroidId","type":"uint256"}],"name":"ScanStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"inputs":[{"internalType":"address","name":"_manager","type":"address"}],"name":"addManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_asteroidId","type":"uint256"}],"name":"finalizeScan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_asteroidId","type":"uint256"}],"name":"getScanOrder","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_manager","type":"address"}],"name":"isManager","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_asteroidId","type":"uint256"}],"name":"recordScanOrder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_manager","type":"address"}],"name":"removeManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_asteroidId","type":"uint256"}],"name":"retrieveScan","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"scanOrderCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_asteroidIds","type":"uint256[]"},{"internalType":"uint256[]","name":"_bonuses","type":"uint256[]"}],"name":"setInitialBonuses","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_asteroidId","type":"uint256"}],"name":"startScan","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6080604052600060055534801561001557600080fd5b50604051611de9380380611de98339818101604052604081101561003857600080fd5b81019080805190602001909291908051906020019092919050505060008060006101000a81548160ff021916908315150217905550600061007d6101a560201b60201c565b905080600060016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050506101ad565b600033905090565b611c2d806101bc6000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c80639be4b07d1161008c578063b3d96ad911610066578063b3d96ad914610383578063d8b0b547146103a1578063f2fde38b146103cf578063f3ae241514610413576100ea565b80639be4b07d14610243578063a76cb64e14610311578063ac18de431461033f576100ea565b80635c975abb116100c85780635c975abb146101a3578063715018a6146101c35780638da5cb5b146101cd578063924fdcea14610201576100ea565b8063034c6063146100ef57806322053d17146101315780632d06177a1461015f575b600080fd5b61011b6004803603602081101561010557600080fd5b810190808035906020019092919050505061046d565b6040518082815260200191505060405180910390f35b61015d6004803603602081101561014757600080fd5b8101908080359060200190929190505050610494565b005b6101a16004803603602081101561017557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610527565b005b6101ab610631565b60405180821515815260200191505060405180910390f35b6101cb610647565b005b6101d56107b6565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61022d6004803603602081101561021757600080fd5b81019080803590602001909291905050506107df565b6040518082815260200191505060405180910390f35b61030f6004803603604081101561025957600080fd5b810190808035906020019064010000000081111561027657600080fd5b82018360208201111561028857600080fd5b803590602001918460208302840111640100000000831117156102aa57600080fd5b9091929391929390803590602001906401000000008111156102cb57600080fd5b8201836020820111156102dd57600080fd5b803590602001918460208302840111640100000000831117156102ff57600080fd5b909192939192939050505061080a565b005b61033d6004803603602081101561032757600080fd5b81019080803590602001909291905050506109a1565b005b6103816004803603602081101561035557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114bd565b005b61038b6115c7565b6040518082815260200191505060405180910390f35b6103cd600480360360208110156103b757600080fd5b81019080803590602001909291905050506115cd565b005b610411600480360360208110156103e557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118e9565b005b6104556004803603602081101561042957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ade565b60405180821515815260200191505060405180910390f35b6000600460008381526020019081526020016000205467ffffffffffffffff169050919050565b6104a461049f611b34565b611ade565b6104f9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611baf6024913960400191505060405180910390fd5b6001600560008282540192505081905550600554600460008381526020019081526020016000208190555050565b61052f611b34565b73ffffffffffffffffffffffffffffffffffffffff1661054d6107b6565b73ffffffffffffffffffffffffffffffffffffffff16146105d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008060009054906101000a900460ff16905090565b61064f611b34565b73ffffffffffffffffffffffffffffffffffffffff1661066d6107b6565b73ffffffffffffffffffffffffffffffffffffffff16146106f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600060406004600084815260200190815260200160002054901c67ffffffffffffffff169050919050565b610812611b34565b73ffffffffffffffffffffffffffffffffffffffff166108306107b6565b73ffffffffffffffffffffffffffffffffffffffff16146108b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600554146108c857600080fd5b8181905084849050146108da57600080fd5b60005b8484905081101561099a5760408383838181106108f657fe5b90506020020135901b6004600087878581811061090f57fe5b9050602002013581526020019081526020016000206000828254179250508190555084848281811061093d57fe5b905060200201357f7b85081387f3caca905b2f5fdc161900fe25a51b0f1f985ba1336bc9f5ec204384848481811061097157fe5b905060200201356040518082815260200191505060405180910390a280806001019150506108dd565b5050505050565b6109a9610631565b15610a1c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b600060806004600084815260200190815260200160002054901c67ffffffffffffffff169050600060406004600085815260200190815260200160002054901c67ffffffffffffffff1614610abc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611b3d6021913960400191505060405180910390fd5b438114158015610acc5750600081115b610b21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180611b5e602b913960400191505060405180910390fd5b6000600190506000600460008581526020019081526020016000205467ffffffffffffffff169050600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663825a013e876040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610bbf57600080fd5b505afa158015610bd3573d6000803e3d6000fd5b505050506040513d6020811015610be957600080fd5b810190808051906020019092919050505090506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f4c10f1b836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610c7157600080fd5b505afa158015610c85573d6000803e3d6000fd5b505050506040513d6020811015610c9b57600080fd5b810190808051906020019092919050505090506000864060001c905060008114611456578273a06f481a2b8cb004ac50701e375ea9022d33eef36312dbaacc9091836040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610d1857600080fd5b505af4158015610d2c573d6000803e3d6000fd5b505050506040513d6020811015610d4257600080fd5b8101908080519060200190929190505050925060006040518061016001604052806040518060c00160405280600160ff168152602001600160ff168152602001600060ff168152602001600160ff168152602001600060ff168152602001600060ff1681525081526020016040518060c00160405280600160ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600060ff168152602001600160ff1681525081526020016040518060c00160405280600160ff168152602001600160ff168152602001600060ff168152602001600160ff168152602001600060ff168152602001600060ff1681525081526020016040518060c00160405280600160ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600160ff1681525081526020016040518060c00160405280600160ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600160ff1681525081526020016040518060c00160405280600160ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600160ff1681525081526020016040518060c00160405280600160ff168152602001600060ff168152602001600160ff168152602001600060ff168152602001600160ff168152602001600160ff1681525081526020016040518060c00160405280600160ff168152602001600060ff168152602001600160ff168152602001600060ff168152602001600160ff168152602001600160ff1681525081526020016040518060c00160405280600160ff168152602001600160ff168152602001600160ff168152602001600060ff168152602001600160ff168152602001600160ff1681525081526020016040518060c00160405280600160ff168152602001600060ff168152602001600160ff168152602001600060ff168152602001600060ff168152602001600160ff1681525081526020016040518060c00160405280600160ff168152602001600160ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff1681525081525090506000612711905060648710156110ab57610d7190506110d1565b61044c8710156110bf5761102f90506110d0565b612b5c8710156110cf576115d490505b5b5b60005b600681101561143757600481108015611110575060018386600b81106110f657fe5b6020020151826006811061110657fe5b602002015160ff16145b156112a3578573a06f481a2b8cb004ac50701e375ea9022d33eef36312dbaacc9091836040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561116e57600080fd5b505af4158015611182573d6000803e3d6000fd5b505050506040513d602081101561119857600080fd5b810190808051906020019092919050505073a06f481a2b8cb004ac50701e375ea9022d33eef363d6457b0890916000856040518463ffffffff1660e01b81526004018084815260200183815260200182600f0b8152602001935050505060206040518083038186803b15801561120d57600080fd5b505af4158015611221573d6000803e3d6000fd5b505050506040513d602081101561123757600080fd5b810190808051906020019092919050505060070b965061083487116112a25761025887111561127457600160038202016001901b891798506112a1565b606487111561129157600260038202016001901b891798506112a0565b6003808202016001901b891798505b5b5b5b600481101580156112d7575060018386600b81106112bd57fe5b602002015182600681106112cd57fe5b602002015160ff16145b1561142a578573a06f481a2b8cb004ac50701e375ea9022d33eef36312dbaacc9091836040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561133557600080fd5b505af4158015611349573d6000803e3d6000fd5b505050506040513d602081101561135f57600080fd5b810190808051906020019092919050505073a06f481a2b8cb004ac50701e375ea9022d33eef363d6457b0890916000856040518463ffffffff1660e01b81526004018084815260200183815260200182600f0b8152602001935050505060206040518083038186803b1580156113d457600080fd5b505af41580156113e8573d6000803e3d6000fd5b505050506040513d60208110156113fe57600080fd5b810190808051906020019092919050505060070b965060fa871161142957600981016001901b891798505b5b80806001019150506110d4565b50612b5c871080156114495750600188145b1561145357600397505b50505b604086901b600460008a815260200190815260200160002060008282541792505081905550877f7b85081387f3caca905b2f5fdc161900fe25a51b0f1f985ba1336bc9f5ec2043876040518082815260200191505060405180910390a25050505050505050565b6114c5611b34565b73ffffffffffffffffffffffffffffffffffffffff166114e36107b6565b73ffffffffffffffffffffffffffffffffffffffff161461156c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60055481565b6115d5610631565b15611648576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b611650611b34565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156116d957600080fd5b505afa1580156116ed573d6000803e3d6000fd5b505050506040513d602081101561170357600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff161461179d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4f6e6c79206f776e65722063616e207363616e2061737465726f69640000000081525060200191505060405180910390fd5b600060406004600084815260200190815260200160002054901c67ffffffffffffffff1614611817576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611b3d6021913960400191505060405180910390fd5b600060806004600084815260200190815260200160002054901c67ffffffffffffffff1614611891576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611bd36025913960400191505060405180910390fd5b608060014301901b6004600083815260200190815260200160002060008282541792505081905550807fba3685f8a05743ff76c648707f2b50c63f1d57e548c5a41c64be54268874e75060405160405180910390a250565b6118f1611b34565b73ffffffffffffffffffffffffffffffffffffffff1661190f6107b6565b73ffffffffffffffffffffffffffffffffffffffff1614611998576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611a1e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611b896026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600060016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60003390509056fe41737465726f69642068617320616c7265616479206265656e207363616e6e65644d7573742077616974206174206c65617374206f6e6520626c6f636b206166746572207374617274696e674f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f6e6c79206d616e61676572732063616e2063616c6c20746869732066756e6374696f6e41737465726f6964207363616e6e696e672068617320616c72656164792073746172746564a2646970667358221220fbb48e5766803b3d7befe88fa7573f18f633c4df9b6bd9e25d8f5d2ba2cd980564736f6c634300070600330000000000000000000000006e4c6d9b0930073e958abd2aba516b885260b8ff00000000000000000000000099ce24101bc957a0d02ec65ab7e3b507fee42a13
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c80639be4b07d1161008c578063b3d96ad911610066578063b3d96ad914610383578063d8b0b547146103a1578063f2fde38b146103cf578063f3ae241514610413576100ea565b80639be4b07d14610243578063a76cb64e14610311578063ac18de431461033f576100ea565b80635c975abb116100c85780635c975abb146101a3578063715018a6146101c35780638da5cb5b146101cd578063924fdcea14610201576100ea565b8063034c6063146100ef57806322053d17146101315780632d06177a1461015f575b600080fd5b61011b6004803603602081101561010557600080fd5b810190808035906020019092919050505061046d565b6040518082815260200191505060405180910390f35b61015d6004803603602081101561014757600080fd5b8101908080359060200190929190505050610494565b005b6101a16004803603602081101561017557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610527565b005b6101ab610631565b60405180821515815260200191505060405180910390f35b6101cb610647565b005b6101d56107b6565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61022d6004803603602081101561021757600080fd5b81019080803590602001909291905050506107df565b6040518082815260200191505060405180910390f35b61030f6004803603604081101561025957600080fd5b810190808035906020019064010000000081111561027657600080fd5b82018360208201111561028857600080fd5b803590602001918460208302840111640100000000831117156102aa57600080fd5b9091929391929390803590602001906401000000008111156102cb57600080fd5b8201836020820111156102dd57600080fd5b803590602001918460208302840111640100000000831117156102ff57600080fd5b909192939192939050505061080a565b005b61033d6004803603602081101561032757600080fd5b81019080803590602001909291905050506109a1565b005b6103816004803603602081101561035557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114bd565b005b61038b6115c7565b6040518082815260200191505060405180910390f35b6103cd600480360360208110156103b757600080fd5b81019080803590602001909291905050506115cd565b005b610411600480360360208110156103e557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506118e9565b005b6104556004803603602081101561042957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611ade565b60405180821515815260200191505060405180910390f35b6000600460008381526020019081526020016000205467ffffffffffffffff169050919050565b6104a461049f611b34565b611ade565b6104f9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526024815260200180611baf6024913960400191505060405180910390fd5b6001600560008282540192505081905550600554600460008381526020019081526020016000208190555050565b61052f611b34565b73ffffffffffffffffffffffffffffffffffffffff1661054d6107b6565b73ffffffffffffffffffffffffffffffffffffffff16146105d6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60008060009054906101000a900460ff16905090565b61064f611b34565b73ffffffffffffffffffffffffffffffffffffffff1661066d6107b6565b73ffffffffffffffffffffffffffffffffffffffff16146106f6576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff16600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a360008060016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550565b60008060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600060406004600084815260200190815260200160002054901c67ffffffffffffffff169050919050565b610812611b34565b73ffffffffffffffffffffffffffffffffffffffff166108306107b6565b73ffffffffffffffffffffffffffffffffffffffff16146108b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600554146108c857600080fd5b8181905084849050146108da57600080fd5b60005b8484905081101561099a5760408383838181106108f657fe5b90506020020135901b6004600087878581811061090f57fe5b9050602002013581526020019081526020016000206000828254179250508190555084848281811061093d57fe5b905060200201357f7b85081387f3caca905b2f5fdc161900fe25a51b0f1f985ba1336bc9f5ec204384848481811061097157fe5b905060200201356040518082815260200191505060405180910390a280806001019150506108dd565b5050505050565b6109a9610631565b15610a1c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b600060806004600084815260200190815260200160002054901c67ffffffffffffffff169050600060406004600085815260200190815260200160002054901c67ffffffffffffffff1614610abc576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611b3d6021913960400191505060405180910390fd5b438114158015610acc5750600081115b610b21576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602b815260200180611b5e602b913960400191505060405180910390fd5b6000600190506000600460008581526020019081526020016000205467ffffffffffffffff169050600080600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663825a013e876040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610bbf57600080fd5b505afa158015610bd3573d6000803e3d6000fd5b505050506040513d6020811015610be957600080fd5b810190808051906020019092919050505090506000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f4c10f1b836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b158015610c7157600080fd5b505afa158015610c85573d6000803e3d6000fd5b505050506040513d6020811015610c9b57600080fd5b810190808051906020019092919050505090506000864060001c905060008114611456578273a06f481a2b8cb004ac50701e375ea9022d33eef36312dbaacc9091836040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b158015610d1857600080fd5b505af4158015610d2c573d6000803e3d6000fd5b505050506040513d6020811015610d4257600080fd5b8101908080519060200190929190505050925060006040518061016001604052806040518060c00160405280600160ff168152602001600160ff168152602001600060ff168152602001600160ff168152602001600060ff168152602001600060ff1681525081526020016040518060c00160405280600160ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600060ff168152602001600160ff1681525081526020016040518060c00160405280600160ff168152602001600160ff168152602001600060ff168152602001600160ff168152602001600060ff168152602001600060ff1681525081526020016040518060c00160405280600160ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600160ff1681525081526020016040518060c00160405280600160ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600160ff1681525081526020016040518060c00160405280600160ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600160ff168152602001600160ff1681525081526020016040518060c00160405280600160ff168152602001600060ff168152602001600160ff168152602001600060ff168152602001600160ff168152602001600160ff1681525081526020016040518060c00160405280600160ff168152602001600060ff168152602001600160ff168152602001600060ff168152602001600160ff168152602001600160ff1681525081526020016040518060c00160405280600160ff168152602001600160ff168152602001600160ff168152602001600060ff168152602001600160ff168152602001600160ff1681525081526020016040518060c00160405280600160ff168152602001600060ff168152602001600160ff168152602001600060ff168152602001600060ff168152602001600160ff1681525081526020016040518060c00160405280600160ff168152602001600160ff168152602001600060ff168152602001600060ff168152602001600060ff168152602001600060ff1681525081525090506000612711905060648710156110ab57610d7190506110d1565b61044c8710156110bf5761102f90506110d0565b612b5c8710156110cf576115d490505b5b5b60005b600681101561143757600481108015611110575060018386600b81106110f657fe5b6020020151826006811061110657fe5b602002015160ff16145b156112a3578573a06f481a2b8cb004ac50701e375ea9022d33eef36312dbaacc9091836040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561116e57600080fd5b505af4158015611182573d6000803e3d6000fd5b505050506040513d602081101561119857600080fd5b810190808051906020019092919050505073a06f481a2b8cb004ac50701e375ea9022d33eef363d6457b0890916000856040518463ffffffff1660e01b81526004018084815260200183815260200182600f0b8152602001935050505060206040518083038186803b15801561120d57600080fd5b505af4158015611221573d6000803e3d6000fd5b505050506040513d602081101561123757600080fd5b810190808051906020019092919050505060070b965061083487116112a25761025887111561127457600160038202016001901b891798506112a1565b606487111561129157600260038202016001901b891798506112a0565b6003808202016001901b891798505b5b5b5b600481101580156112d7575060018386600b81106112bd57fe5b602002015182600681106112cd57fe5b602002015160ff16145b1561142a578573a06f481a2b8cb004ac50701e375ea9022d33eef36312dbaacc9091836040518363ffffffff1660e01b8152600401808381526020018281526020019250505060206040518083038186803b15801561133557600080fd5b505af4158015611349573d6000803e3d6000fd5b505050506040513d602081101561135f57600080fd5b810190808051906020019092919050505073a06f481a2b8cb004ac50701e375ea9022d33eef363d6457b0890916000856040518463ffffffff1660e01b81526004018084815260200183815260200182600f0b8152602001935050505060206040518083038186803b1580156113d457600080fd5b505af41580156113e8573d6000803e3d6000fd5b505050506040513d60208110156113fe57600080fd5b810190808051906020019092919050505060070b965060fa871161142957600981016001901b891798505b5b80806001019150506110d4565b50612b5c871080156114495750600188145b1561145357600397505b50505b604086901b600460008a815260200190815260200160002060008282541792505081905550877f7b85081387f3caca905b2f5fdc161900fe25a51b0f1f985ba1336bc9f5ec2043876040518082815260200191505060405180910390a25050505050505050565b6114c5611b34565b73ffffffffffffffffffffffffffffffffffffffff166114e36107b6565b73ffffffffffffffffffffffffffffffffffffffff161461156c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b60055481565b6115d5610631565b15611648576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260108152602001807f5061757361626c653a207061757365640000000000000000000000000000000081525060200191505060405180910390fd5b611650611b34565b73ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16636352211e836040518263ffffffff1660e01b81526004018082815260200191505060206040518083038186803b1580156116d957600080fd5b505afa1580156116ed573d6000803e3d6000fd5b505050506040513d602081101561170357600080fd5b810190808051906020019092919050505073ffffffffffffffffffffffffffffffffffffffff161461179d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601c8152602001807f4f6e6c79206f776e65722063616e207363616e2061737465726f69640000000081525060200191505060405180910390fd5b600060406004600084815260200190815260200160002054901c67ffffffffffffffff1614611817576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526021815260200180611b3d6021913960400191505060405180910390fd5b600060806004600084815260200190815260200160002054901c67ffffffffffffffff1614611891576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526025815260200180611bd36025913960400191505060405180910390fd5b608060014301901b6004600083815260200190815260200160002060008282541792505081905550807fba3685f8a05743ff76c648707f2b50c63f1d57e548c5a41c64be54268874e75060405160405180910390a250565b6118f1611b34565b73ffffffffffffffffffffffffffffffffffffffff1661190f6107b6565b73ffffffffffffffffffffffffffffffffffffffff1614611998576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260208152602001807f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657281525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff161415611a1e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526026815260200180611b896026913960400191505060405180910390fd5b8073ffffffffffffffffffffffffffffffffffffffff16600060019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a380600060016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60003390509056fe41737465726f69642068617320616c7265616479206265656e207363616e6e65644d7573742077616974206174206c65617374206f6e6520626c6f636b206166746572207374617274696e674f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734f6e6c79206d616e61676572732063616e2063616c6c20746869732066756e6374696f6e41737465726f6964207363616e6e696e672068617320616c72656164792073746172746564a2646970667358221220fbb48e5766803b3d7befe88fa7573f18f633c4df9b6bd9e25d8f5d2ba2cd980564736f6c63430007060033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000006e4c6d9b0930073e958abd2aba516b885260b8ff00000000000000000000000099ce24101bc957a0d02ec65ab7e3b507fee42a13
-----Decoded View---------------
Arg [0] : _token (address): 0x6e4c6D9B0930073e958ABd2ABa516b885260b8Ff
Arg [1] : _features (address): 0x99Ce24101bc957A0d02EC65AB7e3B507Fee42a13
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000006e4c6d9b0930073e958abd2aba516b885260b8ff
Arg [1] : 00000000000000000000000099ce24101bc957a0d02ec65ab7e3b507fee42a13
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.