Contract

0xb2e2b8b7049Ad6ac235a648Bd8Ca71B84BF4B5C0

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

-

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Create Game4006802024-12-14 11:37:275 days ago1734176247IN
0xb2e2b8b7...84BF4B5C0
0.01 S0.000127891.1
Distribute Liqui...4006602024-12-14 11:36:325 days ago1734176192IN
0xb2e2b8b7...84BF4B5C0
0 S0.004537191.1
Distribute Liqui...4006592024-12-14 11:36:295 days ago1734176189IN
0xb2e2b8b7...84BF4B5C0
0 S0.004557011.1
Deploy Tokens4006462024-12-14 11:35:535 days ago1734176153IN
0xb2e2b8b7...84BF4B5C0
0 S0.007298881.1
Deploy Tokens4006442024-12-14 11:35:525 days ago1734176152IN
0xb2e2b8b7...84BF4B5C0
0 S0.007293861.1
Set Tokens Param...4006412024-12-14 11:35:465 days ago1734176146IN
0xb2e2b8b7...84BF4B5C0
0 S0.000452891.1
Transfer Liquidi...4006402024-12-14 11:35:455 days ago1734176145IN
0xb2e2b8b7...84BF4B5C0
0 S0.000149671.1
Create Game3621252024-12-13 8:27:406 days ago1734078460IN
0xb2e2b8b7...84BF4B5C0
0.01 S0.000155451.1

Latest 4 internal transactions

Parent Transaction Hash Block From To
4006802024-12-14 11:37:275 days ago1734176247
0xb2e2b8b7...84BF4B5C0
0.01 S
4006462024-12-14 11:35:535 days ago1734176153
0xb2e2b8b7...84BF4B5C0
 Contract Creation0 S
4006442024-12-14 11:35:525 days ago1734176152
0xb2e2b8b7...84BF4B5C0
 Contract Creation0 S
3621252024-12-13 8:27:406 days ago1734078460
0xb2e2b8b7...84BF4B5C0
0.01 S
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
V3Deployer

Compiler Version
v0.8.19+commit.7dd6d404

Optimization Enabled:
Yes with 200 runs

Other Settings:
default evmVersion
File 1 of 27 : V3Deployer.sol
// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.19;
import "@openzeppelin/contracts/access/Ownable.sol";
import { Token, INonfungiblePositionManager, IUniswapV3Pool, TickMath, FullMath, TransferHelper } from "./Token.sol";
import { IUniswapV3Factory } from "./interfaces/uniswap/IUniswapV3Factory.sol";
import { Babylonian } from "./vendor0.8/uniswap/Babylonian.sol";

contract V3Deployer is Ownable {
    using TransferHelper for address;

    struct TokenParams {
        string name;
        string symbol;
        uint pumpInterval;
        uint pumpBPS;
        uint tokenBPS;
        uint24 V3_fee;
    }

    uint16 private constant observationCardinalityNext = 150;
    uint256 private constant BP = 10_000;
    /// @notice Coin faucet token on current network
    address public coin;
    address public immutable entropyAddress;
    address public activeGame;
    INonfungiblePositionManager public immutable positionManager;
    IUniswapV3Factory public immutable factory;

    struct TokenInfo {
        Token memeToken;
        IUniswapV3Pool V3Pool;
        string name;
        string symbol;
        uint uniPosTokenId;
        uint pumpInterval; // how much time we will wait, until we can roll  chance for pump
        uint pumpBPS; // how much stored liquidity will be involved in pump
        uint tokenBPS; // percent of total game points and total game liquidity for this token, according to voting
        uint24 V3_fee;
        int24 tickSpacing;
    }

    struct Info {
        uint gameLiquidity; //  total game liquidity accumulated during game period
        uint liquidityBPS; //  percent of game liquidity which will be distributed during token creation
        uint PTStotalSupply; //  totalSupply of game points
        mapping(bytes32 => TokenInfo) tokens;
        bytes32[] keys;
        address coin;
    }
    mapping(address => Info) gamesInfo;
    mapping(address => bool) public distributedGames;

    constructor(
        address _entropyAddress,
        address _positionManagerAddress,
        address _factoryAddress,
        address _coin
    ) {
        positionManager = INonfungiblePositionManager(_positionManagerAddress);
        factory = IUniswapV3Factory(_factoryAddress);
        coin = _coin;
        entropyAddress = _entropyAddress;
    }

    event Redeem(address token, address user, uint256 amount);
    event SetParams(bytes32[] keys, TokenParams[] params, uint liquidityBPS, address game);
    event TokenDeployed(address memeToken, address V3Pool, bytes32 key, address game);

    event NewGameStarted(address diceGame);
    event SomeoneAlreadyCreatedV3Pool(bytes32 key);
    event NewCoin(address oldToken, address newToken);

    error NameSymbolLength();
    error UnsupportedFee();
    error PumpInterval();
    error PumpBPS();
    error LiquidityBPS();
    error TransferLiquidityFirst();
    error LiquidityAlreadyTransfered();
    error GameAlreadyStarted();
    error GameAlreadyHaveBeenPlayed();
    error SettingsAlreadyDone();
    error TokenAlreadyExists();
    error TokenBPS();
    error KeysOrParamsLength();
    error DeployAllTokens();
    error NotExists();
    error ZeroValue();

    /// @dev Modifier to check if the current block timestamp is before or equal to the _deadline.
    modifier checkDeadline(uint256 _deadline) {
        require(_blockTimestamp() <= _deadline, "too old");
        _;
    }

    /**
     * @notice Starts a new game with specific parameters, initial token rate
     * @param _diceGame game address SC.
     * @param _initialTokenRate The initial rate used within the game logic, set at the start and never changed afterward.
     * @param _deadline A timestamp until which the game can be initiated. Prevents starting the game too late.
     * @custom:modifier onlyOwner Restricts the function's execution to the contract's owner.
     * @custom:modifier checkDeadline Validates that the function is invoked before the specified _deadline.
     */

    function createGame(
        address _diceGame,
        uint _initialTokenRate,
        uint _deadline
    ) external payable onlyOwner checkDeadline(_deadline) {
        if (activeGame != address(0)) revert GameAlreadyStarted();
        if (distributedGames[_diceGame]) revert GameAlreadyHaveBeenPlayed();
        // Ensure  provided initial token rate is positive
        require(_initialTokenRate > 1e6, "o-o");
        require(_initialTokenRate < 1e30, "o-o");
        activeGame = _diceGame;
        //call dice game contract and start game
        (bool start, ) = address(_diceGame).call{ value: msg.value }(
            abi.encodeWithSignature("startGame(uint256)", _initialTokenRate)
        );
        require(start);
        emit NewGameStarted(_diceGame);
    }

    /**
     * @notice transfer all liquidity from dice smart contract after game ends
     */

    function transferLiquidity() external {
        (bool success, bytes memory response) = address(activeGame).call(
            abi.encodeWithSignature("sendLiquidity()")
        );
        require(success, "Failed send funds");
        Info storage gameInfo = gamesInfo[activeGame];
        if (gameInfo.gameLiquidity != 0) revert LiquidityAlreadyTransfered();
        (gameInfo.gameLiquidity, gameInfo.PTStotalSupply) = abi.decode(
            response,
            (uint256, uint256)
        );
        gameInfo.coin = coin;
    }

    /**
    * @notice Starts a new game with specific parameters including sponsor wallet, initial token rate
        WATCH OUT, SETTINGS CAN BE EXECUTED ONLY ONCE.
    * @param _keys unique hash for each token
    * @param _params tokens settings
    * @param _liquidityBPS percent of game liquidity which will be distributed during tokens creation
    * @custom:modifier onlyOwner Restricts the function's execution to the contract's owner.
    */

    function setTokensParams(
        bytes32[] calldata _keys,
        TokenParams[] calldata _params,
        uint _liquidityBPS
    ) external onlyOwner {
        Info storage gameInfo = gamesInfo[activeGame];
        if (gameInfo.gameLiquidity == 0) revert TransferLiquidityFirst();
        if (gameInfo.keys.length != 0) revert SettingsAlreadyDone();
        uint keysLength = _keys.length;
        if (keysLength != _params.length) revert KeysOrParamsLength();
        if (keysLength == 0) revert ZeroValue();
        if (_liquidityBPS < 1000 || _liquidityBPS > 10000) revert LiquidityBPS();
        gameInfo.liquidityBPS = _liquidityBPS;
        uint totalTokensBPS;
        TokenParams memory _p;
        for (uint i; i < keysLength; ) {
            _p = _params[i];
            //add new token
            TokenInfo storage newToken = gameInfo.tokens[_keys[i]];
            if (_p.tokenBPS == 0) revert TokenBPS();
            if (newToken.pumpInterval != 0) revert TokenAlreadyExists();
            if (_p.pumpInterval == 0) revert PumpInterval();
            if (_p.pumpBPS > 5000 || _p.pumpBPS < 500) revert PumpBPS();
            if (bytes(_p.name).length < 3 || bytes(_p.symbol).length < 3) revert NameSymbolLength();
            unchecked {
                totalTokensBPS += _p.tokenBPS;
            }
            newToken.name = _p.name;
            newToken.symbol = _p.symbol;
            newToken.pumpInterval = _p.pumpInterval;
            newToken.pumpBPS = _p.pumpBPS;
            newToken.tokenBPS = _p.tokenBPS;
            //check supported fee
            (bool success, bytes memory response) = address(factory).staticcall(
                abi.encodeWithSignature("feeAmountTickSpacing(uint24)", _p.V3_fee)
            );
            require(success && response.length == 32);
            int24 tickSpacing = abi.decode(response, (int24));
            if (tickSpacing == 0) revert UnsupportedFee();
            newToken.V3_fee = _p.V3_fee;
            newToken.tickSpacing = tickSpacing;
            //add key
            gameInfo.keys.push(_keys[i]);
            unchecked {
                ++i;
            }
        }
        if (totalTokensBPS != BP) revert TokenBPS();
        emit SetParams(_keys, _params, _liquidityBPS, activeGame);
    }

    /// @notice Deploys Token and sets up a corresponding V3 pool.
    /// This function must be invoked 5 times in row if owner previously added 5 mem tokens
    /// If you see event SomeoneAlreadyCreatedV3Pool you must execute anti ddos actions - invoke this function from another msg.sender,
    /// or create V3Pool and initiaize it separately
    /// Can only be called after the game has ended and if the Token has not been set yet.
    /// @dev This function deploys a new Token ERC20  using 'CREATE2' for deterministic addresses,
    /// then checks if a Uniswap V3 pool with the token exists. If not, it creates one. If a pool does
    /// exist but its price is incorrect, emits event SomeoneAlreadyCreatedV3Pool with proper key and aborts deployment to
    /// prevent DOS attacks by preemptive pool creation.
    /// Emits a `TokenDeployed` event upon successful deployment.
    //

    function deployTokens() external {
        Info storage gameInfo = gamesInfo[activeGame];
        address _coin = coin;
        uint length = gameInfo.keys.length;
        if (length == 0) revert ZeroValue();
        for (uint i; i < length; ) {
            bytes32 key = gameInfo.keys[i];
            TokenInfo storage token = gameInfo.tokens[key];
            if (address(token.memeToken) == address(0)) {
                if (token.pumpInterval == 0) revert NotExists();
                (uint160 sqrtPriceX96, address token_) = calculateTokenDeployParams(
                    msg.sender,
                    activeGame,
                    key
                );
                uint24 V3Fee = token.V3_fee;
                address _V3Pool = factory.getPool(token_, _coin, V3Fee);
                // If the V3 pool with our new token does not exist, create and initialize it
                if (_V3Pool == address(0)) {
                    _V3Pool = factory.createPool(token_, _coin, V3Fee);
                    IUniswapV3Pool(_V3Pool).initialize(sqrtPriceX96);
                    token.V3Pool = IUniswapV3Pool(_V3Pool);
                    _deployToken(token, token_, key, _coin);
                    emit TokenDeployed(token_, _V3Pool, key, activeGame);
                } else {
                    emit SomeoneAlreadyCreatedV3Pool(key);
                    (uint160 sqrtPriceX96current, , , , , , ) = IUniswapV3Pool(_V3Pool).slot0();
                    if (sqrtPriceX96current == sqrtPriceX96) {
                        token.V3Pool = IUniswapV3Pool(_V3Pool);
                        _deployToken(token, token_, key, _coin);
                        emit TokenDeployed(token_, _V3Pool, key, activeGame);
                    }
                }
                break;
            }
            unchecked {
                ++i;
            }
        }
    }

    function _deployToken(
        TokenInfo storage token,
        address token_,
        bytes32 key,
        address _coin
    ) internal {
        bytes32 salt = keccak256(abi.encode(msg.sender, key));
        token.memeToken = new Token{ salt: salt }(
            entropyAddress,
            _coin,
            address(positionManager),
            token.name,
            token.symbol,
            token.pumpInterval,
            token.pumpBPS
        );
        require(address(token.memeToken) == token_, "a-m");
    }

    /**
     * @notice Distributes liquidity to liquidity pool. This function must executed 5 times in row if owner previously added 5 mem tokens
     * @dev This function manages the distribution of Token and Coin Token liquidity
     * to the Uniswap V3 pool represented by `V3Pool`. It ensures that there is a Token address set
     * (ensuring `deployTokens` was called and all tokens deployed), mints tokens, approves the necessary tokens for the positionManager,
     * and then provides liquidity by minting a new position in the liquidity pool. Finally, it transfers any remaining
     * Coin Tokenbalance to the Token liquidity vault (smart contract of meme token) and initializes it with the provided parameters.
     *
     * Reverts if all Tokens has not been set, indicating deployToken() should be called first.
     * Also reverts if the Token vault's initialization fails post-liquidity provision.
     */
    function distributeLiquidity() external {
        address activeGame_ = activeGame;
        Info storage gameInfo = gamesInfo[activeGame_];
        address _coin = coin;
        uint keysLength = gameInfo.keys.length;
        if (keysLength == 0) revert KeysOrParamsLength();
        TokenInfo storage lastToken = gameInfo.tokens[gameInfo.keys[keysLength - 1]];
        if (address(lastToken.memeToken) == address(0)) revert DeployAllTokens();
        for (uint i; i < keysLength; ) {
            TokenInfo storage token = gameInfo.tokens[gameInfo.keys[i]];
            if (token.uniPosTokenId == 0) {
                Token memeToken = token.memeToken;
                token.V3Pool.increaseObservationCardinalityNext(observationCardinalityNext);
                // Determine the ordering of token addresses for Token and Coin Token
                bool zeroForToken = address(memeToken) < _coin;
                (address token0, address token1) = zeroForToken
                    ? (address(memeToken), _coin)
                    : (_coin, address(memeToken));
                // Retrieve the full range of liquidity ticks for adding liquidity
                (int24 tickLower, int24 tickUpper) = _getFullTickRange(token.tickSpacing);
                uint256 partOfmemeToken;
                uint256 partOfCoin;
                uint liquidityBPS = gameInfo.liquidityBPS;
                uint tokenLiquidity;
                unchecked {
                    tokenLiquidity = (gameInfo.gameLiquidity * token.tokenBPS) / BP;
                    partOfmemeToken =
                        (((gameInfo.PTStotalSupply * token.tokenBPS) / BP) * liquidityBPS) /
                        BP;
                    partOfCoin = (tokenLiquidity * liquidityBPS) / BP;
                }
                (uint256 amount0, uint256 amount1) = zeroForToken
                    ? (partOfmemeToken, partOfCoin)
                    : (partOfCoin, partOfmemeToken);
                // Mint tokens required to add liquidity
                memeToken.mint(address(this), zeroForToken ? amount0 : amount1);
                // Approve tokens for liquidity provision to the positionManager
                token0.safeApprove(address(positionManager), amount0);
                token1.safeApprove(address(positionManager), amount1);
                // Provide liquidity to the pool via positionManager and receive an NFT token ID
                (uint256 tokenId, , , ) = positionManager.mint(
                    INonfungiblePositionManager.MintParams({
                        token0: token0,
                        token1: token1,
                        fee: token.V3_fee,
                        tickLower: tickLower,
                        tickUpper: tickUpper,
                        amount0Desired: amount0,
                        amount1Desired: amount1,
                        amount0Min: 0,
                        amount1Min: 0,
                        recipient: address(memeToken),
                        deadline: block.timestamp
                    })
                );

                // Transfer remaining Coin Token liquidity to the Token liquidity vault for future pumps
                _coin.safeTransfer(address(memeToken), tokenLiquidity - partOfCoin);
                // Initialize the Token vault with the newly created liquidity position; revert if failed
                memeToken.initialize(zeroForToken, address(token.V3Pool), tokenId);
                token.uniPosTokenId = tokenId;
                if (i == keysLength - 1) {
                    distributedGames[activeGame_] = true;
                    delete activeGame;
                }
                break;
            }
            unchecked {
                ++i;
            }
        }
    }

    /// @notice Redeem points for tokens.
    /// @dev Burns points from the redeemer's balance and mints equivalent tokens.
    ///      Emits a Redeem event upon success.
    ///      Requires the game to be over.
    ///      Requires the Token to have been set and the caller to have a non-zero point balance.
    function redeem(address account, uint amount) external {
        require(distributedGames[msg.sender], "wait for distribution");
        Info storage gameInfo = gamesInfo[msg.sender];
        uint length = gameInfo.keys.length;
        //logic for disperse points amounts
        for (uint i; i < length; ) {
            TokenInfo storage token = gameInfo.tokens[gameInfo.keys[i]];
            uint calculatedAmount = (amount * token.tokenBPS) / BP;
            token.memeToken.mint(account, calculatedAmount);
            emit Redeem(address(token.memeToken), account, calculatedAmount);
            unchecked {
                ++i;
            }
        }
    }

    function setCoin(address _coin) external onlyOwner {
        require(_coin != address(0), "zero");
        if (activeGame != address(0)) revert GameAlreadyStarted();
        address old = coin;
        coin = _coin;
        emit NewCoin(old, _coin);
    }

    function sellPointsToggle(address _game, bool _sellForbidden) external onlyOwner {
        (bool success, ) = address(_game).call(
            abi.encodeWithSignature("setSellPointsMode(bool)", _sellForbidden)
        );
        require(success, "Failed set sell points mode");
    }

    /**
     * @dev Token Deployment Parameters Calculation
     * @param deployer The address of the account that would deploy the  Token

     * @return _sqrtPriceX96 The sqrtPrice required to initialize V3 pool of Token
     * @return _token The address of the Token associated with the deployer's address
     */
    function calculateTokenDeployParams(
        address deployer,
        address diceGame,
        bytes32 key
    ) public view returns (uint160 _sqrtPriceX96, address _token) {
        Info storage gameInfo = gamesInfo[diceGame];
        TokenInfo storage token = gameInfo.tokens[key];
        _token = computeTokenAddress(deployer, token, key);
        bool zeroForToken = _token < coin;
        _sqrtPriceX96 = zeroForToken
            ? uint160(
                Babylonian.sqrt(
                    FullMath.mulDiv(1 << 192, gameInfo.gameLiquidity, gameInfo.PTStotalSupply)
                )
            )
            : uint160(
                Babylonian.sqrt(
                    FullMath.mulDiv(1 << 192, gameInfo.PTStotalSupply, gameInfo.gameLiquidity)
                )
            );
    }

    /// This can be used to predict the address before deployment.
    /// @param deployer The address of the account that would deploy the Token.
    /// @param token  We need for retrieve info about name, symbol, etc.
    /// @param key  We need for retrieve info about name, symbol, etc. and for salt
    /// @return The anticipated Ethereum address of the to-be-deployed Token.
    function computeTokenAddress(
        address deployer,
        TokenInfo storage token,
        bytes32 key
    ) private view returns (address) {
        bytes32 salt = keccak256(abi.encode(deployer, key));
        bytes memory bytecode = type(Token).creationCode;
        bytes32 initCodeHash = keccak256(
            abi.encodePacked(
                bytecode,
                abi.encode(
                    entropyAddress,
                    coin,
                    address(positionManager),
                    token.name,
                    token.symbol,
                    token.pumpInterval,
                    token.pumpBPS
                )
            )
        );
        return
            address(
                uint160(
                    uint256(
                        keccak256(abi.encodePacked(bytes1(0xff), address(this), salt, initCodeHash))
                    )
                )
            );
    }

    function getGameInfo(
        address _diceGame
    )
        external
        view
        returns (
            uint gameLiquidity,
            uint liquidityBPS,
            uint PTStotalSupply,
            bytes32[] memory keys,
            TokenInfo[] memory tokensInfo
        )
    {
        Info storage gameInfo = _diceGame == address(0)
            ? gamesInfo[activeGame]
            : gamesInfo[_diceGame];
        gameLiquidity = gameInfo.gameLiquidity;
        liquidityBPS = gameInfo.liquidityBPS;
        PTStotalSupply = gameInfo.PTStotalSupply;
        keys = gameInfo.keys;
        uint length = keys.length;
        if (length != 0) {
            tokensInfo = new TokenInfo[](length);
            for (uint i = 0; i < length; ) {
                tokensInfo[i] = gameInfo.tokens[keys[i]];
                unchecked {
                    ++i;
                }
            }
        }
    }

    /**
     * @dev Calculates the full tick range based on the tick spacing of the Token pool.
     *      The result is the widest valid tick range that can be used for creating a position
     *      on Uniswap v3. This function assumes that tickSpacing is set to the
     *      tick spacing of the Token pool in which this contract will interact.
     *
     * @return tickLower The lower end of the calculated tick range, aligned with the allowable tick spacing.
     * @return tickUpper The upper end of the calculated tick range, aligned with the allowable tick spacing.
     */
    function _getFullTickRange(
        int24 tickSpacing
    ) private pure returns (int24 tickLower, int24 tickUpper) {
        unchecked {
            tickLower = (TickMath.MIN_TICK / tickSpacing) * tickSpacing;
            tickUpper = (TickMath.MAX_TICK / tickSpacing) * tickSpacing;
        }
    }

    function _blockTimestamp() private view returns (uint256) {
        return block.timestamp;
    }
}

