false
true
0

Contract Address Details

0x996a7388ACe7cD08BE43bc4A7275db288E1f6756

Contract Name
V4VaultFactory
Creator
0x31ac05–f770a7 at 0xb19de5–564a1c
Balance
0 PLS ( )
Tokens
Fetching tokens...
Transactions
1 Transactions
Transfers
0 Transfers
Gas Used
50,343
Last Balance Update
27555721
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been partially verified via Sourcify. View contract in Sourcify repository
Contract name:
V4VaultFactory




Optimization enabled
true
Compiler version
v0.8.20+commit.a1b79de6




Optimization runs
800
EVM Version
paris




Verified at
2026-05-17T05:02:06.727717Z

contracts/V4VaultFactory.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity ^0.8.20;
pragma abicoder v1;

import {IV4VaultFactory} from './interfaces/vault/IV4VaultFactory.sol';
import {V4CommunityVault} from './V4CommunityVault.sol';
import {AccessControl} from '@openzeppelin/contracts/access/AccessControl.sol';
import {IV4Factory} from './interfaces/IV4Factory.sol';

/// @title V4 vault factory stub
/// @notice This contract is used to set V4CommunityVault as communityVault in new pools
contract V4VaultFactory is AccessControl, IV4VaultFactory {
  address public immutable factory;

  /// @dev The role can be granted in V4Factory
  bytes32 public constant COMMUNITY_FEE_VAULT_ADMINISTRATOR = keccak256('COMMUNITY_FEE_VAULT_ADMINISTRATOR');

  /// @notice Default v4 fee manager for newly created vaults
  /// @dev If unset, resolves to factory owner; if owner is zero, only non-factory callers may fallback to msg.sender
  address public defaultV4FeeManager;

  mapping(address _pool => address) public vault;

  constructor(address _factory) {
    if (_factory == address(0)) revert InvalidAddress();
    factory = _factory;
  }

  modifier onlyAdministratorOrFactory() {
    if (!(IV4Factory(factory).hasRoleOrOwner(COMMUNITY_FEE_VAULT_ADMINISTRATOR, msg.sender) || msg.sender == factory)) {
      revert OnlyAdministrator();
    }
    _;
  }

  /// @inheritdoc IV4VaultFactory
  function getVaultForPool(address pool) external view override returns (address) {
    return vault[pool];
  }

  /// @inheritdoc IV4VaultFactory
  function createVaultForPool(
    address pool,
    address creator,
    address deployer,
    address token0,
    address token1
  ) external override onlyAdministratorOrFactory returns (address communityFeeVault) {
    if (vault[pool] != address(0)) revert vaultAlreadyExists();
    address v4FeeManager = defaultV4FeeManager;
    if (v4FeeManager == address(0)) {
      v4FeeManager = IV4Factory(factory).owner();
      if (v4FeeManager == address(0)) {
        if (msg.sender == factory) revert InvalidAddress();
        v4FeeManager = msg.sender;
      }
    }
    communityFeeVault = address(
      new V4CommunityVault{salt: keccak256(abi.encodePacked(pool, creator, deployer, token0, token1))}(factory, v4FeeManager)
    );
    vault[pool] = communityFeeVault;
    emit VaultCreated(communityFeeVault, pool, creator, deployer, token0, token1);
  }

  /// @notice Sets default v4 fee manager applied to newly created community vaults
  function setDefaultV4FeeManager(address newV4FeeManager) external onlyAdministratorOrFactory {
    defaultV4FeeManager = newV4FeeManager;
    emit DefaultV4FeeManager(newV4FeeManager);
  }
}
        

/SafeTransfer.sol

// SPDX-License-Identifier: MIT
pragma solidity >=0.8.4 <0.9.0;

import '../interfaces/pool/IV4PoolErrors.sol';

