Feature Tip: Add private address tag to any address under My Name Tag !
Overview
Max Total Supply
878,733,211.583189122102896987 GENIE
Holders
341 (0.00%)
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 18 Decimals)
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
GenieSwap
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 369 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.17; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; import "@uniswap/v3-core/contracts/libraries/FixedPoint96.sol"; import "./lib/TickMath.sol"; import "./lib/FullMath.sol"; interface IUSDT { function transferFrom( address from, address to, uint256 amount ) external; } contract GenieSwap is ERC20, Ownable, ReentrancyGuard { event Transformed( address token, uint256 amount, uint256 value, uint256 minted, uint256 rate ); event Referred( address minter, address referrer, uint256 value, uint256 rate, address token, uint256 rewardRate, uint256 rewardAmount ); event MintingClosed( uint256 minted, uint256 team, uint256 liquidity ); constructor( address _flush ) payable ERC20("GenieSwap", "GENIE") { // Pools to use pools[WETH] = 0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640; // ETH/USDC 0.05% pools[WBTC] = 0x99ac8cA7087fA4A2A1FB6357269965A2014ABc35; // WBTC/USDC 0.3% pools[USDC] = 0x5777d92f208679DB4b9778590Fa3CAB3aC9e2168; // DAI/USDC 0.01% pools[USDT] = 0x3416cF6C708Da44DB2624D63ea0AAef7113527C6; // USDT/USDC 0.01% pools[DAI] = 0x5777d92f208679DB4b9778590Fa3CAB3aC9e2168; // DAI/USDC 0.01% // Flush address flushAddress = _flush; // Set launch day launchDay = _today(); } // Pools to use for TWAP mapping(address => address) public pools; // TWAP for pricing int32 public constant twapInterval = 60 minutes; // @dev address to tokens to address public flushAddress; bool public flushOnTransaction; // Accepted tokens address immutable WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address immutable WBTC = 0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599; address immutable USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48; address immutable USDT = 0xdAC17F958D2ee523a2206206994597C13D831ec7; address immutable DAI = 0x6B175474E89094C44Da98b954EedeAC495271d0F; // Referrer value mapping(address => uint256) public referrerValue; // Launch settings uint64 public launchDay; uint64 public constant launchDays = 365; uint64 public constant referrerRate = 5; uint64 public constant customerBonus = 15; uint64 public constant endTeam = 25; uint64 public constant endLiquidity = 10; // Allow for closing bool public mintPhaseClosed = false; // @dev get current day function today() external view returns (uint64) { return _today(); } // @dev returns days since launch function currentDay() external view returns (uint64) { return _currentDay(); } // @dev returns current launch window function currentWindow() external view returns(uint64) { return _currentWindow(); } // @dev returns next window timestamp function nextWindow() external view returns(uint64) { return launchDay + ((_currentWindow() + 1) * _windowDays() * 1 days); } // @dev returns days per window function windowDays() external view returns(uint64) { return _windowDays(); } // @dev returns current launch mint rate function mintRate() external view returns (uint256) { return _mintRate(_currentWindow()); } // @dev returns next launch mint rate function nextRate() external view returns (uint256) { return _mintRate(_currentWindow() + 1); } // @dev returns reward rate for an address function rewardRate(address referrer) external view returns (uint256) { return _rewardRate(referrer); } // @dev quote token function quoteToken(address token, uint256 amount, address caller) external view returns ( uint256 value, uint256 rate, uint256 minted ) { return _quoteToken(token, amount, caller); } // @dev mint token for sender function mintToken(address token, uint256 amount, address referrer) external payable returns ( uint256 value, uint256 rate, uint256 minted ) { return _mintToken(token, amount, msg.sender, referrer); } // @dev mint token for an address function mintTokenFor(address token, uint256 amount, address to) external payable returns ( uint256 value, uint256 rate, uint256 minted ) { return _mintToken(token, amount, to, address(0)); } // @dev close the launch phase function closeLaunchPhase() external onlyOwner nonReentrant returns ( uint256 minted, uint256 team, uint256 liquidity ) { // Restrict to after launch phase require(_currentDay() > launchDays, 'Minting phase still in progress'); // Only closable once require(!mintPhaseClosed, 'Minting already closed'); // Close mint phase mintPhaseClosed = true; // Total minted during launch phase minted = totalSupply(); // Mint team token supply team = (minted * endTeam) / 100; _mint(msg.sender, team); // Mint liquidity tokens liquidity = (minted * endLiquidity) / 100; _mint(msg.sender, liquidity); // Emit event emit MintingClosed( minted, team, liquidity ); } // @dev allow owner to set the launch date function setLaunchDay() external onlyOwner{ // Restrict to first 30 days require(_currentDay() < 30, 'Minting phase has started'); launchDay = _today(); } // @dev allow owner to set flush address function setFlushAddress(address to) external onlyOwner{ require(to != address(0), 'flushAddress can not be zero address'); flushAddress = to; } // @dev allow owner to enable / disable flush on transaction function setFlushOnTransaction(bool immediately) external onlyOwner{ flushOnTransaction = immediately; } // @dev flush eth function flush() external onlyOwner { Address.sendValue(payable(flushAddress), address(this).balance); } // @dev flush token function flushToken(address token) external onlyOwner { SafeERC20.safeTransfer(IERC20(token), flushAddress, IERC20(token).balanceOf(address(this))); } // @dev get current day function _today() internal view returns (uint64) { return uint64((block.timestamp / 1 days) * 1 days); } // @dev returns days since launch function _currentDay() internal view returns (uint64 since) { since = _today() - launchDay; if(since > 0) { since = since / 1 days; } } // @dev returns current launch window function _currentWindow() internal view returns(uint64 window) { window = _currentDay(); if(window > 0) { window = window / _windowDays(); } } // @dev returns days per window function _windowDays() internal view returns(uint64) { // 2 days for testnet if(block.chainid == 941) { return 2; } // 30 for mainnet return 30; } // @dev returns current rate function _mintRate(uint64 window) pure internal returns (uint256) { if(window < 2) { return 10; } // Month 2: 0.010 if(window < 3) { return 15; } // Month 3: 0.015 if(window < 4) { return 15; } // Month 4: 0.015 if(window < 5) { return 20; } // Month 5: 0.020 if(window < 6) { return 21; } // Month 6: 0.021 if(window < 7) { return 22; } // Month 7: 0.022 if(window < 8) { return 23; } // Month 8: 0.023 if(window < 9) { return 24; } // Month 9: 0.024 if(window < 10) { return 25; } // Month 10: 0.025 if(window < 11) { return 26; } // Month 11: 0.026 return 28; // Month 12: 0.028 } // @dev returns reward rate for an address function _rewardRate(address referrer) view internal returns (uint256) { uint256 value = referrerValue[referrer]; if(value >= 500000_000000 ) { return 22; } // Above $500,000 = 22% if(value >= 250000_000000 ) { return 15; } // $250,000 - $500,000 = 15% if(value >= 100000_000000 ) { return 12; } // $100,000 - $250,000 = 12% if(value >= 50000_000000 ) { return 9; } // $50,000 - $100,000 = 9% if(value >= 25000_000000 ) { return 7; } // $25,000 - $50,000 = 7% return 5; // $0 - $25,000 = 5% } // @dev quote token using TWAP function _quoteToken(address token, uint256 amount, address caller) internal view returns ( uint256 value, uint256 rate, uint256 minted ) { // Get pool (use WETH for ETH) address pool = pools[token == address(0) ? WETH : token]; // Check token accepted require(pool != address(0), 'Token not accepted'); // Get current price uint256 price = _getPriceX96FromSqrtPriceX96(_getSqrtTwapX96(pool)); // USDC is 1 to 1 if(token == USDC) { value = amount; } // Use USDC side of pool else if(IUniswapV3Pool(pool).token0() == USDC) { value = (amount * (2**96)) / price; } // Otherwise other side of pool else { value = amount * price / (2 ** 96); } // Current rate to use rate = _mintRate(_currentWindow()); // Convert using rate and to 18 decimals and 3 for basis minted = (value * 10 ** 15) / rate; // Include 15% bonus when minting on behalf of customer if(caller == owner()) { minted += (minted * customerBonus) / 100; } } // @dev mint token using TWAP function _mintToken(address token, uint256 amount, address to, address referrer) internal nonReentrant returns ( uint256 value, uint256 rate, uint256 minted ) { // Require at least something require(amount > 0, 'Amount must be > 0'); // Restrict to launch days require(_currentDay() < launchDays, 'Minting phase has ended'); // Get pool (use WETH for ETH) address pool = pools[token == address(0) ? WETH : token]; // Check token accepted require(pool != address(0), 'Token not accepted'); // Get value rate and total to mint (value, rate, minted) = _quoteToken(token, amount, msg.sender); // Deal with ETH if(token == address(0)) { require(amount == msg.value, 'Amount does not match msg.value'); } // Transfer token else { if(token == USDT) { // USDT does not conform to IERC20 IUSDT(token).transferFrom(msg.sender, address(this), amount); } else { // IERC20 returns a value IERC20(token).transferFrom(msg.sender, address(this), amount); } } // Emit event emit Transformed( token, amount, value, minted, rate ); // Mint tokens for sender _mint(to, minted); // Reward referrer when not owner or self if(referrer != address(0) && referrer != owner() && msg.sender != owner() && referrer != msg.sender) { // Mint for referrer _mint(referrer, (minted * referrerRate) / 100); // Increase referrer value referrerValue[referrer] += value; // Reward referrer uint256 rewardedRate = _rewardRate(referrer); uint256 rewardAmount = (amount * rewardedRate) / 100; // Transfer reward if(rewardAmount > 0) { // ETH if(token == address(0)) { payable(referrer).transfer(rewardAmount); } // ERC20 else { SafeERC20.safeTransfer(IERC20(token), referrer, rewardAmount); } } // Emit event emit Referred( msg.sender, referrer, value, rate, token, rewardedRate, rewardAmount ); } // Flush on transaction if(flushOnTransaction && token != address(0)) { SafeERC20.safeTransfer(IERC20(token), flushAddress, IERC20(token).balanceOf(address(this))); } } // @dev get TWAP from pool function _getSqrtTwapX96(address uniswapV3Pool) internal view returns (uint160 sqrtPriceX96) { uint32[] memory secondsAgos = new uint32[](2); secondsAgos[0] = uint32(twapInterval); secondsAgos[1] = 0; (int56[] memory tickCumulatives, ) = IUniswapV3Pool(uniswapV3Pool).observe(secondsAgos); sqrtPriceX96 = TickMath.getSqrtRatioAtTick( int24((tickCumulatives[1] - tickCumulatives[0]) / twapInterval) ); } // @dev get price from sqrt function _getPriceX96FromSqrtPriceX96(uint160 sqrtPriceX96) internal pure returns(uint256 priceX96) { return FullMath.mulDiv(sqrtPriceX96, sqrtPriceX96, FixedPoint96.Q96); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @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. */ 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]. */ 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 v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../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; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @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, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import './pool/IUniswapV3PoolImmutables.sol'; import './pool/IUniswapV3PoolState.sol'; import './pool/IUniswapV3PoolDerivedState.sol'; import './pool/IUniswapV3PoolActions.sol'; import './pool/IUniswapV3PoolOwnerActions.sol'; import './pool/IUniswapV3PoolEvents.sol'; /// @title The interface for a Uniswap V3 Pool /// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform /// to the ERC20 specification /// @dev The pool interface is broken up into many smaller pieces interface IUniswapV3Pool is IUniswapV3PoolImmutables, IUniswapV3PoolState, IUniswapV3PoolDerivedState, IUniswapV3PoolActions, IUniswapV3PoolOwnerActions, IUniswapV3PoolEvents { }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissionless pool actions /// @notice Contains pool methods that can be called by anyone interface IUniswapV3PoolActions { /// @notice Sets the initial price for the pool /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96 function initialize(uint160 sqrtPriceX96) external; /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends /// on tickLower, tickUpper, the amount of liquidity, and the current price. /// @param recipient The address for which the liquidity will be created /// @param tickLower The lower tick of the position in which to add liquidity /// @param tickUpper The upper tick of the position in which to add liquidity /// @param amount The amount of liquidity to mint /// @param data Any data that should be passed through to the callback /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback function mint( address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes calldata data ) external returns (uint256 amount0, uint256 amount1); /// @notice Collects tokens owed to a position /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity. /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity. /// @param recipient The address which should receive the fees collected /// @param tickLower The lower tick of the position for which to collect fees /// @param tickUpper The upper tick of the position for which to collect fees /// @param amount0Requested How much token0 should be withdrawn from the fees owed /// @param amount1Requested How much token1 should be withdrawn from the fees owed /// @return amount0 The amount of fees collected in token0 /// @return amount1 The amount of fees collected in token1 function collect( address recipient, int24 tickLower, int24 tickUpper, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0 /// @dev Fees must be collected separately via a call to #collect /// @param tickLower The lower tick of the position for which to burn liquidity /// @param tickUpper The upper tick of the position for which to burn liquidity /// @param amount How much liquidity to burn /// @return amount0 The amount of token0 sent to the recipient /// @return amount1 The amount of token1 sent to the recipient function burn( int24 tickLower, int24 tickUpper, uint128 amount ) external returns (uint256 amount0, uint256 amount1); /// @notice Swap token0 for token1, or token1 for token0 /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback /// @param recipient The address to receive the output of the swap /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0 /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative) /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this /// value after the swap. If one for zero, the price cannot be greater than this value after the swap /// @param data Any data to be passed through to the callback /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive function swap( address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes calldata data ) external returns (int256 amount0, int256 amount1); /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling /// with 0 amount{0,1} and sending the donation amount(s) from the callback /// @param recipient The address which will receive the token0 and token1 amounts /// @param amount0 The amount of token0 to send /// @param amount1 The amount of token1 to send /// @param data Any data to be passed through to the callback function flash( address recipient, uint256 amount0, uint256 amount1, bytes calldata data ) external; /// @notice Increase the maximum number of price and liquidity observations that this pool will store /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to /// the input observationCardinalityNext. /// @param observationCardinalityNext The desired minimum number of observations for the pool to store function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that is not stored /// @notice Contains view functions to provide information about the pool that is computed rather than stored on the /// blockchain. The functions here may have variable gas costs. interface IUniswapV3PoolDerivedState { /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick, /// you must call it with secondsAgos = [3600, 0]. /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio. /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block /// timestamp function observe(uint32[] calldata secondsAgos) external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s); /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed. /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first /// snapshot is taken and the second snapshot is taken. /// @param tickLower The lower tick of the range /// @param tickUpper The upper tick of the range /// @return tickCumulativeInside The snapshot of the tick accumulator for the range /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range /// @return secondsInside The snapshot of seconds per liquidity for the range function snapshotCumulativesInside(int24 tickLower, int24 tickUpper) external view returns ( int56 tickCumulativeInside, uint160 secondsPerLiquidityInsideX128, uint32 secondsInside ); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Events emitted by a pool /// @notice Contains all events emitted by the pool interface IUniswapV3PoolEvents { /// @notice Emitted exactly once by a pool when #initialize is first called on the pool /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96 /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool event Initialize(uint160 sqrtPriceX96, int24 tick); /// @notice Emitted when liquidity is minted for a given position /// @param sender The address that minted the liquidity /// @param owner The owner of the position and recipient of any minted liquidity /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity minted to the position range /// @param amount0 How much token0 was required for the minted liquidity /// @param amount1 How much token1 was required for the minted liquidity event Mint( address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted when fees are collected by the owner of a position /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees /// @param owner The owner of the position for which fees are collected /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount0 The amount of token0 fees collected /// @param amount1 The amount of token1 fees collected event Collect( address indexed owner, address recipient, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount0, uint128 amount1 ); /// @notice Emitted when a position's liquidity is removed /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect /// @param owner The owner of the position for which liquidity is removed /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity to remove /// @param amount0 The amount of token0 withdrawn /// @param amount1 The amount of token1 withdrawn event Burn( address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted by the pool for any swaps between token0 and token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the output of the swap /// @param amount0 The delta of the token0 balance of the pool /// @param amount1 The delta of the token1 balance of the pool /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96 /// @param liquidity The liquidity of the pool after the swap /// @param tick The log base 1.0001 of price of the pool after the swap event Swap( address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick ); /// @notice Emitted by the pool for any flashes of token0/token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the tokens from flash /// @param amount0 The amount of token0 that was flashed /// @param amount1 The amount of token1 that was flashed /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee event Flash( address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1 ); /// @notice Emitted by the pool for increases to the number of observations that can be stored /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index /// just before a mint/swap/burn. /// @param observationCardinalityNextOld The previous value of the next observation cardinality /// @param observationCardinalityNextNew The updated value of the next observation cardinality event IncreaseObservationCardinalityNext( uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew ); /// @notice Emitted when the protocol fee is changed by the pool /// @param feeProtocol0Old The previous value of the token0 protocol fee /// @param feeProtocol1Old The previous value of the token1 protocol fee /// @param feeProtocol0New The updated value of the token0 protocol fee /// @param feeProtocol1New The updated value of the token1 protocol fee event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New); /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner /// @param sender The address that collects the protocol fees /// @param recipient The address that receives the collected protocol fees /// @param amount0 The amount of token0 protocol fees that is withdrawn /// @param amount0 The amount of token1 protocol fees that is withdrawn event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that never changes /// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values interface IUniswapV3PoolImmutables { /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface /// @return The contract address function factory() external view returns (address); /// @notice The first of the two tokens of the pool, sorted by address /// @return The token contract address function token0() external view returns (address); /// @notice The second of the two tokens of the pool, sorted by address /// @return The token contract address function token1() external view returns (address); /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6 /// @return The fee function fee() external view returns (uint24); /// @notice The pool tick spacing /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ... /// This value is an int24 to avoid casting even though it is always positive. /// @return The tick spacing function tickSpacing() external view returns (int24); /// @notice The maximum amount of position liquidity that can use any tick in the range /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool /// @return The max amount of liquidity per tick function maxLiquidityPerTick() external view returns (uint128); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissioned pool actions /// @notice Contains pool methods that may only be called by the factory owner interface IUniswapV3PoolOwnerActions { /// @notice Set the denominator of the protocol's % share of the fees /// @param feeProtocol0 new protocol fee for token0 of the pool /// @param feeProtocol1 new protocol fee for token1 of the pool function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external; /// @notice Collect the protocol fee accrued to the pool /// @param recipient The address to which collected protocol fees should be sent /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1 /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0 /// @return amount0 The protocol fee collected in token0 /// @return amount1 The protocol fee collected in token1 function collectProtocol( address recipient, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that can change /// @notice These methods compose the pool's state, and can change with any frequency including multiple times /// per transaction interface IUniswapV3PoolState { /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas /// when accessed externally. /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value /// tick The current tick of the pool, i.e. according to the last tick transition that was run. /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick /// boundary. /// observationIndex The index of the last oracle observation that was written, /// observationCardinality The current maximum number of observations stored in the pool, /// observationCardinalityNext The next maximum number of observations, to be updated when the observation. /// feeProtocol The protocol fee for both tokens of the pool. /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0 /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee. /// unlocked Whether the pool is currently locked to reentrancy function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked ); /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal0X128() external view returns (uint256); /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal1X128() external view returns (uint256); /// @notice The amounts of token0 and token1 that are owed to the protocol /// @dev Protocol fees will never exceed uint128 max in either token function protocolFees() external view returns (uint128 token0, uint128 token1); /// @notice The currently in range liquidity available to the pool /// @dev This value has no relationship to the total liquidity across all ticks function liquidity() external view returns (uint128); /// @notice Look up information about a specific tick in the pool /// @param tick The tick to look up /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or /// tick upper, /// liquidityNet how much liquidity changes when the pool price crosses the tick, /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0, /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1, /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick, /// secondsOutside the seconds spent on the other side of the tick from the current tick, /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false. /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0. /// In addition, these values are only relative and must be used only in comparison to previous snapshots for /// a specific position. function ticks(int24 tick) external view returns ( uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, int56 tickCumulativeOutside, uint160 secondsPerLiquidityOutsideX128, uint32 secondsOutside, bool initialized ); /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information function tickBitmap(int16 wordPosition) external view returns (uint256); /// @notice Returns the information about a position by the position's key /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper /// @return _liquidity The amount of liquidity in the position, /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke, /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke, /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke, /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke function positions(bytes32 key) external view returns ( uint128 _liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); /// @notice Returns data about a specific observation index /// @param index The element of the observations array to fetch /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time /// ago, rather than at a specific index in the array. /// @return blockTimestamp The timestamp of the observation, /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp, /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp, /// Returns initialized whether the observation has been initialized and the values are safe to use function observations(uint256 index) external view returns ( uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized ); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.4.0; /// @title FixedPoint96 /// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format) /// @dev Used in SqrtPriceMath.sol library FixedPoint96 { uint8 internal constant RESOLUTION = 96; uint256 internal constant Q96 = 0x1000000000000000000000000; }
// SPDX-License-Identifier: MIT // https://github.com/0xTomoyo/fullrange/blob/master/src/libraries/FullMath.sol pragma solidity >=0.8.0; /// @title Contains 512-bit math functions /// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision /// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits library FullMath { /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv function mulDiv( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = a * b // Compute the product mod 2**256 and mod 2**256 - 1 // then use the Chinese Remainder Theorem to reconstruct // the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2**256 + prod0 uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(a, b, not(0)) prod0 := mul(a, b) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division if (prod1 == 0) { require(denominator > 0); assembly { result := div(prod0, denominator) } return result; } // Make sure the result is less than 2**256. // Also prevents denominator == 0 require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0] // Compute remainder using mulmod uint256 remainder; assembly { remainder := mulmod(a, b, denominator) } // Subtract 256 bit number from 512 bit number assembly { prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator // Compute largest power of two divisor of denominator. // Always >= 1. uint256 twos = (type(uint256).max - denominator + 1) & denominator; // Divide denominator by power of two assembly { denominator := div(denominator, twos) } // Divide [prod1 prod0] by the factors of two assembly { prod0 := div(prod0, twos) } // Shift in bits from prod1 into prod0. For this we need // to flip `twos` such that it is 2**256 / twos. // If twos is zero, then it becomes one assembly { twos := add(div(sub(0, twos), twos), 1) } 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 // correct for four bits. That is, denominator * inv = 1 mod 2**4 uint256 inv = (3 * denominator) ^ 2; // Now use 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. inv *= 2 - denominator * inv; // inverse mod 2**8 inv *= 2 - denominator * inv; // inverse mod 2**16 inv *= 2 - denominator * inv; // inverse mod 2**32 inv *= 2 - denominator * inv; // inverse mod 2**64 inv *= 2 - denominator * inv; // inverse mod 2**128 inv *= 2 - denominator * inv; // 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 precoditions 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 * inv; return result; } } /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result function mulDivRoundingUp( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { result = mulDiv(a, b, denominator); unchecked { if (mulmod(a, b, denominator) > 0) { require(result < type(uint256).max); result++; } } } }
// SPDX-License-Identifier: GPL-2.0-or-later // https://github.com/0xTomoyo/fullrange/blob/master/src/libraries/TickMath.sol pragma solidity >=0.8.0; /// @title Math library for computing sqrt prices from ticks and vice versa /// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports /// prices between 2**-128 and 2**128 library TickMath { /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128 int24 internal constant MIN_TICK = -887272; /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128 int24 internal constant MAX_TICK = -MIN_TICK; /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK) uint160 internal constant MIN_SQRT_RATIO = 4295128739; /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK) uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342; /// @notice Calculates sqrt(1.0001^tick) * 2^96 /// @dev Throws if |tick| > max tick /// @param tick The input tick for the above formula /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) /// at the given tick function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) { unchecked { uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick)); require(absTick <= uint256(int256(MAX_TICK)), "T"); uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000; if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128; if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128; if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128; if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128; if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128; if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128; if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128; if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128; if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128; if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128; if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128; if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128; if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128; if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128; if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128; if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128; if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128; if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128; if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128; if (tick > 0) ratio = type(uint256).max / ratio; // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96. // we then downcast because we know the result always fits within 160 bits due to our tick input constraint // we round up in the division so getTickAtSqrtRatio of the output price is always consistent sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)); } } /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may /// ever return. /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96 /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) { unchecked { // second inequality must be < because the price can never reach the price at the max tick require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, "R"); uint256 ratio = uint256(sqrtPriceX96) << 32; uint256 r = ratio; uint256 msb = 0; assembly { let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(5, gt(r, 0xFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(4, gt(r, 0xFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(3, gt(r, 0xFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(2, gt(r, 0xF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(1, gt(r, 0x3)) msb := or(msb, f) r := shr(f, r) } assembly { let f := gt(r, 0x1) msb := or(msb, f) } if (msb >= 128) r = ratio >> (msb - 127); else r = ratio << (127 - msb); int256 log_2 = (int256(msb) - 128) << 64; assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(63, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(62, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(61, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(60, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(59, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(58, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(57, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(56, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(55, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(54, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(53, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(52, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(51, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(50, f)) } int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128); int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128); tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow; } } function getTicks(int24 tickSpacing) internal pure returns (int24 minTick, int24 maxTick) { minTick = (MIN_TICK / tickSpacing) * tickSpacing; maxTick = (MAX_TICK / tickSpacing) * tickSpacing; } }
{ "optimizer": { "enabled": true, "runs": 369 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_flush","type":"address"}],"stateMutability":"payable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"minted","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"team","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"liquidity","type":"uint256"}],"name":"MintingClosed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minter","type":"address"},{"indexed":false,"internalType":"address","name":"referrer","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"rewardRate","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rewardAmount","type":"uint256"}],"name":"Referred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"minted","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"rate","type":"uint256"}],"name":"Transformed","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"closeLaunchPhase","outputs":[{"internalType":"uint256","name":"minted","type":"uint256"},{"internalType":"uint256","name":"team","type":"uint256"},{"internalType":"uint256","name":"liquidity","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentDay","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentWindow","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"customerBonus","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"subtractedValue","type":"uint256"}],"name":"decreaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"endLiquidity","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endTeam","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flush","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"flushAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"flushOnTransaction","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"flushToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"addedValue","type":"uint256"}],"name":"increaseAllowance","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"launchDay","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"launchDays","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintPhaseClosed","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"referrer","type":"address"}],"name":"mintToken","outputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"minted","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"mintTokenFor","outputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"minted","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextWindow","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"pools","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"caller","type":"address"}],"name":"quoteToken","outputs":[{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"minted","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"referrerRate","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"referrerValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"referrer","type":"address"}],"name":"rewardRate","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"setFlushAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"immediately","type":"bool"}],"name":"setFlushOnTransaction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"setLaunchDay","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"today","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"twapInterval","outputs":[{"internalType":"int32","name":"","type":"int32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"windowDays","outputs":[{"internalType":"uint64","name":"","type":"uint64"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
610120604081905273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2608052732260fac5e5542a773aa44fbcfedf7c193bc2c59960a05273a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4860c05273dac17f958d2ee523a2206206994597c13d831ec760e052736b175474e89094c44da98b954eedeac495271d0f61010052600a805460ff60401b19169055620031b338819003908190833981016040819052620000ac91620002b9565b60405180604001604052806009815260200168047656e6965537761760bc1b8152506040518060400160405280600581526020016447454e494560d81b8152508160039081620000fd919062000390565b5060046200010c828262000390565b50505062000129620001236200023e60201b60201c565b62000242565b60016006556080516001600160a01b0390811660009081526007602052604080822080546001600160a01b03199081167388e6a0c2ddd26feeb64f039a2c41296fcb3f56401790915560a05184168352818320805482167399ac8ca7087fa4a2a1fb6357269965a2014abc3517905560c0518416835281832080548216735777d92f208679db4b9778590fa3cab3ac9e216890811790915560e0518516845282842080548316733416cf6c708da44db2624d63ea0aaef7113527c617905561010051851684529190922080548316909117905560088054928416929091169190911790556200021762000294565b600a80546001600160401b0319166001600160401b039290921691909117905550620004ab565b3390565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6000620002a562015180426200045c565b620002b490620151806200047f565b905090565b600060208284031215620002cc57600080fd5b81516001600160a01b0381168114620002e457600080fd5b9392505050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200031657607f821691505b6020821081036200033757634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200038b57600081815260208120601f850160051c81016020861015620003665750805b601f850160051c820191505b81811015620003875782815560010162000372565b5050505b505050565b81516001600160401b03811115620003ac57620003ac620002eb565b620003c481620003bd845462000301565b846200033d565b602080601f831160018114620003fc5760008415620003e35750858301515b600019600386901b1c1916600185901b17855562000387565b600085815260208120601f198616915b828110156200042d578886015182559484019460019091019084016200040c565b50858210156200044c5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000826200047a57634e487b7160e01b600052601260045260246000fd5b500490565b8082028115828204841417620004a557634e487b7160e01b600052601160045260246000fd5b92915050565b60805160a05160c05160e05161010051612cbb620004f860003960005050600061177c015260008181611c6c0152611cad015260005050600081816116850152611bd40152612cbb6000f3fe60806040526004361061028c5760003560e01c80639cee789f11610164578063bc0628c0116100c6578063df3e353b1161008a578063e8fa9add11610064578063e8fa9add1461079a578063f2fde38b146107af578063fffd5ec4146107cf57600080fd5b8063df3e353b14610745578063dfc37cf81461075a578063e492fd471461076d57600080fd5b8063bc0628c01461069f578063bff02698146106b4578063ca0dcf16146106d4578063dd62ed3e146106e9578063dddb0ec11461072f57600080fd5b8063ad920c4911610128578063b74e452b11610102578063b74e452b14610655578063ba0bafb41461066a578063bbbf799f1461067f57600080fd5b8063ad920c4914610600578063af375ece14610620578063b259a7991461064057600080fd5b80639cee789f14610555578063a324aef314610575578063a4063dbc1461058a578063a457c2d7146105c0578063a9059cbb146105e057600080fd5b80635c9302c91161020d57806370a08231116101d15780638da5cb5b116101ab5780638da5cb5b146104ed57806395d89b411461051f5780639647e2011461053457600080fd5b806370a082311461048157806370e9ff46146104b7578063715018a6146104d857600080fd5b80635c9302c9146103ff5780635f20fd9214610414578063615d1661146104295780636b9f96ea1461043e5780636dfada861461045357600080fd5b806323b872dd1161025457806323b872dd14610342578063313ce5671461036257806337030bc01461037e57806339509351146103b65780633c1d5df0146103d657600080fd5b806306fdde0314610291578063095ea7b3146102bc5780630ba55f9d146102ec57806318160ddd14610303578063221ca18c14610322575b600080fd5b34801561029d57600080fd5b506102a66107e4565b6040516102b391906126ef565b60405180910390f35b3480156102c857600080fd5b506102dc6102d7366004612737565b610876565b60405190151581526020016102b3565b3480156102f857600080fd5b50610301610890565b005b34801561030f57600080fd5b506002545b6040519081526020016102b3565b34801561032e57600080fd5b5061031461033d366004612763565b610928565b34801561034e57600080fd5b506102dc61035d366004612780565b610933565b34801561036e57600080fd5b50604051601281526020016102b3565b34801561038a57600080fd5b50600a5461039e906001600160401b031681565b6040516001600160401b0390911681526020016102b3565b3480156103c257600080fd5b506102dc6103d1366004612737565b610959565b3480156103e257600080fd5b506103ec610e1081565b60405160039190910b81526020016102b3565b34801561040b57600080fd5b5061039e610998565b34801561042057600080fd5b506103146109a7565b34801561043557600080fd5b5061039e6109c4565b34801561044a57600080fd5b506103016109ce565b6104666104613660046127c1565b6109ee565b604080519384526020840192909252908201526060016102b3565b34801561048d57600080fd5b5061031461049c366004612763565b6001600160a01b031660009081526020819052604090205490565b3480156104c357600080fd5b506008546102dc90600160a01b900460ff1681565b3480156104e457600080fd5b50610301610a0e565b3480156104f957600080fd5b506005546001600160a01b03165b6040516001600160a01b0390911681526020016102b3565b34801561052b57600080fd5b506102a6610a20565b34801561054057600080fd5b50600a546102dc90600160401b900460ff1681565b34801561056157600080fd5b50610301610570366004612763565b610a2f565b34801561058157600080fd5b5061039e601981565b34801561059657600080fd5b506105076105a5366004612763565b6007602052600090815260409020546001600160a01b031681565b3480156105cc57600080fd5b506102dc6105db366004612737565b610ab5565b3480156105ec57600080fd5b506102dc6105fb366004612737565b610b52565b34801561060c57600080fd5b50600854610507906001600160a01b031681565b34801561062c57600080fd5b5061046661063b3660046127c1565b610b60565b34801561064c57600080fd5b5061039e600a81565b34801561066157600080fd5b5061039e610b70565b34801561067657600080fd5b5061039e610b7a565b34801561068b57600080fd5b5061030161069a366004612763565b610b84565b3480156106ab57600080fd5b5061039e600f81565b3480156106c057600080fd5b506103016106cf366004612811565b610c10565b3480156106e057600080fd5b50610314610c36565b3480156106f557600080fd5b5061031461070436600461282e565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b34801561073b57600080fd5b5061039e61016d81565b34801561075157600080fd5b5061039e600581565b6104666107683660046127c1565b610c43565b34801561077957600080fd5b50610314610788366004612763565b60096020526000908152604090205481565b3480156107a657600080fd5b50610466610c55565b3480156107bb57600080fd5b506103016107ca366004612763565b610dde565b3480156107db57600080fd5b5061039e610e54565b6060600380546107f390612867565b80601f016020809104026020016040519081016040528092919081815260200182805461081f90612867565b801561086c5780601f106108415761010080835404028352916020019161086c565b820191906000526020600020905b81548152906001019060200180831161084f57829003601f168201915b5050505050905090565b600033610884818585610e9e565b60019150505b92915050565b610898610fc2565b601e6108a261101c565b6001600160401b0316106108fd5760405162461bcd60e51b815260206004820152601960248201527f4d696e74696e672070686173652068617320737461727465640000000000000060448201526064015b60405180910390fd5b61090561105e565b600a805467ffffffffffffffff19166001600160401b0392909216919091179055565b600061088a8261107a565b600033610941858285611105565b61094c858585611197565b60019150505b9392505050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919061088490829086906109939087906128b7565b610e9e565b60006109a261101c565b905090565b60006109a26109b461133b565b6109bf9060016128ca565b611368565b60006109a2611476565b6109d6610fc2565b6008546109ec906001600160a01b03164761148d565b565b60008060006109ff868633876115ab565b92509250925093509350939050565b610a16610fc2565b6109ec6000611afc565b6060600480546107f390612867565b610a37610fc2565b6008546040516370a0823160e01b8152306004820152610ab29183916001600160a01b03918216918316906370a08231906024015b602060405180830381865afa158015610a89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aad91906128f1565b611b4e565b50565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919083811015610b3a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016108f4565b610b478286868403610e9e565b506001949350505050565b600033610884818585611197565b60008060006109ff868686611bb5565b60006109a261105e565b60006109a261133b565b610b8c610fc2565b6001600160a01b038116610bee5760405162461bcd60e51b8152602060048201526024808201527f666c757368416464726573732063616e206e6f74206265207a65726f206164646044820152637265737360e01b60648201526084016108f4565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b610c18610fc2565b60088054911515600160a01b0260ff60a01b19909216919091179055565b60006109a26109bf61133b565b60008060006109ff86868660006115ab565b6000806000610c62610fc2565b610c6a611e05565b61016d610c7561101c565b6001600160401b031611610ccb5760405162461bcd60e51b815260206004820152601f60248201527f4d696e74696e67207068617365207374696c6c20696e2070726f67726573730060448201526064016108f4565b600a54600160401b900460ff1615610d255760405162461bcd60e51b815260206004820152601660248201527f4d696e74696e6720616c726561647920636c6f7365640000000000000000000060448201526064016108f4565b600a805468ff00000000000000001916600160401b179055610d4660025490565b92506064610d5560198561290a565b610d5f9190612937565b9150610d6b3383611e5e565b6064610d78600a8561290a565b610d829190612937565b9050610d8e3382611e5e565b60408051848152602081018490529081018290527fd2b7cc74a9d3ef03c8032969dcc7c4a184b729f0b8c9b3c22d3485e8aebe0d7b9060600160405180910390a1610dd96001600655565b909192565b610de6610fc2565b6001600160a01b038116610e4b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108f4565b610ab281611afc565b6000610e5e611476565b610e6661133b565b610e719060016128ca565b610e7b919061294b565b610e88906201518061294b565b600a546109a291906001600160401b03166128ca565b6001600160a01b038316610f005760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016108f4565b6001600160a01b038216610f615760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016108f4565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6005546001600160a01b031633146109ec5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108f4565b600a546000906001600160401b031661103361105e565b61103d9190612976565b90506001600160401b0381161561105b576109a26201518082612996565b90565b600061106d6201518042612937565b6109a2906201518061290a565b6001600160a01b03811660009081526009602052604081205464746a52880081106110a85750601692915050565b643a3529440081106110bd5750600f92915050565b64174876e80081106110d25750600c92915050565b640ba43b740081106110e75750600992915050565b6405d21dba0081106110fc5750600792915050565b50600592915050565b6001600160a01b03838116600090815260016020908152604080832093861683529290522054600019811461119157818110156111845760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016108f4565b6111918484848403610e9e565b50505050565b6001600160a01b0383166111fb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016108f4565b6001600160a01b03821661125d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016108f4565b6001600160a01b038316600090815260208190526040902054818110156112d55760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016108f4565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3611191565b600061134561101c565b90506001600160401b0381161561105b5761135e611476565b6109a29082612996565b60006002826001600160401b031610156113845750600a919050565b6003826001600160401b0316101561139e5750600f919050565b6004826001600160401b031610156113b85750600f919050565b6005826001600160401b031610156113d257506014919050565b6006826001600160401b031610156113ec57506015919050565b6007826001600160401b0316101561140657506016919050565b6008826001600160401b0316101561142057506017919050565b6009826001600160401b0316101561143a57506018919050565b600a826001600160401b0316101561145457506019919050565b600b826001600160401b0316101561146e5750601a919050565b50601c919050565b6000466103ad036114875750600290565b50601e90565b804710156114dd5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016108f4565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461152a576040519150601f19603f3d011682016040523d82523d6000602084013e61152f565b606091505b50509050806115a65760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016108f4565b505050565b60008060006115b8611e05565b600086116116085760405162461bcd60e51b815260206004820152601260248201527f416d6f756e74206d757374206265203e2030000000000000000000000000000060448201526064016108f4565b61016d61161361101c565b6001600160401b0316106116695760405162461bcd60e51b815260206004820152601760248201527f4d696e74696e672070686173652068617320656e64656400000000000000000060448201526064016108f4565b60006007816001600160a01b038a161561168357896116a5565b7f00000000000000000000000000000000000000000000000000000000000000005b6001600160a01b039081168252602082019290925260400160002054169050806117065760405162461bcd60e51b8152602060048201526012602482015271151bdad95b881b9bdd081858d8d95c1d195960721b60448201526064016108f4565b611711888833611bb5565b919550935091506001600160a01b03881661177a573487146117755760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e7420646f6573206e6f74206d61746368206d73672e76616c75650060448201526064016108f4565b611897565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316886001600160a01b03160361181e576040516323b872dd60e01b8152336004820152306024820152604481018890526001600160a01b038916906323b872dd90606401600060405180830381600087803b15801561180157600080fd5b505af1158015611815573d6000803e3d6000fd5b50505050611897565b6040516323b872dd60e01b8152336004820152306024820152604481018890526001600160a01b038916906323b872dd906064016020604051808303816000875af1158015611871573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061189591906129bc565b505b604080516001600160a01b038a1681526020810189905290810185905260608101839052608081018490527f7f4131948bf6030559a654032ee614b785d5a80841f0047c5af6c39a287b806c9060a00160405180910390a16118f98683611e5e565b6001600160a01b0385161580159061191f57506005546001600160a01b03868116911614155b801561193657506005546001600160a01b03163314155b801561194b57506001600160a01b0385163314155b15611a885761197085606461196160058661290a565b61196b9190612937565b611e5e565b6001600160a01b038516600090815260096020526040812080548692906119989084906128b7565b90915550600090506119a98661107a565b9050600060646119b9838b61290a565b6119c39190612937565b90508015611a20576001600160a01b038a16611a15576040516001600160a01b0388169082156108fc029083906000818181858888f19350505050158015611a0f573d6000803e3d6000fd5b50611a20565b611a208a8883611b4e565b604080513381526001600160a01b038981166020830152818301899052606082018890528c16608082015260a0810184905260c0810183905290517f166b1ea789e6ca2168a65c7ea84b33cfd4afa18a28d5d30c71243fc4c8dc446a9181900360e00190a150505b600854600160a01b900460ff168015611aa957506001600160a01b03881615155b15611ae7576008546040516370a0823160e01b8152306004820152611ae7918a916001600160a01b03918216918316906370a0823190602401610a6c565b50611af26001600655565b9450945094915050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b1790526115a6908490611f1d565b60008080806007816001600160a01b03891615611bd25788611bf4565b7f00000000000000000000000000000000000000000000000000000000000000005b6001600160a01b03908116825260208201929092526040016000205416905080611c555760405162461bcd60e51b8152602060048201526012602482015271151bdad95b881b9bdd081858d8d95c1d195960721b60448201526064016108f4565b6000611c68611c6383611fef565b612145565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316886001600160a01b031603611cab57869450611d81565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316826001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d3791906129d9565b6001600160a01b031603611d655780611d5488600160601b61290a565b611d5e9190612937565b9450611d81565b600160601b611d74828961290a565b611d7e9190612937565b94505b611d8c6109bf61133b565b935083611da08666038d7ea4c6800061290a565b611daa9190612937565b9250611dbe6005546001600160a01b031690565b6001600160a01b0316866001600160a01b031603611dfa576064611de3600f8561290a565b611ded9190612937565b611df790846128b7565b92505b505093509350939050565b600260065403611e575760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108f4565b6002600655565b6001600160a01b038216611eb45760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016108f4565b8060026000828254611ec691906128b7565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6000611f72826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661215f9092919063ffffffff16565b8051909150156115a65780806020019051810190611f9091906129bc565b6115a65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016108f4565b60408051600280825260608201835260009283929190602083019080368337019050509050610e108160008151811061202a5761202a612a0c565b602002602001019063ffffffff16908163ffffffff168152505060008160018151811061205957612059612a0c565b63ffffffff9092166020928302919091019091015260405163883bdbfd60e01b81526000906001600160a01b0385169063883bdbfd9061209d908590600401612a22565b600060405180830381865afa1580156120ba573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120e29190810190612b33565b50905061213d610e1060030b8260008151811061210157612101612a0c565b60200260200101518360018151811061211c5761211c612a0c565b602002602001015161212e9190612bfe565b6121389190612c2b565b61216e565b949350505050565b600061088a6001600160a01b03831680600160601b6124a4565b606061213d8484600085612552565b60008060008360020b12612185578260020b61218d565b8260020b6000035b9050620d89e88111156121c65760405162461bcd60e51b81526020600482015260016024820152601560fa1b60448201526064016108f4565b6000816001166000036121dd57600160801b6121ef565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615612223576ffff97272373d413259a46990580e213a0260801c5b6004821615612242576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615612261576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615612280576fffcb9843d60f6159c9db58835c9266440260801c5b602082161561229f576fff973b41fa98c081472e6896dfb254c00260801c5b60408216156122be576fff2ea16466c96a3843ec78b326b528610260801c5b60808216156122dd576ffe5dee046a99a2a811c461f1969c30530260801c5b6101008216156122fd576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b61020082161561231d576ff987a7253ac413176f2b074cf7815e540260801c5b61040082161561233d576ff3392b0822b70005940c7a398e4b70f30260801c5b61080082161561235d576fe7159475a2c29b7443b29c7fa6e889d90260801c5b61100082161561237d576fd097f3bdfd2022b8845ad8f792aa58250260801c5b61200082161561239d576fa9f746462d870fdf8a65dc1f90e061e50260801c5b6140008216156123bd576f70d869a156d2a1b890bb3df62baf32f70260801c5b6180008216156123dd576f31be135f97d08fd981231505542fcfa60260801c5b620100008216156123fe576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b6202000082161561241e576e5d6af8dedb81196699c329225ee6040260801c5b6204000082161561243d576d2216e584f5fa1ea926041bedfe980260801c5b6208000082161561245a576b048a170391f7dc42444e8fa20260801c5b60008460020b131561247b57806000198161247757612477612921565b0490505b64010000000081061561248f576001612492565b60005b60ff16602082901c0192505050919050565b60008080600019858709858702925082811083820303915050806000036124dd57600084116124d257600080fd5b508290049050610952565b8084116124e957600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b6060824710156125b35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108f4565b600080866001600160a01b031685876040516125cf9190612c69565b60006040518083038185875af1925050503d806000811461260c576040519150601f19603f3d011682016040523d82523d6000602084013e612611565b606091505b50915091506126228783838761262d565b979650505050505050565b6060831561269c578251600003612695576001600160a01b0385163b6126955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108f4565b508161213d565b61213d83838151156126b15781518083602001fd5b8060405162461bcd60e51b81526004016108f491906126ef565b60005b838110156126e65781810151838201526020016126ce565b50506000910152565b602081526000825180602084015261270e8160408501602087016126cb565b601f01601f19169190910160400192915050565b6001600160a01b0381168114610ab257600080fd5b6000806040838503121561274a57600080fd5b823561275581612722565b946020939093013593505050565b60006020828403121561277557600080fd5b813561095281612722565b60008060006060848603121561279557600080fd5b83356127a081612722565b925060208401356127b081612722565b929592945050506040919091013590565b6000806000606084860312156127d657600080fd5b83356127e181612722565b92506020840135915060408401356127f881612722565b809150509250925092565b8015158114610ab257600080fd5b60006020828403121561282357600080fd5b813561095281612803565b6000806040838503121561284157600080fd5b823561284c81612722565b9150602083013561285c81612722565b809150509250929050565b600181811c9082168061287b57607f821691505b60208210810361289b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561088a5761088a6128a1565b6001600160401b038181168382160190808211156128ea576128ea6128a1565b5092915050565b60006020828403121561290357600080fd5b5051919050565b808202811582820484141761088a5761088a6128a1565b634e487b7160e01b600052601260045260246000fd5b60008261294657612946612921565b500490565b6001600160401b0381811683821602808216919082811461296e5761296e6128a1565b505092915050565b6001600160401b038281168282160390808211156128ea576128ea6128a1565b60006001600160401b03808416806129b0576129b0612921565b92169190910492915050565b6000602082840312156129ce57600080fd5b815161095281612803565b6000602082840312156129eb57600080fd5b815161095281612722565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b81811015612a6057835163ffffffff1683529284019291840191600101612a3e565b50909695505050505050565b604051601f8201601f191681016001600160401b0381118282101715612a9457612a946129f6565b604052919050565b60006001600160401b03821115612ab557612ab56129f6565b5060051b60200190565b600082601f830112612ad057600080fd5b81516020612ae5612ae083612a9c565b612a6c565b82815260059290921b84018101918181019086841115612b0457600080fd5b8286015b84811015612b28578051612b1b81612722565b8352918301918301612b08565b509695505050505050565b60008060408385031215612b4657600080fd5b82516001600160401b0380821115612b5d57600080fd5b818501915085601f830112612b7157600080fd5b81516020612b81612ae083612a9c565b82815260059290921b84018101918181019089841115612ba057600080fd5b948201945b83861015612bce5785518060060b8114612bbf5760008081fd5b82529482019490820190612ba5565b91880151919650909350505080821115612be757600080fd5b50612bf485828601612abf565b9150509250929050565b600682810b9082900b03667fffffffffffff198112667fffffffffffff8213171561088a5761088a6128a1565b60008160060b8360060b80612c4257612c42612921565b667fffffffffffff19821460001982141615612c6057612c606128a1565b90059392505050565b60008251612c7b8184602087016126cb565b919091019291505056fea2646970667358221220d1fbd10e4526c332ec89577de0d6d56601470c94967dba39961097f52bc277ba64736f6c63430008110033000000000000000000000000101c71fa8b2f55d97b2981277931830e45eee7fd
Deployed Bytecode
0x60806040526004361061028c5760003560e01c80639cee789f11610164578063bc0628c0116100c6578063df3e353b1161008a578063e8fa9add11610064578063e8fa9add1461079a578063f2fde38b146107af578063fffd5ec4146107cf57600080fd5b8063df3e353b14610745578063dfc37cf81461075a578063e492fd471461076d57600080fd5b8063bc0628c01461069f578063bff02698146106b4578063ca0dcf16146106d4578063dd62ed3e146106e9578063dddb0ec11461072f57600080fd5b8063ad920c4911610128578063b74e452b11610102578063b74e452b14610655578063ba0bafb41461066a578063bbbf799f1461067f57600080fd5b8063ad920c4914610600578063af375ece14610620578063b259a7991461064057600080fd5b80639cee789f14610555578063a324aef314610575578063a4063dbc1461058a578063a457c2d7146105c0578063a9059cbb146105e057600080fd5b80635c9302c91161020d57806370a08231116101d15780638da5cb5b116101ab5780638da5cb5b146104ed57806395d89b411461051f5780639647e2011461053457600080fd5b806370a082311461048157806370e9ff46146104b7578063715018a6146104d857600080fd5b80635c9302c9146103ff5780635f20fd9214610414578063615d1661146104295780636b9f96ea1461043e5780636dfada861461045357600080fd5b806323b872dd1161025457806323b872dd14610342578063313ce5671461036257806337030bc01461037e57806339509351146103b65780633c1d5df0146103d657600080fd5b806306fdde0314610291578063095ea7b3146102bc5780630ba55f9d146102ec57806318160ddd14610303578063221ca18c14610322575b600080fd5b34801561029d57600080fd5b506102a66107e4565b6040516102b391906126ef565b60405180910390f35b3480156102c857600080fd5b506102dc6102d7366004612737565b610876565b60405190151581526020016102b3565b3480156102f857600080fd5b50610301610890565b005b34801561030f57600080fd5b506002545b6040519081526020016102b3565b34801561032e57600080fd5b5061031461033d366004612763565b610928565b34801561034e57600080fd5b506102dc61035d366004612780565b610933565b34801561036e57600080fd5b50604051601281526020016102b3565b34801561038a57600080fd5b50600a5461039e906001600160401b031681565b6040516001600160401b0390911681526020016102b3565b3480156103c257600080fd5b506102dc6103d1366004612737565b610959565b3480156103e257600080fd5b506103ec610e1081565b60405160039190910b81526020016102b3565b34801561040b57600080fd5b5061039e610998565b34801561042057600080fd5b506103146109a7565b34801561043557600080fd5b5061039e6109c4565b34801561044a57600080fd5b506103016109ce565b6104666104613660046127c1565b6109ee565b604080519384526020840192909252908201526060016102b3565b34801561048d57600080fd5b5061031461049c366004612763565b6001600160a01b031660009081526020819052604090205490565b3480156104c357600080fd5b506008546102dc90600160a01b900460ff1681565b3480156104e457600080fd5b50610301610a0e565b3480156104f957600080fd5b506005546001600160a01b03165b6040516001600160a01b0390911681526020016102b3565b34801561052b57600080fd5b506102a6610a20565b34801561054057600080fd5b50600a546102dc90600160401b900460ff1681565b34801561056157600080fd5b50610301610570366004612763565b610a2f565b34801561058157600080fd5b5061039e601981565b34801561059657600080fd5b506105076105a5366004612763565b6007602052600090815260409020546001600160a01b031681565b3480156105cc57600080fd5b506102dc6105db366004612737565b610ab5565b3480156105ec57600080fd5b506102dc6105fb366004612737565b610b52565b34801561060c57600080fd5b50600854610507906001600160a01b031681565b34801561062c57600080fd5b5061046661063b3660046127c1565b610b60565b34801561064c57600080fd5b5061039e600a81565b34801561066157600080fd5b5061039e610b70565b34801561067657600080fd5b5061039e610b7a565b34801561068b57600080fd5b5061030161069a366004612763565b610b84565b3480156106ab57600080fd5b5061039e600f81565b3480156106c057600080fd5b506103016106cf366004612811565b610c10565b3480156106e057600080fd5b50610314610c36565b3480156106f557600080fd5b5061031461070436600461282e565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b34801561073b57600080fd5b5061039e61016d81565b34801561075157600080fd5b5061039e600581565b6104666107683660046127c1565b610c43565b34801561077957600080fd5b50610314610788366004612763565b60096020526000908152604090205481565b3480156107a657600080fd5b50610466610c55565b3480156107bb57600080fd5b506103016107ca366004612763565b610dde565b3480156107db57600080fd5b5061039e610e54565b6060600380546107f390612867565b80601f016020809104026020016040519081016040528092919081815260200182805461081f90612867565b801561086c5780601f106108415761010080835404028352916020019161086c565b820191906000526020600020905b81548152906001019060200180831161084f57829003601f168201915b5050505050905090565b600033610884818585610e9e565b60019150505b92915050565b610898610fc2565b601e6108a261101c565b6001600160401b0316106108fd5760405162461bcd60e51b815260206004820152601960248201527f4d696e74696e672070686173652068617320737461727465640000000000000060448201526064015b60405180910390fd5b61090561105e565b600a805467ffffffffffffffff19166001600160401b0392909216919091179055565b600061088a8261107a565b600033610941858285611105565b61094c858585611197565b60019150505b9392505050565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919061088490829086906109939087906128b7565b610e9e565b60006109a261101c565b905090565b60006109a26109b461133b565b6109bf9060016128ca565b611368565b60006109a2611476565b6109d6610fc2565b6008546109ec906001600160a01b03164761148d565b565b60008060006109ff868633876115ab565b92509250925093509350939050565b610a16610fc2565b6109ec6000611afc565b6060600480546107f390612867565b610a37610fc2565b6008546040516370a0823160e01b8152306004820152610ab29183916001600160a01b03918216918316906370a08231906024015b602060405180830381865afa158015610a89573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aad91906128f1565b611b4e565b50565b3360008181526001602090815260408083206001600160a01b038716845290915281205490919083811015610b3a5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016108f4565b610b478286868403610e9e565b506001949350505050565b600033610884818585611197565b60008060006109ff868686611bb5565b60006109a261105e565b60006109a261133b565b610b8c610fc2565b6001600160a01b038116610bee5760405162461bcd60e51b8152602060048201526024808201527f666c757368416464726573732063616e206e6f74206265207a65726f206164646044820152637265737360e01b60648201526084016108f4565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b610c18610fc2565b60088054911515600160a01b0260ff60a01b19909216919091179055565b60006109a26109bf61133b565b60008060006109ff86868660006115ab565b6000806000610c62610fc2565b610c6a611e05565b61016d610c7561101c565b6001600160401b031611610ccb5760405162461bcd60e51b815260206004820152601f60248201527f4d696e74696e67207068617365207374696c6c20696e2070726f67726573730060448201526064016108f4565b600a54600160401b900460ff1615610d255760405162461bcd60e51b815260206004820152601660248201527f4d696e74696e6720616c726561647920636c6f7365640000000000000000000060448201526064016108f4565b600a805468ff00000000000000001916600160401b179055610d4660025490565b92506064610d5560198561290a565b610d5f9190612937565b9150610d6b3383611e5e565b6064610d78600a8561290a565b610d829190612937565b9050610d8e3382611e5e565b60408051848152602081018490529081018290527fd2b7cc74a9d3ef03c8032969dcc7c4a184b729f0b8c9b3c22d3485e8aebe0d7b9060600160405180910390a1610dd96001600655565b909192565b610de6610fc2565b6001600160a01b038116610e4b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016108f4565b610ab281611afc565b6000610e5e611476565b610e6661133b565b610e719060016128ca565b610e7b919061294b565b610e88906201518061294b565b600a546109a291906001600160401b03166128ca565b6001600160a01b038316610f005760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016108f4565b6001600160a01b038216610f615760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016108f4565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6005546001600160a01b031633146109ec5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016108f4565b600a546000906001600160401b031661103361105e565b61103d9190612976565b90506001600160401b0381161561105b576109a26201518082612996565b90565b600061106d6201518042612937565b6109a2906201518061290a565b6001600160a01b03811660009081526009602052604081205464746a52880081106110a85750601692915050565b643a3529440081106110bd5750600f92915050565b64174876e80081106110d25750600c92915050565b640ba43b740081106110e75750600992915050565b6405d21dba0081106110fc5750600792915050565b50600592915050565b6001600160a01b03838116600090815260016020908152604080832093861683529290522054600019811461119157818110156111845760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016108f4565b6111918484848403610e9e565b50505050565b6001600160a01b0383166111fb5760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016108f4565b6001600160a01b03821661125d5760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016108f4565b6001600160a01b038316600090815260208190526040902054818110156112d55760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016108f4565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3611191565b600061134561101c565b90506001600160401b0381161561105b5761135e611476565b6109a29082612996565b60006002826001600160401b031610156113845750600a919050565b6003826001600160401b0316101561139e5750600f919050565b6004826001600160401b031610156113b85750600f919050565b6005826001600160401b031610156113d257506014919050565b6006826001600160401b031610156113ec57506015919050565b6007826001600160401b0316101561140657506016919050565b6008826001600160401b0316101561142057506017919050565b6009826001600160401b0316101561143a57506018919050565b600a826001600160401b0316101561145457506019919050565b600b826001600160401b0316101561146e5750601a919050565b50601c919050565b6000466103ad036114875750600290565b50601e90565b804710156114dd5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016108f4565b6000826001600160a01b03168260405160006040518083038185875af1925050503d806000811461152a576040519150601f19603f3d011682016040523d82523d6000602084013e61152f565b606091505b50509050806115a65760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016108f4565b505050565b60008060006115b8611e05565b600086116116085760405162461bcd60e51b815260206004820152601260248201527f416d6f756e74206d757374206265203e2030000000000000000000000000000060448201526064016108f4565b61016d61161361101c565b6001600160401b0316106116695760405162461bcd60e51b815260206004820152601760248201527f4d696e74696e672070686173652068617320656e64656400000000000000000060448201526064016108f4565b60006007816001600160a01b038a161561168357896116a5565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b6001600160a01b039081168252602082019290925260400160002054169050806117065760405162461bcd60e51b8152602060048201526012602482015271151bdad95b881b9bdd081858d8d95c1d195960721b60448201526064016108f4565b611711888833611bb5565b919550935091506001600160a01b03881661177a573487146117755760405162461bcd60e51b815260206004820152601f60248201527f416d6f756e7420646f6573206e6f74206d61746368206d73672e76616c75650060448201526064016108f4565b611897565b7f000000000000000000000000dac17f958d2ee523a2206206994597c13d831ec76001600160a01b0316886001600160a01b03160361181e576040516323b872dd60e01b8152336004820152306024820152604481018890526001600160a01b038916906323b872dd90606401600060405180830381600087803b15801561180157600080fd5b505af1158015611815573d6000803e3d6000fd5b50505050611897565b6040516323b872dd60e01b8152336004820152306024820152604481018890526001600160a01b038916906323b872dd906064016020604051808303816000875af1158015611871573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061189591906129bc565b505b604080516001600160a01b038a1681526020810189905290810185905260608101839052608081018490527f7f4131948bf6030559a654032ee614b785d5a80841f0047c5af6c39a287b806c9060a00160405180910390a16118f98683611e5e565b6001600160a01b0385161580159061191f57506005546001600160a01b03868116911614155b801561193657506005546001600160a01b03163314155b801561194b57506001600160a01b0385163314155b15611a885761197085606461196160058661290a565b61196b9190612937565b611e5e565b6001600160a01b038516600090815260096020526040812080548692906119989084906128b7565b90915550600090506119a98661107a565b9050600060646119b9838b61290a565b6119c39190612937565b90508015611a20576001600160a01b038a16611a15576040516001600160a01b0388169082156108fc029083906000818181858888f19350505050158015611a0f573d6000803e3d6000fd5b50611a20565b611a208a8883611b4e565b604080513381526001600160a01b038981166020830152818301899052606082018890528c16608082015260a0810184905260c0810183905290517f166b1ea789e6ca2168a65c7ea84b33cfd4afa18a28d5d30c71243fc4c8dc446a9181900360e00190a150505b600854600160a01b900460ff168015611aa957506001600160a01b03881615155b15611ae7576008546040516370a0823160e01b8152306004820152611ae7918a916001600160a01b03918216918316906370a0823190602401610a6c565b50611af26001600655565b9450945094915050565b600580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1663a9059cbb60e01b1790526115a6908490611f1d565b60008080806007816001600160a01b03891615611bd25788611bf4565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc25b6001600160a01b03908116825260208201929092526040016000205416905080611c555760405162461bcd60e51b8152602060048201526012602482015271151bdad95b881b9bdd081858d8d95c1d195960721b60448201526064016108f4565b6000611c68611c6383611fef565b612145565b90507f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b0316886001600160a01b031603611cab57869450611d81565b7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b0316826001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611d13573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d3791906129d9565b6001600160a01b031603611d655780611d5488600160601b61290a565b611d5e9190612937565b9450611d81565b600160601b611d74828961290a565b611d7e9190612937565b94505b611d8c6109bf61133b565b935083611da08666038d7ea4c6800061290a565b611daa9190612937565b9250611dbe6005546001600160a01b031690565b6001600160a01b0316866001600160a01b031603611dfa576064611de3600f8561290a565b611ded9190612937565b611df790846128b7565b92505b505093509350939050565b600260065403611e575760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016108f4565b6002600655565b6001600160a01b038216611eb45760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016108f4565b8060026000828254611ec691906128b7565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b6000611f72826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661215f9092919063ffffffff16565b8051909150156115a65780806020019051810190611f9091906129bc565b6115a65760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016108f4565b60408051600280825260608201835260009283929190602083019080368337019050509050610e108160008151811061202a5761202a612a0c565b602002602001019063ffffffff16908163ffffffff168152505060008160018151811061205957612059612a0c565b63ffffffff9092166020928302919091019091015260405163883bdbfd60e01b81526000906001600160a01b0385169063883bdbfd9061209d908590600401612a22565b600060405180830381865afa1580156120ba573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526120e29190810190612b33565b50905061213d610e1060030b8260008151811061210157612101612a0c565b60200260200101518360018151811061211c5761211c612a0c565b602002602001015161212e9190612bfe565b6121389190612c2b565b61216e565b949350505050565b600061088a6001600160a01b03831680600160601b6124a4565b606061213d8484600085612552565b60008060008360020b12612185578260020b61218d565b8260020b6000035b9050620d89e88111156121c65760405162461bcd60e51b81526020600482015260016024820152601560fa1b60448201526064016108f4565b6000816001166000036121dd57600160801b6121ef565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615612223576ffff97272373d413259a46990580e213a0260801c5b6004821615612242576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615612261576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615612280576fffcb9843d60f6159c9db58835c9266440260801c5b602082161561229f576fff973b41fa98c081472e6896dfb254c00260801c5b60408216156122be576fff2ea16466c96a3843ec78b326b528610260801c5b60808216156122dd576ffe5dee046a99a2a811c461f1969c30530260801c5b6101008216156122fd576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b61020082161561231d576ff987a7253ac413176f2b074cf7815e540260801c5b61040082161561233d576ff3392b0822b70005940c7a398e4b70f30260801c5b61080082161561235d576fe7159475a2c29b7443b29c7fa6e889d90260801c5b61100082161561237d576fd097f3bdfd2022b8845ad8f792aa58250260801c5b61200082161561239d576fa9f746462d870fdf8a65dc1f90e061e50260801c5b6140008216156123bd576f70d869a156d2a1b890bb3df62baf32f70260801c5b6180008216156123dd576f31be135f97d08fd981231505542fcfa60260801c5b620100008216156123fe576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b6202000082161561241e576e5d6af8dedb81196699c329225ee6040260801c5b6204000082161561243d576d2216e584f5fa1ea926041bedfe980260801c5b6208000082161561245a576b048a170391f7dc42444e8fa20260801c5b60008460020b131561247b57806000198161247757612477612921565b0490505b64010000000081061561248f576001612492565b60005b60ff16602082901c0192505050919050565b60008080600019858709858702925082811083820303915050806000036124dd57600084116124d257600080fd5b508290049050610952565b8084116124e957600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b6060824710156125b35760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108f4565b600080866001600160a01b031685876040516125cf9190612c69565b60006040518083038185875af1925050503d806000811461260c576040519150601f19603f3d011682016040523d82523d6000602084013e612611565b606091505b50915091506126228783838761262d565b979650505050505050565b6060831561269c578251600003612695576001600160a01b0385163b6126955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108f4565b508161213d565b61213d83838151156126b15781518083602001fd5b8060405162461bcd60e51b81526004016108f491906126ef565b60005b838110156126e65781810151838201526020016126ce565b50506000910152565b602081526000825180602084015261270e8160408501602087016126cb565b601f01601f19169190910160400192915050565b6001600160a01b0381168114610ab257600080fd5b6000806040838503121561274a57600080fd5b823561275581612722565b946020939093013593505050565b60006020828403121561277557600080fd5b813561095281612722565b60008060006060848603121561279557600080fd5b83356127a081612722565b925060208401356127b081612722565b929592945050506040919091013590565b6000806000606084860312156127d657600080fd5b83356127e181612722565b92506020840135915060408401356127f881612722565b809150509250925092565b8015158114610ab257600080fd5b60006020828403121561282357600080fd5b813561095281612803565b6000806040838503121561284157600080fd5b823561284c81612722565b9150602083013561285c81612722565b809150509250929050565b600181811c9082168061287b57607f821691505b60208210810361289b57634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b8082018082111561088a5761088a6128a1565b6001600160401b038181168382160190808211156128ea576128ea6128a1565b5092915050565b60006020828403121561290357600080fd5b5051919050565b808202811582820484141761088a5761088a6128a1565b634e487b7160e01b600052601260045260246000fd5b60008261294657612946612921565b500490565b6001600160401b0381811683821602808216919082811461296e5761296e6128a1565b505092915050565b6001600160401b038281168282160390808211156128ea576128ea6128a1565b60006001600160401b03808416806129b0576129b0612921565b92169190910492915050565b6000602082840312156129ce57600080fd5b815161095281612803565b6000602082840312156129eb57600080fd5b815161095281612722565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b6020808252825182820181905260009190848201906040850190845b81811015612a6057835163ffffffff1683529284019291840191600101612a3e565b50909695505050505050565b604051601f8201601f191681016001600160401b0381118282101715612a9457612a946129f6565b604052919050565b60006001600160401b03821115612ab557612ab56129f6565b5060051b60200190565b600082601f830112612ad057600080fd5b81516020612ae5612ae083612a9c565b612a6c565b82815260059290921b84018101918181019086841115612b0457600080fd5b8286015b84811015612b28578051612b1b81612722565b8352918301918301612b08565b509695505050505050565b60008060408385031215612b4657600080fd5b82516001600160401b0380821115612b5d57600080fd5b818501915085601f830112612b7157600080fd5b81516020612b81612ae083612a9c565b82815260059290921b84018101918181019089841115612ba057600080fd5b948201945b83861015612bce5785518060060b8114612bbf5760008081fd5b82529482019490820190612ba5565b91880151919650909350505080821115612be757600080fd5b50612bf485828601612abf565b9150509250929050565b600682810b9082900b03667fffffffffffff198112667fffffffffffff8213171561088a5761088a6128a1565b60008160060b8360060b80612c4257612c42612921565b667fffffffffffff19821460001982141615612c6057612c606128a1565b90059392505050565b60008251612c7b8184602087016126cb565b919091019291505056fea2646970667358221220d1fbd10e4526c332ec89577de0d6d56601470c94967dba39961097f52bc277ba64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000101c71fa8b2f55d97b2981277931830e45eee7fd
-----Decoded View---------------
Arg [0] : _flush (address): 0x101C71Fa8b2f55D97B2981277931830E45Eee7FD
-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 000000000000000000000000101c71fa8b2f55d97b2981277931830e45eee7fd
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.