File 2 of 27 : Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling 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);
    }
}

File 3 of 27 : ERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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].
 *
 * The default value of {decimals} is 18. To change this, you should override
 * this function so it returns a different value.
 *
 * We have followed general OpenZeppelin Contracts guidelines: functions revert
 * instead returning `false` on failure. This behavior is nonetheless
 * conventional and does not conflict with the expectations of ERC20
 * applications.
 *
 * Additionally, an {Approval} event is emitted on calls to {transferFrom}.
 * This allows applications to reconstruct the allowance for all accounts just
 * by listening to said events. Other implementations of the EIP may not emit
 * these events, as it isn't required by the specification.
 *
 * 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}.
     *
     * 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 default value returned by this function, unless
     * it's overridden.
     *
     * NOTE: This information is only used for _display_ purposes: it in
     * no way affects any of the arithmetic of the contract, including
     * {IERC20-balanceOf} and {IERC20-transfer}.
     */
    function decimals() public view virtual 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 {}
}

File 4 of 27 : IERC20Metadata.sol
// 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);
}

File 5 of 27 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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);
}

File 6 of 27 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)

pragma solidity ^0.8.0;

/**
 * @title ERC721 token receiver interface
 * @dev Interface for any contract that wants to support safeTransfers
 * from ERC721 asset contracts.
 */
interface IERC721Receiver {
    /**
     * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
     * by `operator` from `from`, this function is called.
     *
     * It must return its Solidity selector to confirm the token transfer.
     * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
     *
     * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}

File 7 of 27 : ERC721Holder.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol)

pragma solidity ^0.8.0;

import "../IERC721Receiver.sol";

/**
 * @dev Implementation of the {IERC721Receiver} interface.
 *
 * Accepts all token transfers.
 * Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
 */
contract ERC721Holder is IERC721Receiver {
    /**
     * @dev See {IERC721Receiver-onERC721Received}.
     *
     * Always returns `IERC721Receiver.onERC721Received.selector`.
     */
    function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) {
        return this.onERC721Received.selector;
    }
}