/// @title SafeTransfer
/// @notice Safe ERC20 transfer library that gracefully handles missing return values.
/// @dev Credit to Solmate under MIT license: https://github.com/transmissions11/solmate/blob/ed67feda67b24fdeff8ad1032360f0ee6047ba0a/src/utils/SafeTransferLib.sol
/// @dev Please note that this library does not check if the token has a code! That responsibility is delegated to the caller.
library SafeTransfer {
  /// @notice Transfers tokens to a recipient
  /// @dev Calls transfer on token contract, errors with transferFailed() if transfer fails
  /// @param token The contract address of the token which will be transferred
  /// @param to The recipient of the transfer
  /// @param amount The amount of the token to transfer
  function safeTransfer(address token, address to, uint256 amount) internal {
    bool success;
    assembly {
      let freeMemoryPointer := mload(0x40) // we will need to restore 0x40 slot
      mstore(0x00, 0xa9059cbb00000000000000000000000000000000000000000000000000000000) // "transfer(address,uint256)" selector
      mstore(0x04, and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // append cleaned "to" address
      mstore(0x24, amount)
      // now we use 0x00 - 0x44 bytes (68), freeMemoryPointer is dirty
      success := call(gas(), token, 0, 0, 0x44, 0, 0x20)
      success := and(
        // set success to true if call isn't reverted and returned exactly 1 (can't just be non-zero data) or nothing
        or(and(eq(mload(0), 1), eq(returndatasize(), 32)), iszero(returndatasize())),
        success
      )
      mstore(0x40, freeMemoryPointer) // restore the freeMemoryPointer
    }

    if (!success) revert IV4PoolErrors.transferFailed();
  }
}
          

/FullMath.sol

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

/// @title Contains 512-bit math functions
/// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision
/// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits
library FullMath {
  /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
  /// @param a The multiplicand
  /// @param b The multiplier
  /// @param denominator The divisor
  /// @return result The 256-bit result
  /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv
  function mulDiv(uint256 a, uint256 b, uint256 denominator) internal pure returns (uint256 result) {
    unchecked {
      // 512-bit multiply [prod1 prod0] = a * b
      // Compute the product mod 2**256 and mod 2**256 - 1
      // then use the Chinese Remainder Theorem to reconstruct
      // the 512 bit result. The result is stored in two 256
      // variables such that product = prod1 * 2**256 + prod0
      uint256 prod0 = 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
      // Subtract 256 bit remainder from 512 bit number
      assembly {
        let remainder := mulmod(a, b, denominator)
        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 {
      if (a == 0 || ((result = a * b) / a == b)) {
        require(denominator > 0);
        assembly {
          result := add(div(result, denominator), gt(mod(result, denominator), 0))
        }
      } else {
        result = mulDiv(a, b, denominator);
        if (mulmod(a, b, denominator) > 0) {
          require(result < type(uint256).max);
          result++;
        }
      }
    }
  }

  /// @notice Returns ceil(x / y)
  /// @dev division by 0 has unspecified behavior, and must be checked externally
  /// @param x The dividend
  /// @param y The divisor
  /// @return z The quotient, ceil(x / y)
  function unsafeDivRoundingUp(uint256 x, uint256 y) internal pure returns (uint256 z) {
    assembly {
      z := add(div(x, y), gt(mod(x, y), 0))
    }
  }
}
          

/IV4VaultFactory.sol

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title The interface for the V4 Vault Factory
/// @notice This contract can be used for automatic vaults creation
/// @dev Version: V4 Dex
interface IV4VaultFactory {
  /// @notice Emitted when a vault is created for a pool
  /// @param communityFeeVault The address of the community fee vault
  /// @param pool The address of the V4 Dex pool
  /// @param creator The address of the creator
  /// @param deployer The address of the deployer
  /// @param token0 The address of the first token
  /// @param token1 The address of the second token
  event VaultCreated(
    address indexed communityFeeVault,
    address indexed pool,
    address indexed creator,
    address deployer,
    address token0,
    address token1
  );

  /// @notice Emitted when the default v4 fee manager is changed
  /// @param v4FeeManager The new default v4 fee manager
  event DefaultV4FeeManager(address v4FeeManager);

  /// @notice Thrown when a vault is already created for a pool
  error vaultAlreadyExists();
  /// @notice Thrown when an address input/configuration is invalid
  error InvalidAddress();
  /// @notice Thrown when caller lacks required administrator/factory permission
  error OnlyAdministrator();

  /// @notice returns address of the community fee vault for the pool
  /// @param pool the address of V4 Dex pool
  /// @return communityFeeVault the address of community fee vault
  function getVaultForPool(address pool) external view returns (address communityFeeVault);

  /// @notice creates the community fee vault for the pool if needed
  /// @param pool the address of V4 Dex pool
  /// @return communityFeeVault the address of community fee vault
  function createVaultForPool(
    address pool,
    address creator,
    address deployer,
    address token0,
    address token1
  ) external returns (address communityFeeVault);

  /// @notice Sets default v4 fee manager applied to newly created community vaults
  /// @param newV4FeeManager The default manager address (zero address clears explicit default)
  function setDefaultV4FeeManager(address newV4FeeManager) external;
}
          

/IV4CommunityVault.sol

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title The interface for the V4 community fee vault
/// @notice Community fee from pools is sent here, if it is enabled
/// @dev Version: V4 Dex
interface IV4CommunityVault {
  /// @notice Event emitted when a fees has been claimed
  /// @param token The address of token fee
  /// @param to The address where claimed rewards were sent to
  /// @param amount The amount of fees tokens claimed by communityFeeReceiver
  event TokensWithdrawal(address indexed token, address indexed to, uint256 amount);

  /// @notice Event emitted when a fees has been claimed
  /// @param token The address of token fee
  /// @param to The address where claimed rewards were sent to
  /// @param amount The amount of fees tokens claimed by V4
  event V4TokensWithdrawal(address indexed token, address indexed to, uint256 amount);

  /// @notice Emitted when a V4FeeReceiver address changed
  /// @param newV4FeeReceiver New V4 fee receiver address
  event V4FeeReceiver(address newV4FeeReceiver);

  /// @notice Emitted when a V4FeeManager address change proposed
  /// @param pendingV4FeeManager New pending V4 fee manager address
  event PendingV4FeeManager(address pendingV4FeeManager);

  /// @notice Emitted when a new V4 fee value proposed
  /// @param proposedNewV4Fee The new proposed V4 fee value
  event V4FeeProposal(uint16 proposedNewV4Fee);

  /// @notice Emitted when a V4 fee proposal canceled
  event CancelV4FeeProposal();

  /// @notice Emitted when a V4FeeManager address changed
  /// @param newV4FeeManager New V4 fee manager address
  event V4FeeManager(address newV4FeeManager);

  /// @notice Emitted when the V4 fee is changed
  /// @param newV4Fee The new V4 fee value
  event V4Fee(uint16 newV4Fee);

  /// @notice Emitted when a CommunityFeeReceiver address changed
  /// @param newCommunityFeeReceiver New fee receiver address
  event CommunityFeeReceiver(address newCommunityFeeReceiver);

  error InvalidAddress();

  /// @notice Current community fee receiver
  function communityFeeReceiver() external view returns (address);

  /// @notice Current v4 fee receiver
  function v4FeeReceiver() external view returns (address);

  /// @notice Current v4 fee in thousandths (1000 = 100%)
  function v4Fee() external view returns (uint16);

  /// @notice Whether a v4 fee proposal is currently active
  function hasNewV4FeeProposal() external view returns (bool);

  /// @notice Withdraw protocol fees from vault
  /// @dev Can only be called by v4FeeManager or communityFeeReceiver
  /// @param token The token address
  /// @param amount The amount of token
  function withdraw(address token, uint256 amount) external;

  struct WithdrawTokensParams {
    address token;
    uint256 amount;
  }

  /// @notice Withdraw protocol fees from vault. Used to claim fees for multiple tokens
  /// @dev Can be called by v4FeeManager or communityFeeReceiver
  /// @param params Array of WithdrawTokensParams objects containing token addresses and amounts to withdraw
  function withdrawTokens(WithdrawTokensParams[] calldata params) external;

  // ### V4 factory owner permissioned actions ###

  /// @notice Accepts the proposed new V4 fee
  /// @dev Can only be called by the factory owner.
  /// The new value will also be used for previously accumulated tokens that have not yet been withdrawn
  /// @param newV4Fee New V4 fee value
  function acceptV4FeeChangeProposal(uint16 newV4Fee) external;

  /// @notice Change community fee receiver address
  /// @dev Can only be called by the factory owner
  /// @param newCommunityFeeReceiver New community fee receiver address
  function changeCommunityFeeReceiver(address newCommunityFeeReceiver) external;

  // ### V4 fee manager permissioned actions ###

  /// @notice Transfers V4 fee manager role
  /// @param _newV4FeeManager new V4 fee manager address
  function transferV4FeeManagerRole(address _newV4FeeManager) external;

  /// @notice accept V4 FeeManager role
  function acceptV4FeeManagerRole() external;

  /// @notice Proposes new V4 fee value for protocol
  /// @dev the new value will also be used for previously accumulated tokens that have not yet been withdrawn
  /// @param newV4Fee new V4 fee value
  function proposeV4FeeChange(uint16 newV4Fee) external;

  /// @notice Cancels V4 fee change proposal
  function cancelV4FeeChangeProposal() external;

  /// @notice Change V4 community fee part receiver
  /// @param newV4FeeReceiver The address of new V4 fee receiver
  function changeV4FeeReceiver(address newV4FeeReceiver) external;
}
          

/IV4PoolErrors.sol

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.8.4;

/// @title Errors emitted by a pool
/// @notice Contains custom errors emitted by the pool
/// @dev Custom errors are separated from the common pool interface for compatibility with older versions of Solidity
interface IV4PoolErrors {
  // ####  pool errors  ####

  /// @notice Emitted by the reentrancy guard
  error locked();

  /// @notice Emitted if arithmetic error occurred
  error arithmeticError();

  /// @notice Emitted if an attempt is made to initialize the pool twice
  error alreadyInitialized();

  /// @notice Emitted if an attempt is made to mint or swap in uninitialized pool
  error notInitialized();

  /// @notice Emitted if 0 is passed as amountRequired to swap function
  error zeroAmountRequired();

  /// @notice Emitted if invalid amount is passed as amountRequired to swap function
  error invalidAmountRequired();

  /// @notice Emitted if plugin fee param greater than fee/override fee
  error incorrectPluginFee();

  /// @notice Emitted if the pool received fewer tokens than it should have
  error insufficientInputAmount();

  /// @notice Emitted if there was an attempt to mint zero liquidity
  error zeroLiquidityDesired();
  /// @notice Emitted if actual amount of liquidity is zero (due to insufficient amount of tokens received)
  error zeroLiquidityActual();

  /// @notice Emitted if the pool received fewer tokens0 after flash than it should have
  error flashInsufficientPaid0();
  /// @notice Emitted if the pool received fewer tokens1 after flash than it should have
  error flashInsufficientPaid1();

  /// @notice Emitted if limitSqrtPrice param is incorrect
  error invalidLimitSqrtPrice();

  /// @notice Tick must be divisible by tickspacing
  error tickIsNotSpaced();

  /// @notice Emitted if a method is called that is accessible only to the factory owner or dedicated role
  error notAllowed();

  /// @notice Emitted if new tick spacing exceeds max allowed value
  error invalidNewTickSpacing();
  /// @notice Emitted if new community fee exceeds max allowed value
  error invalidNewCommunityFee();

  /// @notice Emitted if an attempt is made to manually change the fee value, but dynamic fee is enabled
  error dynamicFeeActive();
  /// @notice Emitted if an attempt is made by plugin to change the fee value, but dynamic fee is disabled
  error dynamicFeeDisabled();
  /// @notice Emitted if an attempt is made to change the plugin configuration, but the plugin is not connected
  error pluginIsNotConnected();
  /// @notice Emitted if an attempt is made to set plugin to zero while there are pending plugin fees
  error pluginFeesPendingToCollect();
  /// @notice Emitted if an attempt is made to set community vault to zero while there are pending community fees
  error communityFeesPendingToCollect();
  /// @notice Emitted if a plugin returns invalid selector after hook call
  /// @param expectedSelector The expected selector
  error invalidHookResponse(bytes4 expectedSelector);

  // ####  LiquidityMath errors  ####

  /// @notice Emitted if liquidity underflows
  error liquiditySub();
  /// @notice Emitted if liquidity overflows
  error liquidityAdd();

  // ####  TickManagement errors  ####

  /// @notice Emitted if the topTick param not greater then the bottomTick param
  error topTickLowerOrEqBottomTick();
  /// @notice Emitted if the bottomTick param is lower than min allowed value
  error bottomTickLowerThanMIN();
  /// @notice Emitted if the topTick param is greater than max allowed value
  error topTickAboveMAX();
  /// @notice Emitted if the liquidity value associated with the tick exceeds MAX_LIQUIDITY_PER_TICK
  error liquidityOverflow();
  /// @notice Emitted if an attempt is made to interact with an uninitialized tick
  error tickIsNotInitialized();
  /// @notice Emitted if there is an attempt to insert a new tick into the list of ticks with incorrect indexes of the previous and next ticks
  error tickInvalidLinks();

  // ####  SafeTransfer errors  ####

  /// @notice Emitted if token transfer failed internally
  error transferFailed();

  // ####  TickMath errors  ####

  /// @notice Emitted if tick is greater than the maximum or less than the minimum allowed value
  error tickOutOfRange();
  /// @notice Emitted if price is greater than the maximum or less than the minimum allowed value
  error priceOutOfRange();
}
          

/IV4PluginFactory.sol

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;

/// @title An interface for a contract that is capable of deploying V4 plugins
/// @dev Such a factory can be used for automatic plugin creation for new pools.
/// Also a factory be used as an entry point for custom (additional) pools creation
interface IV4PluginFactory {
  /// @notice Deploys new plugin contract for pool
  /// @param pool The address of the new pool
  /// @param creator The address that initiated the pool creation
  /// @param deployer The plugin factory address (0 if not used)
  /// @param token0 First token of the pool
  /// @param token1 Second token of the pool
  /// @return New plugin address
  function beforeCreatePoolHook(
    address pool,
    address creator,
    address deployer,
    address token0,
    address token1,
    bytes calldata data
  ) external returns (address);

  /// @notice Called after the pool is created
  /// @param plugin The plugin address
  /// @param pool The address of the new pool
  /// @param deployer The plugin factory address (0 if not used)
  function afterCreatePoolHook(address plugin, address pool, address deployer) external;
}
          

/IV4Factory.sol

// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity >=0.5.0;
pragma abicoder v2;

import './plugin/IV4PluginFactory.sol';
import './vault/IV4VaultFactory.sol';

/// @title The interface for the V4 Factory
/// @dev Credit to Uniswap Labs under GPL-2.0-or-later license:
/// https://github.com/Uniswap/v3-core/tree/main/contracts/interfaces
interface IV4Factory {
  /// @notice Emitted when a process of ownership renounce is started
  /// @param timestamp The timestamp of event
  /// @param finishTimestamp The timestamp when ownership renounce will be possible to finish
  event RenounceOwnershipStart(uint256 timestamp, uint256 finishTimestamp);

  /// @notice Emitted when a process of ownership renounce cancelled
  /// @param timestamp The timestamp of event
  event RenounceOwnershipStop(uint256 timestamp);

  /// @notice Emitted when a process of ownership renounce finished
  /// @param timestamp The timestamp of ownership renouncement
  event RenounceOwnershipFinish(uint256 timestamp);

  /// @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 pool The address of the created pool
  event Pool(address indexed token0, address indexed token1, address pool);

  /// @notice Emitted when a pool is created
  /// @param deployer The corresponding custom deployer contract
  /// @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 pool The address of the created pool
  event CustomPool(address indexed deployer, address indexed token0, address indexed token1, address pool);

  /// @notice Emitted when the default community fee is changed
  /// @param newDefaultCommunityFee The new default community fee value
  event DefaultCommunityFee(uint16 newDefaultCommunityFee);

  /// @notice Emitted when the default tickspacing is changed
  /// @param newDefaultTickspacing The new default tickspacing value
  event DefaultTickspacing(int24 newDefaultTickspacing);

  /// @notice Emitted when the default fee is changed
  /// @param newDefaultFee The new default fee value
  event DefaultFee(uint16 newDefaultFee);

  /// @notice Emitted when the defaultPluginFactory address is changed
  /// @param defaultPluginFactoryAddress The new defaultPluginFactory address
  event DefaultPluginFactory(address defaultPluginFactoryAddress);

  /// @notice Emitted when the vaultFactory address is changed
  /// @param newVaultFactory The new vaultFactory address
  event VaultFactory(address newVaultFactory);

  /// @notice role that can change communityFee and tickspacing in pools
  /// @return The hash corresponding to this role
  function POOLS_ADMINISTRATOR_ROLE() external view returns (bytes32);

  /// @notice role that can call `createCustomPool` function
  /// @return The hash corresponding to this role
  function CUSTOM_POOL_DEPLOYER() external view returns (bytes32);

  /// @notice Returns `true` if `account` has been granted `role` or `account` is owner.
  /// @param role The hash corresponding to the role
  /// @param account The address for which the role is checked
  /// @return bool Whether the address has this role or the owner role or not
  function hasRoleOrOwner(bytes32 role, address account) external view returns (bool);

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

  /// @notice Returns the current poolDeployerAddress
  /// @return The address of the poolDeployer
  function poolDeployer() external view returns (address);

  /// @notice Returns the default community fee
  /// @return Fee which will be set at the creation of the pool
  function defaultCommunityFee() external view returns (uint16);

  /// @notice Returns the default fee
  /// @return Fee which will be set at the creation of the pool
  function defaultFee() external view returns (uint16);

  /// @notice Returns the default tickspacing
  /// @return Tickspacing which will be set at the creation of the pool
  function defaultTickspacing() external view returns (int24);

  /// @notice Return the current pluginFactory address
  /// @dev This contract is used to automatically set a plugin address in new liquidity pools
  /// @return V4 plugin factory
  function defaultPluginFactory() external view returns (IV4PluginFactory);

  /// @notice Return the current vaultFactory address
  /// @dev This contract is used to automatically set a vault address in new liquidity pools
  /// @return V4 vault factory
  function vaultFactory() external view returns (IV4VaultFactory);

  /// @notice Returns the default communityFee, tickspacing, fee and communityFeeVault for pool
  /// @return communityFee which will be set at the creation of the pool
  /// @return tickSpacing which will be set at the creation of the pool
  /// @return fee which will be set at the creation of the pool
  function defaultConfigurationForPool() external view returns (uint16 communityFee, int24 tickSpacing, uint16 fee);

  /// @notice Deterministically computes the pool address given the token0 and token1
  /// @dev The method does not check if such a pool has been created
  /// @param token0 first token
  /// @param token1 second token
  /// @return pool The contract address of the V4 pool
  function computePoolAddress(address token0, address token1) external view returns (address pool);

  /// @notice Deterministically computes the custom pool address given the customDeployer, token0 and token1
  /// @dev The method does not check if such a pool has been created
  /// @param customDeployer the address of the custom plugin factory used to namespace pools
  /// @param token0 first token
  /// @param token1 second token
  /// @return customPool The contract address of the V4 pool
  function computeCustomPoolAddress(address customDeployer, address token0, address token1) external view returns (address customPool);

  /// @notice Returns the pool address for a given pair of tokens, 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
  /// @return pool The pool address
  function poolByPair(address tokenA, address tokenB) external view returns (address pool);

  /// @notice Returns the custom pool address for a customDeployer and a given pair of tokens, or address 0 if it does not exist
  /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order
  /// @param customDeployer The custom plugin factory address used to namespace custom pools
  /// @param tokenA The contract address of either token0 or token1
  /// @param tokenB The contract address of the other token
  /// @return customPool The pool address
  function customPoolByPair(address customDeployer, address tokenA, address tokenB) external view returns (address customPool);

  /// @notice returns keccak256 of V4Pool init bytecode.
  /// @dev the hash value changes with any change in the pool bytecode
  /// @return Keccak256 hash of V4Pool contract init bytecode
  function POOL_INIT_CODE_HASH() external view returns (bytes32);

  /// @return timestamp The timestamp of the beginning of the renounceOwnership process
  function renounceOwnershipStartTimestamp() external view returns (uint256 timestamp);

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

  /// @notice Creates a custom pool for the given two tokens using `deployer` contract
  /// @dev `msg.sender` is expected to be the plugin entry point (e.g. V4CustomPoolEntryPoint) that implements
  /// IV4PluginFactory hooks. The `deployer` argument is forwarded to that entry point and used as the namespace
  /// for deterministic pool address calculation and as the ultimate plugin factory address.
  /// @param deployer The address of the custom plugin factory; used for namespacing and forwarded to hooks by the caller
  /// @param creator The initiator of custom pool creation
  /// @param tokenA One of the two tokens in the desired pool
  /// @param tokenB The other of the two tokens in the desired pool
  /// @param data The additional data bytes
  /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0.
  /// The call will revert if the pool already exists or the token arguments are invalid.
  /// @return customPool The address of the newly created custom pool
  function createCustomPool(
    address deployer,
    address creator,
    address tokenA,
    address tokenB,
    bytes calldata data
  ) external returns (address customPool);

  /// @dev updates default community fee for new pools
  /// @param newDefaultCommunityFee The new community fee, _must_ be <= MAX_COMMUNITY_FEE
  function setDefaultCommunityFee(uint16 newDefaultCommunityFee) external;

  /// @dev updates default fee for new pools
  /// @param newDefaultFee The new  fee, _must_ be <= MAX_DEFAULT_FEE
  function setDefaultFee(uint16 newDefaultFee) external;

  /// @dev updates default tickspacing for new pools
  /// @param newDefaultTickspacing The new tickspacing, _must_ be <= MAX_TICK_SPACING and >= MIN_TICK_SPACING
  function setDefaultTickspacing(int24 newDefaultTickspacing) external;

  /// @dev updates pluginFactory address
  /// @param newDefaultPluginFactory address of new plugin factory
  function setDefaultPluginFactory(address newDefaultPluginFactory) external;

  /// @dev updates vaultFactory address
  /// @param newVaultFactory address of new vault factory
  function setVaultFactory(address newVaultFactory) external;

  /// @notice Starts process of renounceOwnership. After that, a certain period
  /// of time must pass before the ownership renounce can be completed.
  function startRenounceOwnership() external;

  /// @notice Stops process of renounceOwnership and removes timer.
  function stopRenounceOwnership() external;
}
          

/V4CommunityVault.sol

// SPDX-License-Identifier: BUSL-1.1
pragma solidity =0.8.20;

import './libraries/SafeTransfer.sol';
import './libraries/FullMath.sol';

import './interfaces/IV4Factory.sol';
import './interfaces/vault/IV4CommunityVault.sol';

/// @title V4 community fee vault
/// @notice Community fee from pools is sent here, if it is enabled
/// @dev Role system is used to withdraw tokens
/// @dev Version: 1.0
contract V4CommunityVault is IV4CommunityVault {
  /// @dev The role can be granted in V4Factory
  bytes32 public constant COMMUNITY_FEE_WITHDRAWER_ROLE = keccak256('COMMUNITY_FEE_WITHDRAWER');
  /// @dev The role can be granted in V4Factory
  bytes32 public constant COMMUNITY_FEE_VAULT_ADMINISTRATOR = keccak256('COMMUNITY_FEE_VAULT_ADMINISTRATOR');
  address private immutable factory;

  /// @notice Address to which community fees are sent from vault
  address public communityFeeReceiver;
  /// @notice The percentage of the protocol fee that V4 will receive
  /// @dev Value in thousandths,i.e. 1e-3
  uint16 public v4Fee;
  /// @notice Represents whether there is a new V4 fee proposal or not
  bool public hasNewV4FeeProposal;
  /// @notice Suggested V4 fee value
  uint16 public proposedNewV4Fee;
  /// @notice Address of recipient V4 part of community fee
  address public v4FeeReceiver;
  /// @notice Address of V4 fee manager
  address public v4FeeManager;
  address private _pendingV4FeeManager;

  uint16 private constant FEE_DENOMINATOR = 1000;

  modifier onlyAdministrator() {
    require(IV4Factory(factory).hasRoleOrOwner(COMMUNITY_FEE_VAULT_ADMINISTRATOR, msg.sender), 'only administrator');
    _;
  }

  modifier onlyWithdrawer() {
    require(msg.sender == v4FeeManager || IV4Factory(factory).hasRoleOrOwner(COMMUNITY_FEE_WITHDRAWER_ROLE, msg.sender), 'only withdrawer');
    _;
  }

  modifier onlyV4FeeManager() {
    require(msg.sender == v4FeeManager, 'only switchx fee manager');
    _;
  }

  constructor(address _factory, address _v4FeeManager) {
    if (_factory == address(0)) revert InvalidAddress();
    if (_v4FeeManager == address(0)) revert InvalidAddress();
    (factory, v4FeeManager) = (_factory, _v4FeeManager);
  }

  /// @inheritdoc IV4CommunityVault
  function withdraw(address token, uint256 amount) external override onlyWithdrawer {
    (uint16 _v4Fee, address _v4FeeReceiver, address _communityFeeReceiver) = _readAndVerifyWithdrawSettings();
    _withdraw(token, _communityFeeReceiver, amount, _v4Fee, _v4FeeReceiver);
  }

  /// @inheritdoc IV4CommunityVault
  function withdrawTokens(WithdrawTokensParams[] calldata params) external override onlyWithdrawer {
    uint256 paramsLength = params.length;
    (uint16 _v4Fee, address _v4FeeReceiver, address _communityFeeReceiver) = _readAndVerifyWithdrawSettings();

    unchecked {
      for (uint256 i; i < paramsLength; ++i) _withdraw(params[i].token, _communityFeeReceiver, params[i].amount, _v4Fee, _v4FeeReceiver);
    }
  }

  function _readAndVerifyWithdrawSettings() private view returns (uint16 _v4Fee, address _v4FeeReceiver, address _communityFeeReceiver) {
    (_v4Fee, _v4FeeReceiver, _communityFeeReceiver) = (v4Fee, v4FeeReceiver, communityFeeReceiver);
    if (_v4Fee != 0) require(_v4FeeReceiver != address(0), 'invalid switchx fee receiver');
    require(_communityFeeReceiver != address(0), 'invalid receiver');
  }

  function _withdraw(address token, address to, uint256 amount, uint16 _v4Fee, address _v4FeeReceiver) private {
    uint256 withdrawAmount = amount;
    if (_v4Fee != 0) {
      uint256 v4FeeAmount = FullMath.mulDivRoundingUp(withdrawAmount, _v4Fee, FEE_DENOMINATOR);
      withdrawAmount -= v4FeeAmount;
      SafeTransfer.safeTransfer(token, _v4FeeReceiver, v4FeeAmount);
      emit V4TokensWithdrawal(token, _v4FeeReceiver, v4FeeAmount);
    }

    SafeTransfer.safeTransfer(token, to, withdrawAmount);
    emit TokensWithdrawal(token, to, withdrawAmount);
  }

  // ### switchx factory owner permissioned actions ###

  /// @inheritdoc IV4CommunityVault
  function acceptV4FeeChangeProposal(uint16 newV4Fee) external override onlyAdministrator {
    require(hasNewV4FeeProposal, 'not proposed');
    require(newV4Fee == proposedNewV4Fee, 'invalid new fee');
    if (newV4Fee != 0) require(v4FeeReceiver != address(0), 'missing switchx fee receiver');
    require(communityFeeReceiver != address(0), 'missing community fee receiver');

    // note that the new value will be used for previously accumulated tokens that have not yet been withdrawn
    v4Fee = newV4Fee;
    (proposedNewV4Fee, hasNewV4FeeProposal) = (0, false);
    emit V4Fee(newV4Fee);
  }

  /// @inheritdoc IV4CommunityVault
  function changeCommunityFeeReceiver(address newCommunityFeeReceiver) external override onlyAdministrator {
    require(newCommunityFeeReceiver != address(0));
    require(newCommunityFeeReceiver != communityFeeReceiver);
    communityFeeReceiver = newCommunityFeeReceiver;
    emit CommunityFeeReceiver(newCommunityFeeReceiver);
  }

  // ### SwitchX fee manager permissioned actions ###

  /// @inheritdoc IV4CommunityVault
  function transferV4FeeManagerRole(address _newV4FeeManager) external override onlyV4FeeManager {
    _pendingV4FeeManager = _newV4FeeManager;
    emit PendingV4FeeManager(_newV4FeeManager);
  }

  /// @inheritdoc IV4CommunityVault
  function acceptV4FeeManagerRole() external override {
    require(msg.sender == _pendingV4FeeManager);
    (_pendingV4FeeManager, v4FeeManager) = (address(0), msg.sender);
    emit V4FeeManager(msg.sender);
  }

  /// @inheritdoc IV4CommunityVault
  function proposeV4FeeChange(uint16 newV4Fee) external override onlyV4FeeManager {
    require(newV4Fee <= FEE_DENOMINATOR);
    require(newV4Fee != proposedNewV4Fee && newV4Fee != v4Fee);
    (proposedNewV4Fee, hasNewV4FeeProposal) = (newV4Fee, true);
    emit V4FeeProposal(newV4Fee);
  }

  /// @inheritdoc IV4CommunityVault
  function cancelV4FeeChangeProposal() external override onlyV4FeeManager {
    (proposedNewV4Fee, hasNewV4FeeProposal) = (0, false);
    emit CancelV4FeeProposal();
  }

  /// @inheritdoc IV4CommunityVault
  function changeV4FeeReceiver(address newV4FeeReceiver) external override onlyV4FeeManager {
    require(newV4FeeReceiver != address(0));
    require(newV4FeeReceiver != v4FeeReceiver);
    v4FeeReceiver = newV4FeeReceiver;
    emit V4FeeReceiver(newV4FeeReceiver);
  }
}
          

/SignedMath.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard signed math utilities missing in the Solidity language.
 */
library SignedMath {
    /**
     * @dev Returns the largest of two signed numbers.
     */
    function max(int256 a, int256 b) internal pure returns (int256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two signed numbers.
     */
    function min(int256 a, int256 b) internal pure returns (int256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two signed numbers without overflow.
     * The result is rounded towards zero.
     */
    function average(int256 a, int256 b) internal pure returns (int256) {
        // Formula from the book "Hacker's Delight"
        int256 x = (a & b) + ((a ^ b) >> 1);
        return x + (int256(uint256(x) >> 255) & (a ^ b));
    }

    /**
     * @dev Returns the absolute unsigned value of a signed value.
     */
    function abs(int256 n) internal pure returns (uint256) {
        unchecked {
            // must be unchecked in order to support `n = type(int256).min`
            return uint256(n >= 0 ? n : -n);
        }
    }
}
          

/Math.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)

pragma solidity ^0.8.0;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    enum Rounding {
        Down, // Toward negative infinity
        Up, // Toward infinity
        Zero // Toward zero
    }

    /**
     * @dev Returns the largest of two numbers.
     */
    function max(uint256 a, uint256 b) internal pure returns (uint256) {
        return a > b ? a : b;
    }

    /**
     * @dev Returns the smallest of two numbers.
     */
    function min(uint256 a, uint256 b) internal pure returns (uint256) {
        return a < b ? a : b;
    }

    /**
     * @dev Returns the average of two numbers. The result is rounded towards
     * zero.
     */
    function average(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b) / 2 can overflow.
        return (a & b) + (a ^ b) / 2;
    }

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds up instead
     * of rounding down.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

    /**
     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
     * with further edits by Uniswap Labs also under MIT license.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
        unchecked {
            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
            // variables such that product = prod1 * 2^256 + prod0.
            uint256 prod0; // Least significant 256 bits of the product
            uint256 prod1; // Most significant 256 bits of the product
            assembly {
                let mm := mulmod(x, y, not(0))
                prod0 := mul(x, y)
                prod1 := sub(sub(mm, prod0), lt(mm, prod0))
            }

            // Handle non-overflow cases, 256 by 256 division.
            if (prod1 == 0) {
                // Solidity will revert if denominator == 0, unlike the div opcode on its own.
                // The surrounding unchecked block does not change this fact.
                // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
                return prod0 / denominator;
            }

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            require(denominator > prod1, "Math: mulDiv overflow");

            ///////////////////////////////////////////////
            // 512 by 256 division.
            ///////////////////////////////////////////////

            // Make division exact by subtracting the remainder from [prod1 prod0].
            uint256 remainder;
            assembly {
                // Compute remainder using mulmod.
                remainder := mulmod(x, y, denominator)

                // Subtract 256 bit number from 512 bit number.
                prod1 := sub(prod1, gt(remainder, prod0))
                prod0 := sub(prod0, remainder)
            }

            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
            // See https://cs.stackexchange.com/q/138556/92363.

            // Does not overflow because the denominator cannot be zero at this stage in the function.
            uint256 twos = denominator & (~denominator + 1);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

                // Divide [prod1 prod0] by twos.
                prod0 := div(prod0, twos)

                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
                twos := add(div(sub(0, twos), twos), 1)
            }

            // Shift in bits from prod1 into prod0.
            prod0 |= prod1 * twos;

            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
            // four bits. That is, denominator * inv = 1 mod 2^4.
            uint256 inverse = (3 * denominator) ^ 2;

            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
            // in modular arithmetic, doubling the correct bits in each step.
            inverse *= 2 - denominator * inverse; // inverse mod 2^8
            inverse *= 2 - denominator * inverse; // inverse mod 2^16
            inverse *= 2 - denominator * inverse; // inverse mod 2^32
            inverse *= 2 - denominator * inverse; // inverse mod 2^64
            inverse *= 2 - denominator * inverse; // inverse mod 2^128
            inverse *= 2 - denominator * inverse; // inverse mod 2^256

            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
            // is no longer required.
            result = prod0 * inverse;
            return result;
        }
    }

    /**
     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
     */
    function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
        uint256 result = mulDiv(x, y, denominator);
        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
            result += 1;
        }
        return result;
    }

    /**
     * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
     *
     * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
     */
    function sqrt(uint256 a) internal pure returns (uint256) {
        if (a == 0) {
            return 0;
        }

        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
        //
        // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
        // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
        //
        // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
        // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
        // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
        //
        // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
        uint256 result = 1 << (log2(a) >> 1);

        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
        // into the expected uint128 result.
        unchecked {
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            result = (result + a / result) >> 1;
            return min(result, a / result);
        }
    }

    /**
     * @notice Calculates sqrt(a), following the selected rounding direction.
     */
    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = sqrt(a);
            return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 2, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 128;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 64;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 32;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 16;
            }
            if (value >> 8 > 0) {
                value >>= 8;
                result += 8;
            }
            if (value >> 4 > 0) {
                value >>= 4;
                result += 4;
            }
            if (value >> 2 > 0) {
                value >>= 2;
                result += 2;
            }
            if (value >> 1 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 2, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log2(value);
            return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 10, rounded down, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >= 10 ** 64) {
                value /= 10 ** 64;
                result += 64;
            }
            if (value >= 10 ** 32) {
                value /= 10 ** 32;
                result += 32;
            }
            if (value >= 10 ** 16) {
                value /= 10 ** 16;
                result += 16;
            }
            if (value >= 10 ** 8) {
                value /= 10 ** 8;
                result += 8;
            }
            if (value >= 10 ** 4) {
                value /= 10 ** 4;
                result += 4;
            }
            if (value >= 10 ** 2) {
                value /= 10 ** 2;
                result += 2;
            }
            if (value >= 10 ** 1) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 10, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log10(value);
            return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
        }
    }

    /**
     * @dev Return the log in base 256, rounded down, of a positive value.
     * Returns 0 if given 0.
     *
     * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
     */
    function log256(uint256 value) internal pure returns (uint256) {
        uint256 result = 0;
        unchecked {
            if (value >> 128 > 0) {
                value >>= 128;
                result += 16;
            }
            if (value >> 64 > 0) {
                value >>= 64;
                result += 8;
            }
            if (value >> 32 > 0) {
                value >>= 32;
                result += 4;
            }
            if (value >> 16 > 0) {
                value >>= 16;
                result += 2;
            }
            if (value >> 8 > 0) {
                result += 1;
            }
        }
        return result;
    }

    /**
     * @dev Return the log in base 256, following the selected rounding direction, of a positive value.
     * Returns 0 if given 0.
     */
    function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
        unchecked {
            uint256 result = log256(value);
            return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
        }
    }
}
          

