Feature Tip: Add private address tag to any address under My Name Tag !
More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 958 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw | 17555176 | 512 days ago | IN | 0 ETH | 0.0006716 | ||||
Withdraw | 17555168 | 512 days ago | IN | 0 ETH | 0.00083283 | ||||
Withdraw | 17555154 | 512 days ago | IN | 0 ETH | 0.00057015 | ||||
Withdraw | 17339952 | 542 days ago | IN | 0 ETH | 0.00126053 | ||||
Withdraw | 17315499 | 545 days ago | IN | 0 ETH | 0.00246525 | ||||
Withdraw | 17273536 | 551 days ago | IN | 0 ETH | 0.00423997 | ||||
Withdraw | 17251491 | 554 days ago | IN | 0 ETH | 0.00183099 | ||||
Withdraw | 17226362 | 558 days ago | IN | 0 ETH | 0.00339831 | ||||
Withdraw | 17213413 | 560 days ago | IN | 0 ETH | 0.00416342 | ||||
Withdraw | 17182347 | 564 days ago | IN | 0 ETH | 0.00371541 | ||||
Withdraw | 17173335 | 565 days ago | IN | 0 ETH | 0.00402264 | ||||
Withdraw | 17160089 | 567 days ago | IN | 0 ETH | 0.00381564 | ||||
Withdraw | 17153030 | 568 days ago | IN | 0 ETH | 0.00192943 | ||||
Withdraw | 17151406 | 568 days ago | IN | 0 ETH | 0.0015741 | ||||
Withdraw | 17147311 | 569 days ago | IN | 0 ETH | 0.00183525 | ||||
Approve | 17144261 | 569 days ago | IN | 0 ETH | 0.00073579 | ||||
Approve | 17142335 | 570 days ago | IN | 0 ETH | 0.00082228 | ||||
Withdraw | 17136464 | 571 days ago | IN | 0 ETH | 0.00149868 | ||||
Withdraw | 17136143 | 571 days ago | IN | 0 ETH | 0.00164664 | ||||
Withdraw | 17136006 | 571 days ago | IN | 0 ETH | 0.00167277 | ||||
Withdraw | 17134975 | 571 days ago | IN | 0 ETH | 0.001581 | ||||
Withdraw | 17131906 | 571 days ago | IN | 0 ETH | 0.00189207 | ||||
Withdraw | 17131700 | 571 days ago | IN | 0 ETH | 0.00324341 | ||||
Withdraw | 17131206 | 571 days ago | IN | 0 ETH | 0.00197203 | ||||
Withdraw | 17129234 | 572 days ago | IN | 0 ETH | 0.00174683 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
XENKnights
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.10; import "@faircrypto/xen-crypto/contracts/XENCrypto.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "./libs/Strings.sol"; /* Sorting in Ethereum https://medium.com/bandprotocol/solidity-102-3-maintaining-sorted-list-1edd0a228d83 [*] https://stackoverflow.com/questions/64661313/descending-quicksort-in-solidity https://gist.github.com/fiveoutofnine/5140b17f6185aacb71fc74d3a315a9da */ contract XENKnights is IBurnRedeemable, Ownable, ERC165 { enum Status { Waiting, InProgress, Final, // leaderboard loaded Ended, // XEN burned for leaders Canceled // in case shit happens } using Strings for uint256; // PUBLIC CONSTANTS string public constant AUTHORS = "@MrJackLevin @ackebom @lbelyaev faircrypto.org"; uint256 public constant SECS_IN_DAY = 3_600 * 24; // common business logic uint256 public constant MAX_WINNERS = 100; // PUBLIC MUTABLE STATE uint256 public totalPlayers; uint256 public totalToBurn; Status public status; // taproot address => total bid amount mapping(bytes32 => uint256) public amounts; // user address => taproot address => total bid amount mapping(address => mapping(bytes32 => uint256)) public userAmounts; bytes32[] public leaders; // PUBLIC IMMUTABLE STATE uint256 public immutable startTs; uint256 public immutable endTs; // pointer to XEN Stake contract IERC20 public immutable xenCrypto; // CONSTRUCTOR constructor(address xenCrypto_, uint256 startTs_, uint256 durationDays_) { require(xenCrypto_ != address(0)); require(startTs_ >= block.timestamp); require(durationDays_ > 0); xenCrypto = IERC20(xenCrypto_); startTs = startTs_; endTs = startTs_ + durationDays_ * SECS_IN_DAY; emit StatusChanged(Status.Waiting, block.timestamp); } // EVENTS event StatusChanged(Status status, uint256 ts); event Admitted(address indexed user, string taprootAddress, uint256 amount, uint256 totalAmount); event Withdrawn(address indexed user, string taprootAddress, uint256 amount); event Burned(uint256 amount); // IERC-165 function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IBurnRedeemable).interfaceId || super.supportsInterface(interfaceId); } // PRIVATE HELPERS function _canEnter(uint256 amount, string calldata taprootAddress) private view { require(msg.sender == tx.origin, 'XenKnights: only EOAs allowed'); require(block.timestamp > startTs, 'XenKnights: competition not yet started'); require(block.timestamp < endTs, 'XenKnights: competition already finished'); require(status < Status.Final, 'XenKnights: competition not in progress'); require(amount > 0, 'XenKnights: illegal amount'); require(bytes(taprootAddress).length == 62, 'XenKnights: illegal taprootAddress length'); require( _compareStr(string(bytes(taprootAddress)[0:4]), 'bc1p'), 'XenKnights: illegal taprootAddress signature' ); } function _canWithdraw(string calldata taprootAddress, bytes32 hash) private view { require(msg.sender == tx.origin, 'XenKnights: only EOAs allowed'); require(block.timestamp > endTs, 'XenKnights: competition not yet finished'); require(status > Status.InProgress, 'XenKnights: competition still in progress'); require(bytes(taprootAddress).length == 62, 'XenKnights: illegal taprootAddress length'); require( _compareStr(string(bytes(taprootAddress)[0:4]), 'bc1p'), 'XenKnights: illegal taprootAddress signature' ); require(userAmounts[msg.sender][hash] > 0, 'XenKnights: nothing to withdraw'); require(amounts[hash] > 0, 'XenKnights: winner cannot withdraw'); } function _canBurn() private view { require(block.timestamp > endTs, 'XenKnights: competition still in progress'); require(status > Status.InProgress, 'XenKnights: competition not yet final'); require(status < Status.Ended, 'XenKnights: already burned'); require(xenCrypto.balanceOf(address(this)) > 0, 'XenKnights: nothing to burn'); } function _compareStr(string memory one, string memory two) private pure returns (bool) { return sha256(abi.encodePacked(one)) == sha256(abi.encodePacked(two)); } function _compare(bytes32 one, bytes32 two) private pure returns (bool) { //return sha256(abi.encodePacked(one)) == sha256(abi.encodePacked(two)); return one == two; } // PUBLIC READ INTERFACE /** * @dev Returns `count` first tokenIds by lowest amount */ function leaderboard(uint256) external view returns (bytes32[] memory data) { data = leaders; } // ADMIN INTERFACE function loadLeaders(bytes32[] calldata taprootAddresses) external onlyOwner { require(block.timestamp > endTs, 'Admin: cannot load leaders before end'); require(status == Status.InProgress, 'Admin: bad status'); require( taprootAddresses.length > 0 && taprootAddresses.length < MAX_WINNERS + 1, 'Admin: illegal list length' ); uint256 prevAmount = amounts[taprootAddresses[0]]; for (uint256 i = 0; i < taprootAddresses.length; i++) { require(amounts[taprootAddresses[i]] > 0, 'Admin: winner\'s amount cannot be zero'); require( i == 0 || amounts[taprootAddresses[i]] >= prevAmount, 'Admin: list not sorted' ); prevAmount = amounts[taprootAddresses[i]]; leaders.push(taprootAddresses[i]); totalToBurn += prevAmount; amounts[taprootAddresses[i]] = 0; // to mark winners from losers } status = Status.Final; emit StatusChanged(Status.Final, block.timestamp); } // PRIVATE HELPERS /** * @dev Attempt to enter competition based on eligible XEN Stake identified by `tokenId` * @dev Additionally, `taprootAddress` is supplied and stored along with tokenId */ function enterCompetition(uint256 newAmount, string calldata taprootAddress_) external { _canEnter(newAmount, taprootAddress_); require(xenCrypto.transferFrom(msg.sender, address(this), newAmount), 'XenKnights: could not transfer XEN'); bytes32 taprootAddress = keccak256(bytes(taprootAddress_)); uint256 existingAmount = amounts[taprootAddress]; uint256 totalAmount = existingAmount + newAmount; amounts[taprootAddress] = totalAmount; userAmounts[msg.sender][taprootAddress] += newAmount; if (status == Status.Waiting) { status = Status.InProgress; emit StatusChanged(Status.InProgress, block.timestamp); } emit Admitted(msg.sender, taprootAddress_, newAmount, totalAmount); } function withdraw(string calldata taprootAddress_) external { bytes32 taprootAddress = keccak256(bytes(taprootAddress_)); _canWithdraw(taprootAddress_, taprootAddress); uint256 amount = userAmounts[msg.sender][taprootAddress]; require( xenCrypto.transfer(msg.sender, amount), 'XenKnights: error withdrawing' ); delete userAmounts[msg.sender][taprootAddress]; emit Withdrawn(msg.sender, taprootAddress_, amount); } function onTokenBurned(address user, uint256 amount) external { require(msg.sender == address(xenCrypto), "IBurnableRedeemable: illegal callback caller"); require(user == address(this), 'IBurnableRedeemable: illegal burner'); require(amount == totalToBurn, 'IBurnableRedeemable: illegal amount'); require(status == Status.Final, 'IBurnableRedeemable: illegal status'); status = Status.Ended; emit StatusChanged(Status.Ended, block.timestamp); emit Burned(amount); } function burn() external { _canBurn(); xenCrypto.approve(address(this), totalToBurn); IBurnableToken(address(xenCrypto)).burn(address(this), totalToBurn); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol, math/Math.sol) pragma solidity ^0.8.10; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @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 Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } }
// 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.8.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) { unchecked { 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) { unchecked { 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) { unchecked { require (x <= 0x7FFFFFFFFFFFFFFF); return int128 (int256 (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) { unchecked { require (x >= 0); return uint64 (uint128 (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) { unchecked { 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) { unchecked { 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) { unchecked { 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) { unchecked { 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) { unchecked { 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) { unchecked { 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) { unchecked { if (y == 0) return 0; require (x >= 0); uint256 lo = (uint256 (int256 (x)) * (y & 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) >> 64; uint256 hi = uint256 (int256 (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) { unchecked { 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) { unchecked { 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) { unchecked { 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) { unchecked { 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) { unchecked { 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) { unchecked { 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) { unchecked { 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) { unchecked { 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) { unchecked { bool negative = x < 0 && y & 1 == 1; uint256 absX = uint128 (x < 0 ? -x : x); uint256 absResult; absResult = 0x100000000000000000000000000000000; if (absX <= 0x10000000000000000) { absX <<= 63; while (y != 0) { if (y & 0x1 != 0) { absResult = absResult * absX >> 127; } absX = absX * absX >> 127; if (y & 0x2 != 0) { absResult = absResult * absX >> 127; } absX = absX * absX >> 127; if (y & 0x4 != 0) { absResult = absResult * absX >> 127; } absX = absX * absX >> 127; if (y & 0x8 != 0) { absResult = absResult * absX >> 127; } absX = absX * absX >> 127; y >>= 4; } absResult >>= 64; } else { uint256 absXShift = 63; if (absX < 0x1000000000000000000000000) { absX <<= 32; absXShift -= 32; } if (absX < 0x10000000000000000000000000000) { absX <<= 16; absXShift -= 16; } if (absX < 0x1000000000000000000000000000000) { absX <<= 8; absXShift -= 8; } if (absX < 0x10000000000000000000000000000000) { absX <<= 4; absXShift -= 4; } if (absX < 0x40000000000000000000000000000000) { absX <<= 2; absXShift -= 2; } if (absX < 0x80000000000000000000000000000000) { absX <<= 1; absXShift -= 1; } uint256 resultShift = 0; while (y != 0) { require (absXShift < 64); if (y & 0x1 != 0) { absResult = absResult * absX >> 127; resultShift += absXShift; if (absResult > 0x100000000000000000000000000000000) { absResult >>= 1; resultShift += 1; } } absX = absX * absX >> 127; absXShift <<= 1; if (absX >= 0x100000000000000000000000000000000) { absX >>= 1; absXShift += 1; } y >>= 1; } require (resultShift < 64); absResult >>= 64 - resultShift; } int256 result = negative ? -int256 (absResult) : int256 (absResult); require (result >= MIN_64x64 && result <= MAX_64x64); return int128 (result); } } /** * 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) { unchecked { require (x >= 0); return int128 (sqrtu (uint256 (int256 (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) { unchecked { 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 (int256 (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) { unchecked { require (x > 0); return int128 (int256 ( uint256 (int256 (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) { unchecked { 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 (int256 (63 - (x >> 64))); require (result <= uint256 (int256 (MAX_64x64))); return int128 (int256 (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) { unchecked { 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) { unchecked { 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 result += xh == hi >> 128 ? xl / y : 1; } require (result <= 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF); return uint128 (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) { unchecked { 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 >= 0x4) { 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); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (interfaces/IERC165.sol) pragma solidity ^0.8.0; import "../utils/introspection/IERC165.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 pragma solidity ^0.8.10; interface IStakingToken { event Staked(address indexed user, uint256 amount, uint256 term); event Withdrawn(address indexed user, uint256 amount, uint256 reward); function stake(uint256 amount, uint256 term) external; function withdraw() external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; interface IRankedMintingToken { event RankClaimed(address indexed user, uint256 term, uint256 rank); event MintClaimed(address indexed user, uint256 rewardAmount); function claimRank(uint256 term) external; function claimMintReward() external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; interface IBurnableToken { function burn(address user, uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; interface IBurnRedeemable { event Redeemed( address indexed user, address indexed xenContract, address indexed tokenContract, uint256 xenAmount, uint256 tokenAmount ); function onTokenBurned(address user, uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import "./Math.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/interfaces/IERC165.sol"; import "abdk-libraries-solidity/ABDKMath64x64.sol"; import "./interfaces/IStakingToken.sol"; import "./interfaces/IRankedMintingToken.sol"; import "./interfaces/IBurnableToken.sol"; import "./interfaces/IBurnRedeemable.sol"; contract XENCrypto is Context, IRankedMintingToken, IStakingToken, IBurnableToken, ERC20("XEN Crypto", "XEN") { using Math for uint256; using ABDKMath64x64 for int128; using ABDKMath64x64 for uint256; // INTERNAL TYPE TO DESCRIBE A XEN MINT INFO struct MintInfo { address user; uint256 term; uint256 maturityTs; uint256 rank; uint256 amplifier; uint256 eaaRate; } // INTERNAL TYPE TO DESCRIBE A XEN STAKE struct StakeInfo { uint256 term; uint256 maturityTs; uint256 amount; uint256 apy; } // PUBLIC CONSTANTS uint256 public constant SECONDS_IN_DAY = 3_600 * 24; uint256 public constant DAYS_IN_YEAR = 365; uint256 public constant GENESIS_RANK = 1; uint256 public constant MIN_TERM = 1 * SECONDS_IN_DAY - 1; uint256 public constant MAX_TERM_START = 100 * SECONDS_IN_DAY; uint256 public constant MAX_TERM_END = 1_000 * SECONDS_IN_DAY; uint256 public constant TERM_AMPLIFIER = 15; uint256 public constant TERM_AMPLIFIER_THRESHOLD = 5_000; uint256 public constant REWARD_AMPLIFIER_START = 3_000; uint256 public constant REWARD_AMPLIFIER_END = 1; uint256 public constant EAA_PM_START = 100; uint256 public constant EAA_PM_STEP = 1; uint256 public constant EAA_RANK_STEP = 100_000; uint256 public constant WITHDRAWAL_WINDOW_DAYS = 7; uint256 public constant MAX_PENALTY_PCT = 99; uint256 public constant XEN_MIN_STAKE = 0; uint256 public constant XEN_MIN_BURN = 0; uint256 public constant XEN_APY_START = 20; uint256 public constant XEN_APY_DAYS_STEP = 90; uint256 public constant XEN_APY_END = 2; string public constant AUTHORS = "@MrJackLevin @lbelyaev faircrypto.org"; // PUBLIC STATE, READABLE VIA NAMESAKE GETTERS uint256 public immutable genesisTs; uint256 public globalRank = GENESIS_RANK; uint256 public activeMinters; uint256 public activeStakes; uint256 public totalXenStaked; // user address => XEN mint info mapping(address => MintInfo) public userMints; // user address => XEN stake info mapping(address => StakeInfo) public userStakes; // user address => XEN burn amount mapping(address => uint256) public userBurns; // CONSTRUCTOR constructor() { genesisTs = block.timestamp; } // PRIVATE METHODS /** * @dev calculates current MaxTerm based on Global Rank * (if Global Rank crosses over TERM_AMPLIFIER_THRESHOLD) */ function _calculateMaxTerm() private view returns (uint256) { if (globalRank > TERM_AMPLIFIER_THRESHOLD) { uint256 delta = globalRank.fromUInt().log_2().mul(TERM_AMPLIFIER.fromUInt()).toUInt(); uint256 newMax = MAX_TERM_START + delta * SECONDS_IN_DAY; return Math.min(newMax, MAX_TERM_END); } return MAX_TERM_START; } /** * @dev calculates Withdrawal Penalty depending on lateness */ function _penalty(uint256 secsLate) private pure returns (uint256) { // =MIN(2^(daysLate+3)/window-1,99) uint256 daysLate = secsLate / SECONDS_IN_DAY; if (daysLate > WITHDRAWAL_WINDOW_DAYS - 1) return MAX_PENALTY_PCT; uint256 penalty = (uint256(1) << (daysLate + 3)) / WITHDRAWAL_WINDOW_DAYS - 1; return Math.min(penalty, MAX_PENALTY_PCT); } /** * @dev calculates net Mint Reward (adjusted for Penalty) */ function _calculateMintReward( uint256 cRank, uint256 term, uint256 maturityTs, uint256 amplifier, uint256 eeaRate ) private view returns (uint256) { uint256 secsLate = block.timestamp - maturityTs; uint256 penalty = _penalty(secsLate); uint256 rankDelta = Math.max(globalRank - cRank, 2); uint256 EAA = (1_000 + eeaRate); uint256 reward = getGrossReward(rankDelta, amplifier, term, EAA); return (reward * (100 - penalty)) / 100; } /** * @dev cleans up User Mint storage (gets some Gas credit;)) */ function _cleanUpUserMint() private { delete userMints[_msgSender()]; activeMinters--; } /** * @dev calculates XEN Stake Reward */ function _calculateStakeReward( uint256 amount, uint256 term, uint256 maturityTs, uint256 apy ) private view returns (uint256) { if (block.timestamp > maturityTs) { uint256 rate = (apy * term * 1_000_000) / DAYS_IN_YEAR; return (amount * rate) / 100_000_000; } return 0; } /** * @dev calculates Reward Amplifier */ function _calculateRewardAmplifier() private view returns (uint256) { uint256 amplifierDecrease = (block.timestamp - genesisTs) / SECONDS_IN_DAY; if (amplifierDecrease < REWARD_AMPLIFIER_START) { return Math.max(REWARD_AMPLIFIER_START - amplifierDecrease, REWARD_AMPLIFIER_END); } else { return REWARD_AMPLIFIER_END; } } /** * @dev calculates Early Adopter Amplifier Rate (in 1/000ths) * actual EAA is (1_000 + EAAR) / 1_000 */ function _calculateEAARate() private view returns (uint256) { uint256 decrease = (EAA_PM_STEP * globalRank) / EAA_RANK_STEP; if (decrease > EAA_PM_START) return 0; return EAA_PM_START - decrease; } /** * @dev calculates APY (in %) */ function _calculateAPY() private view returns (uint256) { uint256 decrease = (block.timestamp - genesisTs) / (SECONDS_IN_DAY * XEN_APY_DAYS_STEP); if (XEN_APY_START - XEN_APY_END < decrease) return XEN_APY_END; return XEN_APY_START - decrease; } /** * @dev creates User Stake */ function _createStake(uint256 amount, uint256 term) private { userStakes[_msgSender()] = StakeInfo({ term: term, maturityTs: block.timestamp + term * SECONDS_IN_DAY, amount: amount, apy: _calculateAPY() }); activeStakes++; totalXenStaked += amount; } // PUBLIC CONVENIENCE GETTERS /** * @dev calculates gross Mint Reward */ function getGrossReward( uint256 rankDelta, uint256 amplifier, uint256 term, uint256 eaa ) public pure returns (uint256) { int128 log128 = rankDelta.fromUInt().log_2(); int128 reward128 = log128.mul(amplifier.fromUInt()).mul(term.fromUInt()).mul(eaa.fromUInt()); return reward128.div(uint256(1_000).fromUInt()).toUInt(); } /** * @dev returns User Mint object associated with User account address */ function getUserMint() external view returns (MintInfo memory) { return userMints[_msgSender()]; } /** * @dev returns XEN Stake object associated with User account address */ function getUserStake() external view returns (StakeInfo memory) { return userStakes[_msgSender()]; } /** * @dev returns current AMP */ function getCurrentAMP() external view returns (uint256) { return _calculateRewardAmplifier(); } /** * @dev returns current EAA Rate */ function getCurrentEAAR() external view returns (uint256) { return _calculateEAARate(); } /** * @dev returns current APY */ function getCurrentAPY() external view returns (uint256) { return _calculateAPY(); } /** * @dev returns current MaxTerm */ function getCurrentMaxTerm() external view returns (uint256) { return _calculateMaxTerm(); } // PUBLIC STATE-CHANGING METHODS /** * @dev accepts User cRank claim provided all checks pass (incl. no current claim exists) */ function claimRank(uint256 term) external { uint256 termSec = term * SECONDS_IN_DAY; require(termSec > MIN_TERM, "CRank: Term less than min"); require(termSec < _calculateMaxTerm() + 1, "CRank: Term more than current max term"); require(userMints[_msgSender()].rank == 0, "CRank: Mint already in progress"); // create and store new MintInfo MintInfo memory mintInfo = MintInfo({ user: _msgSender(), term: term, maturityTs: block.timestamp + termSec, rank: globalRank, amplifier: _calculateRewardAmplifier(), eaaRate: _calculateEAARate() }); userMints[_msgSender()] = mintInfo; activeMinters++; emit RankClaimed(_msgSender(), term, globalRank++); } /** * @dev ends minting upon maturity (and within permitted Withdrawal Time Window), gets minted XEN */ function claimMintReward() external { MintInfo memory mintInfo = userMints[_msgSender()]; require(mintInfo.rank > 0, "CRank: No mint exists"); require(block.timestamp > mintInfo.maturityTs, "CRank: Mint maturity not reached"); // calculate reward and mint tokens uint256 rewardAmount = _calculateMintReward( mintInfo.rank, mintInfo.term, mintInfo.maturityTs, mintInfo.amplifier, mintInfo.eaaRate ) * 1 ether; _mint(_msgSender(), rewardAmount); _cleanUpUserMint(); emit MintClaimed(_msgSender(), rewardAmount); } /** * @dev ends minting upon maturity (and within permitted Withdrawal time Window) * mints XEN coins and splits them between User and designated other address */ function claimMintRewardAndShare(address other, uint256 pct) external { MintInfo memory mintInfo = userMints[_msgSender()]; require(other != address(0), "CRank: Cannot share with zero address"); require(pct > 0, "CRank: Cannot share zero percent"); require(pct < 101, "CRank: Cannot share 100+ percent"); require(mintInfo.rank > 0, "CRank: No mint exists"); require(block.timestamp > mintInfo.maturityTs, "CRank: Mint maturity not reached"); // calculate reward uint256 rewardAmount = _calculateMintReward( mintInfo.rank, mintInfo.term, mintInfo.maturityTs, mintInfo.amplifier, mintInfo.eaaRate ) * 1 ether; uint256 sharedReward = (rewardAmount * pct) / 100; uint256 ownReward = rewardAmount - sharedReward; // mint reward tokens _mint(_msgSender(), ownReward); _mint(other, sharedReward); _cleanUpUserMint(); emit MintClaimed(_msgSender(), rewardAmount); } /** * @dev ends minting upon maturity (and within permitted Withdrawal time Window) * mints XEN coins and stakes 'pct' of it for 'term' */ function claimMintRewardAndStake(uint256 pct, uint256 term) external { MintInfo memory mintInfo = userMints[_msgSender()]; // require(pct > 0, "CRank: Cannot share zero percent"); require(pct < 101, "CRank: Cannot share >100 percent"); require(mintInfo.rank > 0, "CRank: No mint exists"); require(block.timestamp > mintInfo.maturityTs, "CRank: Mint maturity not reached"); // calculate reward uint256 rewardAmount = _calculateMintReward( mintInfo.rank, mintInfo.term, mintInfo.maturityTs, mintInfo.amplifier, mintInfo.eaaRate ) * 1 ether; uint256 stakedReward = (rewardAmount * pct) / 100; uint256 ownReward = rewardAmount - stakedReward; // mint reward tokens part _mint(_msgSender(), ownReward); _cleanUpUserMint(); emit MintClaimed(_msgSender(), rewardAmount); // nothing to burn since we haven't minted this part yet // stake extra tokens part require(stakedReward > XEN_MIN_STAKE, "XEN: Below min stake"); require(term * SECONDS_IN_DAY > MIN_TERM, "XEN: Below min stake term"); require(term * SECONDS_IN_DAY < MAX_TERM_END + 1, "XEN: Above max stake term"); require(userStakes[_msgSender()].amount == 0, "XEN: stake exists"); _createStake(stakedReward, term); emit Staked(_msgSender(), stakedReward, term); } /** * @dev initiates XEN Stake in amount for a term (days) */ function stake(uint256 amount, uint256 term) external { require(balanceOf(_msgSender()) >= amount, "XEN: not enough balance"); require(amount > XEN_MIN_STAKE, "XEN: Below min stake"); require(term * SECONDS_IN_DAY > MIN_TERM, "XEN: Below min stake term"); require(term * SECONDS_IN_DAY < MAX_TERM_END + 1, "XEN: Above max stake term"); require(userStakes[_msgSender()].amount == 0, "XEN: stake exists"); // burn staked XEN _burn(_msgSender(), amount); // create XEN Stake _createStake(amount, term); emit Staked(_msgSender(), amount, term); } /** * @dev ends XEN Stake and gets reward if the Stake is mature */ function withdraw() external { StakeInfo memory userStake = userStakes[_msgSender()]; require(userStake.amount > 0, "XEN: no stake exists"); uint256 xenReward = _calculateStakeReward( userStake.amount, userStake.term, userStake.maturityTs, userStake.apy ); activeStakes--; totalXenStaked -= userStake.amount; // mint staked XEN (+ reward) _mint(_msgSender(), userStake.amount + xenReward); emit Withdrawn(_msgSender(), userStake.amount, xenReward); delete userStakes[_msgSender()]; } /** * @dev burns XEN tokens and creates Proof-Of-Burn record to be used by connected DeFi services */ function burn(address user, uint256 amount) public { require(amount > XEN_MIN_BURN, "Burn: Below min limit"); require( IERC165(_msgSender()).supportsInterface(type(IBurnRedeemable).interfaceId), "Burn: not a supported contract" ); _spendAllowance(user, _msgSender(), amount); _burn(user, amount); userBurns[user] += amount; IBurnRedeemable(_msgSender()).onTokenBurned(user, amount); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.10; import "abdk-libraries-solidity/ABDKMath64x64.sol"; library Math { function min(uint256 a, uint256 b) external pure returns (uint256) { if (a > b) return b; return a; } function max(uint256 a, uint256 b) external pure returns (uint256) { if (a > b) return a; return b; } function logX64(uint256 x) external pure returns (int128) { return ABDKMath64x64.log_2(ABDKMath64x64.fromUInt(x)); } }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "london", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"xenCrypto_","type":"address"},{"internalType":"uint256","name":"startTs_","type":"uint256"},{"internalType":"uint256","name":"durationDays_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"string","name":"taprootAddress","type":"string"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"totalAmount","type":"uint256"}],"name":"Admitted","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Burned","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":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"xenContract","type":"address"},{"indexed":true,"internalType":"address","name":"tokenContract","type":"address"},{"indexed":false,"internalType":"uint256","name":"xenAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"Redeemed","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum XENKnights.Status","name":"status","type":"uint8"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"}],"name":"StatusChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"string","name":"taprootAddress","type":"string"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdrawn","type":"event"},{"inputs":[],"name":"AUTHORS","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_WINNERS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"SECS_IN_DAY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"amounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endTs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"newAmount","type":"uint256"},{"internalType":"string","name":"taprootAddress_","type":"string"}],"name":"enterCompetition","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"leaderboard","outputs":[{"internalType":"bytes32[]","name":"data","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"leaders","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"taprootAddresses","type":"bytes32[]"}],"name":"loadLeaders","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"onTokenBurned","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"status","outputs":[{"internalType":"enum XENKnights.Status","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalPlayers","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalToBurn","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"userAmounts","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"taprootAddress_","type":"string"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"xenCrypto","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60e06040523480156200001157600080fd5b5060405162001fb338038062001fb3833981016040819052620000349162000135565b6200003f33620000e5565b6001600160a01b0383166200005357600080fd5b428210156200006157600080fd5b600081116200006f57600080fd5b6001600160a01b03831660c052608082905262000090620151808262000190565b6200009c9083620001b0565b60a0526040517f40a180796b90921dd8508eb434c78206ca5c737a0d584582edf399bc9711d9e990620000d4906000904290620001c6565b60405180910390a1505050620001f3565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000806000606084860312156200014b57600080fd5b83516001600160a01b03811681146200016357600080fd5b602085015160409095015190969495509392505050565b634e487b7160e01b600052601160045260246000fd5b8082028115828204841417620001aa57620001aa6200017a565b92915050565b80820180821115620001aa57620001aa6200017a565b6040810160058410620001e957634e487b7160e01b600052602160045260246000fd5b9281526020015290565b60805160a05160c051611d4362000270600039600081816101fb015281816103fe01528181610543015281816105d90152818161064a015281816108bb01526113020152600081816102c101528181610ae201528181610fa9015281816111d4015261153c01526000818161018e01526114bd0152611d436000f3fe608060405234801561001057600080fd5b50600436106101425760003560e01c8063a36e6577116100b8578063c8662d951161007c578063c8662d95146102e3578063ce21ec4114610303578063df5aec081461030d578063e61bceda14610316578063f2fde38b14610341578063f60cdcf61461035457600080fd5b8063a36e657714610261578063b79cf1c714610274578063ba3ec74114610287578063bf3683991461029c578063c84477f1146102bc57600080fd5b806344df8e701161010a57806344df8e70146101db578063543746b1146101e357806371141a58146101f6578063715018a61461023557806380ab17fe1461023d5780638da5cb5b1461025057600080fd5b806301ffc9a714610147578063200d2ed21461016f57806325677e4f1461018957806329a62a76146101be57806331fb67c2146101c6575b600080fd5b61015a6101553660046117b1565b61035d565b60405190151581526020015b60405180910390f35b60035461017c9060ff1681565b604051610166919061181a565b6101b07f000000000000000000000000000000000000000000000000000000000000000081565b604051908152602001610166565b6101b0606481565b6101d96101d4366004611871565b610394565b005b6101d961051b565b6101d96101f13660046118cf565b61063f565b61021d7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610166565b6101d961087a565b6101d961024b3660046118f9565b61088e565b6000546001600160a01b031661021d565b6101b061026f366004611945565b610ab7565b6101d961028236600461195e565b610ad8565b61028f610e69565b60405161016691906119f7565b6102af6102aa366004611945565b610e85565b6040516101669190611a2a565b6101b07f000000000000000000000000000000000000000000000000000000000000000081565b6101b06102f1366004611945565b60046020526000908152604090205481565b6101b06201518081565b6101b060025481565b6101b06103243660046118cf565b600560209081526000928352604080842090915290825290205481565b6101d961034f366004611a6e565b610edf565b6101b060015481565b60006001600160e01b0319821663543746b160e01b148061038e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600082826040516103a6929190611a89565b604051809103902090506103bb838383610f58565b3360008181526005602090815260408083208584529091529081902054905163a9059cbb60e01b8152600481019290925260248201819052906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906044016020604051808303816000875af1158015610447573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046b9190611a99565b6104bc5760405162461bcd60e51b815260206004820152601d60248201527f58656e4b6e69676874733a206572726f72207769746864726177696e6700000060448201526064015b60405180910390fd5b33600081815260056020908152604080832086845290915280822091909155517f18af30a54a1951aeee806c16cdcb8d087ed1a095f0d9a87261b92cef2c6cc92d9061050d90879087908690611ae4565b60405180910390a250505050565b6105236111d2565b60025460405163095ea7b360e01b815230600482015260248101919091527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063095ea7b3906044016020604051808303816000875af1158015610594573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b89190611a99565b50600254604051632770a7eb60e21b815230600482015260248101919091527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031690639dc29fac90604401600060405180830381600087803b15801561062557600080fd5b505af1158015610639573d6000803e3d6000fd5b50505050565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146106cc5760405162461bcd60e51b815260206004820152602c60248201527f494275726e61626c6552656465656d61626c653a20696c6c6567616c2063616c60448201526b363130b1b59031b0b63632b960a11b60648201526084016104b3565b6001600160a01b03821630146107305760405162461bcd60e51b815260206004820152602360248201527f494275726e61626c6552656465656d61626c653a20696c6c6567616c206275726044820152623732b960e91b60648201526084016104b3565b600254811461078d5760405162461bcd60e51b815260206004820152602360248201527f494275726e61626c6552656465656d61626c653a20696c6c6567616c20616d6f6044820152621d5b9d60ea1b60648201526084016104b3565b600260035460ff1660048111156107a6576107a66117e2565b146107ff5760405162461bcd60e51b815260206004820152602360248201527f494275726e61626c6552656465656d61626c653a20696c6c6567616c2073746160448201526274757360e81b60648201526084016104b3565b6003805460ff1916811781556040517f40a180796b90921dd8508eb434c78206ca5c737a0d584582edf399bc9711d9e99161083b914290611b08565b60405180910390a16040518181527fd83c63197e8e676d80ab0122beba9a9d20f3828839e9a1d6fe81d242e9cd7e6e9060200160405180910390a15050565b6108826113c2565b61088c600061141c565b565b61089983838361146c565b6040516323b872dd60e01b8152336004820152306024820152604481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906323b872dd906064016020604051808303816000875af115801561090c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109309190611a99565b6109875760405162461bcd60e51b815260206004820152602260248201527f58656e4b6e69676874733a20636f756c64206e6f74207472616e73666572205860448201526122a760f11b60648201526084016104b3565b60008282604051610999929190611a89565b60408051918290039091206000818152600460205291822054909250906109c08683611b39565b6000848152600460209081526040808320849055338352600582528083208784529091528120805492935088929091906109fb908490611b39565b909155506000905060035460ff166004811115610a1a57610a1a6117e2565b03610a68576003805460ff191660019081179091556040517f40a180796b90921dd8508eb434c78206ca5c737a0d584582edf399bc9711d9e991610a5f914290611b08565b60405180910390a15b336001600160a01b03167f95e6aa54efc49d7eaa2efb8da3adaf22f9257279137a8f1428a0b7c4621d0dcb86868985604051610aa79493929190611b4c565b60405180910390a2505050505050565b60068181548110610ac757600080fd5b600091825260209091200154905081565b610ae06113c2565b7f00000000000000000000000000000000000000000000000000000000000000004211610b5d5760405162461bcd60e51b815260206004820152602560248201527f41646d696e3a2063616e6e6f74206c6f6164206c656164657273206265666f726044820152641948195b9960da1b60648201526084016104b3565b600160035460ff166004811115610b7657610b766117e2565b14610bb75760405162461bcd60e51b815260206004820152601160248201527041646d696e3a206261642073746174757360781b60448201526064016104b3565b8015801590610bd05750610bcd60646001611b39565b81105b610c1c5760405162461bcd60e51b815260206004820152601a60248201527f41646d696e3a20696c6c6567616c206c697374206c656e67746800000000000060448201526064016104b3565b60006004600084846000818110610c3557610c35611b73565b90506020020135815260200190815260200160002054905060005b82811015610e1b57600060046000868685818110610c7057610c70611b73565b9050602002013581526020019081526020016000205411610ce15760405162461bcd60e51b815260206004820152602560248201527f41646d696e3a2077696e6e6572277320616d6f756e742063616e6e6f74206265604482015264207a65726f60d81b60648201526084016104b3565b801580610d1957508160046000868685818110610d0057610d00611b73565b9050602002013581526020019081526020016000205410155b610d5e5760405162461bcd60e51b815260206004820152601660248201527510591b5a5b8e881b1a5cdd081b9bdd081cdbdc9d195960521b60448201526064016104b3565b60046000858584818110610d7457610d74611b73565b9050602002013581526020019081526020016000205491506006848483818110610da057610da0611b73565b835460018101855560009485526020808620920293909301359201919091555060028054849290610dd2908490611b39565b9091555060009050600481868685818110610def57610def611b73565b905060200201358152602001908152602001600020819055508080610e1390611b89565b915050610c50565b506003805460ff191660029081179091556040517f40a180796b90921dd8508eb434c78206ca5c737a0d584582edf399bc9711d9e991610e5c914290611b08565b60405180910390a1505050565b6040518060600160405280602e8152602001611ce0602e913981565b60606006805480602002602001604051908101604052809291908181526020018280548015610ed357602002820191906000526020600020905b815481526020019060010190808311610ebf575b50505050509050919050565b610ee76113c2565b6001600160a01b038116610f4c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104b3565b610f558161141c565b50565b333214610fa75760405162461bcd60e51b815260206004820152601d60248201527f58656e4b6e69676874733a206f6e6c7920454f417320616c6c6f77656400000060448201526064016104b3565b7f000000000000000000000000000000000000000000000000000000000000000042116110275760405162461bcd60e51b815260206004820152602860248201527f58656e4b6e69676874733a20636f6d7065746974696f6e206e6f742079657420604482015267199a5b9a5cda195960c21b60648201526084016104b3565b600160035460ff166004811115611040576110406117e2565b1161105d5760405162461bcd60e51b81526004016104b390611ba2565b603e821461107d5760405162461bcd60e51b81526004016104b390611beb565b6110e461108e600460008587611c34565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506040805180820190915260048152630626331760e41b602082015291506116cd9050565b6111005760405162461bcd60e51b81526004016104b390611c5e565b3360009081526005602090815260408083208484529091529020546111675760405162461bcd60e51b815260206004820152601f60248201527f58656e4b6e69676874733a206e6f7468696e6720746f2077697468647261770060448201526064016104b3565b6000818152600460205260409020546111cd5760405162461bcd60e51b815260206004820152602260248201527f58656e4b6e69676874733a2077696e6e65722063616e6e6f7420776974686472604482015261617760f01b60648201526084016104b3565b505050565b7f000000000000000000000000000000000000000000000000000000000000000042116112115760405162461bcd60e51b81526004016104b390611ba2565b600160035460ff16600481111561122a5761122a6117e2565b116112855760405162461bcd60e51b815260206004820152602560248201527f58656e4b6e69676874733a20636f6d7065746974696f6e206e6f742079657420604482015264199a5b985b60da1b60648201526084016104b3565b6003805460ff16600481111561129d5761129d6117e2565b106112ea5760405162461bcd60e51b815260206004820152601a60248201527f58656e4b6e69676874733a20616c7265616479206275726e656400000000000060448201526064016104b3565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015611351573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113759190611caa565b1161088c5760405162461bcd60e51b815260206004820152601b60248201527f58656e4b6e69676874733a206e6f7468696e6720746f206275726e000000000060448201526064016104b3565b6000546001600160a01b0316331461088c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104b3565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b3332146114bb5760405162461bcd60e51b815260206004820152601d60248201527f58656e4b6e69676874733a206f6e6c7920454f417320616c6c6f77656400000060448201526064016104b3565b7f0000000000000000000000000000000000000000000000000000000000000000421161153a5760405162461bcd60e51b815260206004820152602760248201527f58656e4b6e69676874733a20636f6d7065746974696f6e206e6f7420796574206044820152661cdd185c9d195960ca1b60648201526084016104b3565b7f000000000000000000000000000000000000000000000000000000000000000042106115ba5760405162461bcd60e51b815260206004820152602860248201527f58656e4b6e69676874733a20636f6d7065746974696f6e20616c726561647920604482015267199a5b9a5cda195960c21b60648201526084016104b3565b600260035460ff1660048111156115d3576115d36117e2565b106116305760405162461bcd60e51b815260206004820152602760248201527f58656e4b6e69676874733a20636f6d7065746974696f6e206e6f7420696e2070604482015266726f677265737360c81b60648201526084016104b3565b600083116116805760405162461bcd60e51b815260206004820152601a60248201527f58656e4b6e69676874733a20696c6c6567616c20616d6f756e7400000000000060448201526064016104b3565b603e81146116a05760405162461bcd60e51b81526004016104b390611beb565b6116b161108e600460008486611c34565b6111cd5760405162461bcd60e51b81526004016104b390611c5e565b60006002826040516020016116e29190611cc3565b60408051601f19818403018152908290526116fc91611cc3565b602060405180830381855afa158015611719573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061173c9190611caa565b60028460405160200161174f9190611cc3565b60408051601f198184030181529082905261176991611cc3565b602060405180830381855afa158015611786573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906117a99190611caa565b149392505050565b6000602082840312156117c357600080fd5b81356001600160e01b0319811681146117db57600080fd5b9392505050565b634e487b7160e01b600052602160045260246000fd5b6005811061181657634e487b7160e01b600052602160045260246000fd5b9052565b6020810161038e82846117f8565b60008083601f84011261183a57600080fd5b50813567ffffffffffffffff81111561185257600080fd5b60208301915083602082850101111561186a57600080fd5b9250929050565b6000806020838503121561188457600080fd5b823567ffffffffffffffff81111561189b57600080fd5b6118a785828601611828565b90969095509350505050565b80356001600160a01b03811681146118ca57600080fd5b919050565b600080604083850312156118e257600080fd5b6118eb836118b3565b946020939093013593505050565b60008060006040848603121561190e57600080fd5b83359250602084013567ffffffffffffffff81111561192c57600080fd5b61193886828701611828565b9497909650939450505050565b60006020828403121561195757600080fd5b5035919050565b6000806020838503121561197157600080fd5b823567ffffffffffffffff8082111561198957600080fd5b818501915085601f83011261199d57600080fd5b8135818111156119ac57600080fd5b8660208260051b85010111156119c157600080fd5b60209290920196919550909350505050565b60005b838110156119ee5781810151838201526020016119d6565b50506000910152565b6020815260008251806020840152611a168160408501602087016119d3565b601f01601f19169190910160400192915050565b6020808252825182820181905260009190848201906040850190845b81811015611a6257835183529284019291840191600101611a46565b50909695505050505050565b600060208284031215611a8057600080fd5b6117db826118b3565b8183823760009101908152919050565b600060208284031215611aab57600080fd5b815180151581146117db57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b604081526000611af8604083018587611abb565b9050826020830152949350505050565b60408101611b1682856117f8565b8260208301529392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561038e5761038e611b23565b606081526000611b60606083018688611abb565b6020830194909452506040015292915050565b634e487b7160e01b600052603260045260246000fd5b600060018201611b9b57611b9b611b23565b5060010190565b60208082526029908201527f58656e4b6e69676874733a20636f6d7065746974696f6e207374696c6c20696e6040820152682070726f677265737360b81b606082015260800190565b60208082526029908201527f58656e4b6e69676874733a20696c6c6567616c20746170726f6f7441646472656040820152680e6e640d8cadccee8d60bb1b606082015260800190565b60008085851115611c4457600080fd5b83861115611c5157600080fd5b5050820193919092039150565b6020808252602c908201527f58656e4b6e69676874733a20696c6c6567616c20746170726f6f74416464726560408201526b7373207369676e617475726560a01b606082015260800190565b600060208284031215611cbc57600080fd5b5051919050565b60008251611cd58184602087016119d3565b919091019291505056fe404d724a61636b4c6576696e204061636b65626f6d20406c62656c79616576206661697263727970746f2e6f7267a2646970667358221220db6587d986e2dd4a50cb9876f299cd878c1e0322a4e6eaf16a57e2fcb9b2f35264736f6c6343000811003300000000000000000000000006450dee7fd2fb8e39061434babcfc05599a6fb800000000000000000000000000000000000000000000000000000000643d7b740000000000000000000000000000000000000000000000000000000000000003
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101425760003560e01c8063a36e6577116100b8578063c8662d951161007c578063c8662d95146102e3578063ce21ec4114610303578063df5aec081461030d578063e61bceda14610316578063f2fde38b14610341578063f60cdcf61461035457600080fd5b8063a36e657714610261578063b79cf1c714610274578063ba3ec74114610287578063bf3683991461029c578063c84477f1146102bc57600080fd5b806344df8e701161010a57806344df8e70146101db578063543746b1146101e357806371141a58146101f6578063715018a61461023557806380ab17fe1461023d5780638da5cb5b1461025057600080fd5b806301ffc9a714610147578063200d2ed21461016f57806325677e4f1461018957806329a62a76146101be57806331fb67c2146101c6575b600080fd5b61015a6101553660046117b1565b61035d565b60405190151581526020015b60405180910390f35b60035461017c9060ff1681565b604051610166919061181a565b6101b07f00000000000000000000000000000000000000000000000000000000643d7b7481565b604051908152602001610166565b6101b0606481565b6101d96101d4366004611871565b610394565b005b6101d961051b565b6101d96101f13660046118cf565b61063f565b61021d7f00000000000000000000000006450dee7fd2fb8e39061434babcfc05599a6fb881565b6040516001600160a01b039091168152602001610166565b6101d961087a565b6101d961024b3660046118f9565b61088e565b6000546001600160a01b031661021d565b6101b061026f366004611945565b610ab7565b6101d961028236600461195e565b610ad8565b61028f610e69565b60405161016691906119f7565b6102af6102aa366004611945565b610e85565b6040516101669190611a2a565b6101b07f0000000000000000000000000000000000000000000000000000000064416ff481565b6101b06102f1366004611945565b60046020526000908152604090205481565b6101b06201518081565b6101b060025481565b6101b06103243660046118cf565b600560209081526000928352604080842090915290825290205481565b6101d961034f366004611a6e565b610edf565b6101b060015481565b60006001600160e01b0319821663543746b160e01b148061038e57506301ffc9a760e01b6001600160e01b03198316145b92915050565b600082826040516103a6929190611a89565b604051809103902090506103bb838383610f58565b3360008181526005602090815260408083208584529091529081902054905163a9059cbb60e01b8152600481019290925260248201819052906001600160a01b037f00000000000000000000000006450dee7fd2fb8e39061434babcfc05599a6fb8169063a9059cbb906044016020604051808303816000875af1158015610447573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061046b9190611a99565b6104bc5760405162461bcd60e51b815260206004820152601d60248201527f58656e4b6e69676874733a206572726f72207769746864726177696e6700000060448201526064015b60405180910390fd5b33600081815260056020908152604080832086845290915280822091909155517f18af30a54a1951aeee806c16cdcb8d087ed1a095f0d9a87261b92cef2c6cc92d9061050d90879087908690611ae4565b60405180910390a250505050565b6105236111d2565b60025460405163095ea7b360e01b815230600482015260248101919091527f00000000000000000000000006450dee7fd2fb8e39061434babcfc05599a6fb86001600160a01b03169063095ea7b3906044016020604051808303816000875af1158015610594573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105b89190611a99565b50600254604051632770a7eb60e21b815230600482015260248101919091527f00000000000000000000000006450dee7fd2fb8e39061434babcfc05599a6fb86001600160a01b031690639dc29fac90604401600060405180830381600087803b15801561062557600080fd5b505af1158015610639573d6000803e3d6000fd5b50505050565b336001600160a01b037f00000000000000000000000006450dee7fd2fb8e39061434babcfc05599a6fb816146106cc5760405162461bcd60e51b815260206004820152602c60248201527f494275726e61626c6552656465656d61626c653a20696c6c6567616c2063616c60448201526b363130b1b59031b0b63632b960a11b60648201526084016104b3565b6001600160a01b03821630146107305760405162461bcd60e51b815260206004820152602360248201527f494275726e61626c6552656465656d61626c653a20696c6c6567616c206275726044820152623732b960e91b60648201526084016104b3565b600254811461078d5760405162461bcd60e51b815260206004820152602360248201527f494275726e61626c6552656465656d61626c653a20696c6c6567616c20616d6f6044820152621d5b9d60ea1b60648201526084016104b3565b600260035460ff1660048111156107a6576107a66117e2565b146107ff5760405162461bcd60e51b815260206004820152602360248201527f494275726e61626c6552656465656d61626c653a20696c6c6567616c2073746160448201526274757360e81b60648201526084016104b3565b6003805460ff1916811781556040517f40a180796b90921dd8508eb434c78206ca5c737a0d584582edf399bc9711d9e99161083b914290611b08565b60405180910390a16040518181527fd83c63197e8e676d80ab0122beba9a9d20f3828839e9a1d6fe81d242e9cd7e6e9060200160405180910390a15050565b6108826113c2565b61088c600061141c565b565b61089983838361146c565b6040516323b872dd60e01b8152336004820152306024820152604481018490527f00000000000000000000000006450dee7fd2fb8e39061434babcfc05599a6fb86001600160a01b0316906323b872dd906064016020604051808303816000875af115801561090c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109309190611a99565b6109875760405162461bcd60e51b815260206004820152602260248201527f58656e4b6e69676874733a20636f756c64206e6f74207472616e73666572205860448201526122a760f11b60648201526084016104b3565b60008282604051610999929190611a89565b60408051918290039091206000818152600460205291822054909250906109c08683611b39565b6000848152600460209081526040808320849055338352600582528083208784529091528120805492935088929091906109fb908490611b39565b909155506000905060035460ff166004811115610a1a57610a1a6117e2565b03610a68576003805460ff191660019081179091556040517f40a180796b90921dd8508eb434c78206ca5c737a0d584582edf399bc9711d9e991610a5f914290611b08565b60405180910390a15b336001600160a01b03167f95e6aa54efc49d7eaa2efb8da3adaf22f9257279137a8f1428a0b7c4621d0dcb86868985604051610aa79493929190611b4c565b60405180910390a2505050505050565b60068181548110610ac757600080fd5b600091825260209091200154905081565b610ae06113c2565b7f0000000000000000000000000000000000000000000000000000000064416ff44211610b5d5760405162461bcd60e51b815260206004820152602560248201527f41646d696e3a2063616e6e6f74206c6f6164206c656164657273206265666f726044820152641948195b9960da1b60648201526084016104b3565b600160035460ff166004811115610b7657610b766117e2565b14610bb75760405162461bcd60e51b815260206004820152601160248201527041646d696e3a206261642073746174757360781b60448201526064016104b3565b8015801590610bd05750610bcd60646001611b39565b81105b610c1c5760405162461bcd60e51b815260206004820152601a60248201527f41646d696e3a20696c6c6567616c206c697374206c656e67746800000000000060448201526064016104b3565b60006004600084846000818110610c3557610c35611b73565b90506020020135815260200190815260200160002054905060005b82811015610e1b57600060046000868685818110610c7057610c70611b73565b9050602002013581526020019081526020016000205411610ce15760405162461bcd60e51b815260206004820152602560248201527f41646d696e3a2077696e6e6572277320616d6f756e742063616e6e6f74206265604482015264207a65726f60d81b60648201526084016104b3565b801580610d1957508160046000868685818110610d0057610d00611b73565b9050602002013581526020019081526020016000205410155b610d5e5760405162461bcd60e51b815260206004820152601660248201527510591b5a5b8e881b1a5cdd081b9bdd081cdbdc9d195960521b60448201526064016104b3565b60046000858584818110610d7457610d74611b73565b9050602002013581526020019081526020016000205491506006848483818110610da057610da0611b73565b835460018101855560009485526020808620920293909301359201919091555060028054849290610dd2908490611b39565b9091555060009050600481868685818110610def57610def611b73565b905060200201358152602001908152602001600020819055508080610e1390611b89565b915050610c50565b506003805460ff191660029081179091556040517f40a180796b90921dd8508eb434c78206ca5c737a0d584582edf399bc9711d9e991610e5c914290611b08565b60405180910390a1505050565b6040518060600160405280602e8152602001611ce0602e913981565b60606006805480602002602001604051908101604052809291908181526020018280548015610ed357602002820191906000526020600020905b815481526020019060010190808311610ebf575b50505050509050919050565b610ee76113c2565b6001600160a01b038116610f4c5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104b3565b610f558161141c565b50565b333214610fa75760405162461bcd60e51b815260206004820152601d60248201527f58656e4b6e69676874733a206f6e6c7920454f417320616c6c6f77656400000060448201526064016104b3565b7f0000000000000000000000000000000000000000000000000000000064416ff442116110275760405162461bcd60e51b815260206004820152602860248201527f58656e4b6e69676874733a20636f6d7065746974696f6e206e6f742079657420604482015267199a5b9a5cda195960c21b60648201526084016104b3565b600160035460ff166004811115611040576110406117e2565b1161105d5760405162461bcd60e51b81526004016104b390611ba2565b603e821461107d5760405162461bcd60e51b81526004016104b390611beb565b6110e461108e600460008587611c34565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506040805180820190915260048152630626331760e41b602082015291506116cd9050565b6111005760405162461bcd60e51b81526004016104b390611c5e565b3360009081526005602090815260408083208484529091529020546111675760405162461bcd60e51b815260206004820152601f60248201527f58656e4b6e69676874733a206e6f7468696e6720746f2077697468647261770060448201526064016104b3565b6000818152600460205260409020546111cd5760405162461bcd60e51b815260206004820152602260248201527f58656e4b6e69676874733a2077696e6e65722063616e6e6f7420776974686472604482015261617760f01b60648201526084016104b3565b505050565b7f0000000000000000000000000000000000000000000000000000000064416ff442116112115760405162461bcd60e51b81526004016104b390611ba2565b600160035460ff16600481111561122a5761122a6117e2565b116112855760405162461bcd60e51b815260206004820152602560248201527f58656e4b6e69676874733a20636f6d7065746974696f6e206e6f742079657420604482015264199a5b985b60da1b60648201526084016104b3565b6003805460ff16600481111561129d5761129d6117e2565b106112ea5760405162461bcd60e51b815260206004820152601a60248201527f58656e4b6e69676874733a20616c7265616479206275726e656400000000000060448201526064016104b3565b6040516370a0823160e01b81523060048201526000907f00000000000000000000000006450dee7fd2fb8e39061434babcfc05599a6fb86001600160a01b0316906370a0823190602401602060405180830381865afa158015611351573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113759190611caa565b1161088c5760405162461bcd60e51b815260206004820152601b60248201527f58656e4b6e69676874733a206e6f7468696e6720746f206275726e000000000060448201526064016104b3565b6000546001600160a01b0316331461088c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104b3565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b3332146114bb5760405162461bcd60e51b815260206004820152601d60248201527f58656e4b6e69676874733a206f6e6c7920454f417320616c6c6f77656400000060448201526064016104b3565b7f00000000000000000000000000000000000000000000000000000000643d7b74421161153a5760405162461bcd60e51b815260206004820152602760248201527f58656e4b6e69676874733a20636f6d7065746974696f6e206e6f7420796574206044820152661cdd185c9d195960ca1b60648201526084016104b3565b7f0000000000000000000000000000000000000000000000000000000064416ff442106115ba5760405162461bcd60e51b815260206004820152602860248201527f58656e4b6e69676874733a20636f6d7065746974696f6e20616c726561647920604482015267199a5b9a5cda195960c21b60648201526084016104b3565b600260035460ff1660048111156115d3576115d36117e2565b106116305760405162461bcd60e51b815260206004820152602760248201527f58656e4b6e69676874733a20636f6d7065746974696f6e206e6f7420696e2070604482015266726f677265737360c81b60648201526084016104b3565b600083116116805760405162461bcd60e51b815260206004820152601a60248201527f58656e4b6e69676874733a20696c6c6567616c20616d6f756e7400000000000060448201526064016104b3565b603e81146116a05760405162461bcd60e51b81526004016104b390611beb565b6116b161108e600460008486611c34565b6111cd5760405162461bcd60e51b81526004016104b390611c5e565b60006002826040516020016116e29190611cc3565b60408051601f19818403018152908290526116fc91611cc3565b602060405180830381855afa158015611719573d6000803e3d6000fd5b5050506040513d601f19601f8201168201806040525081019061173c9190611caa565b60028460405160200161174f9190611cc3565b60408051601f198184030181529082905261176991611cc3565b602060405180830381855afa158015611786573d6000803e3d6000fd5b5050506040513d601f19601f820116820180604052508101906117a99190611caa565b149392505050565b6000602082840312156117c357600080fd5b81356001600160e01b0319811681146117db57600080fd5b9392505050565b634e487b7160e01b600052602160045260246000fd5b6005811061181657634e487b7160e01b600052602160045260246000fd5b9052565b6020810161038e82846117f8565b60008083601f84011261183a57600080fd5b50813567ffffffffffffffff81111561185257600080fd5b60208301915083602082850101111561186a57600080fd5b9250929050565b6000806020838503121561188457600080fd5b823567ffffffffffffffff81111561189b57600080fd5b6118a785828601611828565b90969095509350505050565b80356001600160a01b03811681146118ca57600080fd5b919050565b600080604083850312156118e257600080fd5b6118eb836118b3565b946020939093013593505050565b60008060006040848603121561190e57600080fd5b83359250602084013567ffffffffffffffff81111561192c57600080fd5b61193886828701611828565b9497909650939450505050565b60006020828403121561195757600080fd5b5035919050565b6000806020838503121561197157600080fd5b823567ffffffffffffffff8082111561198957600080fd5b818501915085601f83011261199d57600080fd5b8135818111156119ac57600080fd5b8660208260051b85010111156119c157600080fd5b60209290920196919550909350505050565b60005b838110156119ee5781810151838201526020016119d6565b50506000910152565b6020815260008251806020840152611a168160408501602087016119d3565b601f01601f19169190910160400192915050565b6020808252825182820181905260009190848201906040850190845b81811015611a6257835183529284019291840191600101611a46565b50909695505050505050565b600060208284031215611a8057600080fd5b6117db826118b3565b8183823760009101908152919050565b600060208284031215611aab57600080fd5b815180151581146117db57600080fd5b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b604081526000611af8604083018587611abb565b9050826020830152949350505050565b60408101611b1682856117f8565b8260208301529392505050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561038e5761038e611b23565b606081526000611b60606083018688611abb565b6020830194909452506040015292915050565b634e487b7160e01b600052603260045260246000fd5b600060018201611b9b57611b9b611b23565b5060010190565b60208082526029908201527f58656e4b6e69676874733a20636f6d7065746974696f6e207374696c6c20696e6040820152682070726f677265737360b81b606082015260800190565b60208082526029908201527f58656e4b6e69676874733a20696c6c6567616c20746170726f6f7441646472656040820152680e6e640d8cadccee8d60bb1b606082015260800190565b60008085851115611c4457600080fd5b83861115611c5157600080fd5b5050820193919092039150565b6020808252602c908201527f58656e4b6e69676874733a20696c6c6567616c20746170726f6f74416464726560408201526b7373207369676e617475726560a01b606082015260800190565b600060208284031215611cbc57600080fd5b5051919050565b60008251611cd58184602087016119d3565b919091019291505056fe404d724a61636b4c6576696e204061636b65626f6d20406c62656c79616576206661697263727970746f2e6f7267a2646970667358221220db6587d986e2dd4a50cb9876f299cd878c1e0322a4e6eaf16a57e2fcb9b2f35264736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000006450dee7fd2fb8e39061434babcfc05599a6fb800000000000000000000000000000000000000000000000000000000643d7b740000000000000000000000000000000000000000000000000000000000000003
-----Decoded View---------------
Arg [0] : xenCrypto_ (address): 0x06450dEe7FD2Fb8E39061434BAbCFC05599a6Fb8
Arg [1] : startTs_ (uint256): 1681750900
Arg [2] : durationDays_ (uint256): 3
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000006450dee7fd2fb8e39061434babcfc05599a6fb8
Arg [1] : 00000000000000000000000000000000000000000000000000000000643d7b74
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000003
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | 100.00% | <$0.000001 | 742,141,358 | $99.51 |
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.