File 8 of 27 : Context.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (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;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

File 9 of 27 : EntropyEvents.sol
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import "./EntropyStructs.sol";

interface EntropyEvents {
    event Registered(EntropyStructs.ProviderInfo provider);

    event Requested(EntropyStructs.Request request);
    event RequestedWithCallback(
        address indexed provider,
        address indexed requestor,
        uint64 indexed sequenceNumber,
        bytes32 userRandomNumber,
        EntropyStructs.Request request
    );

    event Revealed(
        EntropyStructs.Request request,
        bytes32 userRevelation,
        bytes32 providerRevelation,
        bytes32 blockHash,
        bytes32 randomNumber
    );
    event RevealedWithCallback(
        EntropyStructs.Request request,
        bytes32 userRandomNumber,
        bytes32 providerRevelation,
        bytes32 randomNumber
    );

    event ProviderFeeUpdated(address provider, uint128 oldFee, uint128 newFee);

    event ProviderUriUpdated(address provider, bytes oldUri, bytes newUri);

    event ProviderFeeManagerUpdated(
        address provider,
        address oldFeeManager,
        address newFeeManager
    );

    event Withdrawal(
        address provider,
        address recipient,
        uint128 withdrawnAmount
    );
}

File 10 of 27 : EntropyStructs.sol
// SPDX-License-Identifier: Apache 2

pragma solidity ^0.8.0;

contract EntropyStructs {
    struct ProviderInfo {
        uint128 feeInWei;
        uint128 accruedFeesInWei;
        // The commitment that the provider posted to the blockchain, and the sequence number
        // where they committed to this. This value is not advanced after the provider commits,
        // and instead is stored to help providers track where they are in the hash chain.
        bytes32 originalCommitment;
        uint64 originalCommitmentSequenceNumber;
        // Metadata for the current commitment. Providers may optionally use this field to help
        // manage rotations (i.e., to pick the sequence number from the correct hash chain).
        bytes commitmentMetadata;
        // Optional URI where clients can retrieve revelations for the provider.
        // Client SDKs can use this field to automatically determine how to retrieve random values for each provider.
        // TODO: specify the API that must be implemented at this URI
        bytes uri;
        // The first sequence number that is *not* included in the current commitment (i.e., an exclusive end index).
        // The contract maintains the invariant that sequenceNumber <= endSequenceNumber.
        // If sequenceNumber == endSequenceNumber, the provider must rotate their commitment to add additional random values.
        uint64 endSequenceNumber;
        // The sequence number that will be assigned to the next inbound user request.
        uint64 sequenceNumber;
        // The current commitment represents an index/value in the provider's hash chain.
        // These values are used to verify requests for future sequence numbers. Note that
        // currentCommitmentSequenceNumber < sequenceNumber.
        //
        // The currentCommitment advances forward through the provider's hash chain as values
        // are revealed on-chain.
        bytes32 currentCommitment;
        uint64 currentCommitmentSequenceNumber;
        // An address that is authorized to set / withdraw fees on behalf of this provider.
        address feeManager;
    }

    struct Request {
        // Storage slot 1 //
        address provider;
        uint64 sequenceNumber;
        // The number of hashes required to verify the provider revelation.
        uint32 numHashes;
        // Storage slot 2 //
        // The commitment is keccak256(userCommitment, providerCommitment). Storing the hash instead of both saves 20k gas by
        // eliminating 1 store.
        bytes32 commitment;
        // Storage slot 3 //
        // The number of the block where this request was created.
        // Note that we're using a uint64 such that we have an additional space for an address and other fields in
        // this storage slot. Although block.number returns a uint256, 64 bits should be plenty to index all of the
        // blocks ever generated.
        uint64 blockNumber;
        // The address that requested this random number.
        address requester;
        // If true, incorporate the blockhash of blockNumber into the generated random value.
        bool useBlockhash;
        // If true, the requester will be called back with the generated random value.
        bool isRequestWithCallback;
        // There are 2 remaining bytes of free space in this slot.
    }
}

File 11 of 27 : IEntropy.sol
// SPDX-License-Identifier: Apache 2
pragma solidity ^0.8.0;

import "./EntropyEvents.sol";

interface IEntropy is EntropyEvents {
    // Register msg.sender as a randomness provider. The arguments are the provider's configuration parameters
    // and initial commitment. Re-registering the same provider rotates the provider's commitment (and updates
    // the feeInWei).
    //
    // chainLength is the number of values in the hash chain *including* the commitment, that is, chainLength >= 1.
    function register(
        uint128 feeInWei,
        bytes32 commitment,
        bytes calldata commitmentMetadata,
        uint64 chainLength,
        bytes calldata uri
    ) external;

    // Withdraw a portion of the accumulated fees for the provider msg.sender.
    // Calling this function will transfer `amount` wei to the caller (provided that they have accrued a sufficient
    // balance of fees in the contract).
    function withdraw(uint128 amount) external;

    // Withdraw a portion of the accumulated fees for provider. The msg.sender must be the fee manager for this provider.
    // Calling this function will transfer `amount` wei to the caller (provided that they have accrued a sufficient
    // balance of fees in the contract).
    function withdrawAsFeeManager(address provider, uint128 amount) external;

    // As a user, request a random number from `provider`. Prior to calling this method, the user should
    // generate a random number x and keep it secret. The user should then compute hash(x) and pass that
    // as the userCommitment argument. (You may call the constructUserCommitment method to compute the hash.)
    //
    // This method returns a sequence number. The user should pass this sequence number to
    // their chosen provider (the exact method for doing so will depend on the provider) to retrieve the provider's
    // number. The user should then call fulfillRequest to construct the final random number.
    //
    // This method will revert unless the caller provides a sufficient fee (at least getFee(provider)) as msg.value.
    // Note that excess value is *not* refunded to the caller.
    function request(
        address provider,
        bytes32 userCommitment,
        bool useBlockHash
    ) external payable returns (uint64 assignedSequenceNumber);

    // Request a random number. The method expects the provider address and a secret random number
    // in the arguments. It returns a sequence number.
    //
    // The address calling this function should be a contract that inherits from the IEntropyConsumer interface.
    // The `entropyCallback` method on that interface will receive a callback with the generated random number.
    //
    // This method will revert unless the caller provides a sufficient fee (at least getFee(provider)) as msg.value.
    // Note that excess value is *not* refunded to the caller.
    function requestWithCallback(
        address provider,
        bytes32 userRandomNumber
    ) external payable returns (uint64 assignedSequenceNumber);

    // Fulfill a request for a random number. This method validates the provided userRandomness and provider's proof
    // against the corresponding commitments in the in-flight request. If both values are validated, this function returns
    // the corresponding random number.
    //
    // Note that this function can only be called once per in-flight request. Calling this function deletes the stored
    // request information (so that the contract doesn't use a linear amount of storage in the number of requests).
    // If you need to use the returned random number more than once, you are responsible for storing it.
    function reveal(
        address provider,
        uint64 sequenceNumber,
        bytes32 userRevelation,
        bytes32 providerRevelation
    ) external returns (bytes32 randomNumber);

    // Fulfill a request for a random number. This method validates the provided userRandomness
    // and provider's revelation against the corresponding commitment in the in-flight request. If both values are validated
    // and the requestor address is a contract address, this function calls the requester's entropyCallback method with the
    // sequence number, provider address and the random number as arguments. Else if the requestor is an EOA, it won't call it.
    //
    // Note that this function can only be called once per in-flight request. Calling this function deletes the stored
    // request information (so that the contract doesn't use a linear amount of storage in the number of requests).
    // If you need to use the returned random number more than once, you are responsible for storing it.
    //
    // Anyone can call this method to fulfill a request, but the callback will only be made to the original requester.
    function revealWithCallback(
        address provider,
        uint64 sequenceNumber,
        bytes32 userRandomNumber,
        bytes32 providerRevelation
    ) external;

    function getProviderInfo(
        address provider
    ) external view returns (EntropyStructs.ProviderInfo memory info);

    function getDefaultProvider() external view returns (address provider);

    function getRequest(
        address provider,
        uint64 sequenceNumber
    ) external view returns (EntropyStructs.Request memory req);

    function getFee(address provider) external view returns (uint128 feeAmount);

    function getAccruedPythFees()
        external
        view
        returns (uint128 accruedPythFeesInWei);

    function setProviderFee(uint128 newFeeInWei) external;

    function setProviderFeeAsFeeManager(
        address provider,
        uint128 newFeeInWei
    ) external;

    function setProviderUri(bytes calldata newUri) external;

    // Set manager as the fee manager for the provider msg.sender.
    // After calling this function, manager will be able to set the provider's fees and withdraw them.
    // Only one address can be the fee manager for a provider at a time -- calling this function again with a new value
    // will override the previous value. Call this function with the all-zero address to disable the fee manager role.
    function setFeeManager(address manager) external;

    function constructUserCommitment(
        bytes32 userRandomness
    ) external pure returns (bytes32 userCommitment);

    function combineRandomValues(
        bytes32 userRandomness,
        bytes32 providerRandomness,
        bytes32 blockHash
    ) external pure returns (bytes32 combinedRandomness);
}

File 12 of 27 : IEntropyConsumer.sol
// SPDX-License-Identifier: Apache 2
pragma solidity ^0.8.0;

abstract contract IEntropyConsumer {
    // This method is called by Entropy to provide the random number to the consumer.
    // It asserts that the msg.sender is the Entropy contract. It is not meant to be
    // override by the consumer.
    function _entropyCallback(
        uint64 sequence,
        address provider,
        bytes32 randomNumber
    ) external {
        address entropy = getEntropy();
        require(entropy != address(0), "Entropy address not set");
        require(msg.sender == entropy, "Only Entropy can call this function");

        entropyCallback(sequence, provider, randomNumber);
    }

    // getEntropy returns Entropy contract address. The method is being used to check that the
    // callback is indeed from Entropy contract. The consumer is expected to implement this method.
    // Entropy address can be found here - https://docs.pyth.network/entropy/contract-addresses
    function getEntropy() internal view virtual returns (address);

    // This method is expected to be implemented by the consumer to handle the random number.
    // It will be called by _entropyCallback after _entropyCallback ensures that the call is
    // indeed from Entropy contract.
    function entropyCallback(
        uint64 sequence,
        address provider,
        bytes32 randomNumber
    ) internal virtual;
}

File 13 of 27 : INonfungiblePositionManager.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

interface INonfungiblePositionManager {
    /// @notice Returns the position information associated with a given token ID.
    /// @dev Throws if the token ID is not valid.
    /// @param tokenId The ID of the token that represents the position
    /// @return nonce The nonce for permits
    /// @return operator The address that is approved for spending
    /// @return token0 The address of the token0 for a specific pool
    /// @return token1 The address of the token1 for a specific pool
    /// @return fee The fee associated with the pool
    /// @return tickLower The lower end of the tick range for the position
    /// @return tickUpper The higher end of the tick range for the position
    /// @return liquidity The liquidity of the position
    /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position
    /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position
    /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation
    /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation
    function positions(
        uint256 tokenId
    )
        external
        view
        returns (
            uint96 nonce,
            address operator,
            address token0,
            address token1,
            uint24 fee,
            int24 tickLower,
            int24 tickUpper,
            uint128 liquidity,
            uint256 feeGrowthInside0LastX128,
            uint256 feeGrowthInside1LastX128,
            uint128 tokensOwed0,
            uint128 tokensOwed1
        );

    struct MintParams {
        address token0;
        address token1;
        uint24 fee;
        int24 tickLower;
        int24 tickUpper;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        address recipient;
        uint256 deadline;
    }

    /// @notice Creates a new position wrapped in a NFT
    /// @dev Call this when the pool does exist and is initialized. Note that if the pool is created but not initialized
    /// a method does not exist, i.e. the pool is assumed to be initialized.
    /// @param params The params necessary to mint a position, encoded as `MintParams` in calldata
    /// @return tokenId The ID of the token that represents the minted position
    /// @return liquidity The amount of liquidity for this position
    /// @return amount0 The amount of token0
    /// @return amount1 The amount of token1
    function mint(
        MintParams calldata params
    )
        external
        payable
        returns (uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1);

    struct IncreaseLiquidityParams {
        uint256 tokenId;
        uint256 amount0Desired;
        uint256 amount1Desired;
        uint256 amount0Min;
        uint256 amount1Min;
        uint256 deadline;
    }

    /// @notice Increases the amount of liquidity in a position, with tokens paid by the `msg.sender`
    /// @param params tokenId The ID of the token for which liquidity is being increased,
    /// amount0Desired The desired amount of token0 to be spent,
    /// amount1Desired The desired amount of token1 to be spent,
    /// amount0Min The minimum amount of token0 to spend, which serves as a slippage check,
    /// amount1Min The minimum amount of token1 to spend, which serves as a slippage check,
    /// deadline The time by which the transaction must be included to effect the change
    /// @return liquidity The new liquidity amount as a result of the increase
    /// @return amount0 The amount of token0 to acheive resulting liquidity
    /// @return amount1 The amount of token1 to acheive resulting liquidity
    function increaseLiquidity(
        IncreaseLiquidityParams calldata params
    ) external payable returns (uint128 liquidity, uint256 amount0, uint256 amount1);

    struct DecreaseLiquidityParams {
        uint256 tokenId;
        uint128 liquidity;
        uint256 amount0Min;
        uint256 amount1Min;
        uint256 deadline;
    }

    /// @notice Decreases the amount of liquidity in a position and accounts it to the position
    /// @param params tokenId The ID of the token for which liquidity is being decreased,
    /// amount The amount by which liquidity will be decreased,
    /// amount0Min The minimum amount of token0 that should be accounted for the burned liquidity,
    /// amount1Min The minimum amount of token1 that should be accounted for the burned liquidity,
    /// deadline The time by which the transaction must be included to effect the change
    /// @return amount0 The amount of token0 accounted to the position's tokens owed
    /// @return amount1 The amount of token1 accounted to the position's tokens owed
    function decreaseLiquidity(
        DecreaseLiquidityParams calldata params
    ) external payable returns (uint256 amount0, uint256 amount1);

    struct CollectParams {
        uint256 tokenId;
        address recipient;
        uint128 amount0Max;
        uint128 amount1Max;
    }

    /// @notice Collects up to a maximum amount of fees owed to a specific position to the recipient
    /// @param params tokenId The ID of the NFT for which tokens are being collected,
    /// recipient The account that should receive the tokens,
    /// amount0Max The maximum amount of token0 to collect,
    /// amount1Max The maximum amount of token1 to collect
    /// @return amount0 The amount of fees collected in token0
    /// @return amount1 The amount of fees collected in token1
    function collect(
        CollectParams calldata params
    ) external payable returns (uint256 amount0, uint256 amount1);

    /// @notice Burns a token ID, which deletes it from the NFT contract. The token must have 0 liquidity and all tokens
    /// must be collected first.
    /// @param tokenId The ID of the token that is being burned
    function burn(uint256 tokenId) external payable;

    /**
     * @notice from IERC721
     * @dev Returns the owner of the `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function ownerOf(uint256 tokenId) external view returns (address owner);

    function balanceOf(address owner) external view returns (uint256 balance);

    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    function approve(address to, uint256 tokenId) external;

    function getApproved(uint256 tokenId) external view returns (address);

    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
}

File 14 of 27 : IUniswapV3Factory.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title The interface for the Uniswap V3 Factory
/// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees
interface IUniswapV3Factory {
    /// @notice Emitted when the owner of the factory is changed
    /// @param oldOwner The owner before the owner was changed
    /// @param newOwner The owner after the owner was changed
    event OwnerChanged(address indexed oldOwner, address indexed newOwner);

    /// @notice Emitted when a pool is created
    /// @param token0 The first token of the pool by address sort order
    /// @param token1 The second token of the pool by address sort order
    /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
    /// @param tickSpacing The minimum number of ticks between initialized ticks
    /// @param pool The address of the created pool
    event PoolCreated(
        address indexed token0,
        address indexed token1,
        uint24 indexed fee,
        int24 tickSpacing,
        address pool
    );

    /// @notice Emitted when a new fee amount is enabled for pool creation via the factory
    /// @param fee The enabled fee, denominated in hundredths of a bip
    /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee
    event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing);

    /// @notice Returns the current owner of the factory
    /// @dev Can be changed by the current owner via setOwner
    /// @return The address of the factory owner
    function owner() external view returns (address);

    /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled
    /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context
    /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee
    /// @return The tick spacing
    function feeAmountTickSpacing(uint24 fee) external view returns (int24);

    /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist
    /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order
    /// @param tokenA The contract address of either token0 or token1
    /// @param tokenB The contract address of the other token
    /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip
    /// @return pool The pool address
    function getPool(
        address tokenA,
        address tokenB,
        uint24 fee
    ) external view returns (address pool);

    /// @notice Creates a pool for the given two tokens and fee
    /// @param tokenA One of the two tokens in the desired pool
    /// @param tokenB The other of the two tokens in the desired pool
    /// @param fee The desired fee for the pool
    /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved
    /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments
    /// are invalid.
    /// @return pool The address of the newly created pool
    function createPool(
        address tokenA,
        address tokenB,
        uint24 fee
    ) external returns (address pool);

    /// @notice Updates the owner of the factory
    /// @dev Must be called by the current owner
    /// @param _owner The new owner of the factory
    function setOwner(address _owner) external;

    /// @notice Enables a fee amount with the given tickSpacing
    /// @dev Fee amounts may never be removed once enabled
    /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6)
    /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount
    function enableFeeAmount(uint24 fee, int24 tickSpacing) external;
}

File 15 of 27 : IUniswapV3Pool.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

import {IUniswapV3PoolImmutables} from './pool/IUniswapV3PoolImmutables.sol';
import {IUniswapV3PoolState} from './pool/IUniswapV3PoolState.sol';
import {IUniswapV3PoolDerivedState} from './pool/IUniswapV3PoolDerivedState.sol';
import {IUniswapV3PoolActions} from './pool/IUniswapV3PoolActions.sol';
import {IUniswapV3PoolOwnerActions} from './pool/IUniswapV3PoolOwnerActions.sol';
import {IUniswapV3PoolErrors} from './pool/IUniswapV3PoolErrors.sol';
import {IUniswapV3PoolEvents} from './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,
    IUniswapV3PoolErrors,
    IUniswapV3PoolEvents
{

}

File 16 of 27 : IUniswapV3PoolActions.sol
// 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;
}

File 17 of 27 : IUniswapV3PoolDerivedState.sol
// 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
        );
}

File 18 of 27 : IUniswapV3PoolErrors.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title Errors emitted by a pool
/// @notice Contains all events emitted by the pool
interface IUniswapV3PoolErrors {
    error LOK();
    error TLU();
    error TLM();
    error TUM();
    error AI();
    error M0();
    error M1();
    error AS();
    error IIA();
    error L();
    error F0();
    error F1();
}

File 19 of 27 : IUniswapV3PoolEvents.sol
// 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);
}

File 20 of 27 : IUniswapV3PoolImmutables.sol
// 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);
}

File 21 of 27 : IUniswapV3PoolOwnerActions.sol
// 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);
}

File 22 of 27 : IUniswapV3PoolState.sol
// 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
    /// @return 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.
    /// @return observationIndex The index of the last oracle observation that was written,
    /// @return observationCardinality The current maximum number of observations stored in the pool,
    /// @return observationCardinalityNext The next maximum number of observations, to be updated when the observation.
    /// @return 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
    /// @return The liquidity at the current price of the pool
    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
    /// @return liquidityNet how much liquidity changes when the pool price crosses the tick,
    /// @return feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0,
    /// @return feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1,
    /// @return tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick
    /// @return secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick,
    /// @return secondsOutside the seconds spent on the other side of the tick from the current tick,
    /// @return 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,
    /// @return feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke,
    /// @return feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke,
    /// @return tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke,
    /// @return 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,
    /// @return tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp,
    /// @return secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp,
    /// @return 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
        );
}

File 23 of 27 : TransferHelper.sol
// SPDX-License-Identifier: GPL-2.0-or-later
// https://github.com/Uniswap/v3-periphery/blob/main/contracts/libraries/TransferHelper.sol
pragma solidity 0.8.19;

import "@openzeppelin/contracts/token/ERC20/IERC20.sol";

library TransferHelper {
    /// @notice Transfers tokens from the targeted address to the given destination
    /// @notice Errors with 'STF' if transfer fails
    /// @param token The contract address of the token to be transferred
    /// @param from The originating address from which the tokens will be transferred
    /// @param to The destination address of the transfer
    /// @param value The amount to be transferred
    function safeTransferFrom(address token, address from, address to, uint256 value) internal {
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(IERC20.transferFrom.selector, from, to, value)
        );
        require(success && (data.length == 0 || abi.decode(data, (bool))), "BP-STF");
    }

    /// @notice Transfers tokens from msg.sender to a recipient
    /// @dev Errors with ST if transfer fails
    /// @param token The contract address of the token which will be transferred
    /// @param to The recipient of the transfer
    /// @param value The value of the transfer
    function safeTransfer(address token, address to, uint256 value) internal {
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(IERC20.transfer.selector, to, value)
        );
        require(success && (data.length == 0 || abi.decode(data, (bool))), "BP-ST");
    }

    function getBalance(address token) internal view returns (uint256 balance) {
        bytes memory callData = abi.encodeWithSelector(IERC20.balanceOf.selector, address(this));
        (bool success, bytes memory data) = token.staticcall(callData);
        require(success && data.length >= 32);
        balance = abi.decode(data, (uint256));
    }

    function getBalanceOf(address token, address target) internal view returns (uint256 balance) {
        bytes memory callData = abi.encodeWithSelector(IERC20.balanceOf.selector, target);
        (bool success, bytes memory data) = token.staticcall(callData);
        require(success && data.length >= 32);
        balance = abi.decode(data, (uint256));
    }

    function safeApprove(address token, address spender, uint256 amount) internal {
        (bool success, bytes memory data) = token.call(
            abi.encodeWithSelector(IERC20.approve.selector, spender, amount)
        );
        require(success && (data.length == 0 || abi.decode(data, (bool))), "BP-SA");
    }
}

File 24 of 27 : Token.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import { IEntropyConsumer } from "@pythnetwork/entropy-sdk-solidity/IEntropyConsumer.sol";
import { IEntropy } from "@pythnetwork/entropy-sdk-solidity/IEntropy.sol";

import { INonfungiblePositionManager } from "./interfaces/uniswap/INonfungiblePositionManager.sol";
import { IUniswapV3Pool } from "./interfaces/uniswap/IUniswapV3Pool.sol";
import { TransferHelper } from "./libraries/TransferHelper.sol";
import { TickMath } from "./vendor0.8/uniswap/TickMath.sol";
import { FullMath } from "./vendor0.8/uniswap/FullMath.sol";

contract Token is IEntropyConsumer, ERC20, ERC721Holder {
    using TransferHelper for address;

    uint32 public constant TWAP_DURATION = 10 minutes;
    uint256 public constant TWAP_DEVIATION = 300; // 3%
    uint256 public constant BP = 10_000;
    uint256 public constant EMERGENCY_PUMP_INTERVAL = 60 days;

    uint256 public immutable pumpInterval;
    uint256 public immutable pumpBPS;

    IEntropy entropy;
    address public immutable V3Deployer;
    address public immutable coin;
    INonfungiblePositionManager public immutable positionManager;
    IUniswapV3Pool public V3Pool;

    bool public pumpEnabled;
    bool public zeroForTokenIn;
    
    uint256 public pumpLastTimestamp;
    uint256 public posTokenId;
    mapping(uint64 => bool) public pendingRequestIds;

    constructor(
        address _entropyAddress,
        address _coin, 
        address _positionManagerAddress,
        string memory _name,
        string memory _symbol,
        uint _pumpInterval,
        uint _pumpBPS
    ) ERC20(_name, _symbol) {
        entropy = IEntropy(_entropyAddress);
        coin = _coin;
        positionManager = INonfungiblePositionManager(_positionManagerAddress);
        V3Deployer = msg.sender;
        pumpInterval = _pumpInterval;
        pumpBPS = _pumpBPS;
    }

    event Pump(uint256 pampAmt, uint256 burnAmt);
    event PumpEnabled(bool enabled, uint64 requestId);
    event TryToEnablePump(uint64 requestId);

    error PriceDeviationTooHigh(uint256 deviation);
    error AmountOfEthSentIsTooSmall(uint256 sent, uint256 minimum);

    modifier onlyV3Deployer() {
        require(msg.sender == V3Deployer, "f");
        _;
    }

    function mint(address account, uint256 amount) external onlyV3Deployer {
        _mint(account, amount);
    }

    /**
     * @notice Initializes the V3Pool with the specified parameters.
     * @param zeroForOne If set to true, token0 will be used in the pool, otherwise token1.
     * @param V3PoolAddress The address of the V3 pool for Token.
     * @param tokenId The token ID used for position management within the Uniswap V3 pool.
     */
    function initialize(
        bool zeroForOne,
        address V3PoolAddress,
        uint256 tokenId
    ) external onlyV3Deployer {
        V3Pool = IUniswapV3Pool(V3PoolAddress);
        posTokenId = tokenId;
        zeroForTokenIn = !zeroForOne;
        pumpLastTimestamp = block.timestamp;
    }

    /// @notice Determines if the current time is past the required interval to activate the pump.
    function isTimeToPump() public view returns (bool) {
        return block.timestamp > pumpLastTimestamp + pumpInterval;
    }

    /// @notice Determines if the current time allows for an emergency activation of the pump.
    function isTimeToEmergencyEnablePump() public view returns (bool) {
        return block.timestamp > pumpLastTimestamp + EMERGENCY_PUMP_INTERVAL;
    }

    /**
     * @notice Activates the pump in an emergency, provided the conditions are met.
     * Requires that the current time is sufficient for an emergency enablement as determined by `isTimeToEmergencyEnablePump`.
     */
    function emergencyEnablePump() external {
        require(isTimeToEmergencyEnablePump(), "too early");
        pumpEnabled = true;
        pumpLastTimestamp = block.timestamp;
        emit PumpEnabled(pumpEnabled, 0);
    }

    /// @notice Attempts to enable the pump by sending a request to the entropyProvider.
    /// Requires payment that covers callback gas costs.
    /// Emits `TryToEnablePump` on success..
    /// Checks that the pump has not already been enabled, that the position token ID is set,
    /// and it is the correct time to pump according to `isTimeToPump`.
    /// Transfers msg.value to the sponsor's wallet upon successful validation.
    function tryToEnablePump(bytes32 _userRandomNumber) external payable {
        require(posTokenId > 0, "n-i");
        require(!pumpEnabled, "already enabled");
        require(isTimeToPump(), "too early");
        (address entropyProvider, uint256 fee) = getEntropyFee();
        if (msg.value < fee) {
            revert AmountOfEthSentIsTooSmall(msg.value, fee);
        }

        uint64 requestId = entropy.requestWithCallback{ value: fee }(
            entropyProvider,
            _userRandomNumber
        );
        pendingRequestIds[requestId] = true;
        emit TryToEnablePump(requestId);
    }

    /**
     * @notice This method is called by the entropy contract when a random number is generated.
     * @dev This callback function is meant to be called only by the authorized entropy contract.
     * The function decodes the random data, updates the pump's last timestamp, and sets the `pumpEnabled` state.
     * @param requestId The sequence number of the request.
     * @param provider The address of the provider that generated the random number. If your app uses multiple providers,
     * you can use this argument to distinguish which one is calling the app back.
     * @param randomNumber The generated random number.
     */

    function entropyCallback(
        uint64 requestId,
        address provider,
        bytes32 randomNumber
    ) internal override {
        require(pendingRequestIds[requestId], "i-Id");
        if (isTimeToPump()) {
            pumpLastTimestamp = block.timestamp;
            pumpEnabled = uint256(randomNumber) % 2 == 0;
            emit PumpEnabled(pumpEnabled, requestId);
        }
        delete pendingRequestIds[requestId];
    }


    // It returns the address of the entropy contract which will call the callback.
    function getEntropy() internal view override returns (address) {
        return address(entropy);
    }

    // This method returns the address of DefaultProvider and entropy fee.
    function getEntropyFee() public view returns (address entropyProvider, uint256 fee) {
        entropyProvider = entropy.getDefaultProvider();
        fee = entropy.getFee(entropyProvider);
    }

    /**
     * @notice Executes the pump operation which collects fees, performs a swap, and burns the received tokens.
     * @dev This function encapsulates the entire pump logic which includes:
     * 1. Collecting accumulated fees from a Uniswap V3 position,
     * 2. Calculating the pamp amount based on the balance of coin and defined basis points (BPS),
     * 3. Checking for price deviations before swapping,
     * 4. Performing the swap at the V3 Pool,
     * 5. Burning the acquired Tokens.
     * It first checks if the pumping action is enabled by ensuring `pumpEnabled` is true, then disables pumping to prevent reentrancy.
     * After collecting fees, it calculates the pump amount and proceeds with a token swap if the amount is greater than zero.
     * Upon successful execution, a Pump event is emitted with the amount swapped and burned.
     * Reverts if the pump is not enabled or other preconditions are not met during the process.
     * Assumes the presence of a INonfungiblePositionManager interface to interact with Uniswap V3 positions.
     */
    function pump() external {
        require(pumpEnabled, "pump not enabled");
        pumpEnabled = false;
        positionManager.collect(
            INonfungiblePositionManager.CollectParams({
                tokenId: posTokenId,
                recipient: address(this),
                amount0Max: type(uint128).max,
                amount1Max: type(uint128).max
            })
        );
        // Calculate the pamp amount based on the coin balance and BPS
        uint256 pampAmt = (coin.getBalance() * pumpBPS) / BP;
        if (pampAmt > 0) {
            _checkPriceDeviation(); // Internal check for price deviation

            // Perform the swap at the V3 pool
            V3Pool.swap(
                address(this), //recipient
                zeroForTokenIn,
                int256(pampAmt),
                zeroForTokenIn ? TickMath.MIN_SQRT_RATIO + 1 : TickMath.MAX_SQRT_RATIO - 1,
                new bytes(0)
            );

            // Burn the acquired tokens
            uint256 burnAmt = balanceOf(address(this));
            _burn(address(this), burnAmt);

            emit Pump(pampAmt, burnAmt);
        }
    }

    function uniswapV3SwapCallback(
        int256 amount0Delta,
        int256 amount1Delta,
        bytes calldata /*data*/
    ) external {
        require(msg.sender == address(V3Pool), "i-c");
        if (amount0Delta <= 0 && amount1Delta <= 0) {
            revert("invalid swap");
        }

        uint256 amountToPay = amount0Delta > 0 ? uint256(amount0Delta) : uint256(amount1Delta);
        coin.safeTransfer(msg.sender, amountToPay);
    }

    function _checkPriceDeviation() private view returns (int24 currentTick) {
        (, currentTick, , , , , ) = V3Pool.slot0();
        uint32[] memory secondsAgo = new uint32[](2);
        secondsAgo[0] = TWAP_DURATION;
        secondsAgo[1] = 0;

        (int56[] memory tickCumulatives, ) = V3Pool.observe(secondsAgo);
        int56 TWAP_DURATIONInt56 = int56(uint56(TWAP_DURATION));

        int56 tickCumulativesDelta = tickCumulatives[1] - tickCumulatives[0];
        int24 avarageTick = int24(tickCumulativesDelta / TWAP_DURATIONInt56);

        if (tickCumulativesDelta < 0 && (tickCumulativesDelta % TWAP_DURATIONInt56 != 0))
            avarageTick--;

        uint256 deviationBps = _getPriceDiviation(
            TickMath.getSqrtRatioAtTick(currentTick),
            TickMath.getSqrtRatioAtTick(avarageTick)
        );

        if (deviationBps > TWAP_DEVIATION) {
            revert PriceDeviationTooHigh(deviationBps);
        }
    }

    function _getPriceDiviation(
        uint160 sqrtPrice,
        uint160 sqrtPriceAvg
    ) private pure returns (uint256 deviationBps) {
        uint256 ratio = _getRatio(sqrtPrice);
        uint256 ratioAvg = _getRatio(sqrtPriceAvg);
        uint256 ratioDeviation = ratio > ratioAvg
            ? uint256(ratio - ratioAvg)
            : uint256(ratioAvg - ratio);
        deviationBps = FullMath.mulDiv(ratioDeviation, BP, ratioAvg);
    }

    function _getRatio(uint160 sqrtPrice) private pure returns (uint256 ratio) {
        ratio = FullMath.mulDiv(sqrtPrice, sqrtPrice, 1 << 64);
    }
}

File 25 of 27 : Babylonian.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.4;

/*
 * @author Uniswap
 * @notice Library from Uniswap
 */
library Babylonian {
    function sqrt(uint256 x) internal pure returns (uint256) {
        if (x == 0) return 0;

        uint256 xx = x;
        uint256 r = 1;
        if (xx >= 0x100000000000000000000000000000000) {
            xx >>= 128;
            r <<= 64;
        }
        if (xx >= 0x10000000000000000) {
            xx >>= 64;
            r <<= 32;
        }
        if (xx >= 0x100000000) {
            xx >>= 32;
            r <<= 16;
        }
        if (xx >= 0x10000) {
            xx >>= 16;
            r <<= 8;
        }
        if (xx >= 0x100) {
            xx >>= 8;
            r <<= 4;
        }
        if (xx >= 0x10) {
            xx >>= 4;
            r <<= 2;
        }
        if (xx >= 0x8) {
            r <<= 1;
        }
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;
        r = (r + x / r) >> 1;

        uint256 r1 = x / r;

        return (r < r1 ? r : r1);
    }
}

File 26 of 27 : FullMath.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.19;

/// @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 = a * b; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(a, b, not(0))
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Make sure the result is less than 2**256.
            // Also prevents denominator == 0
            require(denominator > prod1);

            // Handle non-overflow cases, 256 by 256 division
            if (prod1 == 0) {
                assembly {
                    result := div(prod0, denominator)
                }
                return result;
            }

            ///////////////////////////////////////////////
            // 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 = (0 - denominator) & 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 preconditions guarantee
            // that the outcome is less than 2**256, this is the final result.
            // We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * 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) {
        unchecked {
            result = mulDiv(a, b, denominator);
            if (mulmod(a, b, denominator) > 0) {
                require(result < type(uint256).max);
                result++;
            }
        }
    }
}