/IERC165.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[EIP].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
          

/ERC165.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)

pragma solidity ^0.8.0;

import "./IERC165.sol";

/**
 * @dev Implementation of the {IERC165} interface.
 *
 * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
 * for the additional interface id that will be supported. For example:
 *
 * ```solidity
 * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
 *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
 * }
 * ```
 *
 * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
 */
abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}
          

/Strings.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)

pragma solidity ^0.8.0;

import "./math/Math.sol";
import "./math/SignedMath.sol";

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _SYMBOLS = "0123456789abcdef";
    uint8 private constant _ADDRESS_LENGTH = 20;

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        unchecked {
            uint256 length = Math.log10(value) + 1;
            string memory buffer = new string(length);
            uint256 ptr;
            /// @solidity memory-safe-assembly
            assembly {
                ptr := add(buffer, add(32, length))
            }
            while (true) {
                ptr--;
                /// @solidity memory-safe-assembly
                assembly {
                    mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
                }
                value /= 10;
                if (value == 0) break;
            }
            return buffer;
        }
    }

    /**
     * @dev Converts a `int256` to its ASCII `string` decimal representation.
     */
    function toString(int256 value) internal pure returns (string memory) {
        return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        unchecked {
            return toHexString(value, Math.log256(value) + 1);
        }
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }

    /**
     * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
     */
    function toHexString(address addr) internal pure returns (string memory) {
        return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
    }

    /**
     * @dev Returns true if the two strings are equal.
     */
    function equal(string memory a, string memory b) internal pure returns (bool) {
        return keccak256(bytes(a)) == keccak256(bytes(b));
    }
}
          

