ERC-721
Overview
Max Total Supply
0 STK
Holders
289
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
1 STKLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
FluxStaking
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 200 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.26; /* == OZ == */ import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {ERC721} from "@openzeppelin/contracts/token/ERC721/ERC721.sol"; /* == CORE == */ import {Voluntary777Pool} from "@core/Pools/777Voluntary.sol"; /* == UTILS == */ import {Time} from "@utils/Time.sol"; import {wdiv, wmul, sub, wpow} from "@utils/Math.sol"; import {Errors} from "@utils/Errors.sol"; /* == INTERFACES == */ import {IFlux} from "@interfaces/IFlux.sol"; /* == CONST == */ import "@const/Constants.sol"; struct UserRecord { uint160 shares; uint160 lockedFlux; uint128 rewardDebt; uint32 endTime; } /** * @title FluxStaking * @author Zyntek * @notice The staking contract of the Flux system */ contract FluxStaking is ERC721, Errors { using SafeERC20 for IERC20; //===========ENUMS===========// enum POOLS { DAY8, DAY28, DAY88, VOLUNTARY } //===========CONST===========// uint32 public constant MIN_DURATION = 90 days; uint32 public constant MAX_DURATION = 2888 days; //=========IMMUTABLE=========// IERC20 immutable titanX; address immutable auction; Voluntary777Pool public immutable voluntary; IFlux immutable flux; //===========STATE===========// uint256 public totalShares; uint128 public rewardPerShare; uint32 public startTimestamp; uint96 public tokenId; uint32 lastDistributedDay; mapping(POOLS => uint256) public toDistribute; mapping(uint256 id => UserRecord record) public userRecords; //==========ERRORS==========// error FluxStaking__InvalidDuration(); error FluxStaking__NoSharesToClaim(); error FluxStaking__LockPeriodNotOver(); error FluXStaking__CannotUnstakeAutoBoughtAndStakedFlux(); error FluxStaking__OnlyMintingAndBurning(); //==========EVENTS==========// event Staked( address indexed staker, uint256 indexed flux, uint152 indexed id, uint256 _shares, uint32 duration, bool isVoluntary ); event Unstaked( uint256 indexed shares, uint256 indexed fluxAmountReceived, uint256 indexed _tokenId, address recepient ); event Claimed(uint256 indexed id, uint256 indexed rewards, uint256 indexed newRewardDebt, address ownerOfStake); event Distributed(POOLS indexed pool, uint256 indexed amount); //==========CONSTRUCTOR==========// constructor(address _titanX, address _auction, address _flux, uint32 _startTimestamp) ERC721("Staking", "STK") { titanX = IERC20(_titanX); auction = _auction; startTimestamp = _startTimestamp; flux = IFlux(_flux); voluntary = new Voluntary777Pool(address(this), titanX); lastDistributedDay = 1; } //==========================// //==========PUBLIC==========// //==========================// function stake(uint32 _duration, uint160 _fluxAmount) external notAmount0(_fluxAmount) returns (uint96 _tokenId, uint144 shares) { if (_duration > MAX_DURATION || _duration < MIN_DURATION) revert FluxStaking__InvalidDuration(); updateRewardsIfNecessary(); _tokenId = ++tokenId; shares = uint144(wmul(_fluxAmount, getFluxToShareRatio())); _addToVoluntaryPoolIfNeeded(shares, _fluxAmount, _duration, _tokenId); userRecords[_tokenId] = UserRecord({ endTime: Time.blockTs() + _duration, shares: shares, rewardDebt: rewardPerShare, lockedFlux: _fluxAmount }); totalShares += shares; emit Staked( msg.sender, _fluxAmount, _tokenId, shares, _duration, _duration == MAX_DURATION && msg.sender != address(auction) ); flux.transferFrom(msg.sender, address(this), _fluxAmount); _mint(msg.sender, _tokenId); } function batchClaimableAmount(uint160[] calldata _ids) external view returns (uint256 toClaim) { uint32 currentDay = Time.daysSince(startTimestamp) + 1; uint256 m_rewardsPerShare = rewardPerShare; uint256 m_voluntaryRewardPerShare = voluntary.rewardPerShare(); uint256 m_voluntaryTotalShares = voluntary.totalShares(); bool distributeDay8 = (currentDay / 8 > lastDistributedDay / 8); bool distributeDay28 = (currentDay / 28 > lastDistributedDay / 28); bool distributeDay88 = (currentDay / 88 > lastDistributedDay / 88); bool distributeDay777 = (currentDay / 777 > lastDistributedDay / 777); if (distributeDay8) m_rewardsPerShare += uint72(wdiv(toDistribute[POOLS.DAY8], totalShares)); if (distributeDay28) m_rewardsPerShare += uint72(wdiv(toDistribute[POOLS.DAY28], totalShares)); if (distributeDay88) m_rewardsPerShare += uint72(wdiv(toDistribute[POOLS.DAY88], totalShares)); if (distributeDay777) { m_voluntaryRewardPerShare += uint72(wdiv(toDistribute[POOLS.VOLUNTARY], m_voluntaryTotalShares)); } for (uint256 i; i < _ids.length; ++i) { uint160 _id = _ids[i]; UserRecord memory _rec = userRecords[_id]; (uint144 voluntaryIdShares, uint112 voluntaryIdRewardDebt) = voluntary.record(_id); toClaim += wmul(_rec.shares, m_rewardsPerShare - _rec.rewardDebt); toClaim += wmul(voluntaryIdShares, m_voluntaryRewardPerShare - voluntaryIdRewardDebt); } } function unstake(uint160 _tokenId, address _receiver) public notAddress0(_receiver) notAmount0(_tokenId) { address ownerOfStake = ownerOf(_tokenId); UserRecord memory record = userRecords[_tokenId]; if (ownerOfStake == address(auction)) revert FluXStaking__CannotUnstakeAutoBoughtAndStakedFlux(); if (record.shares == 0) revert FluxStaking__NoSharesToClaim(); if (record.endTime > Time.blockTs()) revert FluxStaking__LockPeriodNotOver(); isApprovedOrOwner(_tokenId, msg.sender); _claim(_tokenId, _receiver); uint256 _locked = record.lockedFlux; (uint160 shares,) = voluntary.record(_tokenId); uint256 _shares = record.shares; if (shares != 0 && ownerOfStake != address(auction)) voluntary.unstake(_tokenId, _locked); delete userRecords[_tokenId]; totalShares -= _shares; emit Unstaked(_shares, _locked, _tokenId, _receiver); flux.transfer(_receiver, _locked); _burn(_tokenId); } function batchUnstake(uint160[] calldata _ids, address _receiver) external { for (uint256 i; i < _ids.length; ++i) { unstake(_ids[i], _receiver); } } function claim(uint160 _tokenId, address _receiver) public notAddress0(_receiver) notAmount0(_tokenId) { isApprovedOrOwner(_tokenId, msg.sender); _claim(_tokenId, _receiver); } function batchClaim(uint160[] calldata _ids, address _receiver) external { for (uint256 i; i < _ids.length; ++i) { claim(_ids[i], _receiver); } } function isApprovedOrOwner(uint256 _tokenId, address _spender) public view { _checkAuthorized(ownerOf(_tokenId), _spender, _tokenId); } function distribute(uint256 _amount) external notAmount0(_amount) { titanX.safeTransferFrom(msg.sender, address(this), _amount); _distribute(_amount); } function updateRewardsIfNecessary() public { if (totalShares == 0) return; uint32 currentDay = Time.daysSince(startTimestamp) + 1; // Calculate how many periods have passed for each interval bool distributeDay8 = (currentDay / 8 > lastDistributedDay / 8); bool distributeDay28 = (currentDay / 28 > lastDistributedDay / 28); bool distributeDay88 = (currentDay / 88 > lastDistributedDay / 88); bool distributeDay777 = (currentDay / 777 > lastDistributedDay / 777); // Distribute for the 8-day pool if necessary if (distributeDay8) _updateRewards(POOLS.DAY8, toDistribute); // Distribute for the 28-day pool if necessary if (distributeDay28) _updateRewards(POOLS.DAY28, toDistribute); // Distribute for the 88-day pool if necessary if (distributeDay88) _updateRewards(POOLS.DAY88, toDistribute); // Distribute for the 777-day pool if necessary if (distributeDay777) { uint256 forVoluntary = toDistribute[POOLS.VOLUNTARY]; if (forVoluntary > 0 && voluntary.totalShares() > 0) { titanX.transfer(address(voluntary), forVoluntary); voluntary.distribute(forVoluntary); emit Distributed(POOLS.VOLUNTARY, toDistribute[POOLS.VOLUNTARY]); toDistribute[POOLS.VOLUNTARY] = 0; } } // Update the last distributed day to the current day lastDistributedDay = currentDay; } //==========================// //=========INTERNAL=========// //==========================// function _claim(uint160 _tokenId, address _receiver) internal { UserRecord storage _rec = userRecords[_tokenId]; updateRewardsIfNecessary(); uint256 amountToClaim = wmul(_rec.shares, rewardPerShare - _rec.rewardDebt); (uint160 shares,) = voluntary.record(_tokenId); uint256 amountFromVoluntary = shares != 0 ? voluntary.claim(_tokenId) : 0; _rec.rewardDebt = rewardPerShare; emit Claimed(_tokenId, amountToClaim + amountFromVoluntary, rewardPerShare, ownerOf(_tokenId)); titanX.transfer(_receiver, amountToClaim + amountFromVoluntary); } function _distribute(uint256 amount) internal { uint32 currentDay = Time.daysSince(startTimestamp) + 1; if (currentDay == 1) { toDistribute[POOLS.DAY8] += amount; } else { toDistribute[POOLS.DAY8] += wmul(amount, DAY8POOL_DIST); toDistribute[POOLS.DAY28] += wmul(amount, DAY28POOL_DIST); toDistribute[POOLS.DAY88] += wmul(amount, DAY88POOL_DIST); toDistribute[POOLS.VOLUNTARY] += wmul(amount, VOLUNTARY_DIST); } updateRewardsIfNecessary(); } function _updateRewards(POOLS pool, mapping(POOLS => uint256) storage toDist) internal { if (toDist[pool] == 0) return; rewardPerShare += uint72(wdiv(toDist[pool], totalShares)); emit Distributed(pool, toDist[pool]); toDistribute[pool] = 0; } function getFluxToShareRatio() public view returns (uint256 ratio) { uint32 currentDay = Time.daysSince(startTimestamp) + 1; uint32 gaps = uint32(currentDay / 8); //@note - The initial ratio is WAD ratio = uint160(wpow(wdiv(WAD, WAD - DAY8_SHARE_DECREASE), gaps, WAD)); } function _addToVoluntaryPoolIfNeeded(uint144 _sharesAmount, uint256 fluxAmount, uint32 _duration, uint256 _id) internal { if (msg.sender == address(auction) || _duration != MAX_DURATION) return; voluntary.stake(_id, _sharesAmount, fluxAmount); } //==========================// //=========OVVERRIDE========// //==========================// function _update(address to, uint256 _id, address auth) internal override returns (address) { address from = _ownerOf(_id); if (from != address(0) && to != address(0)) revert FluxStaking__OnlyMintingAndBurning(); return super._update(to, _id, auth); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value))); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value))); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @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 value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` 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 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.20; import {IERC721} from "./IERC721.sol"; import {IERC721Receiver} from "./IERC721Receiver.sol"; import {IERC721Metadata} from "./extensions/IERC721Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {Strings} from "../../utils/Strings.sol"; import {IERC165, ERC165} from "../../utils/introspection/ERC165.sol"; import {IERC721Errors} from "../../interfaces/draft-IERC6093.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ abstract contract ERC721 is Context, ERC165, IERC721, IERC721Metadata, IERC721Errors { using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; mapping(uint256 tokenId => address) private _owners; mapping(address owner => uint256) private _balances; mapping(uint256 tokenId => address) private _tokenApprovals; mapping(address owner => mapping(address operator => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual returns (uint256) { if (owner == address(0)) { revert ERC721InvalidOwner(address(0)); } return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual returns (address) { return _requireOwned(tokenId); } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual returns (string memory) { _requireOwned(tokenId); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string.concat(baseURI, tokenId.toString()) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overridden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual { _approve(to, tokenId, _msgSender()); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual returns (address) { _requireOwned(tokenId); return _getApproved(tokenId); } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual { _setApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom(address from, address to, uint256 tokenId) public virtual { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } // Setting an "auth" arguments enables the `_isAuthorized` check which verifies that the token exists // (from != 0). Therefore, it is not needed to verify that the return value is not 0 here. address previousOwner = _update(to, tokenId, _msgSender()); if (previousOwner != from) { revert ERC721IncorrectOwner(from, tokenId, previousOwner); } } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId) public { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public virtual { transferFrom(from, to, tokenId); _checkOnERC721Received(from, to, tokenId, data); } /** * @dev Returns the owner of the `tokenId`. Does NOT revert if token doesn't exist * * IMPORTANT: Any overrides to this function that add ownership of tokens not tracked by the * core ERC721 logic MUST be matched with the use of {_increaseBalance} to keep balances * consistent with ownership. The invariant to preserve is that for any address `a` the value returned by * `balanceOf(a)` must be equal to the number of tokens such that `_ownerOf(tokenId)` is `a`. */ function _ownerOf(uint256 tokenId) internal view virtual returns (address) { return _owners[tokenId]; } /** * @dev Returns the approved address for `tokenId`. Returns 0 if `tokenId` is not minted. */ function _getApproved(uint256 tokenId) internal view virtual returns (address) { return _tokenApprovals[tokenId]; } /** * @dev Returns whether `spender` is allowed to manage `owner`'s tokens, or `tokenId` in * particular (ignoring whether it is owned by `owner`). * * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this * assumption. */ function _isAuthorized(address owner, address spender, uint256 tokenId) internal view virtual returns (bool) { return spender != address(0) && (owner == spender || isApprovedForAll(owner, spender) || _getApproved(tokenId) == spender); } /** * @dev Checks if `spender` can operate on `tokenId`, assuming the provided `owner` is the actual owner. * Reverts if `spender` does not have approval from the provided `owner` for the given token or for all its assets * the `spender` for the specific `tokenId`. * * WARNING: This function assumes that `owner` is the actual owner of `tokenId` and does not verify this * assumption. */ function _checkAuthorized(address owner, address spender, uint256 tokenId) internal view virtual { if (!_isAuthorized(owner, spender, tokenId)) { if (owner == address(0)) { revert ERC721NonexistentToken(tokenId); } else { revert ERC721InsufficientApproval(spender, tokenId); } } } /** * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override. * * NOTE: the value is limited to type(uint128).max. This protect against _balance overflow. It is unrealistic that * a uint256 would ever overflow from increments when these increments are bounded to uint128 values. * * WARNING: Increasing an account's balance using this function tends to be paired with an override of the * {_ownerOf} function to resolve the ownership of the corresponding tokens so that balances and ownership * remain consistent with one another. */ function _increaseBalance(address account, uint128 value) internal virtual { unchecked { _balances[account] += value; } } /** * @dev Transfers `tokenId` from its current owner to `to`, or alternatively mints (or burns) if the current owner * (or `to`) is the zero address. Returns the owner of the `tokenId` before the update. * * The `auth` argument is optional. If the value passed is non 0, then this function will check that * `auth` is either the owner of the token, or approved to operate on the token (by the owner). * * Emits a {Transfer} event. * * NOTE: If overriding this function in a way that tracks balances, see also {_increaseBalance}. */ function _update(address to, uint256 tokenId, address auth) internal virtual returns (address) { address from = _ownerOf(tokenId); // Perform (optional) operator check if (auth != address(0)) { _checkAuthorized(from, auth, tokenId); } // Execute the update if (from != address(0)) { // Clear approval. No need to re-authorize or emit the Approval event _approve(address(0), tokenId, address(0), false); unchecked { _balances[from] -= 1; } } if (to != address(0)) { unchecked { _balances[to] += 1; } } _owners[tokenId] = to; emit Transfer(from, to, tokenId); return from; } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } address previousOwner = _update(to, tokenId, address(0)); if (previousOwner != address(0)) { revert ERC721InvalidSender(address(0)); } } /** * @dev Mints `tokenId`, transfers it to `to` and checks for `to` acceptance. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint(address to, uint256 tokenId, bytes memory data) internal virtual { _mint(to, tokenId); _checkOnERC721Received(address(0), to, tokenId, data); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * This is an internal function that does not check if the sender is authorized to operate on the token. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal { address previousOwner = _update(address(0), tokenId, address(0)); if (previousOwner == address(0)) { revert ERC721NonexistentToken(tokenId); } } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer(address from, address to, uint256 tokenId) internal { if (to == address(0)) { revert ERC721InvalidReceiver(address(0)); } address previousOwner = _update(to, tokenId, address(0)); if (previousOwner == address(0)) { revert ERC721NonexistentToken(tokenId); } else if (previousOwner != from) { revert ERC721IncorrectOwner(from, tokenId, previousOwner); } } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking that contract recipients * are aware of the ERC721 standard to prevent tokens from being forever locked. * * `data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is like {safeTransferFrom} in the sense that it invokes * {IERC721Receiver-onERC721Received} on the receiver, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `tokenId` token must exist and be owned by `from`. * - `to` cannot be the zero address. * - `from` cannot be the zero address. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer(address from, address to, uint256 tokenId) internal { _safeTransfer(from, to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeTransfer-address-address-uint256-}[`_safeTransfer`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeTransfer(address from, address to, uint256 tokenId, bytes memory data) internal virtual { _transfer(from, to, tokenId); _checkOnERC721Received(from, to, tokenId, data); } /** * @dev Approve `to` to operate on `tokenId` * * The `auth` argument is optional. If the value passed is non 0, then this function will check that `auth` is * either the owner of the token, or approved to operate on all tokens held by this owner. * * Emits an {Approval} event. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address to, uint256 tokenId, address auth) internal { _approve(to, tokenId, auth, true); } /** * @dev Variant of `_approve` with an optional flag to enable or disable the {Approval} event. The event is not * emitted in the context of transfers. */ function _approve(address to, uint256 tokenId, address auth, bool emitEvent) internal virtual { // Avoid reading the owner unless necessary if (emitEvent || auth != address(0)) { address owner = _requireOwned(tokenId); // We do not use _isAuthorized because single-token approvals should not be able to call approve if (auth != address(0) && owner != auth && !isApprovedForAll(owner, auth)) { revert ERC721InvalidApprover(auth); } if (emitEvent) { emit Approval(owner, to, tokenId); } } _tokenApprovals[tokenId] = to; } /** * @dev Approve `operator` to operate on all of `owner` tokens * * Requirements: * - operator can't be the address zero. * * Emits an {ApprovalForAll} event. */ function _setApprovalForAll(address owner, address operator, bool approved) internal virtual { if (operator == address(0)) { revert ERC721InvalidOperator(operator); } _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @dev Reverts if the `tokenId` doesn't have a current owner (it hasn't been minted, or it has been burned). * Returns the owner. * * Overrides to ownership logic should be done to {_ownerOf}. */ function _requireOwned(uint256 tokenId) internal view returns (address) { address owner = _ownerOf(tokenId); if (owner == address(0)) { revert ERC721NonexistentToken(tokenId); } return owner; } /** * @dev Private function to invoke {IERC721Receiver-onERC721Received} on a target address. This will revert if the * recipient doesn't accept the token transfer. The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param data bytes optional data to send along with the call */ function _checkOnERC721Received(address from, address to, uint256 tokenId, bytes memory data) private { if (to.code.length > 0) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, data) returns (bytes4 retval) { if (retval != IERC721Receiver.onERC721Received.selector) { revert ERC721InvalidReceiver(to); } } catch (bytes memory reason) { if (reason.length == 0) { revert ERC721InvalidReceiver(to); } else { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.26; /* == OZ == */ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /* == SYSTEM == */ import {FluxStaking} from "@core/Staking.sol"; /* == UTILS == */ import {Errors} from "@utils/Errors.sol"; import {wmul, wdiv} from "@utils/Math.sol"; /* == CONST == */ import "@const/Constants.sol"; struct UserRecord { uint144 shares; uint112 rewardDebt; } /** * @title Voluntary777Pool * @author Zyntek * @notice The voluntary staking pools where people who staked for the max duration earn extra rewards */ contract Voluntary777Pool is Errors { /* == IMMUTABLE == */ FluxStaking immutable staking; IERC20 immutable titanX; /* == STORAGE == */ mapping(uint256 id => UserRecord) public record; uint256 public totalFluxStaked; uint160 public totalShares; uint112 public rewardPerShare; /* == ERRORS == */ error Voluntary777Pool__OnlyStaking(); /* == MODIFIERS == */ modifier onlyStaking() { _onlyStaking(); _; } /* == CONSTRUCTOR == */ constructor(address fluxStaking, IERC20 _titanX) notAddress0(fluxStaking) notAddress0(address(_titanX)) { staking = FluxStaking(fluxStaking); titanX = _titanX; } /* == PUBLIC == */ function stake(uint256 _tokenId, uint144 _shares, uint256 fluxAmount) external onlyStaking notAmount0(_shares) notAmount0(fluxAmount) notAmount0(_tokenId) { record[_tokenId] = UserRecord({shares: _shares, rewardDebt: rewardPerShare}); totalFluxStaked += fluxAmount; totalShares = totalShares + _shares; } function unstake(uint256 _tokenId, uint256 fluxAmount) external onlyStaking notAmount0(_tokenId) { totalShares -= record[_tokenId].shares; totalFluxStaked -= fluxAmount; delete record[_tokenId]; } function claim(uint160 _tokenId) external onlyStaking notAmount0(_tokenId) returns (uint256 claimedAmount) { UserRecord storage r = record[_tokenId]; claimedAmount = wmul(r.shares, rewardPerShare - r.rewardDebt); if (claimedAmount != 0) { r.rewardDebt = rewardPerShare; titanX.transfer(msg.sender, claimedAmount); } } function claimableAmount(uint160 _tokenId) public view returns (uint256 amountToClaim) { UserRecord storage r = record[_tokenId]; amountToClaim = wmul(r.shares, rewardPerShare - r.rewardDebt); } function distribute(uint256 _amount) external onlyStaking { if (totalShares == 0) return; rewardPerShare += uint112(wdiv(_amount, totalShares)); } /* == INTERNAL == */ function _onlyStaking() internal view { if (msg.sender != address(staking)) revert Voluntary777Pool__OnlyStaking(); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.26; library Time { ///@notice Gets the current timestamp function blockTs() internal view returns (uint32 ts) { assembly { ts := timestamp() } } ///@notice Gets the the day count from a timestamp function dayCountByT(uint32 t) internal pure returns (uint32 dayCount) { assembly { let adjustedTime := sub(t, 61200) dayCount := div(adjustedTime, 86400) } } ///@notice Gets the week count, since a starting timestamp function weekSince(uint32 t) internal view returns (uint32 weeksPassed) { assembly { let currentTime := timestamp() let timeElapsed := sub(currentTime, t) weeksPassed := div(timeElapsed, 604800) } } function daysSince(uint32 t) public view returns (uint32 daysPassed) { assembly { // Get the current block timestamp let currentTime := timestamp() daysPassed := div(sub(currentTime, t), 86400) } } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.26; /* solhint-disable func-visibility, no-inline-assembly */ error Math__toInt256_overflow(); error Math__toUint64_overflow(); error Math__add_overflow_signed(); error Math__sub_overflow_signed(); error Math__mul_overflow_signed(); error Math__mul_overflow(); error Math__div_overflow(); uint256 constant WAD = 1e18; /// @dev Taken from https://github.com/Vectorized/solady/blob/6d706e05ef43cbed234c648f83c55f3a4bb0a520/src/utils/SafeCastLib.sol#L367 function toInt256(uint256 x) pure returns (int256) { if (x >= 1 << 255) revert Math__toInt256_overflow(); return int256(x); } /// @dev Taken from https://github.com/Vectorized/solady/blob/6d706e05ef43cbed234c648f83c55f3a4bb0a520/src/utils/SafeCastLib.sol#L53 function toUint64(uint256 x) pure returns (uint64) { if (x >= 1 << 64) revert Math__toUint64_overflow(); return uint64(x); } /// @dev Taken from https://github.com/Vectorized/solady/blob/6d706e05ef43cbed234c648f83c55f3a4bb0a520/src/utils/FixedPointMathLib.sol#L602 function abs(int256 x) pure returns (uint256 z) { assembly ("memory-safe") { let mask := sub(0, shr(255, x)) z := xor(mask, add(mask, x)) } } /// @dev Taken from https://github.com/Vectorized/solady/blob/6d706e05ef43cbed234c648f83c55f3a4bb0a520/src/utils/FixedPointMathLib.sol#L620 function min(uint256 x, uint256 y) pure returns (uint256 z) { assembly ("memory-safe") { z := xor(x, mul(xor(x, y), lt(y, x))) } } /// @dev Taken from https://github.com/Vectorized/solady/blob/6d706e05ef43cbed234c648f83c55f3a4bb0a520/src/utils/FixedPointMathLib.sol#L628 function min(int256 x, int256 y) pure returns (int256 z) { assembly ("memory-safe") { z := xor(x, mul(xor(x, y), slt(y, x))) } } /// @dev Taken from https://github.com/Vectorized/solady/blob/6d706e05ef43cbed234c648f83c55f3a4bb0a520/src/utils/FixedPointMathLib.sol#L636 function max(uint256 x, uint256 y) pure returns (uint256 z) { assembly ("memory-safe") { z := xor(x, mul(xor(x, y), gt(y, x))) } } /// @dev Taken from https://github.com/makerdao/dss/blob/fa4f6630afb0624d04a003e920b0d71a00331d98/src/vat.sol#L74 function add(uint256 x, int256 y) pure returns (uint256 z) { assembly ("memory-safe") { z := add(x, y) } if ((y > 0 && z < x) || (y < 0 && z > x)) { revert Math__add_overflow_signed(); } } /// @dev Taken from https://github.com/makerdao/dss/blob/fa4f6630afb0624d04a003e920b0d71a00331d98/src/vat.sol#L79 function sub(uint256 x, uint256 y) pure returns (uint256 z) { assembly ("memory-safe") { z := sub(x, y) } if ((y > 0 && z > x) || (y < 0 && z < x)) { revert Math__sub_overflow_signed(); } } /// @dev Taken from https://github.com/makerdao/dss/blob/fa4f6630afb0624d04a003e920b0d71a00331d98/src/vat.sol#L84 function mul(uint256 x, int256 y) pure returns (int256 z) { unchecked { z = int256(x) * y; if (int256(x) < 0 || (y != 0 && z / y != int256(x))) { revert Math__mul_overflow_signed(); } } } /// @dev Equivalent to `(x * y) / WAD` rounded down. /// @dev Taken from https://github.com/Vectorized/solady/blob/6d706e05ef43cbed234c648f83c55f3a4bb0a520/src/utils/FixedPointMathLib.sol#L54 function wmul(uint256 x, uint256 y) pure returns (uint256 z) { assembly ("memory-safe") { // Equivalent to `require(y == 0 || x <= type(uint256).max / y)`. if mul(y, gt(x, div(not(0), y))) { // Store the function selector of `Math__mul_overflow()`. mstore(0x00, 0xc4c5d7f5) // Revert with (offset, size). revert(0x1c, 0x04) } z := div(mul(x, y), WAD) } } function wmul(uint256 x, int256 y) pure returns (int256 z) { unchecked { z = mul(x, y) / int256(WAD); } } /// @dev Equivalent to `(x * y) / WAD` rounded up. /// @dev Taken from https://github.com/Vectorized/solady/blob/969a78905274b32cdb7907398c443f7ea212e4f4/src/utils/FixedPointMathLib.sol#L69C22-L69C22 function wmulUp(uint256 x, uint256 y) pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { // Equivalent to `require(y == 0 || x <= type(uint256).max / y)`. if mul(y, gt(x, div(not(0), y))) { // Store the function selector of `Math__mul_overflow()`. mstore(0x00, 0xc4c5d7f5) // Revert with (offset, size). revert(0x1c, 0x04) } z := add(iszero(iszero(mod(mul(x, y), WAD))), div(mul(x, y), WAD)) } } /// @dev Equivalent to `(x * WAD) / y` rounded down. /// @dev Taken from https://github.com/Vectorized/solady/blob/6d706e05ef43cbed234c648f83c55f3a4bb0a520/src/utils/FixedPointMathLib.sol#L84 function wdiv(uint256 x, uint256 y) pure returns (uint256 z) { assembly ("memory-safe") { // Equivalent to `require(y != 0 && (WAD == 0 || x <= type(uint256).max / WAD))`. if iszero(mul(y, iszero(mul(WAD, gt(x, div(not(0), WAD)))))) { // Store the function selector of `Math__div_overflow()`. mstore(0x00, 0xbcbede65) // Revert with (offset, size). revert(0x1c, 0x04) } z := div(mul(x, WAD), y) } } /// @dev Equivalent to `(x * WAD) / y` rounded up. /// @dev Taken from https://github.com/Vectorized/solady/blob/969a78905274b32cdb7907398c443f7ea212e4f4/src/utils/FixedPointMathLib.sol#L99 function wdivUp(uint256 x, uint256 y) pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { // Equivalent to `require(y != 0 && (WAD == 0 || x <= type(uint256).max / WAD))`. if iszero(mul(y, iszero(mul(WAD, gt(x, div(not(0), WAD)))))) { // Store the function selector of `Math__div_overflow()`. mstore(0x00, 0xbcbede65) // Revert with (offset, size). revert(0x1c, 0x04) } z := add(iszero(iszero(mod(mul(x, WAD), y))), div(mul(x, WAD), y)) } } /// @dev Taken from https://github.com/makerdao/dss/blob/fa4f6630afb0624d04a003e920b0d71a00331d98/src/jug.sol#L62 function wpow(uint256 x, uint256 n, uint256 b) pure returns (uint256 z) { unchecked { assembly ("memory-safe") { switch n case 0 { z := b } default { switch x case 0 { z := 0 } default { switch mod(n, 2) case 0 { z := b } default { z := x } let half := div(b, 2) // for rounding. for { n := div(n, 2) } n { n := div(n, 2) } { let xx := mul(x, x) if shr(128, x) { revert(0, 0) } let xxRound := add(xx, half) if lt(xxRound, xx) { revert(0, 0) } x := div(xxRound, b) if mod(n, 2) { let zx := mul(z, x) if and(iszero(iszero(x)), iszero(eq(div(zx, x), z))) { revert(0, 0) } let zxRound := add(zx, half) if lt(zxRound, zx) { revert(0, 0) } z := div(zxRound, b) } } } } } } } /// @dev Taken from https://github.com/Vectorized/solady/blob/cde0a5fb594da8655ba6bfcdc2e40a7c870c0cc0/src/utils/FixedPointMathLib.sol#L110 /// @dev Equivalent to `x` to the power of `y`. /// because `x ** y = (e ** ln(x)) ** y = e ** (ln(x) * y)`. function wpow(int256 x, int256 y) pure returns (int256) { // Using `ln(x)` means `x` must be greater than 0. return wexp((wln(x) * y) / int256(WAD)); } /// @dev Taken from https://github.com/Vectorized/solady/blob/cde0a5fb594da8655ba6bfcdc2e40a7c870c0cc0/src/utils/FixedPointMathLib.sol#L116 /// @dev Returns `exp(x)`, denominated in `WAD`. function wexp(int256 x) pure returns (int256 r) { unchecked { // When the result is < 0.5 we return zero. This happens when // x <= floor(log(0.5e18) * 1e18) ~ -42e18 if (x <= -42139678854452767551) return r; /// @solidity memory-safe-assembly assembly { // When the result is > (2**255 - 1) / 1e18 we can not represent it as an // int. This happens when x >= floor(log((2**255 - 1) / 1e18) * 1e18) ~ 135. if iszero(slt(x, 135305999368893231589)) { mstore(0x00, 0xa37bfec9) // `ExpOverflow()`. revert(0x1c, 0x04) } } // x is now in the range (-42, 136) * 1e18. Convert to (-42, 136) * 2**96 // for more intermediate precision and a binary basis. This base conversion // is a multiplication by 1e18 / 2**96 = 5**18 / 2**78. x = (x << 78) / 5 ** 18; // Reduce range of x to (-½ ln 2, ½ ln 2) * 2**96 by factoring out powers // of two such that exp(x) = exp(x') * 2**k, where k is an integer. // Solving this gives k = round(x / log(2)) and x' = x - k * log(2). int256 k = ((x << 96) / 54916777467707473351141471128 + 2 ** 95) >> 96; x = x - k * 54916777467707473351141471128; // k is in the range [-61, 195]. // Evaluate using a (6, 7)-term rational approximation. // p is made monic, we'll multiply by a scale factor later. int256 y = x + 1346386616545796478920950773328; y = ((y * x) >> 96) + 57155421227552351082224309758442; int256 p = y + x - 94201549194550492254356042504812; p = ((p * y) >> 96) + 28719021644029726153956944680412240; p = p * x + (4385272521454847904659076985693276 << 96); // We leave p in 2**192 basis so we don't need to scale it back up for the division. int256 q = x - 2855989394907223263936484059900; q = ((q * x) >> 96) + 50020603652535783019961831881945; q = ((q * x) >> 96) - 533845033583426703283633433725380; q = ((q * x) >> 96) + 3604857256930695427073651918091429; q = ((q * x) >> 96) - 14423608567350463180887372962807573; q = ((q * x) >> 96) + 26449188498355588339934803723976023; /// @solidity memory-safe-assembly assembly { // Div in assembly because solidity adds a zero check despite the unchecked. // The q polynomial won't have zeros in the domain as all its roots are complex. // No scaling is necessary because p is already 2**96 too large. r := sdiv(p, q) } // r should be in the range (0.09, 0.25) * 2**96. // We now need to multiply r by: // * the scale factor s = ~6.031367120. // * the 2**k factor from the range reduction. // * the 1e18 / 2**96 factor for base conversion. // We do this all at once, with an intermediate result in 2**213 // basis, so the final right shift is always by a positive amount. r = int256((uint256(r) * 3822833074963236453042738258902158003155416615667) >> uint256(195 - k)); } } /// @dev Taken from https://github.com/Vectorized/solady/blob/cde0a5fb594da8655ba6bfcdc2e40a7c870c0cc0/src/utils/FixedPointMathLib.sol#L184 /// @dev Returns `ln(x)`, denominated in `WAD`. function wln(int256 x) pure returns (int256 r) { unchecked { /// @solidity memory-safe-assembly assembly { if iszero(sgt(x, 0)) { mstore(0x00, 0x1615e638) // `LnWadUndefined()`. revert(0x1c, 0x04) } } // We want to convert x from 10**18 fixed point to 2**96 fixed point. // We do this by multiplying by 2**96 / 10**18. But since // ln(x * C) = ln(x) + ln(C), we can simply do nothing here // and add ln(2**96 / 10**18) at the end. // Compute k = log2(x) - 96, t = 159 - k = 255 - log2(x) = 255 ^ log2(x). int256 t; /// @solidity memory-safe-assembly assembly { t := shl(7, lt(0xffffffffffffffffffffffffffffffff, x)) t := or(t, shl(6, lt(0xffffffffffffffff, shr(t, x)))) t := or(t, shl(5, lt(0xffffffff, shr(t, x)))) t := or(t, shl(4, lt(0xffff, shr(t, x)))) t := or(t, shl(3, lt(0xff, shr(t, x)))) // forgefmt: disable-next-item t := xor( t, byte( and( 0x1f, shr(shr(t, x), 0x8421084210842108cc6318c6db6d54be) ), 0xf8f9f9faf9fdfafbf9fdfcfdfafbfcfef9fafdfafcfcfbfefafafcfbffffffff ) ) } // Reduce range of x to (1, 2) * 2**96 // ln(2^k * x) = k * ln(2) + ln(x) x = int256(uint256(x << uint256(t)) >> 159); // Evaluate using a (8, 8)-term rational approximation. // p is made monic, we will multiply by a scale factor later. int256 p = x + 3273285459638523848632254066296; p = ((p * x) >> 96) + 24828157081833163892658089445524; p = ((p * x) >> 96) + 43456485725739037958740375743393; p = ((p * x) >> 96) - 11111509109440967052023855526967; p = ((p * x) >> 96) - 45023709667254063763336534515857; p = ((p * x) >> 96) - 14706773417378608786704636184526; p = p * x - (795164235651350426258249787498 << 96); // We leave p in 2**192 basis so we don't need to scale it back up for the division. // q is monic by convention. int256 q = x + 5573035233440673466300451813936; q = ((q * x) >> 96) + 71694874799317883764090561454958; q = ((q * x) >> 96) + 283447036172924575727196451306956; q = ((q * x) >> 96) + 401686690394027663651624208769553; q = ((q * x) >> 96) + 204048457590392012362485061816622; q = ((q * x) >> 96) + 31853899698501571402653359427138; q = ((q * x) >> 96) + 909429971244387300277376558375; /// @solidity memory-safe-assembly assembly { // Div in assembly because solidity adds a zero check despite the unchecked. // The q polynomial is known not to have zeros in the domain. // No scaling required because p is already 2**96 too large. r := sdiv(p, q) } // r is in the range (0, 0.125) * 2**96 // Finalization, we need to: // * multiply by the scale factor s = 5.549… // * add ln(2**96 / 10**18) // * add k * ln(2) // * multiply by 10**18 / 2**96 = 5**18 >> 78 // mul s * 5e18 * 2**96, base is now 5**18 * 2**192 r *= 1677202110996718588342820967067443963516166; // add ln(2) * k * 5e18 * 2**192 r += 16597577552685614221487285958193947469193820559219878177908093499208371 * (159 - t); // add ln(2**96 / 10**18) * 5e18 * 2**192 r += 600920179829731861736702779321621459595472258049074101567377883020018308; // base conversion: mul 2**18 / 2**192 r >>= 174; } } /// @dev Returns the square root of `x`, rounded down. function sqrt(uint256 x) pure returns (uint256 z) { /// @solidity memory-safe-assembly assembly { // `floor(sqrt(2**15)) = 181`. `sqrt(2**15) - 181 = 2.84`. z := 181 // The "correct" value is 1, but this saves a multiplication later. // This segment is to get a reasonable initial estimate for the Babylonian method. With a bad // start, the correct # of bits increases ~linearly each iteration instead of ~quadratically. // Let `y = x / 2**r`. We check `y >= 2**(k + 8)` // but shift right by `k` bits to ensure that if `x >= 256`, then `y >= 256`. let r := shl(7, lt(0xffffffffffffffffffffffffffffffffff, x)) r := or(r, shl(6, lt(0xffffffffffffffffff, shr(r, x)))) r := or(r, shl(5, lt(0xffffffffff, shr(r, x)))) r := or(r, shl(4, lt(0xffffff, shr(r, x)))) z := shl(shr(1, r), z) // Goal was to get `z*z*y` within a small factor of `x`. More iterations could // get y in a tighter range. Currently, we will have y in `[256, 256*(2**16))`. // We ensured `y >= 256` so that the relative difference between `y` and `y+1` is small. // That's not possible if `x < 256` but we can just verify those cases exhaustively. // Now, `z*z*y <= x < z*z*(y+1)`, and `y <= 2**(16+8)`, and either `y >= 256`, or `x < 256`. // Correctness can be checked exhaustively for `x < 256`, so we assume `y >= 256`. // Then `z*sqrt(y)` is within `sqrt(257)/sqrt(256)` of `sqrt(x)`, or about 20bps. // For `s` in the range `[1/256, 256]`, the estimate `f(s) = (181/1024) * (s+1)` // is in the range `(1/2.84 * sqrt(s), 2.84 * sqrt(s))`, // with largest error when `s = 1` and when `s = 256` or `1/256`. // Since `y` is in `[256, 256*(2**16))`, let `a = y/65536`, so that `a` is in `[1/256, 256)`. // Then we can estimate `sqrt(y)` using // `sqrt(65536) * 181/1024 * (a + 1) = 181/4 * (y + 65536)/65536 = 181 * (y + 65536)/2**18`. // There is no overflow risk here since `y < 2**136` after the first branch above. z := shr(18, mul(z, add(shr(r, x), 65536))) // A `mul()` is saved from starting `z` at 181. // Given the worst case multiplicative error of 2.84 above, 7 iterations should be enough. z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) z := shr(1, add(z, div(x, z))) // If `x+1` is a perfect square, the Babylonian method cycles between // `floor(sqrt(x))` and `ceil(sqrt(x))`. This statement ensures we return floor. // See: https://en.wikipedia.org/wiki/Integer_square_root#Using_only_integer_division z := sub(z, lt(div(x, z), z)) } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.26; contract Errors { error Address0(); error Amount0(); error Expired(); modifier notAmount0(uint256 a) { _notAmount0(a); _; } modifier notExpired(uint32 _deadline) { if (block.timestamp > _deadline) revert Expired(); _; } modifier notAddress0(address a) { _notAddress0(a); _; } function _notAddress0(address a) internal pure { if (a == address(0)) revert Address0(); } function _notAmount0(uint256 a) internal pure { if (a == 0) revert Amount0(); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.26; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {FluxStaking} from "@core/Staking.sol"; interface IFluxBuyAndBurn { function distributeTitanXForBurning(uint256 _amount) external; } interface IFlux is IERC20 { function pool() external view returns (address); function buyAndBurn() external view returns (IFluxBuyAndBurn); function staking() external view returns (FluxStaking); function emitFlux(address _receiver, uint256 _amount) external; function burn(uint256 amount) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.26; import {ERC20Burnable} from "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import {IDragonX} from "@interfaces/IDragonX.sol"; import {IInferno} from "@interfaces/IInferno.sol"; // Token addresses ERC20Burnable constant TITAN_X = ERC20Burnable(0xF19308F923582A6f7c465e5CE7a9Dc1BEC6665B1); IInferno constant INFERNO = IInferno(0x00F116ac0c304C570daAA68FA6c30a86A04B5C5F); address constant TITAN_X_INFERNO_POOl = 0x1E90B67149e688DfB95fD73Acacd8ADefd16d88D; // Distribution addresses address constant GENESIS_WALLET = 0xfF5758cb7B0F57f332F956A1177a0A0Ed7785eD9; address constant FEES_WALLET = 0xCDFD7919E2a685B53A6da001B72f0170Ca0bF005; address constant OWNER = 0xA4A55205a4649b070EbD6c8D2ECE4442C8BdED2b; address constant HELIOS_ADDR = 0xA2d21205Aa7273BadDFC8E9551e05E23bB49ce46; IDragonX constant DRAGON_X = IDragonX(0x96a5399D07896f757Bd4c6eF56461F58DB951862); // Percentages in WAD uint64 constant INCENTIVE_FEE = 0.015e18; //1.5% uint64 constant WEEKLY_EMISSION_DROP = 0.012e18; // 1.2% uint64 constant DAY8_SHARE_DECREASE = 0.0126e18; uint64 constant FLUX_BUY_AND_BURN = 0.46e18; // 46% uint64 constant REWARD_POOLS = 0.4e18; // 40% uint64 constant TITAN_X_DRAGON_X = 0.04e18; // 4% uint64 constant TITAN_X_HELIOS = 0.02e18; // 2% uint64 constant GENESIS = 0.08e18; // 8% // Reward pools distribution uint64 constant DAY8POOL_DIST = 0.38e18; // 38% uint64 constant DAY28POOL_DIST = 0.3e18; // 30% uint64 constant DAY88POOL_DIST = 0.22e18; // 22% uint64 constant VOLUNTARY_DIST = 0.1e18; // 10% uint64 constant WAD = 1e18; uint16 constant INTERVAL_TIME = 8 minutes; uint8 constant INTERVALS_PER_DAY = uint8(24 hours / INTERVAL_TIME); uint24 constant POOL_FEE = 10_000; //1% int16 constant TICK_SPACING = 200; // Uniswap's tick spacing for 1% pools is 200 ///@dev The initial titan x amount needed to create liquidity pool uint96 constant INITIAL_TITAN_X_FOR_LIQ = 15_000_000_000e18; uint96 constant AUCTION_EMIT = 75_000_000_000e18; ///@dev The intial FLUX that pairs with the inferno received from the swap uint96 constant INITIAL_FLUX_FOR_LP = 10_000_000_000e18; /* === UNIV3 === */ address constant UNISWAP_V3_ROUTER = 0xE592427A0AEce92De3Edee1F18E0157C05861564; address constant UNISWAP_V3_POSITION_MANAGER = 0xC36442b4a4522E871399CD717aBDD847Ab11FE88; address constant UNISWAP_V3_QUOTER = 0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6; /* === SEPOLIA ==== */ // address constant UNISWAP_V3_ROUTER = 0x3bFA4769FB09eefC5a80d6E87c3B9C650f7Ae48E; // address constant UNISWAP_V3_POSITION_MANAGER = 0x1238536071E1c677A632429e3655c799b22cDA52; // address constant UNISWAP_V3_QUOTER = 0xEd1f6473345F45b75F8179591dd5bA1888cf2FB3;
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.20; import {IERC165} from "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon * a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must have been allowed to move this token by either {approve} or * {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon * a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the address zero. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool approved) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.20; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be * reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.20; import {IERC721} from "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol) pragma solidity ^0.8.20; import {Math} from "./math/Math.sol"; import {SignedMath} from "./math/SignedMath.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant HEX_DIGITS = "0123456789abcdef"; uint8 private constant ADDRESS_LENGTH = 20; /** * @dev The `value` string doesn't fit in the specified `length`. */ error StringsInsufficientHexLength(uint256 value, uint256 length); /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), HEX_DIGITS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toStringSigned(int256 value) internal pure returns (string memory) { return string.concat(value < 0 ? "-" : "", toString(SignedMath.abs(value))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { uint256 localValue = value; bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = HEX_DIGITS[localValue & 0xf]; localValue >>= 4; } if (localValue != 0) { revert StringsInsufficientHexLength(value, length); } return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal * representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return bytes(a).length == bytes(b).length && keccak256(bytes(a)) == keccak256(bytes(b)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "./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); * } * ``` */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.20; import {ERC20} from "../ERC20.sol"; import {Context} from "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys a `value` amount of tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 value) public virtual { _burn(_msgSender(), value); } /** * @dev Destroys a `value` amount of tokens from `account`, deducting from * the caller's allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `value`. */ function burnFrom(address account, uint256 value) public virtual { _spendAllowance(account, _msgSender(), value); _burn(account, value); } }
// SPDX-License-Identifier: MIT pragma solidity 0.8.26; interface IDragonX { function updateVault() external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.26; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; interface IInferno is IERC20 { function mint(address _to, uint256 _amount) external; function mintTokensForLP() external; function burn(uint256 value) external; function minting() external view returns (address); function buyAndBurn() external view returns (address); function blazeInfernoPool() external view returns (address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol) pragma solidity ^0.8.20; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { /** * @dev Muldiv operation overflow. */ error MathOverflowedMulDiv(); enum Rounding { Floor, // Toward negative infinity Ceil, // Toward positive infinity Trunc, // Toward zero Expand // Away from zero } /** * @dev Returns the addition of two unsigned integers, with an overflow flag. */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds towards infinity instead * of rounding towards zero. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { if (b == 0) { // Guarantee the same behavior as in a regular Solidity division. return a / b; } // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or * denominator == 0. * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) with further edits by * Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0 = x * y; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (denominator <= prod1) { revert MathOverflowedMulDiv(); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. // Always >= 1. See https://cs.stackexchange.com/q/138556/92363. uint256 twos = denominator & (0 - denominator); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also // works in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (unsignedRoundsUp(rounding) && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded * towards zero. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (unsignedRoundsUp(rounding) && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (unsignedRoundsUp(rounding) && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10 of a positive value rounded towards zero. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (unsignedRoundsUp(rounding) && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256 of a positive value rounded towards zero. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (unsignedRoundsUp(rounding) && 1 << (result << 3) < value ? 1 : 0); } } /** * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers. */ function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) { return uint8(rounding) % 2 == 1; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.20; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC20Metadata} from "./extensions/IERC20Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {IERC20Errors} from "../../interfaces/draft-IERC6093.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}. * * 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]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * 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. */ abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * 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 returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual 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 default value returned by this function, unless * it's 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 returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual 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 `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` 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 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); 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 `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` 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. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply += value; } else { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. _totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` 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. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ 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); }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "@uniswap/v3-core/=lib/v3-core/", "@uniswap/v3-periphery/=lib/v3-periphery/", "@uniswap/v2-periphery/=lib/v2-periphery/", "@uniswap/v2-core/=lib/v2-core/", "@utils/=src/utils/", "@libs/=src/libs/", "@core/=src/core/", "@const/=src/const/", "@actions/=src/core/Actions/", "@interfaces/=src/interfaces/", "@script/=script/", "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "v2-core/=lib/v2-core/contracts/", "v2-periphery/=lib/v2-periphery/contracts/", "v3-core/=lib/v3-core/contracts/", "v3-periphery/=lib/v3-periphery/contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "shanghai", "viaIR": false, "libraries": { "src/utils/Time.sol": { "Time": "0xbbf25CA275325Ef4682851A12Bd8e9aA714DA2F4" } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_titanX","type":"address"},{"internalType":"address","name":"_auction","type":"address"},{"internalType":"address","name":"_flux","type":"address"},{"internalType":"uint32","name":"_startTimestamp","type":"uint32"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"Address0","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"Amount0","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721IncorrectOwner","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721InsufficientApproval","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC721InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"ERC721InvalidOperator","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"ERC721InvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC721InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC721InvalidSender","type":"error"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ERC721NonexistentToken","type":"error"},{"inputs":[],"name":"Expired","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"FluXStaking__CannotUnstakeAutoBoughtAndStakedFlux","type":"error"},{"inputs":[],"name":"FluxStaking__InvalidDuration","type":"error"},{"inputs":[],"name":"FluxStaking__LockPeriodNotOver","type":"error"},{"inputs":[],"name":"FluxStaking__NoSharesToClaim","type":"error"},{"inputs":[],"name":"FluxStaking__OnlyMintingAndBurning","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"rewards","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"newRewardDebt","type":"uint256"},{"indexed":false,"internalType":"address","name":"ownerOfStake","type":"address"}],"name":"Claimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"enum FluxStaking.POOLS","name":"pool","type":"uint8"},{"indexed":true,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Distributed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"staker","type":"address"},{"indexed":true,"internalType":"uint256","name":"flux","type":"uint256"},{"indexed":true,"internalType":"uint152","name":"id","type":"uint152"},{"indexed":false,"internalType":"uint256","name":"_shares","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"duration","type":"uint32"},{"indexed":false,"internalType":"bool","name":"isVoluntary","type":"bool"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"fluxAmountReceived","type":"uint256"},{"indexed":true,"internalType":"uint256","name":"_tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"recepient","type":"address"}],"name":"Unstaked","type":"event"},{"inputs":[],"name":"MAX_DURATION","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_DURATION","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint160[]","name":"_ids","type":"uint160[]"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"batchClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint160[]","name":"_ids","type":"uint160[]"}],"name":"batchClaimableAmount","outputs":[{"internalType":"uint256","name":"toClaim","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint160[]","name":"_ids","type":"uint160[]"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"batchUnstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint160","name":"_tokenId","type":"uint160"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"distribute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getFluxToShareRatio","outputs":[{"internalType":"uint256","name":"ratio","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"},{"internalType":"address","name":"_spender","type":"address"}],"name":"isApprovedOrOwner","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"rewardPerShare","outputs":[{"internalType":"uint128","name":"","type":"uint128"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_duration","type":"uint32"},{"internalType":"uint160","name":"_fluxAmount","type":"uint160"}],"name":"stake","outputs":[{"internalType":"uint96","name":"_tokenId","type":"uint96"},{"internalType":"uint144","name":"shares","type":"uint144"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"startTimestamp","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"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":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum FluxStaking.POOLS","name":"","type":"uint8"}],"name":"toDistribute","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenId","outputs":[{"internalType":"uint96","name":"","type":"uint96"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalShares","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint160","name":"_tokenId","type":"uint160"},{"internalType":"address","name":"_receiver","type":"address"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"updateRewardsIfNecessary","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"userRecords","outputs":[{"internalType":"uint160","name":"shares","type":"uint160"},{"internalType":"uint160","name":"lockedFlux","type":"uint160"},{"internalType":"uint128","name":"rewardDebt","type":"uint128"},{"internalType":"uint32","name":"endTime","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"voluntary","outputs":[{"internalType":"contract Voluntary777Pool","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
610100604052348015610010575f80fd5b50604051613f58380380613f5883398101604081905261002f91610151565b604051806040016040528060078152602001665374616b696e6760c81b8152506040518060400160405280600381526020016253544b60e81b815250815f90816100799190610244565b5060016100868282610244565b5050506001600160a01b03848116608081905284821660a0526007805463ffffffff60801b1916600160801b63ffffffff86160217905590831660e0526040513091906100d290610129565b6001600160a01b03928316815291166020820152604001604051809103905ff080158015610102573d5f803e3d5ffd5b506001600160a01b031660c05250506008805463ffffffff19166001179055506102fe9050565b6108a8806136b083390190565b80516001600160a01b038116811461014c575f80fd5b919050565b5f805f8060808587031215610164575f80fd5b61016d85610136565b935061017b60208601610136565b925061018960408601610136565b9150606085015163ffffffff811681146101a1575f80fd5b939692955090935050565b634e487b7160e01b5f52604160045260245ffd5b600181811c908216806101d457607f821691505b6020821081036101f257634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561023f57805f5260205f20601f840160051c8101602085101561021d5750805b601f840160051c820191505b8181101561023c575f8155600101610229565b50505b505050565b81516001600160401b0381111561025d5761025d6101ac565b6102718161026b84546101c0565b846101f8565b6020601f8211600181146102a3575f831561028c5750848201515b5f19600385901b1c1916600184901b17845561023c565b5f84815260208120601f198516915b828110156102d257878501518255602094850194600190920191016102b2565b50848210156102ef57868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b60805160a05160c05160e0516133086103a85f395f818161114801526115be01525f81816104810152818161099a01528181610a2601528181610d02015281816113b8015281816114a801528181611834015281816118d90152818161198901528181611b4a01528181611beb015261241801525f81816110cb015281816112d40152818161144801526123b201525f8181610e50015281816119080152611ce901526133085ff3fe608060405234801561000f575f80fd5b50600436106101e7575f3560e01c80636cf72fde11610109578063b88d4fde1161009e578063e6fd48bc1161006e578063e6fd48bc14610520578063e985e9c514610537578063ed5029861461054a578063f6c4c9c114610552575f80fd5b8063b88d4fde146104ad578063b9598bf6146104c0578063c87b56dd146104fa578063d5c0b44e1461050d575f80fd5b8063a22cb465116100d9578063a22cb46514610449578063b1724b461461045c578063b18ef3b71461047c578063b6a6d177146104a3575f80fd5b80636cf72fde1461040857806370a082311461041b57806391c05b0b1461042e57806395d89b4114610441575f80fd5b806317d70f7c1161017f578063446a2ec81161014f578063446a2ec814610318578063612f3fbe146103435780636352211e146103d657806367b92272146103e9575f80fd5b806317d70f7c146102b757806323b872dd146102e95780633a98ef39146102fc57806342842e0e14610305575f80fd5b8063093fccc4116101ba578063093fccc414610268578063095ea7b31461027b57806317a224551461028e57806317d194d8146102a1575f80fd5b806301669eca146101eb57806301ffc9a71461020057806306fdde0314610228578063081812fc1461023d575b5f80fd5b6101fe6101f9366004612bfb565b610565565b005b61021361020e366004612c47565b6105a5565b60405190151581526020015b60405180910390f35b6102306105f6565b60405161021f9190612caf565b61025061024b366004612cc1565b610685565b6040516001600160a01b03909116815260200161021f565b6101fe610276366004612d20565b6106ac565b6101fe610289366004612d73565b6106ee565b6101fe61029c366004612d20565b6106fd565b6102a961073f565b60405190815260200161021f565b6007546102d190600160a01b90046001600160601b031681565b6040516001600160601b03909116815260200161021f565b6101fe6102f7366004612d9d565b610833565b6102a960065481565b6101fe610313366004612d9d565b6108bb565b60075461032b906001600160801b031681565b6040516001600160801b03909116815260200161021f565b610397610351366004612cc1565b600a6020525f90815260409020805460018201546002909201546001600160a01b0391821692909116906001600160801b0381169063ffffffff600160801b9091041684565b604080516001600160a01b0395861681529490931660208501526001600160801b039091169183019190915263ffffffff16606082015260800161021f565b6102506103e4366004612cc1565b6108da565b6102a96103f7366004612ddb565b60096020525f908152604090205481565b6102a9610416366004612df9565b6108e4565b6102a9610429366004612e38565b610df4565b6101fe61043c366004612cc1565b610e39565b610230610e81565b6101fe610457366004612e60565b610e90565b610467630edf6c0081565b60405163ffffffff909116815260200161021f565b6102507f000000000000000000000000000000000000000000000000000000000000000081565b6104676276a70081565b6101fe6104bb366004612ea0565b610e9b565b6104d36104ce366004612f92565b610eb2565b604080516001600160601b0390931683526001600160901b0390911660208301520161021f565b610230610508366004612cc1565b6111ce565b6101fe61051b366004612bfb565b61123f565b60075461046790600160801b900463ffffffff1681565b610213610545366004612bfb565b611646565b6101fe611673565b6101fe610560366004612fae565b611a6a565b8061056f81611a7d565b826001600160a01b031661058281611aa7565b610595846001600160a01b031633611a6a565b61059f8484611ac7565b50505050565b5f6001600160e01b031982166380ac58cd60e01b14806105d557506001600160e01b03198216635b5e139f60e01b145b806105f057506301ffc9a760e01b6001600160e01b03198316145b92915050565b60605f805461060490612fd1565b80601f016020809104026020016040519081016040528092919081815260200182805461063090612fd1565b801561067b5780601f106106525761010080835404028352916020019161067b565b820191905f5260205f20905b81548152906001019060200180831161065e57829003601f168201915b5050505050905090565b5f61068f82611d8e565b505f828152600460205260409020546001600160a01b03166105f0565b5f5b8281101561059f576106e68484838181106106cb576106cb613009565b90506020020160208101906106e09190612e38565b83610565565b6001016106ae565b6106f9828233611dc6565b5050565b5f5b8281101561059f5761073784848381811061071c5761071c613009565b90506020020160208101906107319190612e38565b8361123f565b6001016106ff565b60075460405163175c979560e31b8152600160801b90910463ffffffff1660048201525f90819073bbf25ca275325ef4682851a12bd8e9aa714da2f49063bae4bca890602401602060405180830381865af41580156107a0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107c4919061301d565b6107cf90600161304c565b90505f6107dd600883613068565b905061082361080e670de0b6b3a76400006107ff662cc3a21c2b80008261309b565b67ffffffffffffffff16611dd3565b63ffffffff8316670de0b6b3a7640000611e20565b6001600160a01b03169250505090565b6001600160a01b03821661086157604051633250574960e11b81525f60048201526024015b60405180910390fd5b5f61086d838333611ed8565b9050836001600160a01b0316816001600160a01b03161461059f576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610858565b6108d583838360405180602001604052805f815250610e9b565b505050565b5f6105f082611d8e565b60075460405163175c979560e31b8152600160801b90910463ffffffff1660048201525f90819073bbf25ca275325ef4682851a12bd8e9aa714da2f49063bae4bca890602401602060405180830381865af4158015610945573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610969919061301d565b61097490600161304c565b90505f60075f9054906101000a90046001600160801b03166001600160801b031690505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663446a2ec86040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109f4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a1891906130d6565b6001600160701b031690505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633a98ef396040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a80573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610aa491906130ef565b600880546001600160a01b039290921692505f91610ac8919063ffffffff16613068565b63ffffffff16610ad9600887613068565b60085463ffffffff9182169290921192505f91610af991601c9116613068565b63ffffffff16610b0a601c88613068565b60085463ffffffff9182169290921192505f91610b2a9160589116613068565b63ffffffff16610b3b605889613068565b60085463ffffffff9182169290921192505f91610b5c916103099116613068565b63ffffffff16610b6e6103098a613068565b63ffffffff161190508315610bc457610bac60095f805b6003811115610b9657610b9661310a565b81526020019081526020015f2054600654611dd3565b610bc19068ffffffffffffffffff168861311e565b96505b8215610bef57610bd760095f6001610b85565b610bec9068ffffffffffffffffff168861311e565b96505b8115610c1a57610c0260095f6002610b85565b610c179068ffffffffffffffffff168861311e565b96505b8015610c5a5760035f5260096020525f805160206132b383398151915254610c429086611dd3565b610c579068ffffffffffffffffff168761311e565b95505b5f5b8a811015610de5575f8c8c83818110610c7757610c77613009565b9050602002016020810190610c8c9190612e38565b6001600160a01b038181165f818152600a6020908152604080832081516080810183528154871681526001820154871693810193909352600201546001600160801b03811683830152600160801b900463ffffffff1660608301525163160b66c560e11b815260048101939093529394509182917f000000000000000000000000000000000000000000000000000000000000000090911690632c16cd8a906024016040805180830381865afa158015610d48573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d6c9190613131565b91509150610d9e835f01516001600160a01b031684604001516001600160801b03168e610d99919061316f565b611f38565b610da8908f61311e565b9d50610dca6001600160901b038316610d996001600160701b0384168e61316f565b610dd4908f61311e565b9d5050505050806001019050610c5c565b50505050505050505092915050565b5f6001600160a01b038216610e1e576040516322718ad960e21b81525f6004820152602401610858565b506001600160a01b03165f9081526003602052604090205490565b80610e4381611aa7565b610e786001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333085611f63565b6106f982611fbd565b60606001805461060490612fd1565b6106f93383836121e3565b610ea6848484610833565b61059f84848484612281565b5f80826001600160a01b0316610ec781611aa7565b630edf6c0063ffffffff86161180610ee757506276a70063ffffffff8616105b15610f05576040516373aac25d60e01b815260040160405180910390fd5b610f0d611673565b60078054601490610f2d90600160a01b90046001600160601b0316613182565b91906101000a8154816001600160601b0302191690836001600160601b0316021790559250610f67846001600160a01b0316610d9961073f565b9150610f8782856001600160a01b031687866001600160601b03166123a7565b604080516080810182526001600160901b03841681526001600160a01b03861660208201526007546001600160801b03169181019190915260608101610fcd874261304c565b63ffffffff9081169091526001600160601b0385165f908152600a60209081526040808320855181546001600160a01b039182166001600160a01b031991821617835593870151600183018054919092169085161790559085015160029091018054606090960151909416600160801b02949091166001600160801b0390911617929092179055600680546001600160901b038516929061106f90849061311e565b90915550506001600160601b0383166001600160a01b038516337f609557343a82d88cf5cfd7165e8dc9ba0f27383acebbee88e5f41c474cde8e78858963ffffffff8116630edf6c001480156110ee5750336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614155b604080516001600160901b03909416845263ffffffff909216602084015215159082015260600160405180910390a46040516323b872dd60e01b81523360048201523060248201526001600160a01b0385811660448301527f000000000000000000000000000000000000000000000000000000000000000016906323b872dd906064016020604051808303815f875af115801561118e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111b291906131ac565b506111c633846001600160601b031661247d565b509250929050565b60606111d982611d8e565b505f6111ef60408051602081019091525f815290565b90505f81511161120d5760405180602001604052805f815250611238565b80611217846124de565b6040516020016112289291906131c7565b6040516020818303038152906040525b9392505050565b8061124981611a7d565b826001600160a01b031661125c81611aa7565b5f61126f856001600160a01b03166108da565b6001600160a01b038681165f908152600a602090815260409182902082516080810184528154851681526001820154851692810192909252600201546001600160801b03811692820192909252600160801b90910463ffffffff1660608201529192507f0000000000000000000000000000000000000000000000000000000000000000811690831603611316576040516336ec07a160e01b815260040160405180910390fd5b80516001600160a01b03165f0361134057604051636d8df5d760e01b815260040160405180910390fd5b4263ffffffff16816060015163ffffffff1611156113715760405163433f93cb60e11b815260040160405180910390fd5b611384866001600160a01b031633611a6a565b61138e8686611ac7565b602081015160405163160b66c560e11b81526001600160a01b038881166004830152918216915f917f000000000000000000000000000000000000000000000000000000000000000090911690632c16cd8a906024016040805180830381865afa1580156113fe573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114229190613131565b5083516001600160901b039190911691506001600160a01b0316811580159061147d57507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316856001600160a01b031614155b1561150057604051639e2c8a5b60e01b81526001600160a01b038a81166004830152602482018590527f00000000000000000000000000000000000000000000000000000000000000001690639e2c8a5b906044015f604051808303815f87803b1580156114e9575f80fd5b505af11580156114fb573d5f803e3d5ffd5b505050505b6001600160a01b0389165f908152600a6020526040812080546001600160a01b03199081168255600182018054821690556002909101805490911690556006805483929061154f90849061316f565b90915550506040516001600160a01b0389811682528a1690849083907fe58f1bc928f89a539038781e3855b3646edb6dacfabffbc4f320f272e6bb4d6c9060200160405180910390a460405163a9059cbb60e01b81526001600160a01b038981166004830152602482018590527f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906044016020604051808303815f875af1158015611604573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061162891906131ac565b5061163b896001600160a01b031661256e565b505050505050505050565b6001600160a01b039182165f90815260056020908152604080832093909416825291909152205460ff1690565b6006545f0361167e57565b60075460405163175c979560e31b8152600160801b90910463ffffffff1660048201525f9073bbf25ca275325ef4682851a12bd8e9aa714da2f49063bae4bca890602401602060405180830381865af41580156116dd573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611701919061301d565b61170c90600161304c565b600880549192505f91611725919063ffffffff16613068565b63ffffffff16611736600884613068565b60085463ffffffff9182169290921192505f9161175691601c9116613068565b63ffffffff16611767601c85613068565b60085463ffffffff9182169290921192505f916117879160589116613068565b63ffffffff16611798605886613068565b60085463ffffffff9182169290921192505f916117b9916103099116613068565b63ffffffff166117cb61030987613068565b63ffffffff1611905083156117e5576117e55f60096125a6565b82156117f7576117f7600160096125a6565b811561180957611809600260096125a6565b8015611a495760035f5260096020525f805160206132b38339815191525480158015906118bd57505f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633a98ef396040518163ffffffff1660e01b8152600401602060405180830381865afa15801561188e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118b291906130ef565b6001600160a01b0316115b15611a475760405163a9059cbb60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152602482018390527f0000000000000000000000000000000000000000000000000000000000000000169063a9059cbb906044016020604051808303815f875af115801561194e573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061197291906131ac565b506040516391c05b0b60e01b8152600481018290527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906391c05b0b906024015f604051808303815f87803b1580156119d2575f80fd5b505af11580156119e4573d5f803e3d5ffd5b505060035f81815260096020525f805160206132b3833981519152546040519094509192507f6561e54c14520a1109ca3c094be574addf898e575c0712103c2278cf3c31f1a391a360035f90815260096020525f805160206132b3833981519152555b505b50506008805463ffffffff191663ffffffff94909416939093179092555050565b6106f9611a76836108da565b82846126ef565b6001600160a01b038116611aa4576040516359c662df60e11b815260040160405180910390fd5b50565b805f03611aa457604051635a53a6e960e01b815260040160405180910390fd5b6001600160a01b0382165f908152600a60205260409020611ae6611673565b805460028201546007545f92611b26926001600160a01b0390911691611b18916001600160801b0390811691166131f5565b6001600160801b0316611f38565b60405163160b66c560e11b81526001600160a01b0386811660048301529192505f917f00000000000000000000000000000000000000000000000000000000000000001690632c16cd8a906024016040805180830381865afa158015611b8e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611bb29190613131565b506001600160901b031690505f818103611bcc575f611c55565b604051630ccaaaf960e31b81526001600160a01b0387811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063665557c8906024016020604051808303815f875af1158015611c31573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c559190613214565b600780546002870180546fffffffffffffffffffffffffffffffff19166001600160801b03928316179055905491925016611c90828561311e565b6001600160a01b0388167fee0b8b0781df81efd732b637fff3a1f3ab388d58bcfe3547eb43bed7ee111695611cc4826108da565b6040516001600160a01b03909116815260200160405180910390a46001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001663a9059cbb86611d19848761311e565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303815f875af1158015611d61573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611d8591906131ac565b50505050505050565b5f818152600260205260408120546001600160a01b0316806105f057604051637e27328960e01b815260048101849052602401610858565b6108d58383836001612753565b5f7812725dd1d243aba0e75fe645cc4873f9e65afe688c928e1f218311670de0b6b3a764000002158202611e0e5763bcbede655f526004601cfd5b50670de0b6b3a7640000919091020490565b5f828015611ecc57848015611ec257600185168015611e4157869350611e45565b8493505b50600284046002860495505b8515611ebc578687028760801c15611e67575f80fd5b81810181811015611e76575f80fd5b8690049750506001861615611eb1578684028488820414158815151615611e9b575f80fd5b81810181811015611eaa575f80fd5b8690049450505b600286049550611e51565b50611ec6565b5f92505b50611ed0565b8291505b509392505050565b5f828152600260205260408120546001600160a01b03168015801590611f0657506001600160a01b03851615155b15611f24576040516354deb58b60e01b815260040160405180910390fd5b611f2f858585612857565b95945050505050565b5f815f19048311820215611f535763c4c5d7f55f526004601cfd5b50670de0b6b3a764000091020490565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261059f908590612949565b60075460405163175c979560e31b8152600160801b90910463ffffffff1660048201525f9073bbf25ca275325ef4682851a12bd8e9aa714da2f49063bae4bca890602401602060405180830381865af415801561201c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612040919061301d565b61204b90600161304c565b90508063ffffffff166001036120a0575f80805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b805484929061209590849061311e565b909155506121db9050565b6120b28267054607fc96a60000611f38565b5f80805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b80549091906120ec90849061311e565b90915550612104905082670429d069189e0000611f38565b60015f90815260096020527f92e85d02570a8092d09a6e3a57665bc3815a2699a4074001bf1ccabf660f5a36805490919061214090849061311e565b9091555061215890508267030d98d59a960000611f38565b60025f90815260096020527f6cde3cea4b3a3fb2488b2808bae7556f4a405e50f65e1794383bc026131b13c3805490919061219490849061311e565b909155506121ac90508267016345785d8a0000611f38565b60035f90815260096020525f805160206132b383398151915280549091906121d590849061311e565b90915550505b6106f9611673565b6001600160a01b03821661221557604051630b61174360e31b81526001600160a01b0383166004820152602401610858565b6001600160a01b038381165f81815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0383163b1561059f57604051630a85bd0160e11b81526001600160a01b0384169063150b7a02906122c390339088908790879060040161322b565b6020604051808303815f875af19250505080156122fd575060408051601f3d908101601f191682019092526122fa9181019061325d565b60015b612364573d80801561232a576040519150601f19603f3d011682016040523d82523d5f602084013e61232f565b606091505b5080515f0361235c57604051633250574960e11b81526001600160a01b0385166004820152602401610858565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b146123a057604051633250574960e11b81526001600160a01b0385166004820152602401610858565b5050505050565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614806123e8575063ffffffff8216630edf6c0014155b61059f576040516389d67ebb60e01b8152600481018290526001600160901b0385166024820152604481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906389d67ebb906064015f604051808303815f87803b158015612461575f80fd5b505af1158015612473573d5f803e3d5ffd5b5050505050505050565b6001600160a01b0382166124a657604051633250574960e11b81525f6004820152602401610858565b5f6124b283835f611ed8565b90506001600160a01b038116156108d5576040516339e3563760e11b81525f6004820152602401610858565b60605f6124ea836129aa565b60010190505f8167ffffffffffffffff81111561250957612509612e8c565b6040519080825280601f01601f191660200182016040528015612533576020820181803683370190505b5090508181016020015b5f19016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461253d57509392505050565b5f61257a5f835f611ed8565b90506001600160a01b0381166106f957604051637e27328960e01b815260048101839052602401610858565b805f8360038111156125ba576125ba61310a565b60038111156125cb576125cb61310a565b81526020019081526020015f20545f036125e3575050565b6125fa815f846003811115610b8557610b8561310a565b6007805468ffffffffffffffffff92909216915f906126239084906001600160801b0316613278565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550805f83600381111561265b5761265b61310a565b600381111561266c5761266c61310a565b81526020019081526020015f205482600381111561268c5761268c61310a565b6040517f6561e54c14520a1109ca3c094be574addf898e575c0712103c2278cf3c31f1a3905f90a35f60095f8460038111156126ca576126ca61310a565b60038111156126db576126db61310a565b815260208101919091526040015f20555050565b6126fa838383612a81565b6108d5576001600160a01b03831661272857604051637e27328960e01b815260048101829052602401610858565b60405163177e802f60e01b81526001600160a01b038316600482015260248101829052604401610858565b808061276757506001600160a01b03821615155b15612828575f61277684611d8e565b90506001600160a01b038316158015906127a25750826001600160a01b0316816001600160a01b031614155b80156127b557506127b38184611646565b155b156127de5760405163a9fbf51f60e01b81526001600160a01b0384166004820152602401610858565b81156128265783856001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b50505f90815260046020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b5f828152600260205260408120546001600160a01b0390811690831615612883576128838184866126ef565b6001600160a01b038116156128bd5761289e5f855f80612753565b6001600160a01b0381165f90815260036020526040902080545f190190555b6001600160a01b038516156128eb576001600160a01b0385165f908152600360205260409020805460010190555b5f8481526002602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4949350505050565b5f61295d6001600160a01b03841683612ae5565b905080515f1415801561298157508080602001905181019061297f91906131ac565b155b156108d557604051635274afe760e01b81526001600160a01b0384166004820152602401610858565b5f8072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106129e85772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612a14576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310612a3257662386f26fc10000830492506010015b6305f5e1008310612a4a576305f5e100830492506008015b6127108310612a5e57612710830492506004015b60648310612a70576064830492506002015b600a83106105f05760010192915050565b5f6001600160a01b03831615801590612add5750826001600160a01b0316846001600160a01b03161480612aba5750612aba8484611646565b80612add57505f828152600460205260409020546001600160a01b038481169116145b949350505050565b606061123883835f845f80856001600160a01b03168486604051612b099190613297565b5f6040518083038185875af1925050503d805f8114612b43576040519150601f19603f3d011682016040523d82523d5f602084013e612b48565b606091505b5091509150612b58868383612b62565b9695505050505050565b606082612b7757612b7282612bbe565b611238565b8151158015612b8e57506001600160a01b0384163b155b15612bb757604051639996b31560e01b81526001600160a01b0385166004820152602401610858565b5080611238565b805115612bce5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160a01b0381168114611aa4575f80fd5b5f8060408385031215612c0c575f80fd5b8235612c1781612be7565b91506020830135612c2781612be7565b809150509250929050565b6001600160e01b031981168114611aa4575f80fd5b5f60208284031215612c57575f80fd5b813561123881612c32565b5f5b83811015612c7c578181015183820152602001612c64565b50505f910152565b5f8151808452612c9b816020860160208601612c62565b601f01601f19169290920160200192915050565b602081525f6112386020830184612c84565b5f60208284031215612cd1575f80fd5b5035919050565b5f8083601f840112612ce8575f80fd5b50813567ffffffffffffffff811115612cff575f80fd5b6020830191508360208260051b8501011115612d19575f80fd5b9250929050565b5f805f60408486031215612d32575f80fd5b833567ffffffffffffffff811115612d48575f80fd5b612d5486828701612cd8565b9094509250506020840135612d6881612be7565b809150509250925092565b5f8060408385031215612d84575f80fd5b8235612d8f81612be7565b946020939093013593505050565b5f805f60608486031215612daf575f80fd5b8335612dba81612be7565b92506020840135612dca81612be7565b929592945050506040919091013590565b5f60208284031215612deb575f80fd5b813560048110611238575f80fd5b5f8060208385031215612e0a575f80fd5b823567ffffffffffffffff811115612e20575f80fd5b612e2c85828601612cd8565b90969095509350505050565b5f60208284031215612e48575f80fd5b813561123881612be7565b8015158114611aa4575f80fd5b5f8060408385031215612e71575f80fd5b8235612e7c81612be7565b91506020830135612c2781612e53565b634e487b7160e01b5f52604160045260245ffd5b5f805f8060808587031215612eb3575f80fd5b8435612ebe81612be7565b93506020850135612ece81612be7565b925060408501359150606085013567ffffffffffffffff811115612ef0575f80fd5b8501601f81018713612f00575f80fd5b803567ffffffffffffffff811115612f1a57612f1a612e8c565b604051601f8201601f19908116603f0116810167ffffffffffffffff81118282101715612f4957612f49612e8c565b604052818152828201602001891015612f60575f80fd5b816020840160208301375f6020838301015280935050505092959194509250565b63ffffffff81168114611aa4575f80fd5b5f8060408385031215612fa3575f80fd5b8235612c1781612f81565b5f8060408385031215612fbf575f80fd5b823591506020830135612c2781612be7565b600181811c90821680612fe557607f821691505b60208210810361300357634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52603260045260245ffd5b5f6020828403121561302d575f80fd5b815161123881612f81565b634e487b7160e01b5f52601160045260245ffd5b63ffffffff81811683821601908111156105f0576105f0613038565b5f63ffffffff83168061308957634e487b7160e01b5f52601260045260245ffd5b8063ffffffff84160491505092915050565b67ffffffffffffffff82811682821603908111156105f0576105f0613038565b80516001600160701b03811681146130d1575f80fd5b919050565b5f602082840312156130e6575f80fd5b611238826130bb565b5f602082840312156130ff575f80fd5b815161123881612be7565b634e487b7160e01b5f52602160045260245ffd5b808201808211156105f0576105f0613038565b5f8060408385031215613142575f80fd5b82516001600160901b0381168114613158575f80fd5b9150613166602084016130bb565b90509250929050565b818103818111156105f0576105f0613038565b5f6001600160601b0382166001600160601b0381036131a3576131a3613038565b60010192915050565b5f602082840312156131bc575f80fd5b815161123881612e53565b5f83516131d8818460208801612c62565b8351908301906131ec818360208801612c62565b01949350505050565b6001600160801b0382811682821603908111156105f0576105f0613038565b5f60208284031215613224575f80fd5b5051919050565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f90612b5890830184612c84565b5f6020828403121561326d575f80fd5b815161123881612c32565b6001600160801b0381811683821601908111156105f0576105f0613038565b5f82516132a8818460208701612c62565b919091019291505056fec575c31fea594a6eb97c8e9d3f9caee4c16218c6ef37e923234c0fe9014a61e7a26469706673582212208631ea781147cfababe000ae89f1652cdaacd98761e0f3c8789cceafc6a058f864736f6c634300081a003360c060405234801561000f575f80fd5b506040516108a83803806108a883398101604081905261002e91610099565b816100388161005b565b816100428161005b565b50506001600160a01b039182166080521660a0526100d1565b6001600160a01b038116610082576040516359c662df60e11b815260040160405180910390fd5b50565b6001600160a01b0381168114610082575f80fd5b5f80604083850312156100aa575f80fd5b82516100b581610085565b60208401519092506100c681610085565b809150509250929050565b60805160a0516107b66100f25f395f6102cf01525f61055b01526107b65ff3fe608060405234801561000f575f80fd5b5060043610610090575f3560e01c8063665557c811610063578063665557c81461017157806389d67ebb1461018457806391c05b0b146101995780639e2c8a5b146101ac578063d2f3ce39146101bf575f80fd5b80631e098b70146100945780632c16cd8a146100ba5780633a98ef391461011b578063446a2ec814610146575b5f80fd5b6100a76100a2366004610608565b6101c8565b6040519081526020015b60405180910390f35b6100f46100c836600461062e565b5f602081905290815260409020546001600160901b03811690600160901b90046001600160701b031682565b604080516001600160901b0390931683526001600160701b039091166020830152016100b1565b60025461012e906001600160a01b031681565b6040516001600160a01b0390911681526020016100b1565b600354610159906001600160701b031681565b6040516001600160701b0390911681526020016100b1565b6100a761017f366004610608565b610225565b610197610192366004610645565b61034a565b005b6101976101a736600461062e565b610421565b6101976101ba366004610685565b610493565b6100a760015481565b6001600160a01b0381165f908152602081905260408120805460035461021e916001600160901b03811691610210916001600160701b03600160901b909104811691166106b9565b6001600160701b0316610525565b9392505050565b5f61022e610550565b816001600160a01b03166102418161059b565b6001600160a01b0383165f9081526020819052604090208054600354610289916001600160901b03811691610210916001600160701b03600160901b909104811691166106b9565b925082156103435760035481546001600160901b03166001600160701b03909116600160901b0217815560405163a9059cbb60e01b8152336004820152602481018490527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063a9059cbb906044016020604051808303815f875af115801561031d573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061034191906106de565b505b5050919050565b610352610550565b816001600160901b03166103658161059b565b8161036f8161059b565b846103798161059b565b6040805180820182526001600160901b0380881682526003546001600160701b0390811660208085019182525f8c81529081905294852093519051909116600160901b029116179055600180548692906103d49084906106fd565b90915550506002546103f9906001600160901b038716906001600160a01b0316610710565b600280546001600160a01b0319166001600160a01b0392909216919091179055505050505050565b610429610550565b6002546001600160a01b031615610490576002546104519082906001600160a01b03166105bb565b600380545f9061046b9084906001600160701b031661072f565b92506101000a8154816001600160701b0302191690836001600160701b031602179055505b50565b61049b610550565b816104a58161059b565b5f83815260208190526040812054600280546001600160901b039092169290916104d99084906001600160a01b031661074e565b92506101000a8154816001600160a01b0302191690836001600160a01b031602179055508160015f82825461050e919061076d565b9091555050505f9182525060208190526040812055565b5f815f190483118202156105405763c4c5d7f55f526004601cfd5b50670de0b6b3a764000091020490565b336001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000161461059957604051630911bef960e21b815260040160405180910390fd5b565b805f0361049057604051635a53a6e960e01b815260040160405180910390fd5b5f7812725dd1d243aba0e75fe645cc4873f9e65afe688c928e1f218311670de0b6b3a7640000021582026105f65763bcbede655f526004601cfd5b50670de0b6b3a7640000919091020490565b5f60208284031215610618575f80fd5b81356001600160a01b038116811461021e575f80fd5b5f6020828403121561063e575f80fd5b5035919050565b5f805f60608486031215610657575f80fd5b8335925060208401356001600160901b0381168114610674575f80fd5b929592945050506040919091013590565b5f8060408385031215610696575f80fd5b50508035926020909101359150565b634e487b7160e01b5f52601160045260245ffd5b6001600160701b0382811682821603908111156106d8576106d86106a5565b92915050565b5f602082840312156106ee575f80fd5b8151801515811461021e575f80fd5b808201808211156106d8576106d86106a5565b6001600160a01b0381811683821601908111156106d8576106d86106a5565b6001600160701b0381811683821601908111156106d8576106d86106a5565b6001600160a01b0382811682821603908111156106d8576106d86106a5565b818103818111156106d8576106d86106a556fea2646970667358221220267c9a249209515baf99e0368f6a65ba6312dea16ade38e2cc3002af0fe247dd64736f6c634300081a0033000000000000000000000000f19308f923582a6f7c465e5ce7a9dc1bec6665b100000000000000000000000036e5a8105f000029d4b3b99d0c3d0e24aaa52adf000000000000000000000000bfde5ac4f5adb419a931a5bf64b0f3bb5a623d060000000000000000000000000000000000000000000000000000000066f04d10
Deployed Bytecode
0x608060405234801561000f575f80fd5b50600436106101e7575f3560e01c80636cf72fde11610109578063b88d4fde1161009e578063e6fd48bc1161006e578063e6fd48bc14610520578063e985e9c514610537578063ed5029861461054a578063f6c4c9c114610552575f80fd5b8063b88d4fde146104ad578063b9598bf6146104c0578063c87b56dd146104fa578063d5c0b44e1461050d575f80fd5b8063a22cb465116100d9578063a22cb46514610449578063b1724b461461045c578063b18ef3b71461047c578063b6a6d177146104a3575f80fd5b80636cf72fde1461040857806370a082311461041b57806391c05b0b1461042e57806395d89b4114610441575f80fd5b806317d70f7c1161017f578063446a2ec81161014f578063446a2ec814610318578063612f3fbe146103435780636352211e146103d657806367b92272146103e9575f80fd5b806317d70f7c146102b757806323b872dd146102e95780633a98ef39146102fc57806342842e0e14610305575f80fd5b8063093fccc4116101ba578063093fccc414610268578063095ea7b31461027b57806317a224551461028e57806317d194d8146102a1575f80fd5b806301669eca146101eb57806301ffc9a71461020057806306fdde0314610228578063081812fc1461023d575b5f80fd5b6101fe6101f9366004612bfb565b610565565b005b61021361020e366004612c47565b6105a5565b60405190151581526020015b60405180910390f35b6102306105f6565b60405161021f9190612caf565b61025061024b366004612cc1565b610685565b6040516001600160a01b03909116815260200161021f565b6101fe610276366004612d20565b6106ac565b6101fe610289366004612d73565b6106ee565b6101fe61029c366004612d20565b6106fd565b6102a961073f565b60405190815260200161021f565b6007546102d190600160a01b90046001600160601b031681565b6040516001600160601b03909116815260200161021f565b6101fe6102f7366004612d9d565b610833565b6102a960065481565b6101fe610313366004612d9d565b6108bb565b60075461032b906001600160801b031681565b6040516001600160801b03909116815260200161021f565b610397610351366004612cc1565b600a6020525f90815260409020805460018201546002909201546001600160a01b0391821692909116906001600160801b0381169063ffffffff600160801b9091041684565b604080516001600160a01b0395861681529490931660208501526001600160801b039091169183019190915263ffffffff16606082015260800161021f565b6102506103e4366004612cc1565b6108da565b6102a96103f7366004612ddb565b60096020525f908152604090205481565b6102a9610416366004612df9565b6108e4565b6102a9610429366004612e38565b610df4565b6101fe61043c366004612cc1565b610e39565b610230610e81565b6101fe610457366004612e60565b610e90565b610467630edf6c0081565b60405163ffffffff909116815260200161021f565b6102507f00000000000000000000000052ca28e311f200d1cd47c06996063e14ec2d6ab181565b6104676276a70081565b6101fe6104bb366004612ea0565b610e9b565b6104d36104ce366004612f92565b610eb2565b604080516001600160601b0390931683526001600160901b0390911660208301520161021f565b610230610508366004612cc1565b6111ce565b6101fe61051b366004612bfb565b61123f565b60075461046790600160801b900463ffffffff1681565b610213610545366004612bfb565b611646565b6101fe611673565b6101fe610560366004612fae565b611a6a565b8061056f81611a7d565b826001600160a01b031661058281611aa7565b610595846001600160a01b031633611a6a565b61059f8484611ac7565b50505050565b5f6001600160e01b031982166380ac58cd60e01b14806105d557506001600160e01b03198216635b5e139f60e01b145b806105f057506301ffc9a760e01b6001600160e01b03198316145b92915050565b60605f805461060490612fd1565b80601f016020809104026020016040519081016040528092919081815260200182805461063090612fd1565b801561067b5780601f106106525761010080835404028352916020019161067b565b820191905f5260205f20905b81548152906001019060200180831161065e57829003601f168201915b5050505050905090565b5f61068f82611d8e565b505f828152600460205260409020546001600160a01b03166105f0565b5f5b8281101561059f576106e68484838181106106cb576106cb613009565b90506020020160208101906106e09190612e38565b83610565565b6001016106ae565b6106f9828233611dc6565b5050565b5f5b8281101561059f5761073784848381811061071c5761071c613009565b90506020020160208101906107319190612e38565b8361123f565b6001016106ff565b60075460405163175c979560e31b8152600160801b90910463ffffffff1660048201525f90819073bbf25ca275325ef4682851a12bd8e9aa714da2f49063bae4bca890602401602060405180830381865af41580156107a0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107c4919061301d565b6107cf90600161304c565b90505f6107dd600883613068565b905061082361080e670de0b6b3a76400006107ff662cc3a21c2b80008261309b565b67ffffffffffffffff16611dd3565b63ffffffff8316670de0b6b3a7640000611e20565b6001600160a01b03169250505090565b6001600160a01b03821661086157604051633250574960e11b81525f60048201526024015b60405180910390fd5b5f61086d838333611ed8565b9050836001600160a01b0316816001600160a01b03161461059f576040516364283d7b60e01b81526001600160a01b0380861660048301526024820184905282166044820152606401610858565b6108d583838360405180602001604052805f815250610e9b565b505050565b5f6105f082611d8e565b60075460405163175c979560e31b8152600160801b90910463ffffffff1660048201525f90819073bbf25ca275325ef4682851a12bd8e9aa714da2f49063bae4bca890602401602060405180830381865af4158015610945573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610969919061301d565b61097490600161304c565b90505f60075f9054906101000a90046001600160801b03166001600160801b031690505f7f00000000000000000000000052ca28e311f200d1cd47c06996063e14ec2d6ab16001600160a01b031663446a2ec86040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109f4573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a1891906130d6565b6001600160701b031690505f7f00000000000000000000000052ca28e311f200d1cd47c06996063e14ec2d6ab16001600160a01b0316633a98ef396040518163ffffffff1660e01b8152600401602060405180830381865afa158015610a80573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610aa491906130ef565b600880546001600160a01b039290921692505f91610ac8919063ffffffff16613068565b63ffffffff16610ad9600887613068565b60085463ffffffff9182169290921192505f91610af991601c9116613068565b63ffffffff16610b0a601c88613068565b60085463ffffffff9182169290921192505f91610b2a9160589116613068565b63ffffffff16610b3b605889613068565b60085463ffffffff9182169290921192505f91610b5c916103099116613068565b63ffffffff16610b6e6103098a613068565b63ffffffff161190508315610bc457610bac60095f805b6003811115610b9657610b9661310a565b81526020019081526020015f2054600654611dd3565b610bc19068ffffffffffffffffff168861311e565b96505b8215610bef57610bd760095f6001610b85565b610bec9068ffffffffffffffffff168861311e565b96505b8115610c1a57610c0260095f6002610b85565b610c179068ffffffffffffffffff168861311e565b96505b8015610c5a5760035f5260096020525f805160206132b383398151915254610c429086611dd3565b610c579068ffffffffffffffffff168761311e565b95505b5f5b8a811015610de5575f8c8c83818110610c7757610c77613009565b9050602002016020810190610c8c9190612e38565b6001600160a01b038181165f818152600a6020908152604080832081516080810183528154871681526001820154871693810193909352600201546001600160801b03811683830152600160801b900463ffffffff1660608301525163160b66c560e11b815260048101939093529394509182917f00000000000000000000000052ca28e311f200d1cd47c06996063e14ec2d6ab190911690632c16cd8a906024016040805180830381865afa158015610d48573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d6c9190613131565b91509150610d9e835f01516001600160a01b031684604001516001600160801b03168e610d99919061316f565b611f38565b610da8908f61311e565b9d50610dca6001600160901b038316610d996001600160701b0384168e61316f565b610dd4908f61311e565b9d5050505050806001019050610c5c565b50505050505050505092915050565b5f6001600160a01b038216610e1e576040516322718ad960e21b81525f6004820152602401610858565b506001600160a01b03165f9081526003602052604090205490565b80610e4381611aa7565b610e786001600160a01b037f000000000000000000000000f19308f923582a6f7c465e5ce7a9dc1bec6665b116333085611f63565b6106f982611fbd565b60606001805461060490612fd1565b6106f93383836121e3565b610ea6848484610833565b61059f84848484612281565b5f80826001600160a01b0316610ec781611aa7565b630edf6c0063ffffffff86161180610ee757506276a70063ffffffff8616105b15610f05576040516373aac25d60e01b815260040160405180910390fd5b610f0d611673565b60078054601490610f2d90600160a01b90046001600160601b0316613182565b91906101000a8154816001600160601b0302191690836001600160601b0316021790559250610f67846001600160a01b0316610d9961073f565b9150610f8782856001600160a01b031687866001600160601b03166123a7565b604080516080810182526001600160901b03841681526001600160a01b03861660208201526007546001600160801b03169181019190915260608101610fcd874261304c565b63ffffffff9081169091526001600160601b0385165f908152600a60209081526040808320855181546001600160a01b039182166001600160a01b031991821617835593870151600183018054919092169085161790559085015160029091018054606090960151909416600160801b02949091166001600160801b0390911617929092179055600680546001600160901b038516929061106f90849061311e565b90915550506001600160601b0383166001600160a01b038516337f609557343a82d88cf5cfd7165e8dc9ba0f27383acebbee88e5f41c474cde8e78858963ffffffff8116630edf6c001480156110ee5750336001600160a01b037f00000000000000000000000036e5a8105f000029d4b3b99d0c3d0e24aaa52adf1614155b604080516001600160901b03909416845263ffffffff909216602084015215159082015260600160405180910390a46040516323b872dd60e01b81523360048201523060248201526001600160a01b0385811660448301527f000000000000000000000000bfde5ac4f5adb419a931a5bf64b0f3bb5a623d0616906323b872dd906064016020604051808303815f875af115801561118e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111b291906131ac565b506111c633846001600160601b031661247d565b509250929050565b60606111d982611d8e565b505f6111ef60408051602081019091525f815290565b90505f81511161120d5760405180602001604052805f815250611238565b80611217846124de565b6040516020016112289291906131c7565b6040516020818303038152906040525b9392505050565b8061124981611a7d565b826001600160a01b031661125c81611aa7565b5f61126f856001600160a01b03166108da565b6001600160a01b038681165f908152600a602090815260409182902082516080810184528154851681526001820154851692810192909252600201546001600160801b03811692820192909252600160801b90910463ffffffff1660608201529192507f00000000000000000000000036e5a8105f000029d4b3b99d0c3d0e24aaa52adf811690831603611316576040516336ec07a160e01b815260040160405180910390fd5b80516001600160a01b03165f0361134057604051636d8df5d760e01b815260040160405180910390fd5b4263ffffffff16816060015163ffffffff1611156113715760405163433f93cb60e11b815260040160405180910390fd5b611384866001600160a01b031633611a6a565b61138e8686611ac7565b602081015160405163160b66c560e11b81526001600160a01b038881166004830152918216915f917f00000000000000000000000052ca28e311f200d1cd47c06996063e14ec2d6ab190911690632c16cd8a906024016040805180830381865afa1580156113fe573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114229190613131565b5083516001600160901b039190911691506001600160a01b0316811580159061147d57507f00000000000000000000000036e5a8105f000029d4b3b99d0c3d0e24aaa52adf6001600160a01b0316856001600160a01b031614155b1561150057604051639e2c8a5b60e01b81526001600160a01b038a81166004830152602482018590527f00000000000000000000000052ca28e311f200d1cd47c06996063e14ec2d6ab11690639e2c8a5b906044015f604051808303815f87803b1580156114e9575f80fd5b505af11580156114fb573d5f803e3d5ffd5b505050505b6001600160a01b0389165f908152600a6020526040812080546001600160a01b03199081168255600182018054821690556002909101805490911690556006805483929061154f90849061316f565b90915550506040516001600160a01b0389811682528a1690849083907fe58f1bc928f89a539038781e3855b3646edb6dacfabffbc4f320f272e6bb4d6c9060200160405180910390a460405163a9059cbb60e01b81526001600160a01b038981166004830152602482018590527f000000000000000000000000bfde5ac4f5adb419a931a5bf64b0f3bb5a623d06169063a9059cbb906044016020604051808303815f875af1158015611604573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061162891906131ac565b5061163b896001600160a01b031661256e565b505050505050505050565b6001600160a01b039182165f90815260056020908152604080832093909416825291909152205460ff1690565b6006545f0361167e57565b60075460405163175c979560e31b8152600160801b90910463ffffffff1660048201525f9073bbf25ca275325ef4682851a12bd8e9aa714da2f49063bae4bca890602401602060405180830381865af41580156116dd573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611701919061301d565b61170c90600161304c565b600880549192505f91611725919063ffffffff16613068565b63ffffffff16611736600884613068565b60085463ffffffff9182169290921192505f9161175691601c9116613068565b63ffffffff16611767601c85613068565b60085463ffffffff9182169290921192505f916117879160589116613068565b63ffffffff16611798605886613068565b60085463ffffffff9182169290921192505f916117b9916103099116613068565b63ffffffff166117cb61030987613068565b63ffffffff1611905083156117e5576117e55f60096125a6565b82156117f7576117f7600160096125a6565b811561180957611809600260096125a6565b8015611a495760035f5260096020525f805160206132b38339815191525480158015906118bd57505f7f00000000000000000000000052ca28e311f200d1cd47c06996063e14ec2d6ab16001600160a01b0316633a98ef396040518163ffffffff1660e01b8152600401602060405180830381865afa15801561188e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118b291906130ef565b6001600160a01b0316115b15611a475760405163a9059cbb60e01b81526001600160a01b037f00000000000000000000000052ca28e311f200d1cd47c06996063e14ec2d6ab181166004830152602482018390527f000000000000000000000000f19308f923582a6f7c465e5ce7a9dc1bec6665b1169063a9059cbb906044016020604051808303815f875af115801561194e573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061197291906131ac565b506040516391c05b0b60e01b8152600481018290527f00000000000000000000000052ca28e311f200d1cd47c06996063e14ec2d6ab16001600160a01b0316906391c05b0b906024015f604051808303815f87803b1580156119d2575f80fd5b505af11580156119e4573d5f803e3d5ffd5b505060035f81815260096020525f805160206132b3833981519152546040519094509192507f6561e54c14520a1109ca3c094be574addf898e575c0712103c2278cf3c31f1a391a360035f90815260096020525f805160206132b3833981519152555b505b50506008805463ffffffff191663ffffffff94909416939093179092555050565b6106f9611a76836108da565b82846126ef565b6001600160a01b038116611aa4576040516359c662df60e11b815260040160405180910390fd5b50565b805f03611aa457604051635a53a6e960e01b815260040160405180910390fd5b6001600160a01b0382165f908152600a60205260409020611ae6611673565b805460028201546007545f92611b26926001600160a01b0390911691611b18916001600160801b0390811691166131f5565b6001600160801b0316611f38565b60405163160b66c560e11b81526001600160a01b0386811660048301529192505f917f00000000000000000000000052ca28e311f200d1cd47c06996063e14ec2d6ab11690632c16cd8a906024016040805180830381865afa158015611b8e573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611bb29190613131565b506001600160901b031690505f818103611bcc575f611c55565b604051630ccaaaf960e31b81526001600160a01b0387811660048301527f00000000000000000000000052ca28e311f200d1cd47c06996063e14ec2d6ab1169063665557c8906024016020604051808303815f875af1158015611c31573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611c559190613214565b600780546002870180546fffffffffffffffffffffffffffffffff19166001600160801b03928316179055905491925016611c90828561311e565b6001600160a01b0388167fee0b8b0781df81efd732b637fff3a1f3ab388d58bcfe3547eb43bed7ee111695611cc4826108da565b6040516001600160a01b03909116815260200160405180910390a46001600160a01b037f000000000000000000000000f19308f923582a6f7c465e5ce7a9dc1bec6665b11663a9059cbb86611d19848761311e565b6040516001600160e01b031960e085901b1681526001600160a01b03909216600483015260248201526044016020604051808303815f875af1158015611d61573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611d8591906131ac565b50505050505050565b5f818152600260205260408120546001600160a01b0316806105f057604051637e27328960e01b815260048101849052602401610858565b6108d58383836001612753565b5f7812725dd1d243aba0e75fe645cc4873f9e65afe688c928e1f218311670de0b6b3a764000002158202611e0e5763bcbede655f526004601cfd5b50670de0b6b3a7640000919091020490565b5f828015611ecc57848015611ec257600185168015611e4157869350611e45565b8493505b50600284046002860495505b8515611ebc578687028760801c15611e67575f80fd5b81810181811015611e76575f80fd5b8690049750506001861615611eb1578684028488820414158815151615611e9b575f80fd5b81810181811015611eaa575f80fd5b8690049450505b600286049550611e51565b50611ec6565b5f92505b50611ed0565b8291505b509392505050565b5f828152600260205260408120546001600160a01b03168015801590611f0657506001600160a01b03851615155b15611f24576040516354deb58b60e01b815260040160405180910390fd5b611f2f858585612857565b95945050505050565b5f815f19048311820215611f535763c4c5d7f55f526004601cfd5b50670de0b6b3a764000091020490565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b17905261059f908590612949565b60075460405163175c979560e31b8152600160801b90910463ffffffff1660048201525f9073bbf25ca275325ef4682851a12bd8e9aa714da2f49063bae4bca890602401602060405180830381865af415801561201c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190612040919061301d565b61204b90600161304c565b90508063ffffffff166001036120a0575f80805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b805484929061209590849061311e565b909155506121db9050565b6120b28267054607fc96a60000611f38565b5f80805260096020527fec8156718a8372b1db44bb411437d0870f3e3790d4a08526d024ce1b0b668f6b80549091906120ec90849061311e565b90915550612104905082670429d069189e0000611f38565b60015f90815260096020527f92e85d02570a8092d09a6e3a57665bc3815a2699a4074001bf1ccabf660f5a36805490919061214090849061311e565b9091555061215890508267030d98d59a960000611f38565b60025f90815260096020527f6cde3cea4b3a3fb2488b2808bae7556f4a405e50f65e1794383bc026131b13c3805490919061219490849061311e565b909155506121ac90508267016345785d8a0000611f38565b60035f90815260096020525f805160206132b383398151915280549091906121d590849061311e565b90915550505b6106f9611673565b6001600160a01b03821661221557604051630b61174360e31b81526001600160a01b0383166004820152602401610858565b6001600160a01b038381165f81815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b6001600160a01b0383163b1561059f57604051630a85bd0160e11b81526001600160a01b0384169063150b7a02906122c390339088908790879060040161322b565b6020604051808303815f875af19250505080156122fd575060408051601f3d908101601f191682019092526122fa9181019061325d565b60015b612364573d80801561232a576040519150601f19603f3d011682016040523d82523d5f602084013e61232f565b606091505b5080515f0361235c57604051633250574960e11b81526001600160a01b0385166004820152602401610858565b805181602001fd5b6001600160e01b03198116630a85bd0160e11b146123a057604051633250574960e11b81526001600160a01b0385166004820152602401610858565b5050505050565b336001600160a01b037f00000000000000000000000036e5a8105f000029d4b3b99d0c3d0e24aaa52adf1614806123e8575063ffffffff8216630edf6c0014155b61059f576040516389d67ebb60e01b8152600481018290526001600160901b0385166024820152604481018490527f00000000000000000000000052ca28e311f200d1cd47c06996063e14ec2d6ab16001600160a01b0316906389d67ebb906064015f604051808303815f87803b158015612461575f80fd5b505af1158015612473573d5f803e3d5ffd5b5050505050505050565b6001600160a01b0382166124a657604051633250574960e11b81525f6004820152602401610858565b5f6124b283835f611ed8565b90506001600160a01b038116156108d5576040516339e3563760e11b81525f6004820152602401610858565b60605f6124ea836129aa565b60010190505f8167ffffffffffffffff81111561250957612509612e8c565b6040519080825280601f01601f191660200182016040528015612533576020820181803683370190505b5090508181016020015b5f19016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461253d57509392505050565b5f61257a5f835f611ed8565b90506001600160a01b0381166106f957604051637e27328960e01b815260048101839052602401610858565b805f8360038111156125ba576125ba61310a565b60038111156125cb576125cb61310a565b81526020019081526020015f20545f036125e3575050565b6125fa815f846003811115610b8557610b8561310a565b6007805468ffffffffffffffffff92909216915f906126239084906001600160801b0316613278565b92506101000a8154816001600160801b0302191690836001600160801b03160217905550805f83600381111561265b5761265b61310a565b600381111561266c5761266c61310a565b81526020019081526020015f205482600381111561268c5761268c61310a565b6040517f6561e54c14520a1109ca3c094be574addf898e575c0712103c2278cf3c31f1a3905f90a35f60095f8460038111156126ca576126ca61310a565b60038111156126db576126db61310a565b815260208101919091526040015f20555050565b6126fa838383612a81565b6108d5576001600160a01b03831661272857604051637e27328960e01b815260048101829052602401610858565b60405163177e802f60e01b81526001600160a01b038316600482015260248101829052604401610858565b808061276757506001600160a01b03821615155b15612828575f61277684611d8e565b90506001600160a01b038316158015906127a25750826001600160a01b0316816001600160a01b031614155b80156127b557506127b38184611646565b155b156127de5760405163a9fbf51f60e01b81526001600160a01b0384166004820152602401610858565b81156128265783856001600160a01b0316826001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45b505b50505f90815260046020526040902080546001600160a01b0319166001600160a01b0392909216919091179055565b5f828152600260205260408120546001600160a01b0390811690831615612883576128838184866126ef565b6001600160a01b038116156128bd5761289e5f855f80612753565b6001600160a01b0381165f90815260036020526040902080545f190190555b6001600160a01b038516156128eb576001600160a01b0385165f908152600360205260409020805460010190555b5f8481526002602052604080822080546001600160a01b0319166001600160a01b0389811691821790925591518793918516917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4949350505050565b5f61295d6001600160a01b03841683612ae5565b905080515f1415801561298157508080602001905181019061297f91906131ac565b155b156108d557604051635274afe760e01b81526001600160a01b0384166004820152602401610858565b5f8072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106129e85772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310612a14576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310612a3257662386f26fc10000830492506010015b6305f5e1008310612a4a576305f5e100830492506008015b6127108310612a5e57612710830492506004015b60648310612a70576064830492506002015b600a83106105f05760010192915050565b5f6001600160a01b03831615801590612add5750826001600160a01b0316846001600160a01b03161480612aba5750612aba8484611646565b80612add57505f828152600460205260409020546001600160a01b038481169116145b949350505050565b606061123883835f845f80856001600160a01b03168486604051612b099190613297565b5f6040518083038185875af1925050503d805f8114612b43576040519150601f19603f3d011682016040523d82523d5f602084013e612b48565b606091505b5091509150612b58868383612b62565b9695505050505050565b606082612b7757612b7282612bbe565b611238565b8151158015612b8e57506001600160a01b0384163b155b15612bb757604051639996b31560e01b81526001600160a01b0385166004820152602401610858565b5080611238565b805115612bce5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b6001600160a01b0381168114611aa4575f80fd5b5f8060408385031215612c0c575f80fd5b8235612c1781612be7565b91506020830135612c2781612be7565b809150509250929050565b6001600160e01b031981168114611aa4575f80fd5b5f60208284031215612c57575f80fd5b813561123881612c32565b5f5b83811015612c7c578181015183820152602001612c64565b50505f910152565b5f8151808452612c9b816020860160208601612c62565b601f01601f19169290920160200192915050565b602081525f6112386020830184612c84565b5f60208284031215612cd1575f80fd5b5035919050565b5f8083601f840112612ce8575f80fd5b50813567ffffffffffffffff811115612cff575f80fd5b6020830191508360208260051b8501011115612d19575f80fd5b9250929050565b5f805f60408486031215612d32575f80fd5b833567ffffffffffffffff811115612d48575f80fd5b612d5486828701612cd8565b9094509250506020840135612d6881612be7565b809150509250925092565b5f8060408385031215612d84575f80fd5b8235612d8f81612be7565b946020939093013593505050565b5f805f60608486031215612daf575f80fd5b8335612dba81612be7565b92506020840135612dca81612be7565b929592945050506040919091013590565b5f60208284031215612deb575f80fd5b813560048110611238575f80fd5b5f8060208385031215612e0a575f80fd5b823567ffffffffffffffff811115612e20575f80fd5b612e2c85828601612cd8565b90969095509350505050565b5f60208284031215612e48575f80fd5b813561123881612be7565b8015158114611aa4575f80fd5b5f8060408385031215612e71575f80fd5b8235612e7c81612be7565b91506020830135612c2781612e53565b634e487b7160e01b5f52604160045260245ffd5b5f805f8060808587031215612eb3575f80fd5b8435612ebe81612be7565b93506020850135612ece81612be7565b925060408501359150606085013567ffffffffffffffff811115612ef0575f80fd5b8501601f81018713612f00575f80fd5b803567ffffffffffffffff811115612f1a57612f1a612e8c565b604051601f8201601f19908116603f0116810167ffffffffffffffff81118282101715612f4957612f49612e8c565b604052818152828201602001891015612f60575f80fd5b816020840160208301375f6020838301015280935050505092959194509250565b63ffffffff81168114611aa4575f80fd5b5f8060408385031215612fa3575f80fd5b8235612c1781612f81565b5f8060408385031215612fbf575f80fd5b823591506020830135612c2781612be7565b600181811c90821680612fe557607f821691505b60208210810361300357634e487b7160e01b5f52602260045260245ffd5b50919050565b634e487b7160e01b5f52603260045260245ffd5b5f6020828403121561302d575f80fd5b815161123881612f81565b634e487b7160e01b5f52601160045260245ffd5b63ffffffff81811683821601908111156105f0576105f0613038565b5f63ffffffff83168061308957634e487b7160e01b5f52601260045260245ffd5b8063ffffffff84160491505092915050565b67ffffffffffffffff82811682821603908111156105f0576105f0613038565b80516001600160701b03811681146130d1575f80fd5b919050565b5f602082840312156130e6575f80fd5b611238826130bb565b5f602082840312156130ff575f80fd5b815161123881612be7565b634e487b7160e01b5f52602160045260245ffd5b808201808211156105f0576105f0613038565b5f8060408385031215613142575f80fd5b82516001600160901b0381168114613158575f80fd5b9150613166602084016130bb565b90509250929050565b818103818111156105f0576105f0613038565b5f6001600160601b0382166001600160601b0381036131a3576131a3613038565b60010192915050565b5f602082840312156131bc575f80fd5b815161123881612e53565b5f83516131d8818460208801612c62565b8351908301906131ec818360208801612c62565b01949350505050565b6001600160801b0382811682821603908111156105f0576105f0613038565b5f60208284031215613224575f80fd5b5051919050565b6001600160a01b03858116825284166020820152604081018390526080606082018190525f90612b5890830184612c84565b5f6020828403121561326d575f80fd5b815161123881612c32565b6001600160801b0381811683821601908111156105f0576105f0613038565b5f82516132a8818460208701612c62565b919091019291505056fec575c31fea594a6eb97c8e9d3f9caee4c16218c6ef37e923234c0fe9014a61e7a26469706673582212208631ea781147cfababe000ae89f1652cdaacd98761e0f3c8789cceafc6a058f864736f6c634300081a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000f19308f923582a6f7c465e5ce7a9dc1bec6665b100000000000000000000000036e5a8105f000029d4b3b99d0c3d0e24aaa52adf000000000000000000000000bfde5ac4f5adb419a931a5bf64b0f3bb5a623d060000000000000000000000000000000000000000000000000000000066f04d10
-----Decoded View---------------
Arg [0] : _titanX (address): 0xF19308F923582A6f7c465e5CE7a9Dc1BEC6665B1
Arg [1] : _auction (address): 0x36e5a8105f000029d4B3B99d0C3D0e24aaA52adF
Arg [2] : _flux (address): 0xBFDE5ac4f5Adb419A931a5bF64B0f3BB5a623d06
Arg [3] : _startTimestamp (uint32): 1727024400
-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 000000000000000000000000f19308f923582a6f7c465e5ce7a9dc1bec6665b1
Arg [1] : 00000000000000000000000036e5a8105f000029d4b3b99d0c3d0e24aaa52adf
Arg [2] : 000000000000000000000000bfde5ac4f5adb419a931a5bf64b0f3bb5a623d06
Arg [3] : 0000000000000000000000000000000000000000000000000000000066f04d10
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.