File 27 of 27 : TickMath.sol
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity 0.8.19;

/// @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 {
    /// @notice Thrown when the tick passed to #getSqrtRatioAtTick is not between MIN_TICK and MAX_TICK
    error InvalidTick();
    /// @notice Thrown when the ratio passed to #getTickAtSqrtRatio does not correspond to a price between MIN_TICK and MAX_TICK
    error InvalidSqrtRatio();

    /// @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 Given a tickSpacing, compute the maximum usable tick
    function maxUsableTick(int24 tickSpacing) internal pure returns (int24) {
        unchecked {
            return (MAX_TICK / tickSpacing) * tickSpacing;
        }
    }

    /// @notice Given a tickSpacing, compute the minimum usable tick
    function minUsableTick(int24 tickSpacing) internal pure returns (int24) {
        unchecked {
            return (MIN_TICK / tickSpacing) * tickSpacing;
        }
    }

    /// @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 (currency1/currency0)
    /// at the given tick
    function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
        unchecked {
            uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick));
            if (absTick > uint256(int256(MAX_TICK))) revert InvalidTick();

            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
            if (sqrtPriceX96 < MIN_SQRT_RATIO || sqrtPriceX96 >= MAX_SQRT_RATIO) revert InvalidSqrtRatio();
            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;
        }
    }
}

Settings
{
  "viaIR": true,
  "optimizer": {
    "enabled": true,
    "runs": 200
  },
  "metadata": {
    "bytecodeHash": "none"
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_entropyAddress","type":"address"},{"internalType":"address","name":"_positionManagerAddress","type":"address"},{"internalType":"address","name":"_factoryAddress","type":"address"},{"internalType":"address","name":"_coin","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"DeployAllTokens","type":"error"},{"inputs":[],"name":"GameAlreadyHaveBeenPlayed","type":"error"},{"inputs":[],"name":"GameAlreadyStarted","type":"error"},{"inputs":[],"name":"KeysOrParamsLength","type":"error"},{"inputs":[],"name":"LiquidityAlreadyTransfered","type":"error"},{"inputs":[],"name":"LiquidityBPS","type":"error"},{"inputs":[],"name":"NameSymbolLength","type":"error"},{"inputs":[],"name":"NotExists","type":"error"},{"inputs":[],"name":"PumpBPS","type":"error"},{"inputs":[],"name":"PumpInterval","type":"error"},{"inputs":[],"name":"SettingsAlreadyDone","type":"error"},{"inputs":[],"name":"TokenAlreadyExists","type":"error"},{"inputs":[],"name":"TokenBPS","type":"error"},{"inputs":[],"name":"TransferLiquidityFirst","type":"error"},{"inputs":[],"name":"UnsupportedFee","type":"error"},{"inputs":[],"name":"ZeroValue","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldToken","type":"address"},{"indexed":false,"internalType":"address","name":"newToken","type":"address"}],"name":"NewCoin","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"diceGame","type":"address"}],"name":"NewGameStarted","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":"token","type":"address"},{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Redeem","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32[]","name":"keys","type":"bytes32[]"},{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"pumpInterval","type":"uint256"},{"internalType":"uint256","name":"pumpBPS","type":"uint256"},{"internalType":"uint256","name":"tokenBPS","type":"uint256"},{"internalType":"uint24","name":"V3_fee","type":"uint24"}],"indexed":false,"internalType":"struct V3Deployer.TokenParams[]","name":"params","type":"tuple[]"},{"indexed":false,"internalType":"uint256","name":"liquidityBPS","type":"uint256"},{"indexed":false,"internalType":"address","name":"game","type":"address"}],"name":"SetParams","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"key","type":"bytes32"}],"name":"SomeoneAlreadyCreatedV3Pool","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"memeToken","type":"address"},{"indexed":false,"internalType":"address","name":"V3Pool","type":"address"},{"indexed":false,"internalType":"bytes32","name":"key","type":"bytes32"},{"indexed":false,"internalType":"address","name":"game","type":"address"}],"name":"TokenDeployed","type":"event"},{"inputs":[],"name":"activeGame","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"deployer","type":"address"},{"internalType":"address","name":"diceGame","type":"address"},{"internalType":"bytes32","name":"key","type":"bytes32"}],"name":"calculateTokenDeployParams","outputs":[{"internalType":"uint160","name":"_sqrtPriceX96","type":"uint160"},{"internalType":"address","name":"_token","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"coin","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_diceGame","type":"address"},{"internalType":"uint256","name":"_initialTokenRate","type":"uint256"},{"internalType":"uint256","name":"_deadline","type":"uint256"}],"name":"createGame","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"deployTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"distributeLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"distributedGames","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entropyAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"contract IUniswapV3Factory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_diceGame","type":"address"}],"name":"getGameInfo","outputs":[{"internalType":"uint256","name":"gameLiquidity","type":"uint256"},{"internalType":"uint256","name":"liquidityBPS","type":"uint256"},{"internalType":"uint256","name":"PTStotalSupply","type":"uint256"},{"internalType":"bytes32[]","name":"keys","type":"bytes32[]"},{"components":[{"internalType":"contract Token","name":"memeToken","type":"address"},{"internalType":"contract IUniswapV3Pool","name":"V3Pool","type":"address"},{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"uniPosTokenId","type":"uint256"},{"internalType":"uint256","name":"pumpInterval","type":"uint256"},{"internalType":"uint256","name":"pumpBPS","type":"uint256"},{"internalType":"uint256","name":"tokenBPS","type":"uint256"},{"internalType":"uint24","name":"V3_fee","type":"uint24"},{"internalType":"int24","name":"tickSpacing","type":"int24"}],"internalType":"struct V3Deployer.TokenInfo[]","name":"tokensInfo","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"positionManager","outputs":[{"internalType":"contract INonfungiblePositionManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"redeem","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_game","type":"address"},{"internalType":"bool","name":"_sellForbidden","type":"bool"}],"name":"sellPointsToggle","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_coin","type":"address"}],"name":"setCoin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32[]","name":"_keys","type":"bytes32[]"},{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"uint256","name":"pumpInterval","type":"uint256"},{"internalType":"uint256","name":"pumpBPS","type":"uint256"},{"internalType":"uint256","name":"tokenBPS","type":"uint256"},{"internalType":"uint24","name":"V3_fee","type":"uint24"}],"internalType":"struct V3Deployer.TokenParams[]","name":"_params","type":"tuple[]"},{"internalType":"uint256","name":"_liquidityBPS","type":"uint256"}],"name":"setTokensParams","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"transferLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]