/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;
    }
}
          

/IAccessControl.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)

pragma solidity ^0.8.0;

/**
 * @dev External interface of AccessControl declared to support ERC165 detection.
 */
interface IAccessControl {
    /**
     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
     *
     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
     * {RoleAdminChanged} not being emitted signaling this.
     *
     * _Available since v3.1._
     */
    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);

    /**
     * @dev Emitted when `account` is granted `role`.
     *
     * `sender` is the account that originated the contract call, an admin role
     * bearer except when using {AccessControl-_setupRole}.
     */
    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Emitted when `account` is revoked `role`.
     *
     * `sender` is the account that originated the contract call:
     *   - if using `revokeRole`, it is the admin role bearer
     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)
     */
    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) external view returns (bool);

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {AccessControl-_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) external view returns (bytes32);

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function grantRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     */
    function revokeRole(bytes32 role, address account) external;

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been granted `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     */
    function renounceRole(bytes32 role, address account) external;
}
          

/AccessControl.sol

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)

pragma solidity ^0.8.0;

import "./IAccessControl.sol";
import "../utils/Context.sol";
import "../utils/Strings.sol";
import "../utils/introspection/ERC165.sol";

/**
 * @dev Contract module that allows children to implement role-based access
 * control mechanisms. This is a lightweight version that doesn't allow enumerating role
 * members except through off-chain means by accessing the contract event logs. Some
 * applications may benefit from on-chain enumerability, for those cases see
 * {AccessControlEnumerable}.
 *
 * Roles are referred to by their `bytes32` identifier. These should be exposed
 * in the external API and be unique. The best way to achieve this is by
 * using `public constant` hash digests:
 *
 * ```solidity
 * bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
 * ```
 *
 * Roles can be used to represent a set of permissions. To restrict access to a
 * function call, use {hasRole}:
 *
 * ```solidity
 * function foo() public {
 *     require(hasRole(MY_ROLE, msg.sender));
 *     ...
 * }
 * ```
 *
 * Roles can be granted and revoked dynamically via the {grantRole} and
 * {revokeRole} functions. Each role has an associated admin role, and only
 * accounts that have a role's admin role can call {grantRole} and {revokeRole}.
 *
 * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
 * that only accounts with this role will be able to grant or revoke other
 * roles. More complex role relationships can be created by using
 * {_setRoleAdmin}.
 *
 * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
 * grant and revoke this role. Extra precautions should be taken to secure
 * accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
 * to enforce additional security measures for this role.
 */
abstract contract AccessControl is Context, IAccessControl, ERC165 {
    struct RoleData {
        mapping(address => bool) members;
        bytes32 adminRole;
    }

    mapping(bytes32 => RoleData) private _roles;

    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;

    /**
     * @dev Modifier that checks that an account has a specific role. Reverts
     * with a standardized message including the required role.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     *
     * _Available since v4.1._
     */
    modifier onlyRole(bytes32 role) {
        _checkRole(role);
        _;
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
    }

    /**
     * @dev Returns `true` if `account` has been granted `role`.
     */
    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
        return _roles[role].members[account];
    }

    /**
     * @dev Revert with a standard message if `_msgSender()` is missing `role`.
     * Overriding this function changes the behavior of the {onlyRole} modifier.
     *
     * Format of the revert message is described in {_checkRole}.
     *
     * _Available since v4.6._
     */
    function _checkRole(bytes32 role) internal view virtual {
        _checkRole(role, _msgSender());
    }

    /**
     * @dev Revert with a standard message if `account` is missing `role`.
     *
     * The format of the revert reason is given by the following regular expression:
     *
     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
     */
    function _checkRole(bytes32 role, address account) internal view virtual {
        if (!hasRole(role, account)) {
            revert(
                string(
                    abi.encodePacked(
                        "AccessControl: account ",
                        Strings.toHexString(account),
                        " is missing role ",
                        Strings.toHexString(uint256(role), 32)
                    )
                )
            );
        }
    }

    /**
     * @dev Returns the admin role that controls `role`. See {grantRole} and
     * {revokeRole}.
     *
     * To change a role's admin, use {_setRoleAdmin}.
     */
    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
        return _roles[role].adminRole;
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleGranted} event.
     */
    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _grantRole(role, account);
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * If `account` had been granted `role`, emits a {RoleRevoked} event.
     *
     * Requirements:
     *
     * - the caller must have ``role``'s admin role.
     *
     * May emit a {RoleRevoked} event.
     */
    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
        _revokeRole(role, account);
    }

    /**
     * @dev Revokes `role` from the calling account.
     *
     * Roles are often managed via {grantRole} and {revokeRole}: this function's
     * purpose is to provide a mechanism for accounts to lose their privileges
     * if they are compromised (such as when a trusted device is misplaced).
     *
     * If the calling account had been revoked `role`, emits a {RoleRevoked}
     * event.
     *
     * Requirements:
     *
     * - the caller must be `account`.
     *
     * May emit a {RoleRevoked} event.
     */
    function renounceRole(bytes32 role, address account) public virtual override {
        require(account == _msgSender(), "AccessControl: can only renounce roles for self");

        _revokeRole(role, account);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * If `account` had not been already granted `role`, emits a {RoleGranted}
     * event. Note that unlike {grantRole}, this function doesn't perform any
     * checks on the calling account.
     *
     * May emit a {RoleGranted} event.
     *
     * [WARNING]
     * ====
     * This function should only be called from the constructor when setting
     * up the initial roles for the system.
     *
     * Using this function in any other way is effectively circumventing the admin
     * system imposed by {AccessControl}.
     * ====
     *
     * NOTE: This function is deprecated in favor of {_grantRole}.
     */
    function _setupRole(bytes32 role, address account) internal virtual {
        _grantRole(role, account);
    }

    /**
     * @dev Sets `adminRole` as ``role``'s admin role.
     *
     * Emits a {RoleAdminChanged} event.
     */
    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
        bytes32 previousAdminRole = getRoleAdmin(role);
        _roles[role].adminRole = adminRole;
        emit RoleAdminChanged(role, previousAdminRole, adminRole);
    }

    /**
     * @dev Grants `role` to `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleGranted} event.
     */
    function _grantRole(bytes32 role, address account) internal virtual {
        if (!hasRole(role, account)) {
            _roles[role].members[account] = true;
            emit RoleGranted(role, account, _msgSender());
        }
    }

    /**
     * @dev Revokes `role` from `account`.
     *
     * Internal function without access restriction.
     *
     * May emit a {RoleRevoked} event.
     */
    function _revokeRole(bytes32 role, address account) internal virtual {
        if (hasRole(role, account)) {
            _roles[role].members[account] = false;
            emit RoleRevoked(role, account, _msgSender());
        }
    }
}
          

Compiler Settings

{"remappings":[],"optimizer":{"runs":800,"enabled":true},"metadata":{"bytecodeHash":"none"},"libraries":{},"evmVersion":"paris","compilationTarget":{"contracts/V4VaultFactory.sol":"V4VaultFactory"}}
              

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_factory","internalType":"address"}]},{"type":"error","name":"InvalidAddress","inputs":[]},{"type":"error","name":"OnlyAdministrator","inputs":[]},{"type":"error","name":"vaultAlreadyExists","inputs":[]},{"type":"event","name":"DefaultV4FeeManager","inputs":[{"type":"address","name":"v4FeeManager","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"previousAdminRole","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"newAdminRole","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"VaultCreated","inputs":[{"type":"address","name":"communityFeeVault","internalType":"address","indexed":true},{"type":"address","name":"pool","internalType":"address","indexed":true},{"type":"address","name":"creator","internalType":"address","indexed":true},{"type":"address","name":"deployer","internalType":"address","indexed":false},{"type":"address","name":"token0","internalType":"address","indexed":false},{"type":"address","name":"token1","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"COMMUNITY_FEE_VAULT_ADMINISTRATOR","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"address","name":"communityFeeVault","internalType":"address"}],"name":"createVaultForPool","inputs":[{"type":"address","name":"pool","internalType":"address"},{"type":"address","name":"creator","internalType":"address"},{"type":"address","name":"deployer","internalType":"address"},{"type":"address","name":"token0","internalType":"address"},{"type":"address","name":"token1","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"defaultV4FeeManager","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"factory","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getVaultForPool","inputs":[{"type":"address","name":"pool","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setDefaultV4FeeManager","inputs":[{"type":"address","name":"newV4FeeManager","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"vault","inputs":[{"type":"address","name":"_pool","internalType":"address"}]}]
              

Contract Creation Code

Verify & Publish
0x60a060405234801561001057600080fd5b506040516122623803806122628339818101604052602081101561003357600080fd5b50516001600160a01b03811661005c5760405163e6c4247b60e01b815260040160405180910390fd5b6001600160a01b03166080526080516121ae6100b4600039600081816102e6015281816104cb01528181610540015281816105e4015281816106720152818161071a0152818161085d01526108d101526121ae6000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063a22e35791161008c578063c45a015511610066578063c45a0155146102e1578063c740a9f514610308578063d547741f1461032e578063f815c03d1461035a57600080fd5b8063a22e35791461025f578063b8a1d3c614610272578063bbac3b8d146102ba57600080fd5b806336568abe116100c857806336568abe146101975780637570e389146101c357806391d1485414610215578063a217fddf1461025757600080fd5b806301ffc9a7146100ef578063248a9ca31461012a5780632f2ff15d14610169575b600080fd5b6101166004803603602081101561010557600080fd5b50356001600160e01b031916610390565b604080519115158252519081900360200190f35b6101576004803603602081101561014057600080fd5b503560009081526020819052604090206001015490565b60408051918252519081900360200190f35b6101956004803603604081101561017f57600080fd5b50803590602001356001600160a01b03166103c7565b005b610195600480360360408110156101ad57600080fd5b50803590602001356001600160a01b03166103f1565b6101f9600480360360208110156101d957600080fd5b50356001600160a01b039081166000908152600260205260409020541690565b604080516001600160a01b039092168252519081900360200190f35b6101166004803603604081101561022b57600080fd5b508035600090815260208181526040808320938201356001600160a01b03168352929052205460ff1690565b610157600081565b6001546101f9906001600160a01b031681565b6101f9600480360360a081101561028857600080fd5b506001600160a01b03813581169160208101358216916040820135811691606081013582169160809091013516610482565b6101577f63e58c34d94475ba3fc063e19800b940485850d84d09cd3c1f2c14192c559a6881565b6101f97f000000000000000000000000000000000000000000000000000000000000000081565b6101956004803603602081101561031e57600080fd5b50356001600160a01b0316610817565b6101956004803603604081101561034457600080fd5b50803590602001356001600160a01b031661098a565b6101f96004803603602081101561037057600080fd5b5060026020526001600160a01b0390358116600090815260409020541681565b60006001600160e01b03198216637965db0b60e01b14806103c157506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000828152602081905260409020600101546103e2816109af565b6103ec83836109bc565b505050565b6001600160a01b03811633146104745760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b61047e8282610a5a565b5050565b6040805163e8ae2b6960e01b81527f63e58c34d94475ba3fc063e19800b940485850d84d09cd3c1f2c14192c559a68600482015233602482015290516000916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e8ae2b69916044808201926020929091908290030181865afa158015610517573d6000803e3d6000fd5b505050506040513d602081101561052d57600080fd5b5051806105625750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b610598576040517fff512cd000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0386811660009081526002602052604090205416156105d157604051630b50fed960e21b815260040160405180910390fd5b6001546001600160a01b0316806106b4577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610640573d6000803e3d6000fd5b505050506040513d602081101561065657600080fd5b505190506001600160a01b0381166106b4576001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633036106b15760405163e6c4247b60e01b815260040160405180910390fd5b50335b60408051606089811b6bffffffffffffffffffffffff199081166020808501919091528a831b8216603485015289831b8216604885015288831b8216605c8501529187901b166070830152825180830360640181526084909201928390528151910120907f000000000000000000000000000000000000000000000000000000000000000090839061074590610d0e565b6001600160a01b03928316815291166020820152604080518392819003909101906000f590508015801561077d573d6000803e3d6000fd5b506001600160a01b03808916600081815260026020908152604091829020805485871673ffffffffffffffffffffffffffffffffffffffff19909116811790915582518b861681528a861692810192909252888516828401529151949650928a1693919290917f16009f0dfe8f8fbbc65a0e5fe924094336de344edd37c037a074875a84eb17649181900360600190a45095945050505050565b6040805163e8ae2b6960e01b81527f63e58c34d94475ba3fc063e19800b940485850d84d09cd3c1f2c14192c559a68600482015233602482015290516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e8ae2b699160448083019260209291908290030181865afa1580156108a8573d6000803e3d6000fd5b505050506040513d60208110156108be57600080fd5b5051806108f35750336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016145b610929576040517fff512cd000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180546001600160a01b03831673ffffffffffffffffffffffffffffffffffffffff19909116811790915560408051918252517f078774c760378fc88a81c17fd4ed865eb4ae532c693ad7fb4dccee5d9f18d2cb9181900360200190a150565b6000828152602081905260409020600101546109a5816109af565b6103ec8383610a5a565b6109b98133610ad9565b50565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1661047e576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610a163390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff161561047e576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1661047e57610b0a81610b4c565b610b15836020610b5e565b604051602001610b26929190610d3f565b60408051601f198184030181529082905262461bcd60e51b825261046b91600401610dc0565b60606103c16001600160a01b03831660145b60606000610b6d836002610e09565b610b78906002610e20565b67ffffffffffffffff811115610b9057610b90610e33565b6040519080825280601f01601f191660200182016040528015610bba576020820181803683370190505b509050600360fc1b81600081518110610bd557610bd5610e49565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610c0457610c04610e49565b60200101906001600160f81b031916908160001a9053506000610c28846002610e09565b610c33906001610e20565b90505b6001811115610cb8577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110610c7457610c74610e49565b1a60f81b828281518110610c8a57610c8a610e49565b60200101906001600160f81b031916908160001a90535060049490941c93610cb181610e5f565b9050610c36565b508315610d075760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161046b565b9392505050565b61132b80610e7783390190565b60005b83811015610d36578181015183820152602001610d1e565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351610d77816017850160208801610d1b565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351610db4816028840160208801610d1b565b01602801949350505050565b6020815260008251806020840152610ddf816040850160208701610d1b565b601f01601f19169190910160400192915050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176103c1576103c1610df3565b808201808211156103c1576103c1610df3565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081610e6e57610e6e610df3565b50600019019056fe60a060405234801561001057600080fd5b5060405161132b38038061132b83398101604081905261002f916100be565b6001600160a01b0382166100565760405163e6c4247b60e01b815260040160405180910390fd5b6001600160a01b03811661007d5760405163e6c4247b60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b03928316179055166080526100f1565b80516001600160a01b03811681146100b957600080fd5b919050565b600080604083850312156100d157600080fd5b6100da836100a2565b91506100e8602084016100a2565b90509250929050565b60805161120a610121600039600081816103050152818161087101528181610a8d0152610c76015261120a6000f3fe608060405234801561001057600080fd5b506004361061011b5760003560e01c8063a4bb2920116100b2578063cc913a4111610081578063edc0975711610066578063edc097571461029c578063f3fef3a3146102a4578063f7e0d526146102b757600080fd5b8063cc913a4114610265578063dfadc7941461028957600080fd5b8063a4bb292014610210578063b5f680ae14610223578063bbac3b8d14610236578063c4b60ce71461025d57600080fd5b8063371abc95116100ee578063371abc95146101c2578063432604fa146101d55780639c1c6d60146101ea5780639ef3c2a0146101fd57600080fd5b8063063c7c2714610120578063113cd2a1146101505780631a169492146101655780631de416131461018d575b600080fd5b600154610133906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61016361015e36600461108e565b6102ca565b005b60005461017a90600160b81b900461ffff1681565b60405161ffff9091168152602001610147565b6101b47fb77a63f119f4dc2174dc6c76fc1a1565fa4f2b0dde50ed5c0465471cd9b331f681565b604051908152602001610147565b600054610133906001600160a01b031681565b60005461017a90600160a01b900461ffff1681565b6101636101f83660046110ce565b6105b5565b61016361020b36600461108e565b61065d565b61016361021e3660046110ce565b610760565b6101636102313660046110ce565b610836565b6101b47f63e58c34d94475ba3fc063e19800b940485850d84d09cd3c1f2c14192c559a6881565b6101636109ac565b60005461027990600160b01b900460ff1681565b6040519015158152602001610147565b6101636102973660046110e9565b610a3e565b610163610bbc565b6101636102b236600461115e565b610c27565b600254610133906001600160a01b031681565b60405163e8ae2b6960e01b81527f63e58c34d94475ba3fc063e19800b940485850d84d09cd3c1f2c14192c559a6860048201523360248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063e8ae2b6990604401602060405180830381865afa158015610354573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103789190611188565b6103c95760405162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e6973747261746f72000000000000000000000000000060448201526064015b60405180910390fd5b600054600160b01b900460ff166104225760405162461bcd60e51b815260206004820152600c60248201527f6e6f742070726f706f736564000000000000000000000000000000000000000060448201526064016103c0565b60005461ffff828116600160b81b90920416146104815760405162461bcd60e51b815260206004820152600f60248201527f696e76616c6964206e657720666565000000000000000000000000000000000060448201526064016103c0565b61ffff8116156104e3576001546001600160a01b03166104e35760405162461bcd60e51b815260206004820152601c60248201527f6d697373696e672073776974636878206665652072656365697665720000000060448201526064016103c0565b6000546001600160a01b031661053b5760405162461bcd60e51b815260206004820152601e60248201527f6d697373696e6720636f6d6d756e69747920666565207265636569766572000060448201526064016103c0565b600080547fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b61ffff841690810262ffffff60b01b1916919091179091556040519081527f91c000bd4b73da243840e9ce4151f5f119a51d86529a5fb922ae9131493a7f77906020015b60405180910390a150565b6002546001600160a01b0316331461060f5760405162461bcd60e51b815260206004820152601860248201527f6f6e6c79207377697463687820666565206d616e61676572000000000000000060448201526064016103c0565b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527ffac690777b4a5eed44435607f80a7bdd44a1020191d23110a6fe5a07cdf57418906020016105aa565b6002546001600160a01b031633146106b75760405162461bcd60e51b815260206004820152601860248201527f6f6e6c79207377697463687820666565206d616e61676572000000000000000060448201526064016103c0565b6103e861ffff821611156106ca57600080fd5b60005461ffff828116600160b81b90920416148015906106fa575060005461ffff828116600160a01b9092041614155b61070357600080fd5b6000805461ffff8316600160b81b0262ffffff60b01b1990911617600160b01b1790556040517f4257f7514c82dfba8cc314bf1b5192f83aa6e58b9c966aaf0971b75c4c67c855906105aa90839061ffff91909116815260200190565b6002546001600160a01b031633146107ba5760405162461bcd60e51b815260206004820152601860248201527f6f6e6c79207377697463687820666565206d616e61676572000000000000000060448201526064016103c0565b6001600160a01b0381166107cd57600080fd5b6001546001600160a01b03908116908216036107e857600080fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f75bda8e1940ce7f561eaab4ce5cca241a9cc5a0c45315f3b865ad8d870afa68c906020016105aa565b60405163e8ae2b6960e01b81527f63e58c34d94475ba3fc063e19800b940485850d84d09cd3c1f2c14192c559a6860048201523360248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063e8ae2b6990604401602060405180830381865afa1580156108c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e49190611188565b6109305760405162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e6973747261746f72000000000000000000000000000060448201526064016103c0565b6001600160a01b03811661094357600080fd5b6000546001600160a01b039081169082160361095e57600080fd5b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527f2f4db788b994a5908051d68a2340153f49870447185a244d2326861e60cc4186906020016105aa565b6002546001600160a01b03163314610a065760405162461bcd60e51b815260206004820152601860248201527f6f6e6c79207377697463687820666565206d616e61676572000000000000000060448201526064016103c0565b6000805462ffffff60b01b191681556040517f5bb7b62432b6c6ba379dae9a137dc99ed67721324f96abceab41e3e2724f6ac49190a1565b6002546001600160a01b0316331480610b00575060405163e8ae2b6960e01b81527fb77a63f119f4dc2174dc6c76fc1a1565fa4f2b0dde50ed5c0465471cd9b331f660048201523360248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063e8ae2b6990604401602060405180830381865afa158015610adc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b009190611188565b610b3e5760405162461bcd60e51b815260206004820152600f60248201526e37b7363c903bb4ba34323930bbb2b960891b60448201526064016103c0565b8060008080610b4b610d4e565b92509250925060005b84811015610bb357610bab878783818110610b7157610b716111aa565b610b8792602060409092020190810191506110ce565b83898985818110610b9a57610b9a6111aa565b905060400201602001358787610e24565b600101610b54565b50505050505050565b6003546001600160a01b03163314610bd357600080fd5b60028054336001600160a01b031991821681179092556003805490911690556040519081527fa94b215723211a31264cbdf378f9c0c3687c71139a4ebbdf0b443f453c5cdfa49060200160405180910390a1565b6002546001600160a01b0316331480610ce9575060405163e8ae2b6960e01b81527fb77a63f119f4dc2174dc6c76fc1a1565fa4f2b0dde50ed5c0465471cd9b331f660048201523360248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063e8ae2b6990604401602060405180830381865afa158015610cc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce99190611188565b610d275760405162461bcd60e51b815260206004820152600f60248201526e37b7363c903bb4ba34323930bbb2b960891b60448201526064016103c0565b6000806000610d34610d4e565b925092509250610d478582868686610e24565b5050505050565b60005460015461ffff600160a01b830416916001600160a01b0391821691168215610dc9576001600160a01b038216610dc95760405162461bcd60e51b815260206004820152601c60248201527f696e76616c69642073776974636878206665652072656365697665720000000060448201526064016103c0565b6001600160a01b038116610e1f5760405162461bcd60e51b815260206004820152601060248201527f696e76616c69642072656365697665720000000000000000000000000000000060448201526064016103c0565b909192565b8261ffff831615610eaa576000610e428261ffff86166103e8610f0a565b9050610e4e81836111c0565b9150610e5b878483610f8b565b826001600160a01b0316876001600160a01b03167feb3dbdda9a0093d3167e1c5d460b8705d1ca43f89a5dca58a9d40c146c7353b583604051610ea091815260200190565b60405180910390a3505b610eb5868683610f8b565b846001600160a01b0316866001600160a01b03167f7a629b77ef27ad337abe438773206187960a90abfb43607826bef77d650e84b983604051610efa91815260200190565b60405180910390a3505050505050565b6000831580610f2b57505082820282848281610f2857610f286111e7565b04145b15610f4c5760008211610f3d57600080fd5b81810490829006151501610f84565b610f57848484610ff5565b905060008280610f6957610f696111e7565b8486091115610f84576000198110610f8057600080fd5b6001015b9392505050565b600060405163a9059cbb60e01b6000526001600160a01b03841660045282602452602060006044600080895af19150813d1560203d146001600051141617169150806040525080610fef57604051637232c81f60e11b815260040160405180910390fd5b50505050565b6000838302816000198587098281108382030391505080841161101757600080fd5b8060000361102a57508290049050610f84565b8385870960008581038616958690049560026003880281188089028203028089028203028089028203028089028203028089028203028089029091030291819003819004600101858411909403939093029190930391909104170290509392505050565b6000602082840312156110a057600080fd5b813561ffff81168114610f8457600080fd5b80356001600160a01b03811681146110c957600080fd5b919050565b6000602082840312156110e057600080fd5b610f84826110b2565b600080602083850312156110fc57600080fd5b823567ffffffffffffffff8082111561111457600080fd5b818501915085601f83011261112857600080fd5b81358181111561113757600080fd5b8660208260061b850101111561114c57600080fd5b60209290920196919550909350505050565b6000806040838503121561117157600080fd5b61117a836110b2565b946020939093013593505050565b60006020828403121561119a57600080fd5b81518015158114610f8457600080fd5b634e487b7160e01b600052603260045260246000fd5b818103818111156111e157634e487b7160e01b600052601160045260246000fd5b92915050565b634e487b7160e01b600052601260045260246000fdfea164736f6c6343000814000aa164736f6c6343000814000a000000000000000000000000ef72cbccf4a807dfa1fbecd61ddb488ff8a05fa3

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063a22e35791161008c578063c45a015511610066578063c45a0155146102e1578063c740a9f514610308578063d547741f1461032e578063f815c03d1461035a57600080fd5b8063a22e35791461025f578063b8a1d3c614610272578063bbac3b8d146102ba57600080fd5b806336568abe116100c857806336568abe146101975780637570e389146101c357806391d1485414610215578063a217fddf1461025757600080fd5b806301ffc9a7146100ef578063248a9ca31461012a5780632f2ff15d14610169575b600080fd5b6101166004803603602081101561010557600080fd5b50356001600160e01b031916610390565b604080519115158252519081900360200190f35b6101576004803603602081101561014057600080fd5b503560009081526020819052604090206001015490565b60408051918252519081900360200190f35b6101956004803603604081101561017f57600080fd5b50803590602001356001600160a01b03166103c7565b005b610195600480360360408110156101ad57600080fd5b50803590602001356001600160a01b03166103f1565b6101f9600480360360208110156101d957600080fd5b50356001600160a01b039081166000908152600260205260409020541690565b604080516001600160a01b039092168252519081900360200190f35b6101166004803603604081101561022b57600080fd5b508035600090815260208181526040808320938201356001600160a01b03168352929052205460ff1690565b610157600081565b6001546101f9906001600160a01b031681565b6101f9600480360360a081101561028857600080fd5b506001600160a01b03813581169160208101358216916040820135811691606081013582169160809091013516610482565b6101577f63e58c34d94475ba3fc063e19800b940485850d84d09cd3c1f2c14192c559a6881565b6101f97f000000000000000000000000ef72cbccf4a807dfa1fbecd61ddb488ff8a05fa381565b6101956004803603602081101561031e57600080fd5b50356001600160a01b0316610817565b6101956004803603604081101561034457600080fd5b50803590602001356001600160a01b031661098a565b6101f96004803603602081101561037057600080fd5b5060026020526001600160a01b0390358116600090815260409020541681565b60006001600160e01b03198216637965db0b60e01b14806103c157506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000828152602081905260409020600101546103e2816109af565b6103ec83836109bc565b505050565b6001600160a01b03811633146104745760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b61047e8282610a5a565b5050565b6040805163e8ae2b6960e01b81527f63e58c34d94475ba3fc063e19800b940485850d84d09cd3c1f2c14192c559a68600482015233602482015290516000916001600160a01b037f000000000000000000000000ef72cbccf4a807dfa1fbecd61ddb488ff8a05fa3169163e8ae2b69916044808201926020929091908290030181865afa158015610517573d6000803e3d6000fd5b505050506040513d602081101561052d57600080fd5b5051806105625750336001600160a01b037f000000000000000000000000ef72cbccf4a807dfa1fbecd61ddb488ff8a05fa316145b610598576040517fff512cd000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001600160a01b0386811660009081526002602052604090205416156105d157604051630b50fed960e21b815260040160405180910390fd5b6001546001600160a01b0316806106b4577f000000000000000000000000ef72cbccf4a807dfa1fbecd61ddb488ff8a05fa36001600160a01b0316638da5cb5b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610640573d6000803e3d6000fd5b505050506040513d602081101561065657600080fd5b505190506001600160a01b0381166106b4576001600160a01b037f000000000000000000000000ef72cbccf4a807dfa1fbecd61ddb488ff8a05fa31633036106b15760405163e6c4247b60e01b815260040160405180910390fd5b50335b60408051606089811b6bffffffffffffffffffffffff199081166020808501919091528a831b8216603485015289831b8216604885015288831b8216605c8501529187901b166070830152825180830360640181526084909201928390528151910120907f000000000000000000000000ef72cbccf4a807dfa1fbecd61ddb488ff8a05fa390839061074590610d0e565b6001600160a01b03928316815291166020820152604080518392819003909101906000f590508015801561077d573d6000803e3d6000fd5b506001600160a01b03808916600081815260026020908152604091829020805485871673ffffffffffffffffffffffffffffffffffffffff19909116811790915582518b861681528a861692810192909252888516828401529151949650928a1693919290917f16009f0dfe8f8fbbc65a0e5fe924094336de344edd37c037a074875a84eb17649181900360600190a45095945050505050565b6040805163e8ae2b6960e01b81527f63e58c34d94475ba3fc063e19800b940485850d84d09cd3c1f2c14192c559a68600482015233602482015290516001600160a01b037f000000000000000000000000ef72cbccf4a807dfa1fbecd61ddb488ff8a05fa3169163e8ae2b699160448083019260209291908290030181865afa1580156108a8573d6000803e3d6000fd5b505050506040513d60208110156108be57600080fd5b5051806108f35750336001600160a01b037f000000000000000000000000ef72cbccf4a807dfa1fbecd61ddb488ff8a05fa316145b610929576040517fff512cd000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600180546001600160a01b03831673ffffffffffffffffffffffffffffffffffffffff19909116811790915560408051918252517f078774c760378fc88a81c17fd4ed865eb4ae532c693ad7fb4dccee5d9f18d2cb9181900360200190a150565b6000828152602081905260409020600101546109a5816109af565b6103ec8383610a5a565b6109b98133610ad9565b50565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1661047e576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055610a163390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff161561047e576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff1661047e57610b0a81610b4c565b610b15836020610b5e565b604051602001610b26929190610d3f565b60408051601f198184030181529082905262461bcd60e51b825261046b91600401610dc0565b60606103c16001600160a01b03831660145b60606000610b6d836002610e09565b610b78906002610e20565b67ffffffffffffffff811115610b9057610b90610e33565b6040519080825280601f01601f191660200182016040528015610bba576020820181803683370190505b509050600360fc1b81600081518110610bd557610bd5610e49565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610c0457610c04610e49565b60200101906001600160f81b031916908160001a9053506000610c28846002610e09565b610c33906001610e20565b90505b6001811115610cb8577f303132333435363738396162636465660000000000000000000000000000000085600f1660108110610c7457610c74610e49565b1a60f81b828281518110610c8a57610c8a610e49565b60200101906001600160f81b031916908160001a90535060049490941c93610cb181610e5f565b9050610c36565b508315610d075760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e74604482015260640161046b565b9392505050565b61132b80610e7783390190565b60005b83811015610d36578181015183820152602001610d1e565b50506000910152565b7f416363657373436f6e74726f6c3a206163636f756e7420000000000000000000815260008351610d77816017850160208801610d1b565b7f206973206d697373696e6720726f6c65200000000000000000000000000000006017918401918201528351610db4816028840160208801610d1b565b01602801949350505050565b6020815260008251806020840152610ddf816040850160208701610d1b565b601f01601f19169190910160400192915050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176103c1576103c1610df3565b808201808211156103c1576103c1610df3565b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b600081610e6e57610e6e610df3565b50600019019056fe60a060405234801561001057600080fd5b5060405161132b38038061132b83398101604081905261002f916100be565b6001600160a01b0382166100565760405163e6c4247b60e01b815260040160405180910390fd5b6001600160a01b03811661007d5760405163e6c4247b60e01b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b03928316179055166080526100f1565b80516001600160a01b03811681146100b957600080fd5b919050565b600080604083850312156100d157600080fd5b6100da836100a2565b91506100e8602084016100a2565b90509250929050565b60805161120a610121600039600081816103050152818161087101528181610a8d0152610c76015261120a6000f3fe608060405234801561001057600080fd5b506004361061011b5760003560e01c8063a4bb2920116100b2578063cc913a4111610081578063edc0975711610066578063edc097571461029c578063f3fef3a3146102a4578063f7e0d526146102b757600080fd5b8063cc913a4114610265578063dfadc7941461028957600080fd5b8063a4bb292014610210578063b5f680ae14610223578063bbac3b8d14610236578063c4b60ce71461025d57600080fd5b8063371abc95116100ee578063371abc95146101c2578063432604fa146101d55780639c1c6d60146101ea5780639ef3c2a0146101fd57600080fd5b8063063c7c2714610120578063113cd2a1146101505780631a169492146101655780631de416131461018d575b600080fd5b600154610133906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61016361015e36600461108e565b6102ca565b005b60005461017a90600160b81b900461ffff1681565b60405161ffff9091168152602001610147565b6101b47fb77a63f119f4dc2174dc6c76fc1a1565fa4f2b0dde50ed5c0465471cd9b331f681565b604051908152602001610147565b600054610133906001600160a01b031681565b60005461017a90600160a01b900461ffff1681565b6101636101f83660046110ce565b6105b5565b61016361020b36600461108e565b61065d565b61016361021e3660046110ce565b610760565b6101636102313660046110ce565b610836565b6101b47f63e58c34d94475ba3fc063e19800b940485850d84d09cd3c1f2c14192c559a6881565b6101636109ac565b60005461027990600160b01b900460ff1681565b6040519015158152602001610147565b6101636102973660046110e9565b610a3e565b610163610bbc565b6101636102b236600461115e565b610c27565b600254610133906001600160a01b031681565b60405163e8ae2b6960e01b81527f63e58c34d94475ba3fc063e19800b940485850d84d09cd3c1f2c14192c559a6860048201523360248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063e8ae2b6990604401602060405180830381865afa158015610354573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103789190611188565b6103c95760405162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e6973747261746f72000000000000000000000000000060448201526064015b60405180910390fd5b600054600160b01b900460ff166104225760405162461bcd60e51b815260206004820152600c60248201527f6e6f742070726f706f736564000000000000000000000000000000000000000060448201526064016103c0565b60005461ffff828116600160b81b90920416146104815760405162461bcd60e51b815260206004820152600f60248201527f696e76616c6964206e657720666565000000000000000000000000000000000060448201526064016103c0565b61ffff8116156104e3576001546001600160a01b03166104e35760405162461bcd60e51b815260206004820152601c60248201527f6d697373696e672073776974636878206665652072656365697665720000000060448201526064016103c0565b6000546001600160a01b031661053b5760405162461bcd60e51b815260206004820152601e60248201527f6d697373696e6720636f6d6d756e69747920666565207265636569766572000060448201526064016103c0565b600080547fffffffffffffff0000000000ffffffffffffffffffffffffffffffffffffffff16600160a01b61ffff841690810262ffffff60b01b1916919091179091556040519081527f91c000bd4b73da243840e9ce4151f5f119a51d86529a5fb922ae9131493a7f77906020015b60405180910390a150565b6002546001600160a01b0316331461060f5760405162461bcd60e51b815260206004820152601860248201527f6f6e6c79207377697463687820666565206d616e61676572000000000000000060448201526064016103c0565b600380546001600160a01b0319166001600160a01b0383169081179091556040519081527ffac690777b4a5eed44435607f80a7bdd44a1020191d23110a6fe5a07cdf57418906020016105aa565b6002546001600160a01b031633146106b75760405162461bcd60e51b815260206004820152601860248201527f6f6e6c79207377697463687820666565206d616e61676572000000000000000060448201526064016103c0565b6103e861ffff821611156106ca57600080fd5b60005461ffff828116600160b81b90920416148015906106fa575060005461ffff828116600160a01b9092041614155b61070357600080fd5b6000805461ffff8316600160b81b0262ffffff60b01b1990911617600160b01b1790556040517f4257f7514c82dfba8cc314bf1b5192f83aa6e58b9c966aaf0971b75c4c67c855906105aa90839061ffff91909116815260200190565b6002546001600160a01b031633146107ba5760405162461bcd60e51b815260206004820152601860248201527f6f6e6c79207377697463687820666565206d616e61676572000000000000000060448201526064016103c0565b6001600160a01b0381166107cd57600080fd5b6001546001600160a01b03908116908216036107e857600080fd5b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f75bda8e1940ce7f561eaab4ce5cca241a9cc5a0c45315f3b865ad8d870afa68c906020016105aa565b60405163e8ae2b6960e01b81527f63e58c34d94475ba3fc063e19800b940485850d84d09cd3c1f2c14192c559a6860048201523360248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063e8ae2b6990604401602060405180830381865afa1580156108c0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108e49190611188565b6109305760405162461bcd60e51b815260206004820152601260248201527f6f6e6c792061646d696e6973747261746f72000000000000000000000000000060448201526064016103c0565b6001600160a01b03811661094357600080fd5b6000546001600160a01b039081169082160361095e57600080fd5b600080546001600160a01b0319166001600160a01b0383169081179091556040519081527f2f4db788b994a5908051d68a2340153f49870447185a244d2326861e60cc4186906020016105aa565b6002546001600160a01b03163314610a065760405162461bcd60e51b815260206004820152601860248201527f6f6e6c79207377697463687820666565206d616e61676572000000000000000060448201526064016103c0565b6000805462ffffff60b01b191681556040517f5bb7b62432b6c6ba379dae9a137dc99ed67721324f96abceab41e3e2724f6ac49190a1565b6002546001600160a01b0316331480610b00575060405163e8ae2b6960e01b81527fb77a63f119f4dc2174dc6c76fc1a1565fa4f2b0dde50ed5c0465471cd9b331f660048201523360248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063e8ae2b6990604401602060405180830381865afa158015610adc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b009190611188565b610b3e5760405162461bcd60e51b815260206004820152600f60248201526e37b7363c903bb4ba34323930bbb2b960891b60448201526064016103c0565b8060008080610b4b610d4e565b92509250925060005b84811015610bb357610bab878783818110610b7157610b716111aa565b610b8792602060409092020190810191506110ce565b83898985818110610b9a57610b9a6111aa565b905060400201602001358787610e24565b600101610b54565b50505050505050565b6003546001600160a01b03163314610bd357600080fd5b60028054336001600160a01b031991821681179092556003805490911690556040519081527fa94b215723211a31264cbdf378f9c0c3687c71139a4ebbdf0b443f453c5cdfa49060200160405180910390a1565b6002546001600160a01b0316331480610ce9575060405163e8ae2b6960e01b81527fb77a63f119f4dc2174dc6c76fc1a1565fa4f2b0dde50ed5c0465471cd9b331f660048201523360248201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063e8ae2b6990604401602060405180830381865afa158015610cc5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ce99190611188565b610d275760405162461bcd60e51b815260206004820152600f60248201526e37b7363c903bb4ba34323930bbb2b960891b60448201526064016103c0565b6000806000610d34610d4e565b925092509250610d478582868686610e24565b5050505050565b60005460015461ffff600160a01b830416916001600160a01b0391821691168215610dc9576001600160a01b038216610dc95760405162461bcd60e51b815260206004820152601c60248201527f696e76616c69642073776974636878206665652072656365697665720000000060448201526064016103c0565b6001600160a01b038116610e1f5760405162461bcd60e51b815260206004820152601060248201527f696e76616c69642072656365697665720000000000000000000000000000000060448201526064016103c0565b909192565b8261ffff831615610eaa576000610e428261ffff86166103e8610f0a565b9050610e4e81836111c0565b9150610e5b878483610f8b565b826001600160a01b0316876001600160a01b03167feb3dbdda9a0093d3167e1c5d460b8705d1ca43f89a5dca58a9d40c146c7353b583604051610ea091815260200190565b60405180910390a3505b610eb5868683610f8b565b846001600160a01b0316866001600160a01b03167f7a629b77ef27ad337abe438773206187960a90abfb43607826bef77d650e84b983604051610efa91815260200190565b60405180910390a3505050505050565b6000831580610f2b57505082820282848281610f2857610f286111e7565b04145b15610f4c5760008211610f3d57600080fd5b81810490829006151501610f84565b610f57848484610ff5565b905060008280610f6957610f696111e7565b8486091115610f84576000198110610f8057600080fd5b6001015b9392505050565b600060405163a9059cbb60e01b6000526001600160a01b03841660045282602452602060006044600080895af19150813d1560203d146001600051141617169150806040525080610fef57604051637232c81f60e11b815260040160405180910390fd5b50505050565b6000838302816000198587098281108382030391505080841161101757600080fd5b8060000361102a57508290049050610f84565b8385870960008581038616958690049560026003880281188089028203028089028203028089028203028089028203028089028203028089029091030291819003819004600101858411909403939093029190930391909104170290509392505050565b6000602082840312156110a057600080fd5b813561ffff81168114610f8457600080fd5b80356001600160a01b03811681146110c957600080fd5b919050565b6000602082840312156110e057600080fd5b610f84826110b2565b600080602083850312156110fc57600080fd5b823567ffffffffffffffff8082111561111457600080fd5b818501915085601f83011261112857600080fd5b81358181111561113757600080fd5b8660208260061b850101111561114c57600080fd5b60209290920196919550909350505050565b6000806040838503121561117157600080fd5b61117a836110b2565b946020939093013593505050565b60006020828403121561119a57600080fd5b81518015158114610f8457600080fd5b634e487b7160e01b600052603260045260246000fd5b818103818111156111e157634e487b7160e01b600052601160045260246000fd5b92915050565b634e487b7160e01b600052601260045260246000fdfea164736f6c6343000814000aa164736f6c6343000814000a