60e0346200014657601f6200541738819003918201601f19168301916001600160401b038311848410176200014b5780849260809460405283398101031262000146576200004d8162000161565b6200005b6020830162000161565b6200007760606200006f6040860162000161565b940162000161565b600080546001600160a01b03198082163390811784556040519791956001600160a01b0395948694859391908416907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09080a31660a0521660c052169060015416176001556080526152a090816200017782396080518181816114600152818161251d0152612678015260a0518181816102c6015281816102fc0152818161047201528181611367015281816124f90152612655015260c05181818161084101528181610d490152611cf30152f35b600080fd5b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b0382168203620001465756fe60808060405260043610156200001457600080fd5b60003560e01c908162b531631462001bff575080630ea901d2146200185657806311df9995146200182b5780631e9a695014620016935780633953c8d714620015d65780633b17469e146200148f5780634bb7b599146200144857806351c107a714620013f3578063715018a61462001396578063791b98bc146200134f5780637b4f4ec3146200132457806382e46b75146200125b5780638da5cb5b14620012305780639bff71da14620011ed578063acd502bb14620010da578063b3e1d61f1462000870578063c45a01551462000829578063f2fde38b146200075e5763ff9d682a146200010357600080fd5b34620005fa576000366003190112620005fa576002546001600160a01b0390811660008181526003602052604090206001546004820154929316919081156200074c5781600019810111620005c65762000165600019830160048301620022e2565b9054600391821b1c600090815290820160205260409020546001600160a01b0316156200073a5760005b8281106200019957005b620001a88160048401620022e2565b90549060031b1c600052600382016020526040600020600481015415620001d357506001016200018f565b8054600182015492956001600160a01b0391821693909116803b15620005fa57600080916024604051809481936332148f6760e01b8352609660048401525af18015620005ee5762000728575b50808310156200071f578293815b600884015460181c60020b9182156200070957600291600182015493612710858185549560078b0154978891015402040204868910600014620006f557906127108681878702040204925b878a1015620006ee57825b8a3b15620005fa576040516340c10f1960e01b81523060048201526024810191909152600081604481838f5af18015620005ee57620006dc575b50620002f5837f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168d620027a9565b6200032b847f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031683620027a9565b62ffffff60088a015416906040519b8c6001600160401b03610160828181011092011117620006c6576101608d0160405260018060a01b03168c5260018060a01b031660208c015260408b01528080620d89e719050260020b60608b015280620d89e8050260020b60808a015260a089015260c0880152600060e08801526000610100880152856101208801524261014088015261014060405197634418b22b60e11b895260018060a01b0381511660048a015260018060a01b0360208201511660248a015262ffffff60408201511660448a0152606081015160020b60648a0152608081015160020b60848a015260a081015160a48a015260c081015160c48a015260e081015160e48a01526101008101516101048a015260018060a01b03610120820151166101248a0152015161014488015260808761016481600060018060a01b037f0000000000000000000000000000000000000000000000000000000000000000165af1968715620005ee5760009762000669575b50906127109102048061271083820204810311620005c65760405163a9059cbb60e01b602082019081526001600160a01b038716602483015261271093830293909304909103604482015260009182916200050e81606481015b03601f198101835282620021b4565b519082855af16200051e620021f2565b816200062c575b5015620005ff5760018201546001600160a01b0316833b15620005fa5760646000928360405196879485936353806ec760e01b85528210600485015260248401528860448401525af1918215620005ee57600492620005dc575b50015580600019810111620005c65760001901146200059a57005b60005260046020526040600020600160ff198254161790556001600160601b0360a01b60025416600255005b634e487b7160e01b600052601160045260246000fd5b620005e7906200214b565b386200057f565b6040513d6000823e3d90fd5b600080fd5b60405162461bcd60e51b815260206004820152600560248201526410940b54d560da1b6044820152606490fd5b805180159250821562000643575b50503862000525565b8192509060209181010312620005fa57602062000661910162002381565b38806200063a565b919096506080823d608011620006bd575b816200068960809383620021b4565b81010312620005fa57602082519201516fffffffffffffffffffffffffffffffff811603620005fa579095612710620004a5565b3d91506200067a565b634e487b7160e01b600052604160045260246000fd5b620006e7906200214b565b38620002be565b8362000284565b906127108681878702040204919262000279565b634e487b7160e01b600052601260045260246000fd5b8093836200022e565b62000733906200214b565b3862000220565b604051631872405d60e31b8152600490fd5b6040516368b837bf60e01b8152600490fd5b34620005fa576020366003190112620005fa576200077b62002029565b62000785620020bf565b6001600160a01b03908116908115620007d557600054826001600160601b0360a01b821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b34620005fa576000366003190112620005fa576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b34620005fa576060366003190112620005fa576004356001600160401b038111620005fa57620008a59036906004016200208c565b6024356001600160401b038111620005fa57620008c79036906004016200208c565b620008d1620020bf565b6002546001600160a01b03166000908152600360205260409020805415620010c8576004810154620010b6578184036200074c578315620010a4576103e860443510801562001096575b62001084576044356001820155600090600060a06040516200093d816200217c565b6060815260606020820152826040820152826060820152826080820152015260005b85811062000ad85750506127100362000ac65760025460405160808082528101859052936001600160a01b0390911692906001600160fb1b038111620005fa5760059291921b809560a086013760a08585018581038201602087015290810182905260c0600583901b8201810196849260009201905b84831062000a14577fb9859596bc769c8dca4eed4db0104afed7ecdd7c7b009729dbfde89ae2d25d4c88808b8a604435604084015260608301520390a1005b90919293949760bf19828901820301835288359060be1986360301821215620005fa576020809187600194019060a062ffffff62000ab18262000a8b62000a6f62000a608880620022fb565b60c0895260c08901916200232f565b62000a7d89890189620022fb565b908883038b8a01526200232f565b956040810135604087015260608101356060870152608081013560808701520162002274565b169101529a01930193019194939290620009d5565b604051631c9cf1db60e11b8152600490fd5b838110156200106e5760be19853603018160051b8601351215620005fa5760c08160051b8601358601360312620005fa576040519262000b18846200217c565b6001600160401b038260051b87013587013511620005fa5762000b4836600584901b880135880180350162002227565b84526001600160401b0360208360051b8801358801013511620005fa5762000b8036600584901b880135880160208101350162002227565b6020850152600582901b860135860160408181013590860152606080820135908601526080808201359086015262000bbb9060a00162002274565b60a085015262000bcd82888a62002285565b356000526003830160205260406000209060808501511562000ac65760058201546200105c576040850151156200104a57606085015161138881119081156200103d575b506200102b5760038551511080156200101b575b62001009576080850151019380518051906001600160401b038211620006c657819062000c56600286015462002296565b601f811162000fb1575b50602090601f831160011462000f3a5760009262000f2e575b50508160011b916000199060031b1c19161760028301555b60208101518051906001600160401b038211620006c657819062000cb9600386015462002296565b601f811162000ed6575b50602090601f831160011462000e5f5760009262000e53575b50508160011b916000199060031b1c19161760038301555b60408101516005830155606081015160068301556080810151600783015560008062ffffff60a08401511660405160208101916322afcccb60e01b835260248201526024815262000d458162002198565b51907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03165afa62000d7d620021f2565b908062000e47575b15620005fa57602081805181010312620005fa57602062000da79101620022d3565b908160020b1562000e355762ffffff60a060089201511692019182549160181b65ffffff000000169165ffffffffffff19161717905562000dea81878962002285565b3590600483015491600160401b831015620006c65762000e18836001809501600487015560048601620022e2565b819291549060031b91821b91600019901b1916179055016200095f565b6040516309c74fbb60e21b8152600490fd5b50602081511462000d85565b015190508b8062000cdc565b9250600385016000526020600020906000935b601f198416851062000eba576001945083601f1981161062000ea0575b505050811b01600383015562000cf4565b015160001960f88460031b161c191690558b808062000e8f565b8181015183556020948501946001909301929091019062000e72565b909150600385016000526020600020601f840160051c81016020851062000f26575b90849392915b601f830160051c8201811062000f1657505062000cc3565b6000815585945060010162000efe565b508062000ef8565b015190508b8062000c79565b9250600285016000526020600020906000935b601f198416851062000f95576001945083601f1981161062000f7b575b505050811b01600283015562000c91565b015160001960f88460031b161c191690558b808062000f6a565b8181015183556020948501946001909301929091019062000f4d565b909150600285016000526020600020601f840160051c81016020851062001001575b90849392915b601f830160051c8201811062000ff157505062000c60565b6000815585945060010162000fd9565b508062000fd3565b6040516328f4e19960e01b8152600490fd5b5060036020860151511062000c25565b60405163f60be68960e01b8152600490fd5b6101f49150108a62000c11565b60405163a818d88b60e01b8152600490fd5b60405163c991cbb160e01b8152600490fd5b634e487b7160e01b600052603260045260246000fd5b604051632588bc7f60e21b8152600490fd5b50612710604435116200091b565b604051637c946ed760e01b8152600490fd5b6040516354ff87af60e11b8152600490fd5b60405163781d8eef60e01b8152600490fd5b34620005fa576000366003190112620005fa5760025460408051630bf2495560e21b60208201908152600482526001600160a01b0393928201928416906001600160401b03841183851017620006c6576000809493819460405251925af162001142620021f2565b9015620011b457816002541660005260036020526040600020918254620011a257604082805181010312620005fa578160406020600594015191015160028501558355600154169101906001600160601b0360a01b825416179055600080f35b604051630156e28d60e31b8152600490fd5b60405162461bcd60e51b81526020600482015260116024820152704661696c65642073656e642066756e647360781b6044820152606490fd5b34620005fa576020366003190112620005fa576001600160a01b036200121262002029565b166000526004602052602060ff604060002054166040519015158152f35b34620005fa576000366003190112620005fa576000546040516001600160a01b039091168152602090f35b34620005fa576020366003190112620005fa576200127862002029565b62001282620020bf565b6001600160a01b039081168015620012f9578160025416620012e7577f68d8574d09d4edebcd045f9cb987227b11a8b779ceb0dfebcf81c4dbc65ae4949160409160015491816001600160601b0360a01b8416176001558351921682526020820152a1005b60405163ba26162b60e01b8152600490fd5b606460405162461bcd60e51b81526020600482015260046024820152637a65726f60e01b6044820152fd5b34620005fa576000366003190112620005fa576002546040516001600160a01b039091168152602090f35b34620005fa576000366003190112620005fa576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b34620005fa576000366003190112620005fa57620013b3620020bf565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b34620005fa576060366003190112620005fa576200141062002029565b6001600160a01b036024358181168103620005fa57604092620014379160443591620025a3565b835191831682529091166020820152f35b34620005fa576000366003190112620005fa576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b6060366003190112620005fa57620014a662002029565b602435620014b3620020bf565b6044354211620015a7576002546001600160a01b03808216620012e75783169283600052600460205260ff60406000205416620015955782846000949362001501620f424087961162002118565b6200151b6c0c9f2c9cd04674edea40000000841062002118565b6001600160601b0360a01b1617600255604051602081019163e5ed1d5960e01b8352602482015260248152620015518162002198565b519134905af162001561620021f2565b5015620005fa5760207f67eb30c25f0667fe3d9b2d6e8f0db01a2cdd5af4c76ed397709c29962f6894b791604051908152a1005b604051637180486560e01b8152600490fd5b60405162461bcd60e51b81526020600482015260076024820152661d1bdbc81bdb1960ca1b6044820152606490fd5b34620005fa576040366003190112620005fa57620015f362002029565b602435801515809103620005fa57600091829162001610620020bf565b826040516020810192631f8e31cd60e01b8452602482015260248152620016378162002198565b51925af162001645620021f2565b50156200164e57005b60405162461bcd60e51b815260206004820152601b60248201527f4661696c6564207365742073656c6c20706f696e7473206d6f646500000000006044820152606490fd5b34620005fa576040366003190112620005fa57620016b062002029565b33600052600460205260ff6040600020541615620017ee573360005260038060205260406000209160048301549160009360243515945b848110620016f157005b620017008160048401620022e2565b905490841b1c600052828201602052604060002090600782015491826024350292602435840414881715620005c65780546001600160a01b0316803b15620005fa576040516340c10f1960e01b81526001600160a01b038816600482015261271085046024820152906000908290604490829084905af1938415620005ee576127107fd12200efa34901b99367694174c3b0d32c99585fdf37c7c26892136ddd0836d993606093600197620017dc575b50868060a01b0390541691604051928352868060a01b038a166020840152046040820152a101620016e7565b620017e7906200214b565b8c620017b0565b60405162461bcd60e51b81526020600482015260156024820152743bb0b4ba103337b9103234b9ba3934b13aba34b7b760591b6044820152606490fd5b34620005fa576000366003190112620005fa576001546040516001600160a01b039091168152602090f35b34620005fa576020366003190112620005fa576200187362002029565b6060906001600160a01b03168062001beb57506002546001600160a01b03166000908152600360205260409020905b8154906001830154926002810154926004820191604051908182602086549283815201809660005260206000209260005b81811062001bd1575050620018eb92500383620021b4565b81518062001a32575b50506040929192519460a096878701948752602087015260408601528560608601525180925260c091828501919060005b81811062001a1b575050506080908481038286015283519182825260208201906020808560051b8501019601946000935b858510620019645788880389f35b909192939495966020808b600193601f198682030189528b51858060a01b038151168252858060a01b03848201511684830152620019c9620019b6604083015161014080604087015285019062002065565b6060830151848203606086015262002065565b92898201518a8401528082015190830152878101518883015260e081015160e083015261010062ffffff8183015116908301526101208091015160020b91015299019501950193959492919062001956565b825184526020938401939092019160010162001925565b909462001a3f826200277c565b9062001a4f6040519283620021b4565b828252601f1962001a60846200277c565b019060005b82811062001b7257505050809560005b83811062001a85575050620018f4565b8062001a946001928762002794565b5160005260038084016020526008604060002062001aee62001b0a6040519462001abe866200215f565b835460a089901b89900390811687528489015416602087015260405162001af68162001aee81600289016200238f565b0382620021b4565b60408701526040519283809286016200238f565b606084015260048101546080840152600581015460a0840152600681015460c0840152600781015460e0840152015462ffffff811661010083015260181c60020b61012082015262001b5d828662002794565b5262001b6a818562002794565b500162001a75565b60209060405162001b83816200215f565b60008152600083820152836040820152838082015260006080820152600060a0820152600060c0820152600060e0820152600061010082015260006101208201528282870101520162001a65565b8454835260019485019487945060209093019201620018d3565b6000526003602052604060002090620018a2565b34620005fa576000366003190112620005fa5760018060a01b0390600282815416600052600360209080825260406000209360019580875416926004870180549384156200201a5750929681019260005b88811062001c5a57005b62001c668183620022e2565b905490841b1c80600052858852604060002090858254161562001c8d575050890162001c50565b969799509997939450505050600587015415620020085762001cb4838383541633620025a3565b6008890154604051630b4c774160e11b81526001600160a01b0383811660048301528816602482015262ffffff909116604482018190529197929691907f00000000000000000000000000000000000000000000000000000000000000008616908a81606481855afa908115620005ee5760009162001fe6575b50808716908162001e8e57505060405163a167129560e01b81526001600160a01b038a811660048301528416602482015262ffffff9290921660448301528990829060649082906000905af1988915620005ee5760009962001e58575b505083881695863b15620005fa5760405163f637731d60e01b81529085166004820152600081602481838b5af18015620005ee577fb55c1e806314817ad210a5d7b18404d946ba5092b127eb8d4c945cf6f10819e49a62001e419862001e0f9589948c9462001e46575b50820180546001600160a01b031916909117905562002485565b54604080516001600160a01b039687168152968616602088015286019290925216909116606083015281906080820190565b0390a1005b62001e51906200214b565b8e62001df5565b62001e7d929950803d1062001e86575b62001e748183620021b4565b81019062002350565b96898062001d8b565b503d62001e68565b9a92509a9397600491507fb96a1a294c15169f42741eb4faaec6cfe5032eabfc182932afed34f2ef2d38de836040518a8152a1604051633850c7bd60e01b81529160e0908390818f5afa928315620005ee57879260009462001f41575b5050811691161462001ef957005b8487837fb55c1e806314817ad210a5d7b18404d946ba5092b127eb8d4c945cf6f10819e49b62001e419962001e0f9601906001600160601b0360a01b82541617905562002485565b919350915060e0813d60e01162001fdd575b8162001f6260e09383620021b4565b81010312620005fa578051918783168303620005fa5762001f85908201620022d3565b5062001f946040820162002371565b5062001fa36060820162002371565b5062001fb26080820162002371565b5060a081015160ff811603620005fa57869162001fd360c084930162002381565b5092908d62001eeb565b3d915062001f53565b6200200191508b3d8d1162001e865762001e748183620021b4565b8c62001d2e565b604051635861b41d60e01b8152600490fd5b637c946ed760e01b8152600490fd5b600435906001600160a01b0382168203620005fa57565b60005b838110620020545750506000910152565b818101518382015260200162002043565b90602091620020808151809281855285808601910162002040565b601f01601f1916010190565b9181601f84011215620005fa578235916001600160401b038311620005fa576020808501948460051b010111620005fa57565b6000546001600160a01b03163303620020d457565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b156200212057565b60405162461bcd60e51b81526020600482015260036024820152626f2d6f60e81b6044820152606490fd5b6001600160401b038111620006c657604052565b61014081019081106001600160401b03821117620006c657604052565b60c081019081106001600160401b03821117620006c657604052565b606081019081106001600160401b03821117620006c657604052565b90601f801991011681019081106001600160401b03821117620006c657604052565b6001600160401b038111620006c657601f01601f191660200190565b3d1562002222573d906200220682620021d6565b91620022166040519384620021b4565b82523d6000602084013e565b606090565b81601f82011215620005fa578035906200224182620021d6565b92620022516040519485620021b4565b82845260208383010111620005fa57816000926020809301838601378301015290565b359062ffffff82168203620005fa57565b91908110156200106e5760051b0190565b90600182811c92168015620022c8575b6020831014620022b257565b634e487b7160e01b600052602260045260246000fd5b91607f1691620022a6565b51908160020b8203620005fa57565b80548210156200106e5760005260206000200190600090565b9035601e1982360301811215620005fa5701602081359101916001600160401b038211620005fa578136038313620005fa57565b908060209392818452848401376000828201840152601f01601f1916010190565b90816020910312620005fa57516001600160a01b0381168103620005fa5790565b519061ffff82168203620005fa57565b51908115158203620005fa57565b9060009291805491620023a28362002296565b918282526001938481169081600014620024095750600114620023c6575b50505050565b90919394506000526020928360002092846000945b838610620023f4575050505001019038808080620023c0565b805485870183015294019385908201620023db565b9294505050602093945060ff191683830152151560051b01019038808080620023c0565b9360c095926200247b946200246c939a99989a60018060a01b039283809216895216602088015216604086015260e0606086015260e08501906200238f565b9083820360808501526200238f565b9460a08201520152565b60408051336020820190815291810194909452909392620024aa8160608101620004ff565b51902060058401546006850154906040519161281790818401928484106001600160401b03851117620006c6578493620025439362002a7d86396001600160a01b039860038b019160028c01917f00000000000000000000000000000000000000000000000000000000000000008c16917f0000000000000000000000000000000000000000000000000000000000000000906200242d565b03906000f58015620005ee57821692836001600160601b0360a01b82541617905516036200256d57565b60405162461bcd60e51b8152602060048201526003602482015262612d6d60e81b6044820152606490fd5b811562000709570490565b6001600160a01b039182166000908152600360208181526040808420878552928301825280842081519587168684019081528683019890985281865293969294601f19949390620025f6606082620021b4565b51902092620026d4620026e184612817938a8651916200261984880184620021b4565b8683528383019662002a7d8839620026ab82600154169b8c936200269e60058501546006860154908d519687948b8601996002600384019301917f000000000000000000000000000000000000000000000000000000000000000016907f00000000000000000000000000000000000000000000000000000000000000008c6200242d565b03908101835282620021b4565b8751958693620026c4868601998a925192839162002040565b8401915180938684019062002040565b01038084520182620021b4565b51902081519283019360ff60f81b85523060601b6021850152603584015260558301526055825260808201908282106001600160401b03831117620027685752519020831693508310156200275157620027478160026200274d935491015490620029f5565b62002880565b1691565b620027478160026200274d930154905490620029f5565b634e487b7160e01b88526041600452602488fd5b6001600160401b038111620006c65760051b60200190565b80518210156200106e5760209160051b010190565b60405163095ea7b360e01b602082019081526001600160a01b03909316602482015260448101939093526000928392908390620027ea8160648101620004ff565b51925af1620027f8620021f2565b8162002835575b50156200280857565b60405162461bcd60e51b815260206004820152600560248201526442502d534160d81b6044820152606490fd5b80518015925082156200284c575b505038620027ff565b8192509060209181010312620005fa5760206200286a910162002381565b388062002843565b91908201809211620005c657565b8015620029ef57600181600160801b811015620029dc575b6200296362002954620029456200293662002927620029186200297d97600888600160401b620029729a1015620029ce575b640100000000811015620029c0575b62010000811015620029b3575b610100811015620029a6575b601081101562002998575b10156200298f575b62002911818b62002598565b9062002872565b60011c62002911818a62002598565b60011c62002911818962002598565b60011c62002911818862002598565b60011c62002911818762002598565b60011c62002911818662002598565b60011c62002911818562002598565b60011c809262002598565b808210156200298a575090565b905090565b60011b62002905565b60041c9160021b91620028fd565b811c9160041b91620028f2565b60101c91811b91620028e6565b60201c9160101b91620028d9565b60401c9160201b91620028ca565b50600160401b9050608082901c62002898565b50600090565b600160c01b9160c082901b9160001981850993838086109503948086039586851115620005fa571462002a74579082910981806000031680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b50509150049056fe61012060405234620003fa5762002817803803806200001e81620003ff565b928339810160e082820312620003fa57620000398262000425565b916020926200004a84830162000425565b620000586040840162000425565b606084015190956001600160401b03959091868111620003fa5781620000809187016200043a565b90608086015190878211620003fa576200009c9187016200043a565b9560c060a0870151960151968251828111620002fa576003918254916001958684811c94168015620003ef575b88851014620003d9578190601f9485811162000383575b5088908583116001146200031c5760009262000310575b505060001982861b1c191690861b1783555b8051938411620002fa5760049586548681811c91168015620002ef575b82821014620002da578381116200028f575b508092851160011462000221575093839491849260009562000215575b50501b92600019911b1c19161790555b600580546001600160a01b0319166001600160a01b0393841617905560e052929092166101009081523360c05260809290925260a05260405161236a9182620004ad83396080518281816104d90152818161073001528181610a960152610d2a015260a0518281816108ea0152610ea9015260c0518281816109de01528181610c4d0152611615015260e0518281816102b101528181610e61015261180b0152518181816109400152610e070152f35b01519350388062000155565b92919084601f1981168860005285600020956000905b8983831062000274575050501062000259575b50505050811b01905562000165565b01519060f884600019921b161c19169055388080806200024a565b85870151895590970196948501948893509081019062000237565b87600052816000208480880160051c820192848910620002d0575b0160051c019087905b828110620002c357505062000138565b60008155018790620002b3565b92508192620002aa565b602288634e487b7160e01b6000525260246000fd5b90607f169062000126565b634e487b7160e01b600052604160045260246000fd5b015190503880620000f7565b90889350601f19831691876000528a6000209260005b8c8282106200036c575050841162000353575b505050811b01835562000109565b015160001983881b60f8161c1916905538808062000345565b8385015186558c9790950194938401930162000332565b90915085600052886000208580850160051c8201928b8610620003cf575b918a91869594930160051c01915b828110620003bf575050620000e0565b600081558594508a9101620003af565b92508192620003a1565b634e487b7160e01b600052602260045260246000fd5b93607f1693620000c9565b600080fd5b6040519190601f01601f191682016001600160401b03811183821017620002fa57604052565b51906001600160a01b0382168203620003fa57565b919080601f84011215620003fa5782516001600160401b038111620002fa5760209062000470601f8201601f19168301620003ff565b92818452828287010111620003fa5760005b8181106200049857508260009394955001015290565b85810183015184820184015282016200048256fe608080604052600436101561001357600080fd5b60003560e01c90816306fdde03146118c4575080630780fc2a14611885578063095ea7b31461185f5780630a1926321461183a57806311df9995146117f557806311ea5441146117cc578063150b7a021461173e57806318160ddd1461172057806323b872dd1461166257806325d4995e1461164457806325de6036146115ff5780632d971e63146115c9578063313ce567146115ad578063395093511461155c578063395ea61b14610d5957806339986e8114610d0f57806340c10f1914610c215780634f590f0814610bfb57806352a5f1f814610a3457806353806ec7146109a957806370a082311461096f578063791b98bc1461092a578063879ac8f81461090d5780638a6af663146108d25780638c7b6e921461070357806395d89b41146105f15780639cfdbd5e146105d4578063a457c2d71461052d578063a9059cbb146104fc578063dce0e92b146104c1578063dd62ed3e14610470578063e3767dd61461044a578063e6dacb921461042d578063ebd2ee7b146103ba578063fa461e33146101f7578063fbd09a7c146101d95763fc1afd20146101b657600080fd5b346101d45760003660031901126101d4576020600754604051908152f35b600080fd5b346101d45760003660031901126101d4576020600854604051908152f35b346101d45760603660031901126101d457602460043581356044356001600160401b038082116101d457366023830112156101d45781600401359081116101d4573691018401116101d4576006546001600160a01b031633036103905760008213801580610385575b61035257600092839290911561034b57505b6040805163a9059cbb60e01b602080830191825233888401908152908101949094529290916102ac9183910103601f198101835282611a21565b5190827f00000000000000000000000000000000000000000000000000000000000000005af16102da611ed8565b81610314575b50156102e857005b60649060056040519162461bcd60e51b8352602060048401528201526410940b54d560da1b6044820152fd5b8051801592508215610329575b5050826102e0565b81925090602091810103126101d45760206103449101611e74565b8280610321565b9050610272565b60405162461bcd60e51b815260206004820152600c818601526b0696e76616c696420737761760a41b6044820152606490fd5b506000821315610260565b60405162461bcd60e51b81526020600482015260038185015262692d6360e81b6044820152606490fd5b346101d45760003660031901126101d4576103db6103d6611d0a565b611d1f565b7f42886893c2c02827643a75f50ecf4556313dada98ba97caf3c36f857829f6d2c6040600160a01b60ff60a01b196006541617806006554260075560ff82519160a01c161515815260006020820152a1005b346101d45760003660031901126101d457602060405161012c8152f35b346101d45760003660031901126101d457602060ff60065460a01c166040519015158152f35b346101d45760403660031901126101d4576104896119da565b6104916119f0565b9060018060a01b038091166000526001602052604060002091166000526020526020604060002054604051908152f35b346101d45760003660031901126101d45760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b346101d45760403660031901126101d4576105226105186119da565b6024359033611a6a565b602060405160018152f35b346101d45760403660031901126101d4576105466119da565b60243590336000526001602052604060002060018060a01b038216600052602052604060002054918083106105815761052292039033611bd8565b60405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608490fd5b346101d45760003660031901126101d45760206040516127108152f35b346101d45760003660031901126101d457604051600060045490600182811c918184169182156106f9575b60209485851084146106e35785879486865291826000146106c3575050600114610666575b5061064e92500383611a21565b610662604051928284938452830190611984565b0390f35b84915060046000527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b906000915b8583106106ab57505061064e935082010185610641565b80548389018501528794508693909201918101610694565b60ff19168582015261064e95151560051b85010192508791506106419050565b634e487b7160e01b600052602260045260246000fd5b92607f169261061c565b6020806003193601126101d457600854156108a85760ff60065460a01c166108725761075c6107556007547f000000000000000000000000000000000000000000000000000000000000000090611a5d565b4211611d1f565b610764611d57565b90813410610853576005546040516319cb825f60e01b81526001600160a01b03928316600480830191909152356024820152928492849260449284929091165af190811561084757600091610801575b7f31cc170ef68cc97ae6f7f5530435b792096d77885d0d3d0a3ed2d2e7ba136906836001600160401b03841680600052600982526040600020600160ff19825416179055604051908152a1005b90508181813d8311610840575b6108188183611a21565b810103126101d45751906001600160401b03821682036101d457906001600160401b036107b4565b503d61080e565b6040513d6000823e3d90fd5b604051633ce6d0ef60e21b815234600482015260248101839052604490fd5b6064906040519062461bcd60e51b82526004820152600f60248201526e185b1c9958591e48195b98589b1959608a1b6044820152fd5b6064906040519062461bcd60e51b8252600482015260036024820152626e2d6960e81b6044820152fd5b346101d45760003660031901126101d45760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b346101d45760003660031901126101d45760206040516102588152f35b346101d45760003660031901126101d4576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346101d45760203660031901126101d4576001600160a01b036109906119da565b1660005260006020526020604060002054604051908152f35b346101d45760603660031901126101d4576004358015908115036101d4576109cf6119f0565b906001600160a01b03610a05337f0000000000000000000000000000000000000000000000000000000000000000831614611cda565b60068054604435600855600161ff0160a01b031916919093161760a89190911b60ff60a81b1617905542600755005b346101d45760603660031901126101d457610a4d6119c4565b610a556119f0565b506005546001600160a01b03168015610bb6573303610b65576001600160401b031680600052600960205260ff6040600020541615610b3a57610abb6007547f000000000000000000000000000000000000000000000000000000000000000090611a5d565b4211610ada575b6000908152600960205260409020805460ff19169055005b426007557f42886893c2c02827643a75f50ecf4556313dada98ba97caf3c36f857829f6d2c604060065460ff60a01b6001604435161560a01b169060ff60a01b1916178060065560ff82519160a01c1615158152836020820152a1610ac2565b606460405162461bcd60e51b81526020600482015260046024820152631a4b525960e21b6044820152fd5b60405162461bcd60e51b815260206004820152602360248201527f4f6e6c7920456e74726f70792063616e2063616c6c20746869732066756e637460448201526234b7b760e91b6064820152608490fd5b60405162461bcd60e51b815260206004820152601760248201527f456e74726f70792061646472657373206e6f74207365740000000000000000006044820152606490fd5b346101d45760003660031901126101d457602060ff60065460a81c166040519015158152f35b346101d45760403660031901126101d457610c3a6119da565b602435906001600160a01b0390610c74337f0000000000000000000000000000000000000000000000000000000000000000841614611cda565b16908115610cca577fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602082610cae600094600254611a5d565b60025584845283825260408420818154019055604051908152a3005b60405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606490fd5b346101d45760003660031901126101d4576020610d4f6007547f000000000000000000000000000000000000000000000000000000000000000090611a5d565b4211604051908152f35b346101d45760003660031901126101d45760065460ff8160a01c16156115245760ff60a01b191660065560085460405190608082016001600160401b0381118382101761126857604090815290825230602083019081526001600160801b0383830181815260608501828152845163fc6f786560e01b81529551600487015292516001600160a01b0390811660248701529051821660448601529151166064840152829060849082906000907f0000000000000000000000000000000000000000000000000000000000000000165af18015610847576114f9575b5060008060405160208101906370a0823160e01b825230602482015260248152610e5d81611a06565b51907f00000000000000000000000000000000000000000000000000000000000000005afa610e8a611ed8565b90806114ed575b156101d4576020818051810103126101d457602001517f0000000000000000000000000000000000000000000000000000000000000000908181029181830414901517156112d2576127108104610ee457005b600654604051633850c7bd60e01b815260e0816004816001600160a01b0386165afa90811561084757600091611461575b50604051610f2281611a06565b6002815260208101906040368337610258610f3c82611e98565b526000610f4882611ebb565b5260405163883bdbfd60e01b8152602060048201529051602482018190529091829160448301919060005b81811061144257506000939283900391508290506001600160a01b0387165afa908115610847576000916112f9575b50610fb9610faf82611ebb565b5160060b91611e98565b5160060b9003667fffffffffffff198112667fffffffffffff8213176112d25760060b90610258820560020b916000811290816112e8575b506112bb575b9061103361102361101361100d61104b95611fd6565b93611fd6565b926001600160a01b031680611f08565b916001600160a01b031680611f08565b9081808211156112b15761104691611ecb565b611f54565b61012c8111611299575060ff8160a81c168060001461127e576401000276a4915b6040519060208201938285106001600160401b038611176112685760006040946110dd968652818552855196879586948593630251596160e31b8552306004860152151560248501526127108b04604485015260018060a01b0316606484015260a0608484015260a4830190611984565b03926001600160a01b03165af180156108475761123d575b503060005260006020526040600020549030156111ee573060005260006020526040600020549082821061119e57827fddbfb0687fbb06c476f9de1e483e656b4c56516f7580ab8224fbf91c81ed9f51936040933060005260006020520383600020558060025403600255600083518281527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60203092a36127108351920482526020820152a1005b60405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608490fd5b60405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608490fd5b604090813d8311611261575b6112538183611a21565b810103126101d457816110f5565b503d611249565b634e487b7160e01b600052604160045260246000fd5b73fffd8963efd1fc6a506488495d951d5263988d259161106c565b602490604051906303aa7b4160e61b82526004820152fd5b9061104691611ecb565b627fffff1982146112d25760001990910190610ff7565b634e487b7160e01b600052601160045260246000fd5b61025891500760060b151585610ff1565b3d9150816000823e61130b8282611a21565b60408183810103126101d4578051916001600160401b0383116101d457808201601f8484010112156101d457828201519261134584611e81565b936113536040519586611a21565b808552602085019183850160208360051b8388010101116101d45791602083860101925b60208360051b82880101018410611422575050505060208201516001600160401b0381116101d457818301601f8285010112156101d457808301519260206113be85611e81565b6113cb6040519182611a21565b8581520192810160208560051b8484010101116101d45780820160200192915b60208560051b8284010101841061140757505050505084610fa2565b602080809461141587611e51565b81520194019392506113eb565b8351918260060b83036101d4576020818194829352019401939150611377565b825163ffffffff16845285945060209384019390920191600101610f73565b905060e0813d82116114e5575b8161147b60e09383611a21565b810103126101d45761148c81611e51565b506020810151908160020b82036101d4576114a960408201611e65565b506114b660608201611e65565b506114c360808201611e65565b5060a081015160ff8116036101d45760c06114de9101611e74565b5083610f15565b3d915061146e565b50602081511015610e91565b604090813d831161151d575b61150f8183611a21565b810103126101d45780610e34565b503d611505565b60405162461bcd60e51b815260206004820152601060248201526f1c1d5b5c081b9bdd08195b98589b195960821b6044820152606490fd5b346101d45760403660031901126101d4576105226115786119da565b336000526001602052604060002060018060a01b0382166000526020526115a6602435604060002054611a5d565b9033611bd8565b346101d45760003660031901126101d457602060405160128152f35b346101d45760003660031901126101d4576115e2611d57565b604080516001600160a01b03939093168352602083019190915290f35b346101d45760003660031901126101d4576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346101d45760003660031901126101d4576020604051624f1a008152f35b346101d45760603660031901126101d45761167b6119da565b6116836119f0565b6044359060018060a01b03831660005260016020526040600020336000526020526040600020549260001984036116bf575b6105229350611a6a565b8284106116db576116d68361052295033383611bd8565b6116b5565b60405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606490fd5b346101d45760003660031901126101d4576020600254604051908152f35b346101d45760803660031901126101d4576117576119da565b506117606119f0565b506064356001600160401b0381116101d457366023820112156101d45780600401359061178c82611a42565b9161179a6040519384611a21565b80835236602482840101116101d4576000928160246020940184830137010152604051630a85bd0160e11b8152602090f35b346101d45760003660031901126101d4576006546040516001600160a01b039091168152602090f35b346101d45760003660031901126101d4576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346101d45760003660031901126101d4576020611855611d0a565b6040519015158152f35b346101d45760403660031901126101d45761052261187b6119da565b6024359033611bd8565b346101d45760203660031901126101d4576001600160401b036118a66119c4565b166000526009602052602060ff604060002054166040519015158152f35b346101d45760003660031901126101d457600060035490600182811c9181841691821561197a575b60209485851084146106e35785879486865291826000146106c357505060011461191d575061064e92500383611a21565b84915060036000527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b906000915b85831061196257505061064e935082010185610641565b8054838901850152879450869390920191810161194b565b92607f16926118ec565b919082519283825260005b8481106119b0575050826000602080949584010152601f8019910116010190565b60208183018101518483018201520161198f565b600435906001600160401b03821682036101d457565b600435906001600160a01b03821682036101d457565b602435906001600160a01b03821682036101d457565b606081019081106001600160401b0382111761126857604052565b90601f801991011681019081106001600160401b0382111761126857604052565b6001600160401b03811161126857601f01601f191660200190565b919082018092116112d257565b6001600160a01b03908116918215611b855716918215611b3457600082815280602052604081205491808310611ae057604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef958760209652828652038282205586815220818154019055604051908152a3565b60405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608490fd5b60405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608490fd5b60405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608490fd5b6001600160a01b03908116918215611c895716918215611c395760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b60405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608490fd5b60405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608490fd5b15611ce157565b60405162461bcd60e51b81526020600482015260016024820152603360f91b6044820152606490fd5b600754624f1a0081018091116112d257421190565b15611d2657565b60405162461bcd60e51b8152602060048201526009602482015268746f6f206561726c7960b81b6044820152606490fd5b6005546040516320bba64360e21b815291906020906001600160a01b03908116908285600481855afa94851561084757600095611e17575b5082906024866040519485938492631711922960e31b84521660048301525afa91821561084757600092611dcc575b50506001600160801b031690565b81813d8311611e10575b611de08183611a21565b81010312611e0c5751906001600160801b0382168203611e0957506001600160801b0338611dbe565b80fd5b5080fd5b503d611dd6565b8381819793973d8311611e4a575b611e2f8183611a21565b81010312611e0c5751908582168203611e0957509382611d8f565b503d611e25565b51906001600160a01b03821682036101d457565b519061ffff821682036101d457565b519081151582036101d457565b6001600160401b0381116112685760051b60200190565b805115611ea55760200190565b634e487b7160e01b600052603260045260246000fd5b805160011015611ea55760400190565b919082039182116112d257565b3d15611f03573d90611ee982611a42565b91611ef76040519384611a21565b82523d6000602084013e565b606090565b81810291906000198282099183808410930391838303936801000000000000000093858511156101d45714611f4a570990828211900360c01b910360401c1790565b5050505060401c90565b906127108083029190600019818509938380861095039480860395868511156101d45714611fce579082910981806000031680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b505091500490565b60020b60008112156123575780600003905b620d89e88211612345576001821615612333576001600160881b036ffffcb933bd6fad37aa2d162d1a5940015b169160028116612317575b600481166122fb575b600881166122df575b601081166122c3575b602081166122a7575b6040811661228b575b608090818116612270575b6101008116612255575b610200811661223a575b610400811661221f575b6108008116612204575b61100081166121e9575b61200081166121ce575b61400081166121b3575b6180008116612198575b62010000811661217d575b620200008116612163575b620400008116612149575b620800001661212e575b50600012612109575b63ffffffff8116612101576000905b60201c60ff91909116016001600160a01b031690565b6001906120eb565b801561211857600019046120dc565b634e487b7160e01b600052601260045260246000fd5b6b048a170391f7dc42444e8fa26000929302901c91906120d3565b6d2216e584f5fa1ea926041bedfe98909302811c926120c9565b926e5d6af8dedb81196699c329225ee60402811c926120be565b926f09aa508b5b7a84e1c677de54f3e99bc902811c926120b3565b926f31be135f97d08fd981231505542fcfa602811c926120a8565b926f70d869a156d2a1b890bb3df62baf32f702811c9261209e565b926fa9f746462d870fdf8a65dc1f90e061e502811c92612094565b926fd097f3bdfd2022b8845ad8f792aa582502811c9261208a565b926fe7159475a2c29b7443b29c7fa6e889d902811c92612080565b926ff3392b0822b70005940c7a398e4b70f302811c92612076565b926ff987a7253ac413176f2b074cf7815e5402811c9261206c565b926ffcbe86c7900a88aedcffc83b479aa3a402811c92612062565b926ffe5dee046a99a2a811c461f1969c305302811c92612058565b916fff2ea16466c96a3843ec78b326b528610260801c9161204d565b916fff973b41fa98c081472e6896dfb254c00260801c91612044565b916fffcb9843d60f6159c9db58835c9266440260801c9161203b565b916fffe5caca7e10e4e61c3624eaa0941cd00260801c91612032565b916ffff2e50f5f656932ef12357cf3c7fdcc0260801c91612029565b916ffff97272373d413259a46990580e213a0260801c91612020565b6001600160881b03600160801b612015565b6040516333a3bdff60e21b8152600490fd5b80611fe856fea164736f6c6343000813000aa164736f6c6343000813000a00000000000000000000000036825bf3fbdf5a29e2d5148bfe7dcf7b5639e32000000000000000000000000077dcc9b09c6ae94cdc726540735682a38e18d69000000000000000000000000056cfc796bc88c9c7e1b38c2b0af9b7120b079aef000000000000000000000000fffff4d5c35b709809bba92e76b421a246c7e7e2

Deployed Bytecode

0x60808060405260043610156200001457600080fd5b60003560e01c908162b531631462001bff575080630ea901d2146200185657806311df9995146200182b5780631e9a695014620016935780633953c8d714620015d65780633b17469e146200148f5780634bb7b599146200144857806351c107a714620013f3578063715018a61462001396578063791b98bc146200134f5780637b4f4ec3146200132457806382e46b75146200125b5780638da5cb5b14620012305780639bff71da14620011ed578063acd502bb14620010da578063b3e1d61f1462000870578063c45a01551462000829578063f2fde38b146200075e5763ff9d682a146200010357600080fd5b34620005fa576000366003190112620005fa576002546001600160a01b0390811660008181526003602052604090206001546004820154929316919081156200074c5781600019810111620005c65762000165600019830160048301620022e2565b9054600391821b1c600090815290820160205260409020546001600160a01b0316156200073a5760005b8281106200019957005b620001a88160048401620022e2565b90549060031b1c600052600382016020526040600020600481015415620001d357506001016200018f565b8054600182015492956001600160a01b0391821693909116803b15620005fa57600080916024604051809481936332148f6760e01b8352609660048401525af18015620005ee5762000728575b50808310156200071f578293815b600884015460181c60020b9182156200070957600291600182015493612710858185549560078b0154978891015402040204868910600014620006f557906127108681878702040204925b878a1015620006ee57825b8a3b15620005fa576040516340c10f1960e01b81523060048201526024810191909152600081604481838f5af18015620005ee57620006dc575b50620002f5837f00000000000000000000000077dcc9b09c6ae94cdc726540735682a38e18d6906001600160a01b03168d620027a9565b6200032b847f00000000000000000000000077dcc9b09c6ae94cdc726540735682a38e18d6906001600160a01b031683620027a9565b62ffffff60088a015416906040519b8c6001600160401b03610160828181011092011117620006c6576101608d0160405260018060a01b03168c5260018060a01b031660208c015260408b01528080620d89e719050260020b60608b015280620d89e8050260020b60808a015260a089015260c0880152600060e08801526000610100880152856101208801524261014088015261014060405197634418b22b60e11b895260018060a01b0381511660048a015260018060a01b0360208201511660248a015262ffffff60408201511660448a0152606081015160020b60648a0152608081015160020b60848a015260a081015160a48a015260c081015160c48a015260e081015160e48a01526101008101516101048a015260018060a01b03610120820151166101248a0152015161014488015260808761016481600060018060a01b037f00000000000000000000000077dcc9b09c6ae94cdc726540735682a38e18d690165af1968715620005ee5760009762000669575b50906127109102048061271083820204810311620005c65760405163a9059cbb60e01b602082019081526001600160a01b038716602483015261271093830293909304909103604482015260009182916200050e81606481015b03601f198101835282620021b4565b519082855af16200051e620021f2565b816200062c575b5015620005ff5760018201546001600160a01b0316833b15620005fa5760646000928360405196879485936353806ec760e01b85528210600485015260248401528860448401525af1918215620005ee57600492620005dc575b50015580600019810111620005c65760001901146200059a57005b60005260046020526040600020600160ff198254161790556001600160601b0360a01b60025416600255005b634e487b7160e01b600052601160045260246000fd5b620005e7906200214b565b386200057f565b6040513d6000823e3d90fd5b600080fd5b60405162461bcd60e51b815260206004820152600560248201526410940b54d560da1b6044820152606490fd5b805180159250821562000643575b50503862000525565b8192509060209181010312620005fa57602062000661910162002381565b38806200063a565b919096506080823d608011620006bd575b816200068960809383620021b4565b81010312620005fa57602082519201516fffffffffffffffffffffffffffffffff811603620005fa579095612710620004a5565b3d91506200067a565b634e487b7160e01b600052604160045260246000fd5b620006e7906200214b565b38620002be565b8362000284565b906127108681878702040204919262000279565b634e487b7160e01b600052601260045260246000fd5b8093836200022e565b62000733906200214b565b3862000220565b604051631872405d60e31b8152600490fd5b6040516368b837bf60e01b8152600490fd5b34620005fa576020366003190112620005fa576200077b62002029565b62000785620020bf565b6001600160a01b03908116908115620007d557600054826001600160601b0360a01b821617600055167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3005b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b34620005fa576000366003190112620005fa576040517f00000000000000000000000056cfc796bc88c9c7e1b38c2b0af9b7120b079aef6001600160a01b03168152602090f35b34620005fa576060366003190112620005fa576004356001600160401b038111620005fa57620008a59036906004016200208c565b6024356001600160401b038111620005fa57620008c79036906004016200208c565b620008d1620020bf565b6002546001600160a01b03166000908152600360205260409020805415620010c8576004810154620010b6578184036200074c578315620010a4576103e860443510801562001096575b62001084576044356001820155600090600060a06040516200093d816200217c565b6060815260606020820152826040820152826060820152826080820152015260005b85811062000ad85750506127100362000ac65760025460405160808082528101859052936001600160a01b0390911692906001600160fb1b038111620005fa5760059291921b809560a086013760a08585018581038201602087015290810182905260c0600583901b8201810196849260009201905b84831062000a14577fb9859596bc769c8dca4eed4db0104afed7ecdd7c7b009729dbfde89ae2d25d4c88808b8a604435604084015260608301520390a1005b90919293949760bf19828901820301835288359060be1986360301821215620005fa576020809187600194019060a062ffffff62000ab18262000a8b62000a6f62000a608880620022fb565b60c0895260c08901916200232f565b62000a7d89890189620022fb565b908883038b8a01526200232f565b956040810135604087015260608101356060870152608081013560808701520162002274565b169101529a01930193019194939290620009d5565b604051631c9cf1db60e11b8152600490fd5b838110156200106e5760be19853603018160051b8601351215620005fa5760c08160051b8601358601360312620005fa576040519262000b18846200217c565b6001600160401b038260051b87013587013511620005fa5762000b4836600584901b880135880180350162002227565b84526001600160401b0360208360051b8801358801013511620005fa5762000b8036600584901b880135880160208101350162002227565b6020850152600582901b860135860160408181013590860152606080820135908601526080808201359086015262000bbb9060a00162002274565b60a085015262000bcd82888a62002285565b356000526003830160205260406000209060808501511562000ac65760058201546200105c576040850151156200104a57606085015161138881119081156200103d575b506200102b5760038551511080156200101b575b62001009576080850151019380518051906001600160401b038211620006c657819062000c56600286015462002296565b601f811162000fb1575b50602090601f831160011462000f3a5760009262000f2e575b50508160011b916000199060031b1c19161760028301555b60208101518051906001600160401b038211620006c657819062000cb9600386015462002296565b601f811162000ed6575b50602090601f831160011462000e5f5760009262000e53575b50508160011b916000199060031b1c19161760038301555b60408101516005830155606081015160068301556080810151600783015560008062ffffff60a08401511660405160208101916322afcccb60e01b835260248201526024815262000d458162002198565b51907f00000000000000000000000056cfc796bc88c9c7e1b38c2b0af9b7120b079aef6001600160a01b03165afa62000d7d620021f2565b908062000e47575b15620005fa57602081805181010312620005fa57602062000da79101620022d3565b908160020b1562000e355762ffffff60a060089201511692019182549160181b65ffffff000000169165ffffffffffff19161717905562000dea81878962002285565b3590600483015491600160401b831015620006c65762000e18836001809501600487015560048601620022e2565b819291549060031b91821b91600019901b1916179055016200095f565b6040516309c74fbb60e21b8152600490fd5b50602081511462000d85565b015190508b8062000cdc565b9250600385016000526020600020906000935b601f198416851062000eba576001945083601f1981161062000ea0575b505050811b01600383015562000cf4565b015160001960f88460031b161c191690558b808062000e8f565b8181015183556020948501946001909301929091019062000e72565b909150600385016000526020600020601f840160051c81016020851062000f26575b90849392915b601f830160051c8201811062000f1657505062000cc3565b6000815585945060010162000efe565b508062000ef8565b015190508b8062000c79565b9250600285016000526020600020906000935b601f198416851062000f95576001945083601f1981161062000f7b575b505050811b01600283015562000c91565b015160001960f88460031b161c191690558b808062000f6a565b8181015183556020948501946001909301929091019062000f4d565b909150600285016000526020600020601f840160051c81016020851062001001575b90849392915b601f830160051c8201811062000ff157505062000c60565b6000815585945060010162000fd9565b508062000fd3565b6040516328f4e19960e01b8152600490fd5b5060036020860151511062000c25565b60405163f60be68960e01b8152600490fd5b6101f49150108a62000c11565b60405163a818d88b60e01b8152600490fd5b60405163c991cbb160e01b8152600490fd5b634e487b7160e01b600052603260045260246000fd5b604051632588bc7f60e21b8152600490fd5b50612710604435116200091b565b604051637c946ed760e01b8152600490fd5b6040516354ff87af60e11b8152600490fd5b60405163781d8eef60e01b8152600490fd5b34620005fa576000366003190112620005fa5760025460408051630bf2495560e21b60208201908152600482526001600160a01b0393928201928416906001600160401b03841183851017620006c6576000809493819460405251925af162001142620021f2565b9015620011b457816002541660005260036020526040600020918254620011a257604082805181010312620005fa578160406020600594015191015160028501558355600154169101906001600160601b0360a01b825416179055600080f35b604051630156e28d60e31b8152600490fd5b60405162461bcd60e51b81526020600482015260116024820152704661696c65642073656e642066756e647360781b6044820152606490fd5b34620005fa576020366003190112620005fa576001600160a01b036200121262002029565b166000526004602052602060ff604060002054166040519015158152f35b34620005fa576000366003190112620005fa576000546040516001600160a01b039091168152602090f35b34620005fa576020366003190112620005fa576200127862002029565b62001282620020bf565b6001600160a01b039081168015620012f9578160025416620012e7577f68d8574d09d4edebcd045f9cb987227b11a8b779ceb0dfebcf81c4dbc65ae4949160409160015491816001600160601b0360a01b8416176001558351921682526020820152a1005b60405163ba26162b60e01b8152600490fd5b606460405162461bcd60e51b81526020600482015260046024820152637a65726f60e01b6044820152fd5b34620005fa576000366003190112620005fa576002546040516001600160a01b039091168152602090f35b34620005fa576000366003190112620005fa576040517f00000000000000000000000077dcc9b09c6ae94cdc726540735682a38e18d6906001600160a01b03168152602090f35b34620005fa576000366003190112620005fa57620013b3620020bf565b600080546001600160a01b0319811682556001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a3005b34620005fa576060366003190112620005fa576200141062002029565b6001600160a01b036024358181168103620005fa57604092620014379160443591620025a3565b835191831682529091166020820152f35b34620005fa576000366003190112620005fa576040517f00000000000000000000000036825bf3fbdf5a29e2d5148bfe7dcf7b5639e3206001600160a01b03168152602090f35b6060366003190112620005fa57620014a662002029565b602435620014b3620020bf565b6044354211620015a7576002546001600160a01b03808216620012e75783169283600052600460205260ff60406000205416620015955782846000949362001501620f424087961162002118565b6200151b6c0c9f2c9cd04674edea40000000841062002118565b6001600160601b0360a01b1617600255604051602081019163e5ed1d5960e01b8352602482015260248152620015518162002198565b519134905af162001561620021f2565b5015620005fa5760207f67eb30c25f0667fe3d9b2d6e8f0db01a2cdd5af4c76ed397709c29962f6894b791604051908152a1005b604051637180486560e01b8152600490fd5b60405162461bcd60e51b81526020600482015260076024820152661d1bdbc81bdb1960ca1b6044820152606490fd5b34620005fa576040366003190112620005fa57620015f362002029565b602435801515809103620005fa57600091829162001610620020bf565b826040516020810192631f8e31cd60e01b8452602482015260248152620016378162002198565b51925af162001645620021f2565b50156200164e57005b60405162461bcd60e51b815260206004820152601b60248201527f4661696c6564207365742073656c6c20706f696e7473206d6f646500000000006044820152606490fd5b34620005fa576040366003190112620005fa57620016b062002029565b33600052600460205260ff6040600020541615620017ee573360005260038060205260406000209160048301549160009360243515945b848110620016f157005b620017008160048401620022e2565b905490841b1c600052828201602052604060002090600782015491826024350292602435840414881715620005c65780546001600160a01b0316803b15620005fa576040516340c10f1960e01b81526001600160a01b038816600482015261271085046024820152906000908290604490829084905af1938415620005ee576127107fd12200efa34901b99367694174c3b0d32c99585fdf37c7c26892136ddd0836d993606093600197620017dc575b50868060a01b0390541691604051928352868060a01b038a166020840152046040820152a101620016e7565b620017e7906200214b565b8c620017b0565b60405162461bcd60e51b81526020600482015260156024820152743bb0b4ba103337b9103234b9ba3934b13aba34b7b760591b6044820152606490fd5b34620005fa576000366003190112620005fa576001546040516001600160a01b039091168152602090f35b34620005fa576020366003190112620005fa576200187362002029565b6060906001600160a01b03168062001beb57506002546001600160a01b03166000908152600360205260409020905b8154906001830154926002810154926004820191604051908182602086549283815201809660005260206000209260005b81811062001bd1575050620018eb92500383620021b4565b81518062001a32575b50506040929192519460a096878701948752602087015260408601528560608601525180925260c091828501919060005b81811062001a1b575050506080908481038286015283519182825260208201906020808560051b8501019601946000935b858510620019645788880389f35b909192939495966020808b600193601f198682030189528b51858060a01b038151168252858060a01b03848201511684830152620019c9620019b6604083015161014080604087015285019062002065565b6060830151848203606086015262002065565b92898201518a8401528082015190830152878101518883015260e081015160e083015261010062ffffff8183015116908301526101208091015160020b91015299019501950193959492919062001956565b825184526020938401939092019160010162001925565b909462001a3f826200277c565b9062001a4f6040519283620021b4565b828252601f1962001a60846200277c565b019060005b82811062001b7257505050809560005b83811062001a85575050620018f4565b8062001a946001928762002794565b5160005260038084016020526008604060002062001aee62001b0a6040519462001abe866200215f565b835460a089901b89900390811687528489015416602087015260405162001af68162001aee81600289016200238f565b0382620021b4565b60408701526040519283809286016200238f565b606084015260048101546080840152600581015460a0840152600681015460c0840152600781015460e0840152015462ffffff811661010083015260181c60020b61012082015262001b5d828662002794565b5262001b6a818562002794565b500162001a75565b60209060405162001b83816200215f565b60008152600083820152836040820152838082015260006080820152600060a0820152600060c0820152600060e0820152600061010082015260006101208201528282870101520162001a65565b8454835260019485019487945060209093019201620018d3565b6000526003602052604060002090620018a2565b34620005fa576000366003190112620005fa5760018060a01b0390600282815416600052600360209080825260406000209360019580875416926004870180549384156200201a5750929681019260005b88811062001c5a57005b62001c668183620022e2565b905490841b1c80600052858852604060002090858254161562001c8d575050890162001c50565b969799509997939450505050600587015415620020085762001cb4838383541633620025a3565b6008890154604051630b4c774160e11b81526001600160a01b0383811660048301528816602482015262ffffff909116604482018190529197929691907f00000000000000000000000056cfc796bc88c9c7e1b38c2b0af9b7120b079aef8616908a81606481855afa908115620005ee5760009162001fe6575b50808716908162001e8e57505060405163a167129560e01b81526001600160a01b038a811660048301528416602482015262ffffff9290921660448301528990829060649082906000905af1988915620005ee5760009962001e58575b505083881695863b15620005fa5760405163f637731d60e01b81529085166004820152600081602481838b5af18015620005ee577fb55c1e806314817ad210a5d7b18404d946ba5092b127eb8d4c945cf6f10819e49a62001e419862001e0f9589948c9462001e46575b50820180546001600160a01b031916909117905562002485565b54604080516001600160a01b039687168152968616602088015286019290925216909116606083015281906080820190565b0390a1005b62001e51906200214b565b8e62001df5565b62001e7d929950803d1062001e86575b62001e748183620021b4565b81019062002350565b96898062001d8b565b503d62001e68565b9a92509a9397600491507fb96a1a294c15169f42741eb4faaec6cfe5032eabfc182932afed34f2ef2d38de836040518a8152a1604051633850c7bd60e01b81529160e0908390818f5afa928315620005ee57879260009462001f41575b5050811691161462001ef957005b8487837fb55c1e806314817ad210a5d7b18404d946ba5092b127eb8d4c945cf6f10819e49b62001e419962001e0f9601906001600160601b0360a01b82541617905562002485565b919350915060e0813d60e01162001fdd575b8162001f6260e09383620021b4565b81010312620005fa578051918783168303620005fa5762001f85908201620022d3565b5062001f946040820162002371565b5062001fa36060820162002371565b5062001fb26080820162002371565b5060a081015160ff811603620005fa57869162001fd360c084930162002381565b5092908d62001eeb565b3d915062001f53565b6200200191508b3d8d1162001e865762001e748183620021b4565b8c62001d2e565b604051635861b41d60e01b8152600490fd5b637c946ed760e01b8152600490fd5b600435906001600160a01b0382168203620005fa57565b60005b838110620020545750506000910152565b818101518382015260200162002043565b90602091620020808151809281855285808601910162002040565b601f01601f1916010190565b9181601f84011215620005fa578235916001600160401b038311620005fa576020808501948460051b010111620005fa57565b6000546001600160a01b03163303620020d457565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b156200212057565b60405162461bcd60e51b81526020600482015260036024820152626f2d6f60e81b6044820152606490fd5b6001600160401b038111620006c657604052565b61014081019081106001600160401b03821117620006c657604052565b60c081019081106001600160401b03821117620006c657604052565b606081019081106001600160401b03821117620006c657604052565b90601f801991011681019081106001600160401b03821117620006c657604052565b6001600160401b038111620006c657601f01601f191660200190565b3d1562002222573d906200220682620021d6565b91620022166040519384620021b4565b82523d6000602084013e565b606090565b81601f82011215620005fa578035906200224182620021d6565b92620022516040519485620021b4565b82845260208383010111620005fa57816000926020809301838601378301015290565b359062ffffff82168203620005fa57565b91908110156200106e5760051b0190565b90600182811c92168015620022c8575b6020831014620022b257565b634e487b7160e01b600052602260045260246000fd5b91607f1691620022a6565b51908160020b8203620005fa57565b80548210156200106e5760005260206000200190600090565b9035601e1982360301811215620005fa5701602081359101916001600160401b038211620005fa578136038313620005fa57565b908060209392818452848401376000828201840152601f01601f1916010190565b90816020910312620005fa57516001600160a01b0381168103620005fa5790565b519061ffff82168203620005fa57565b51908115158203620005fa57565b9060009291805491620023a28362002296565b918282526001938481169081600014620024095750600114620023c6575b50505050565b90919394506000526020928360002092846000945b838610620023f4575050505001019038808080620023c0565b805485870183015294019385908201620023db565b9294505050602093945060ff191683830152151560051b01019038808080620023c0565b9360c095926200247b946200246c939a99989a60018060a01b039283809216895216602088015216604086015260e0606086015260e08501906200238f565b9083820360808501526200238f565b9460a08201520152565b60408051336020820190815291810194909452909392620024aa8160608101620004ff565b51902060058401546006850154906040519161281790818401928484106001600160401b03851117620006c6578493620025439362002a7d86396001600160a01b039860038b019160028c01917f00000000000000000000000077dcc9b09c6ae94cdc726540735682a38e18d6908c16917f00000000000000000000000036825bf3fbdf5a29e2d5148bfe7dcf7b5639e320906200242d565b03906000f58015620005ee57821692836001600160601b0360a01b82541617905516036200256d57565b60405162461bcd60e51b8152602060048201526003602482015262612d6d60e81b6044820152606490fd5b811562000709570490565b6001600160a01b039182166000908152600360208181526040808420878552928301825280842081519587168684019081528683019890985281865293969294601f19949390620025f6606082620021b4565b51902092620026d4620026e184612817938a8651916200261984880184620021b4565b8683528383019662002a7d8839620026ab82600154169b8c936200269e60058501546006860154908d519687948b8601996002600384019301917f00000000000000000000000077dcc9b09c6ae94cdc726540735682a38e18d69016907f00000000000000000000000036825bf3fbdf5a29e2d5148bfe7dcf7b5639e3208c6200242d565b03908101835282620021b4565b8751958693620026c4868601998a925192839162002040565b8401915180938684019062002040565b01038084520182620021b4565b51902081519283019360ff60f81b85523060601b6021850152603584015260558301526055825260808201908282106001600160401b03831117620027685752519020831693508310156200275157620027478160026200274d935491015490620029f5565b62002880565b1691565b620027478160026200274d930154905490620029f5565b634e487b7160e01b88526041600452602488fd5b6001600160401b038111620006c65760051b60200190565b80518210156200106e5760209160051b010190565b60405163095ea7b360e01b602082019081526001600160a01b03909316602482015260448101939093526000928392908390620027ea8160648101620004ff565b51925af1620027f8620021f2565b8162002835575b50156200280857565b60405162461bcd60e51b815260206004820152600560248201526442502d534160d81b6044820152606490fd5b80518015925082156200284c575b505038620027ff565b8192509060209181010312620005fa5760206200286a910162002381565b388062002843565b91908201809211620005c657565b8015620029ef57600181600160801b811015620029dc575b6200296362002954620029456200293662002927620029186200297d97600888600160401b620029729a1015620029ce575b640100000000811015620029c0575b62010000811015620029b3575b610100811015620029a6575b601081101562002998575b10156200298f575b62002911818b62002598565b9062002872565b60011c62002911818a62002598565b60011c62002911818962002598565b60011c62002911818862002598565b60011c62002911818762002598565b60011c62002911818662002598565b60011c62002911818562002598565b60011c809262002598565b808210156200298a575090565b905090565b60011b62002905565b60041c9160021b91620028fd565b811c9160041b91620028f2565b60101c91811b91620028e6565b60201c9160101b91620028d9565b60401c9160201b91620028ca565b50600160401b9050608082901c62002898565b50600090565b600160c01b9160c082901b9160001981850993838086109503948086039586851115620005fa571462002a74579082910981806000031680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b50509150049056fe61012060405234620003fa5762002817803803806200001e81620003ff565b928339810160e082820312620003fa57620000398262000425565b916020926200004a84830162000425565b620000586040840162000425565b606084015190956001600160401b03959091868111620003fa5781620000809187016200043a565b90608086015190878211620003fa576200009c9187016200043a565b9560c060a0870151960151968251828111620002fa576003918254916001958684811c94168015620003ef575b88851014620003d9578190601f9485811162000383575b5088908583116001146200031c5760009262000310575b505060001982861b1c191690861b1783555b8051938411620002fa5760049586548681811c91168015620002ef575b82821014620002da578381116200028f575b508092851160011462000221575093839491849260009562000215575b50501b92600019911b1c19161790555b600580546001600160a01b0319166001600160a01b0393841617905560e052929092166101009081523360c05260809290925260a05260405161236a9182620004ad83396080518281816104d90152818161073001528181610a960152610d2a015260a0518281816108ea0152610ea9015260c0518281816109de01528181610c4d0152611615015260e0518281816102b101528181610e61015261180b0152518181816109400152610e070152f35b01519350388062000155565b92919084601f1981168860005285600020956000905b8983831062000274575050501062000259575b50505050811b01905562000165565b01519060f884600019921b161c19169055388080806200024a565b85870151895590970196948501948893509081019062000237565b87600052816000208480880160051c820192848910620002d0575b0160051c019087905b828110620002c357505062000138565b60008155018790620002b3565b92508192620002aa565b602288634e487b7160e01b6000525260246000fd5b90607f169062000126565b634e487b7160e01b600052604160045260246000fd5b015190503880620000f7565b90889350601f19831691876000528a6000209260005b8c8282106200036c575050841162000353575b505050811b01835562000109565b015160001983881b60f8161c1916905538808062000345565b8385015186558c9790950194938401930162000332565b90915085600052886000208580850160051c8201928b8610620003cf575b918a91869594930160051c01915b828110620003bf575050620000e0565b600081558594508a9101620003af565b92508192620003a1565b634e487b7160e01b600052602260045260246000fd5b93607f1693620000c9565b600080fd5b6040519190601f01601f191682016001600160401b03811183821017620002fa57604052565b51906001600160a01b0382168203620003fa57565b919080601f84011215620003fa5782516001600160401b038111620002fa5760209062000470601f8201601f19168301620003ff565b92818452828287010111620003fa5760005b8181106200049857508260009394955001015290565b85810183015184820184015282016200048256fe608080604052600436101561001357600080fd5b60003560e01c90816306fdde03146118c4575080630780fc2a14611885578063095ea7b31461185f5780630a1926321461183a57806311df9995146117f557806311ea5441146117cc578063150b7a021461173e57806318160ddd1461172057806323b872dd1461166257806325d4995e1461164457806325de6036146115ff5780632d971e63146115c9578063313ce567146115ad578063395093511461155c578063395ea61b14610d5957806339986e8114610d0f57806340c10f1914610c215780634f590f0814610bfb57806352a5f1f814610a3457806353806ec7146109a957806370a082311461096f578063791b98bc1461092a578063879ac8f81461090d5780638a6af663146108d25780638c7b6e921461070357806395d89b41146105f15780639cfdbd5e146105d4578063a457c2d71461052d578063a9059cbb146104fc578063dce0e92b146104c1578063dd62ed3e14610470578063e3767dd61461044a578063e6dacb921461042d578063ebd2ee7b146103ba578063fa461e33146101f7578063fbd09a7c146101d95763fc1afd20146101b657600080fd5b346101d45760003660031901126101d4576020600754604051908152f35b600080fd5b346101d45760003660031901126101d4576020600854604051908152f35b346101d45760603660031901126101d457602460043581356044356001600160401b038082116101d457366023830112156101d45781600401359081116101d4573691018401116101d4576006546001600160a01b031633036103905760008213801580610385575b61035257600092839290911561034b57505b6040805163a9059cbb60e01b602080830191825233888401908152908101949094529290916102ac9183910103601f198101835282611a21565b5190827f00000000000000000000000000000000000000000000000000000000000000005af16102da611ed8565b81610314575b50156102e857005b60649060056040519162461bcd60e51b8352602060048401528201526410940b54d560da1b6044820152fd5b8051801592508215610329575b5050826102e0565b81925090602091810103126101d45760206103449101611e74565b8280610321565b9050610272565b60405162461bcd60e51b815260206004820152600c818601526b0696e76616c696420737761760a41b6044820152606490fd5b506000821315610260565b60405162461bcd60e51b81526020600482015260038185015262692d6360e81b6044820152606490fd5b346101d45760003660031901126101d4576103db6103d6611d0a565b611d1f565b7f42886893c2c02827643a75f50ecf4556313dada98ba97caf3c36f857829f6d2c6040600160a01b60ff60a01b196006541617806006554260075560ff82519160a01c161515815260006020820152a1005b346101d45760003660031901126101d457602060405161012c8152f35b346101d45760003660031901126101d457602060ff60065460a01c166040519015158152f35b346101d45760403660031901126101d4576104896119da565b6104916119f0565b9060018060a01b038091166000526001602052604060002091166000526020526020604060002054604051908152f35b346101d45760003660031901126101d45760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b346101d45760403660031901126101d4576105226105186119da565b6024359033611a6a565b602060405160018152f35b346101d45760403660031901126101d4576105466119da565b60243590336000526001602052604060002060018060a01b038216600052602052604060002054918083106105815761052292039033611bd8565b60405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608490fd5b346101d45760003660031901126101d45760206040516127108152f35b346101d45760003660031901126101d457604051600060045490600182811c918184169182156106f9575b60209485851084146106e35785879486865291826000146106c3575050600114610666575b5061064e92500383611a21565b610662604051928284938452830190611984565b0390f35b84915060046000527f8a35acfbc15ff81a39ae7d344fd709f28e8600b4aa8c65c6b64bfe7fe36bd19b906000915b8583106106ab57505061064e935082010185610641565b80548389018501528794508693909201918101610694565b60ff19168582015261064e95151560051b85010192508791506106419050565b634e487b7160e01b600052602260045260246000fd5b92607f169261061c565b6020806003193601126101d457600854156108a85760ff60065460a01c166108725761075c6107556007547f000000000000000000000000000000000000000000000000000000000000000090611a5d565b4211611d1f565b610764611d57565b90813410610853576005546040516319cb825f60e01b81526001600160a01b03928316600480830191909152356024820152928492849260449284929091165af190811561084757600091610801575b7f31cc170ef68cc97ae6f7f5530435b792096d77885d0d3d0a3ed2d2e7ba136906836001600160401b03841680600052600982526040600020600160ff19825416179055604051908152a1005b90508181813d8311610840575b6108188183611a21565b810103126101d45751906001600160401b03821682036101d457906001600160401b036107b4565b503d61080e565b6040513d6000823e3d90fd5b604051633ce6d0ef60e21b815234600482015260248101839052604490fd5b6064906040519062461bcd60e51b82526004820152600f60248201526e185b1c9958591e48195b98589b1959608a1b6044820152fd5b6064906040519062461bcd60e51b8252600482015260036024820152626e2d6960e81b6044820152fd5b346101d45760003660031901126101d45760206040517f00000000000000000000000000000000000000000000000000000000000000008152f35b346101d45760003660031901126101d45760206040516102588152f35b346101d45760003660031901126101d4576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346101d45760203660031901126101d4576001600160a01b036109906119da565b1660005260006020526020604060002054604051908152f35b346101d45760603660031901126101d4576004358015908115036101d4576109cf6119f0565b906001600160a01b03610a05337f0000000000000000000000000000000000000000000000000000000000000000831614611cda565b60068054604435600855600161ff0160a01b031916919093161760a89190911b60ff60a81b1617905542600755005b346101d45760603660031901126101d457610a4d6119c4565b610a556119f0565b506005546001600160a01b03168015610bb6573303610b65576001600160401b031680600052600960205260ff6040600020541615610b3a57610abb6007547f000000000000000000000000000000000000000000000000000000000000000090611a5d565b4211610ada575b6000908152600960205260409020805460ff19169055005b426007557f42886893c2c02827643a75f50ecf4556313dada98ba97caf3c36f857829f6d2c604060065460ff60a01b6001604435161560a01b169060ff60a01b1916178060065560ff82519160a01c1615158152836020820152a1610ac2565b606460405162461bcd60e51b81526020600482015260046024820152631a4b525960e21b6044820152fd5b60405162461bcd60e51b815260206004820152602360248201527f4f6e6c7920456e74726f70792063616e2063616c6c20746869732066756e637460448201526234b7b760e91b6064820152608490fd5b60405162461bcd60e51b815260206004820152601760248201527f456e74726f70792061646472657373206e6f74207365740000000000000000006044820152606490fd5b346101d45760003660031901126101d457602060ff60065460a81c166040519015158152f35b346101d45760403660031901126101d457610c3a6119da565b602435906001600160a01b0390610c74337f0000000000000000000000000000000000000000000000000000000000000000841614611cda565b16908115610cca577fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef602082610cae600094600254611a5d565b60025584845283825260408420818154019055604051908152a3005b60405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606490fd5b346101d45760003660031901126101d4576020610d4f6007547f000000000000000000000000000000000000000000000000000000000000000090611a5d565b4211604051908152f35b346101d45760003660031901126101d45760065460ff8160a01c16156115245760ff60a01b191660065560085460405190608082016001600160401b0381118382101761126857604090815290825230602083019081526001600160801b0383830181815260608501828152845163fc6f786560e01b81529551600487015292516001600160a01b0390811660248701529051821660448601529151166064840152829060849082906000907f0000000000000000000000000000000000000000000000000000000000000000165af18015610847576114f9575b5060008060405160208101906370a0823160e01b825230602482015260248152610e5d81611a06565b51907f00000000000000000000000000000000000000000000000000000000000000005afa610e8a611ed8565b90806114ed575b156101d4576020818051810103126101d457602001517f0000000000000000000000000000000000000000000000000000000000000000908181029181830414901517156112d2576127108104610ee457005b600654604051633850c7bd60e01b815260e0816004816001600160a01b0386165afa90811561084757600091611461575b50604051610f2281611a06565b6002815260208101906040368337610258610f3c82611e98565b526000610f4882611ebb565b5260405163883bdbfd60e01b8152602060048201529051602482018190529091829160448301919060005b81811061144257506000939283900391508290506001600160a01b0387165afa908115610847576000916112f9575b50610fb9610faf82611ebb565b5160060b91611e98565b5160060b9003667fffffffffffff198112667fffffffffffff8213176112d25760060b90610258820560020b916000811290816112e8575b506112bb575b9061103361102361101361100d61104b95611fd6565b93611fd6565b926001600160a01b031680611f08565b916001600160a01b031680611f08565b9081808211156112b15761104691611ecb565b611f54565b61012c8111611299575060ff8160a81c168060001461127e576401000276a4915b6040519060208201938285106001600160401b038611176112685760006040946110dd968652818552855196879586948593630251596160e31b8552306004860152151560248501526127108b04604485015260018060a01b0316606484015260a0608484015260a4830190611984565b03926001600160a01b03165af180156108475761123d575b503060005260006020526040600020549030156111ee573060005260006020526040600020549082821061119e57827fddbfb0687fbb06c476f9de1e483e656b4c56516f7580ab8224fbf91c81ed9f51936040933060005260006020520383600020558060025403600255600083518281527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60203092a36127108351920482526020820152a1005b60405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b6064820152608490fd5b60405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b6064820152608490fd5b604090813d8311611261575b6112538183611a21565b810103126101d457816110f5565b503d611249565b634e487b7160e01b600052604160045260246000fd5b73fffd8963efd1fc6a506488495d951d5263988d259161106c565b602490604051906303aa7b4160e61b82526004820152fd5b9061104691611ecb565b627fffff1982146112d25760001990910190610ff7565b634e487b7160e01b600052601160045260246000fd5b61025891500760060b151585610ff1565b3d9150816000823e61130b8282611a21565b60408183810103126101d4578051916001600160401b0383116101d457808201601f8484010112156101d457828201519261134584611e81565b936113536040519586611a21565b808552602085019183850160208360051b8388010101116101d45791602083860101925b60208360051b82880101018410611422575050505060208201516001600160401b0381116101d457818301601f8285010112156101d457808301519260206113be85611e81565b6113cb6040519182611a21565b8581520192810160208560051b8484010101116101d45780820160200192915b60208560051b8284010101841061140757505050505084610fa2565b602080809461141587611e51565b81520194019392506113eb565b8351918260060b83036101d4576020818194829352019401939150611377565b825163ffffffff16845285945060209384019390920191600101610f73565b905060e0813d82116114e5575b8161147b60e09383611a21565b810103126101d45761148c81611e51565b506020810151908160020b82036101d4576114a960408201611e65565b506114b660608201611e65565b506114c360808201611e65565b5060a081015160ff8116036101d45760c06114de9101611e74565b5083610f15565b3d915061146e565b50602081511015610e91565b604090813d831161151d575b61150f8183611a21565b810103126101d45780610e34565b503d611505565b60405162461bcd60e51b815260206004820152601060248201526f1c1d5b5c081b9bdd08195b98589b195960821b6044820152606490fd5b346101d45760403660031901126101d4576105226115786119da565b336000526001602052604060002060018060a01b0382166000526020526115a6602435604060002054611a5d565b9033611bd8565b346101d45760003660031901126101d457602060405160128152f35b346101d45760003660031901126101d4576115e2611d57565b604080516001600160a01b03939093168352602083019190915290f35b346101d45760003660031901126101d4576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346101d45760003660031901126101d4576020604051624f1a008152f35b346101d45760603660031901126101d45761167b6119da565b6116836119f0565b6044359060018060a01b03831660005260016020526040600020336000526020526040600020549260001984036116bf575b6105229350611a6a565b8284106116db576116d68361052295033383611bd8565b6116b5565b60405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606490fd5b346101d45760003660031901126101d4576020600254604051908152f35b346101d45760803660031901126101d4576117576119da565b506117606119f0565b506064356001600160401b0381116101d457366023820112156101d45780600401359061178c82611a42565b9161179a6040519384611a21565b80835236602482840101116101d4576000928160246020940184830137010152604051630a85bd0160e11b8152602090f35b346101d45760003660031901126101d4576006546040516001600160a01b039091168152602090f35b346101d45760003660031901126101d4576040517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602090f35b346101d45760003660031901126101d4576020611855611d0a565b6040519015158152f35b346101d45760403660031901126101d45761052261187b6119da565b6024359033611bd8565b346101d45760203660031901126101d4576001600160401b036118a66119c4565b166000526009602052602060ff604060002054166040519015158152f35b346101d45760003660031901126101d457600060035490600182811c9181841691821561197a575b60209485851084146106e35785879486865291826000146106c357505060011461191d575061064e92500383611a21565b84915060036000527fc2575a0e9e593c00f959f8c92f12db2869c3395a3b0502d05e2516446f71f85b906000915b85831061196257505061064e935082010185610641565b8054838901850152879450869390920191810161194b565b92607f16926118ec565b919082519283825260005b8481106119b0575050826000602080949584010152601f8019910116010190565b60208183018101518483018201520161198f565b600435906001600160401b03821682036101d457565b600435906001600160a01b03821682036101d457565b602435906001600160a01b03821682036101d457565b606081019081106001600160401b0382111761126857604052565b90601f801991011681019081106001600160401b0382111761126857604052565b6001600160401b03811161126857601f01601f191660200190565b919082018092116112d257565b6001600160a01b03908116918215611b855716918215611b3457600082815280602052604081205491808310611ae057604082827fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef958760209652828652038282205586815220818154019055604051908152a3565b60405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608490fd5b60405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608490fd5b60405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608490fd5b6001600160a01b03908116918215611c895716918215611c395760207f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925918360005260018252604060002085600052825280604060002055604051908152a3565b60405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608490fd5b60405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608490fd5b15611ce157565b60405162461bcd60e51b81526020600482015260016024820152603360f91b6044820152606490fd5b600754624f1a0081018091116112d257421190565b15611d2657565b60405162461bcd60e51b8152602060048201526009602482015268746f6f206561726c7960b81b6044820152606490fd5b6005546040516320bba64360e21b815291906020906001600160a01b03908116908285600481855afa94851561084757600095611e17575b5082906024866040519485938492631711922960e31b84521660048301525afa91821561084757600092611dcc575b50506001600160801b031690565b81813d8311611e10575b611de08183611a21565b81010312611e0c5751906001600160801b0382168203611e0957506001600160801b0338611dbe565b80fd5b5080fd5b503d611dd6565b8381819793973d8311611e4a575b611e2f8183611a21565b81010312611e0c5751908582168203611e0957509382611d8f565b503d611e25565b51906001600160a01b03821682036101d457565b519061ffff821682036101d457565b519081151582036101d457565b6001600160401b0381116112685760051b60200190565b805115611ea55760200190565b634e487b7160e01b600052603260045260246000fd5b805160011015611ea55760400190565b919082039182116112d257565b3d15611f03573d90611ee982611a42565b91611ef76040519384611a21565b82523d6000602084013e565b606090565b81810291906000198282099183808410930391838303936801000000000000000093858511156101d45714611f4a570990828211900360c01b910360401c1790565b5050505060401c90565b906127108083029190600019818509938380861095039480860395868511156101d45714611fce579082910981806000031680920460028082600302188083028203028083028203028083028203028083028203028083028203028092029003029360018380600003040190848311900302920304170290565b505091500490565b60020b60008112156123575780600003905b620d89e88211612345576001821615612333576001600160881b036ffffcb933bd6fad37aa2d162d1a5940015b169160028116612317575b600481166122fb575b600881166122df575b601081166122c3575b602081166122a7575b6040811661228b575b608090818116612270575b6101008116612255575b610200811661223a575b610400811661221f575b6108008116612204575b61100081166121e9575b61200081166121ce575b61400081166121b3575b6180008116612198575b62010000811661217d575b620200008116612163575b620400008116612149575b620800001661212e575b50600012612109575b63ffffffff8116612101576000905b60201c60ff91909116016001600160a01b031690565b6001906120eb565b801561211857600019046120dc565b634e487b7160e01b600052601260045260246000fd5b6b048a170391f7dc42444e8fa26000929302901c91906120d3565b6d2216e584f5fa1ea926041bedfe98909302811c926120c9565b926e5d6af8dedb81196699c329225ee60402811c926120be565b926f09aa508b5b7a84e1c677de54f3e99bc902811c926120b3565b926f31be135f97d08fd981231505542fcfa602811c926120a8565b926f70d869a156d2a1b890bb3df62baf32f702811c9261209e565b926fa9f746462d870fdf8a65dc1f90e061e502811c92612094565b926fd097f3bdfd2022b8845ad8f792aa582502811c9261208a565b926fe7159475a2c29b7443b29c7fa6e889d902811c92612080565b926ff3392b0822b70005940c7a398e4b70f302811c92612076565b926ff987a7253ac413176f2b074cf7815e5402811c9261206c565b926ffcbe86c7900a88aedcffc83b479aa3a402811c92612062565b926ffe5dee046a99a2a811c461f1969c305302811c92612058565b916fff2ea16466c96a3843ec78b326b528610260801c9161204d565b916fff973b41fa98c081472e6896dfb254c00260801c91612044565b916fffcb9843d60f6159c9db58835c9266440260801c9161203b565b916fffe5caca7e10e4e61c3624eaa0941cd00260801c91612032565b916ffff2e50f5f656932ef12357cf3c7fdcc0260801c91612029565b916ffff97272373d413259a46990580e213a0260801c91612020565b6001600160881b03600160801b612015565b6040516333a3bdff60e21b8152600490fd5b80611fe856fea164736f6c6343000813000aa164736f6c6343000813000a

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000036825bf3fbdf5a29e2d5148bfe7dcf7b5639e32000000000000000000000000077dcc9b09c6ae94cdc726540735682a38e18d69000000000000000000000000056cfc796bc88c9c7e1b38c2b0af9b7120b079aef000000000000000000000000fffff4d5c35b709809bba92e76b421a246c7e7e2

-----Decoded View---------------
Arg [0] : _entropyAddress (address): 0x36825bf3Fbdf5a29E2d5148bfe7Dcf7B5639e320
Arg [1] : _positionManagerAddress (address): 0x77DcC9b09C6Ae94CDC726540735682A38e18d690
Arg [2] : _factoryAddress (address): 0x56CFC796bC88C9c7e1b38C2b0aF9B7120B079aef
Arg [3] : _coin (address): 0xfffff4d5c35B709809BBA92E76b421A246C7e7E2

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 00000000000000000000000036825bf3fbdf5a29e2d5148bfe7dcf7b5639e320
Arg [1] : 00000000000000000000000077dcc9b09c6ae94cdc726540735682a38e18d690
Arg [2] : 00000000000000000000000056cfc796bc88c9c7e1b38c2b0af9b7120b079aef
Arg [3] : 000000000000000000000000fffff4d5c35b709809bba92e76b421a246c7e7e2


Block Transaction Gas Used Reward
view all blocks produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.