S Price: $0.517338 (+0.75%)
    /

    Contract

    0xD9009Ba9292faA2878BE052089b42A50c0759441

    Overview

    S Balance

    Sonic LogoSonic LogoSonic Logo0 S

    S Value

    $0.00

    Multichain Info

    No addresses found
    Transaction Hash
    Method
    Block
    Age
    From
    To

    There are no matching entries

    Please try again later

    Parent Transaction Hash Block Age From To Amount
    View All Internal Transactions
    Loading...
    Loading

    Contract Source Code Verified (Exact Match)

    Contract Name:
    NonfungibleTokenPositionDescriptor

    Compiler Version
    v0.8.28+commit.7893614a

    Optimization Enabled:
    Yes with 2633 runs

    Other Settings:
    cancun EvmVersion
    File 1 of 38 : NonfungibleTokenPositionDescriptor.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity ^0.8.26;
    pragma abicoder v2;
    import '../core/interfaces/IRamsesV3Pool.sol';
    import './libraries/SafeERC20Namer.sol';
    import './libraries/ChainId.sol';
    import './interfaces/INonfungiblePositionManager.sol';
    import './interfaces/INonfungibleTokenPositionDescriptor.sol';
    import './interfaces/IERC20Metadata.sol';
    import './libraries/PoolAddress.sol';
    import './libraries/NFTDescriptor.sol';
    import './libraries/TokenRatioSortOrder.sol';
    /// @title Describes NFT token positions
    /// @notice Produces a string containing the data URI for a JSON metadata string
    contract NonfungibleTokenPositionDescriptor is INonfungibleTokenPositionDescriptor {
    address public immutable WETH9;
    /// @dev A null-terminated string
    string public constant S = 'S';
    constructor(address _WETH9) {
    WETH9 = _WETH9;
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 2 of 38 : IRamsesV3Pool.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.5.0;
    import {IRamsesV3PoolImmutables} from './pool/IRamsesV3PoolImmutables.sol';
    import {IRamsesV3PoolState} from './pool/IRamsesV3PoolState.sol';
    import {IRamsesV3PoolDerivedState} from './pool/IRamsesV3PoolDerivedState.sol';
    import {IRamsesV3PoolActions} from './pool/IRamsesV3PoolActions.sol';
    import {IRamsesV3PoolOwnerActions} from './pool/IRamsesV3PoolOwnerActions.sol';
    import {IRamsesV3PoolErrors} from './pool/IRamsesV3PoolErrors.sol';
    import {IRamsesV3PoolEvents} from './pool/IRamsesV3PoolEvents.sol';
    /// @title The interface for a Ramses V3 Pool
    /// @notice A Ramses pool facilitates swapping and automated market making between any two assets that strictly conform
    /// to the ERC20 specification
    /// @dev The pool interface is broken up into many smaller pieces
    interface IRamsesV3Pool is
    IRamsesV3PoolImmutables,
    IRamsesV3PoolState,
    IRamsesV3PoolDerivedState,
    IRamsesV3PoolActions,
    IRamsesV3PoolOwnerActions,
    IRamsesV3PoolErrors,
    IRamsesV3PoolEvents
    {
    /// @notice if a new period, advance on interaction
    function _advancePeriod() external;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 3 of 38 : SafeERC20Namer.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: GPL-3.0-or-later
    // from https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/SafeERC20Namer.sol
    // modified for solidity 0.8
    pragma solidity >=0.8.0;
    import './AddressStringUtil.sol';
    // produces token descriptors from inconsistent or absent ERC20 symbol implementations that can return string or bytes32
    // this library will always produce a string symbol to represent the token
    library SafeERC20Namer {
    function bytes32ToString(bytes32 x) private pure returns (string memory) {
    bytes memory bytesString = new bytes(32);
    uint256 charCount = 0;
    for (uint256 j = 0; j < 32; j++) {
    bytes1 char = x[j];
    if (char != 0) {
    bytesString[charCount] = char;
    charCount++;
    }
    }
    bytes memory bytesStringTrimmed = new bytes(charCount);
    for (uint256 j = 0; j < charCount; j++) {
    bytesStringTrimmed[j] = bytesString[j];
    }
    return string(bytesStringTrimmed);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 4 of 38 : ChainId.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.7.0;
    /// @title Function for getting the current chain ID
    library ChainId {
    /// @dev Gets the current chain ID
    /// @return chainId The current chain ID
    function get() internal view returns (uint256 chainId) {
    assembly {
    chainId := chainid()
    }
    }
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 5 of 38 : INonfungiblePositionManager.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.7.5;
    pragma abicoder v2;
    import {IPoolInitializer} from './IPoolInitializer.sol';
    import {IPeripheryPayments} from './IPeripheryPayments.sol';
    import {IPeripheryImmutableState} from './IPeripheryImmutableState.sol';
    import {PoolAddress} from '../libraries/PoolAddress.sol';
    import {IERC721} from '@openzeppelin/contracts/token/ERC721/IERC721.sol';
    import {IERC721Metadata} from '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';
    import {IERC721Enumerable} from '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol';
    import {IPeripheryErrors} from './IPeripheryErrors.sol';
    /// @title Non-fungible token for positions
    /// @notice Wraps Uniswap V3 positions in a non-fungible token interface which allows for them to be transferred
    /// and authorized.
    interface INonfungiblePositionManager is
    IPeripheryErrors,
    IPoolInitializer,
    IPeripheryPayments,
    IPeripheryImmutableState,
    IERC721,
    IERC721Metadata,
    IERC721Enumerable
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 6 of 38 : INonfungibleTokenPositionDescriptor.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.5.0;
    import './INonfungiblePositionManager.sol';
    /// @title Describes position NFT tokens via URI
    interface INonfungibleTokenPositionDescriptor {
    /// @notice Produces the URI describing a particular token ID for a position manager
    /// @dev Note this URI may be a data: URI with the JSON contents directly inlined
    /// @param positionManager The position manager for which to describe the token
    /// @param tokenId The ID of the token for which to produce a description, which may not be valid
    /// @return The URI of the ERC721-compliant metadata
    function tokenURI(INonfungiblePositionManager positionManager, uint256 tokenId)
    external
    view
    returns (string memory);
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 7 of 38 : IERC20Metadata.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity ^0.8.0;
    import '@openzeppelin/contracts/token/ERC20/IERC20.sol';
    /// @title IERC20Metadata
    /// @title Interface for ERC20 Metadata
    /// @notice Extension to IERC20 that includes token metadata
    interface IERC20Metadata is IERC20 {
    /// @return The name of the token
    function name() external view returns (string memory);
    /// @return The symbol of the token
    function symbol() external view returns (string memory);
    /// @return The number of decimal places the token has
    function decimals() external view returns (uint8);
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 8 of 38 : PoolAddress.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.5.0;
    /// @title Provides functions for deriving a pool address from the deployer, tokens, and the fee
    library PoolAddress {
    bytes32 internal constant POOL_INIT_CODE_HASH = 0xd012d453ebb4a7bb3632aea48cc0e61fba82473e96bb7d980661630271904f27;
    error TokenOrder();
    /// @notice The identifying key of the pool
    struct PoolKey {
    address token0;
    address token1;
    int24 tickSpacing;
    }
    /// @notice Returns PoolKey: the ordered tokens with the matched fee levels
    /// @param tokenA The first token of a pool, unsorted
    /// @param tokenB The second token of a pool, unsorted
    /// @param tickSpacing The tickSpacing of the pool
    /// @return Poolkey The pool details with ordered token0 and token1 assignments
    function getPoolKey(address tokenA, address tokenB, int24 tickSpacing) internal pure returns (PoolKey memory) {
    if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA);
    return PoolKey({token0: tokenA, token1: tokenB, tickSpacing: tickSpacing});
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 9 of 38 : NFTDescriptor.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.7.0;
    pragma abicoder v2;
    import '../../core/interfaces/IRamsesV3Pool.sol';
    import '../../core/libraries/TickMath.sol';
    import '../../core/libraries/BitMath.sol';
    import '../../core/libraries/FullMath.sol';
    import '@openzeppelin/contracts/utils/Strings.sol';
    import "@openzeppelin/contracts/utils/Base64.sol";
    import './HexStrings.sol';
    import './NFTSVG.sol';
    library NFTDescriptor {
    using TickMath for int24;
    using Strings for uint256;
    using HexStrings for uint256;
    uint256 constant sqrt10X128 = 1076067327063303206878105757264492625226;
    struct ConstructTokenURIParams {
    uint256 tokenId;
    address quoteTokenAddress;
    address baseTokenAddress;
    string quoteTokenSymbol;
    string baseTokenSymbol;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 10 of 38 : TokenRatioSortOrder.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    // SPDX-License-Identifier: MIT
    pragma solidity ^0.8.0;
    library TokenRatioSortOrder {
    int256 constant NUMERATOR_MOST = 300;
    int256 constant NUMERATOR_MORE = 200;
    int256 constant NUMERATOR = 100;
    int256 constant DENOMINATOR_MOST = -300;
    int256 constant DENOMINATOR_MORE = -200;
    int256 constant DENOMINATOR = -100;
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 11 of 38 : IRamsesV3PoolImmutables.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.5.0;
    /// @title Pool state that never changes
    /// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values
    interface IRamsesV3PoolImmutables {
    /// @notice The contract that deployed the pool, which must adhere to the IRamsesV3Factory interface
    /// @return The contract address
    function factory() external view returns (address);
    /// @notice The first of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token0() external view returns (address);
    /// @notice The second of the two tokens of the pool, sorted by address
    /// @return The token contract address
    function token1() external view returns (address);
    /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6
    /// @return The fee
    function fee() external view returns (uint24);
    /// @notice The pool tick spacing
    /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive
    /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ...
    /// This value is an int24 to avoid casting even though it is always positive.
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 12 of 38 : IRamsesV3PoolState.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.5.0;
    /// @title Pool state that can change
    /// @notice These methods compose the pool's state, and can change with any frequency including multiple times
    /// per transaction
    interface IRamsesV3PoolState {
    /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas
    /// when accessed externally.
    /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value
    /// @return tick The current tick of the pool, i.e. according to the last tick transition that was run.
    /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick
    /// boundary.
    /// @return observationIndex The index of the last oracle observation that was written,
    /// @return observationCardinality The current maximum number of observations stored in the pool,
    /// @return observationCardinalityNext The next maximum number of observations, to be updated when the observation.
    /// @return feeProtocol The protocol fee for both tokens of the pool.
    /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0
    /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee.
    /// unlocked Whether the pool is currently locked to reentrancy
    function slot0()
    external
    view
    returns (
    uint160 sqrtPriceX96,
    int24 tick,
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 13 of 38 : IRamsesV3PoolDerivedState.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.5.0;
    /// @title Pool state that is not stored
    /// @notice Contains view functions to provide information about the pool that is computed rather than stored on the
    /// blockchain. The functions here may have variable gas costs.
    interface IRamsesV3PoolDerivedState {
    /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp
    /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing
    /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick,
    /// you must call it with secondsAgos = [3600, 0].
    /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in
    /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio.
    /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned
    /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp
    /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block
    /// timestamp
    function observe(
    uint32[] calldata secondsAgos
    ) external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s);
    /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range
    /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed.
    /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first
    /// snapshot is taken and the second snapshot is taken.
    /// @param tickLower The lower tick of the range
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 14 of 38 : IRamsesV3PoolActions.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.5.0;
    /// @title Permissionless pool actions
    /// @notice Contains pool methods that can be called by anyone
    interface IRamsesV3PoolActions {
    /// @notice Sets the initial price for the pool
    /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value
    /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96
    function initialize(uint160 sqrtPriceX96) external;
    /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position
    /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback
    /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends
    /// on tickLower, tickUpper, the amount of liquidity, and the current price.
    /// @param recipient The address for which the liquidity will be created
    /// @param index The index for which the liquidity will be created
    /// @param tickLower The lower tick of the position in which to add liquidity
    /// @param tickUpper The upper tick of the position in which to add liquidity
    /// @param amount The amount of liquidity to mint
    /// @param data Any data that should be passed through to the callback
    /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback
    /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback
    function mint(
    address recipient,
    uint256 index,
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 15 of 38 : IRamsesV3PoolOwnerActions.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.5.0;
    /// @title Permissioned pool actions
    /// @notice Contains pool methods that may only be called by the factory owner
    interface IRamsesV3PoolOwnerActions {
    /// @notice Set the denominator of the protocol's % share of the fees
    function setFeeProtocol() external;
    /// @notice Collect the protocol fee accrued to the pool
    /// @param recipient The address to which collected protocol fees should be sent
    /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1
    /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0
    /// @return amount0 The protocol fee collected in token0
    /// @return amount1 The protocol fee collected in token1
    function collectProtocol(
    address recipient,
    uint128 amount0Requested,
    uint128 amount1Requested
    ) external returns (uint128 amount0, uint128 amount1);
    function setFee(uint24 _fee) external;
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 16 of 38 : IRamsesV3PoolErrors.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.5.0;
    /// @title Errors emitted by a pool
    /// @notice Contains all events emitted by the pool
    interface IRamsesV3PoolErrors {
    error LOK();
    error TLU();
    error TLM();
    error TUM();
    error AI();
    error M0();
    error M1();
    error AS();
    error IIA();
    error L();
    error F0();
    error F1();
    error SPL();
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 17 of 38 : IRamsesV3PoolEvents.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.5.0;
    /// @title Events emitted by a pool
    /// @notice Contains all events emitted by the pool
    interface IRamsesV3PoolEvents {
    /// @notice Emitted exactly once by a pool when #initialize is first called on the pool
    /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize
    /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96
    /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool
    event Initialize(uint160 sqrtPriceX96, int24 tick);
    /// @notice Emitted when liquidity is minted for a given position
    /// @param sender The address that minted the liquidity
    /// @param owner The owner of the position and recipient of any minted liquidity
    /// @param tickLower The lower tick of the position
    /// @param tickUpper The upper tick of the position
    /// @param amount The amount of liquidity minted to the position range
    /// @param amount0 How much token0 was required for the minted liquidity
    /// @param amount1 How much token1 was required for the minted liquidity
    event Mint(
    address sender,
    address indexed owner,
    int24 indexed tickLower,
    int24 indexed tickUpper,
    uint128 amount,
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 18 of 38 : AddressStringUtil.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: GPL-3.0-or-later
    // from https://github.com/Uniswap/solidity-lib/blob/master/contracts/libraries/AddressStringUtil.sol
    // modified for solidity 0.8
    pragma solidity >=0.8.0;
    library AddressStringUtil {
    error InvalidLen();
    // converts an address to the uppercase hex string, extracting only len bytes (up to 20, multiple of 2)
    function toAsciiString(address addr, uint256 len) internal pure returns (string memory) {
    if (len % 2 != 0 || len == 0 || len > 40) revert InvalidLen();
    bytes memory s = new bytes(len);
    uint256 addrNum = uint256(uint160(addr));
    for (uint256 i = 0; i < len / 2; i++) {
    // shift right and truncate all but the least significant byte to extract the byte at position 19-i
    uint8 b = uint8(addrNum >> (8 * (19 - i)));
    // first hex character is the most significant 4 bits
    uint8 hi = b >> 4;
    // second hex character is the least significant 4 bits
    uint8 lo = b - (hi << 4);
    s[2 * i] = char(hi);
    s[2 * i + 1] = char(lo);
    }
    return string(s);
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 19 of 38 : IPoolInitializer.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.7.5;
    pragma abicoder v2;
    /// @title Creates and initializes V3 Pools
    /// @notice Provides a method for creating and initializing a pool, if necessary, for bundling with other methods that
    /// require the pool to exist.
    interface IPoolInitializer {
    /// @notice Creates a new pool if it does not exist, then initializes if not initialized
    /// @dev This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool
    /// @param token0 The contract address of token0 of the pool
    /// @param token1 The contract address of token1 of the pool
    /// @param tickSpacing The tickSpacing of the v3 pool for the specified token pair
    /// @param sqrtPriceX96 The initial square root price of the pool as a Q64.96 value
    /// @return pool Returns the pool address based on the pair of tokens and fee, will return the newly created pool address if necessary
    function createAndInitializePoolIfNecessary(
    address token0,
    address token1,
    int24 tickSpacing,
    uint160 sqrtPriceX96
    ) external payable returns (address pool);
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 20 of 38 : IPeripheryPayments.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.7.5;
    /// @title Periphery Payments
    /// @notice Functions to ease deposits and withdrawals of ETH
    interface IPeripheryPayments {
    /// @notice Unwraps the contract's WETH9 balance and sends it to recipient as ETH.
    /// @dev The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users.
    /// @param amountMinimum The minimum amount of WETH9 to unwrap
    /// @param recipient The address receiving ETH
    function unwrapWETH9(uint256 amountMinimum, address recipient) external payable;
    /// @notice Refunds any ETH balance held by this contract to the `msg.sender`
    /// @dev Useful for bundling with mint or increase liquidity that uses ether, or exact output swaps
    /// that use ether for the input amount
    function refundETH() external payable;
    /// @notice Transfers the full amount of a token held by this contract to recipient
    /// @dev The amountMinimum parameter prevents malicious contracts from stealing the token from users
    /// @param token The contract address of the token which will be transferred to `recipient`
    /// @param amountMinimum The minimum amount of token required for a transfer
    /// @param recipient The destination address of the token
    function sweepToken(
    address token,
    uint256 amountMinimum,
    address recipient
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 21 of 38 : IPeripheryImmutableState.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.5.0;
    /// @title Immutable state
    /// @notice Functions that return immutable state of the router
    interface IPeripheryImmutableState {
    /// @return Returns the address of the Uniswap V3 deployer
    function deployer() external view returns (address);
    /// @return Returns the address of WETH9
    function WETH9() external view returns (address);
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 22 of 38 : IERC721.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC721/IERC721.sol)
    pragma solidity ^0.8.20;
    import {IERC165} from "../../utils/introspection/IERC165.sol";
    /**
    * @dev Required interface of an ERC-721 compliant contract.
    */
    interface IERC721 is IERC165 {
    /**
    * @dev Emitted when `tokenId` token is transferred from `from` to `to`.
    */
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
    /**
    * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
    */
    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
    /**
    * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
    */
    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 23 of 38 : IERC721Metadata.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Metadata.sol)
    pragma solidity ^0.8.20;
    import {IERC721} from "../IERC721.sol";
    /**
    * @title ERC-721 Non-Fungible Token Standard, optional metadata extension
    * @dev See https://eips.ethereum.org/EIPS/eip-721
    */
    interface IERC721Metadata is IERC721 {
    /**
    * @dev Returns the token collection name.
    */
    function name() external view returns (string memory);
    /**
    * @dev Returns the token collection symbol.
    */
    function symbol() external view returns (string memory);
    /**
    * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token.
    */
    function tokenURI(uint256 tokenId) external view returns (string memory);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 24 of 38 : IERC721Enumerable.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC721/extensions/IERC721Enumerable.sol)
    pragma solidity ^0.8.20;
    import {IERC721} from "../IERC721.sol";
    /**
    * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension
    * @dev See https://eips.ethereum.org/EIPS/eip-721
    */
    interface IERC721Enumerable is IERC721 {
    /**
    * @dev Returns the total amount of tokens stored by the contract.
    */
    function totalSupply() external view returns (uint256);
    /**
    * @dev Returns a token ID owned by `owner` at a given `index` of its token list.
    * Use along with {balanceOf} to enumerate all of ``owner``'s tokens.
    */
    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);
    /**
    * @dev Returns a token ID at a given `index` of all the tokens stored by the contract.
    * Use along with {totalSupply} to enumerate all tokens.
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 25 of 38 : IPeripheryErrors.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.5.0;
    /// @title Errors emitted by the NonFungiblePositionManager
    /// @notice Contains all events emitted by the NfpManager
    interface IPeripheryErrors {
    error InvalidTokenId(uint256 tokenId);
    error CheckSlippage();
    error NotCleared();
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 26 of 38 : IERC20.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)
    pragma solidity ^0.8.20;
    /**
    * @dev Interface of the ERC-20 standard as defined in the ERC.
    */
    interface IERC20 {
    /**
    * @dev Emitted when `value` tokens are moved from one account (`from`) to
    * another (`to`).
    *
    * Note that `value` may be zero.
    */
    event Transfer(address indexed from, address indexed to, uint256 value);
    /**
    * @dev Emitted when the allowance of a `spender` for an `owner` is set by
    * a call to {approve}. `value` is the new allowance.
    */
    event Approval(address indexed owner, address indexed spender, uint256 value);
    /**
    * @dev Returns the value of tokens in existence.
    */
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 27 of 38 : TickMath.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity ^0.8.26;
    /// @title Math library for computing sqrt prices from ticks and vice versa
    /// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports
    /// prices between 2**-128 and 2**128
    library TickMath {
    error T();
    error R();
    /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128
    int24 internal constant MIN_TICK = -887272;
    /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128
    int24 internal constant MAX_TICK = -MIN_TICK;
    /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK)
    uint160 internal constant MIN_SQRT_RATIO = 4295128739;
    /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK)
    uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342;
    /// @notice Calculates sqrt(1.0001^tick) * 2^96
    /// @dev Throws if |tick| > max tick
    /// @param tick The input tick for the above formula
    /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0)
    /// at the given tick
    function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) {
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 28 of 38 : BitMath.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity ^0.8.26;
    /// @title BitMath
    /// @dev This library provides functionality for computing bit properties of an unsigned integer
    library BitMath {
    /// @notice Returns the index of the most significant bit of the number,
    /// where the least significant bit is at index 0 and the most significant bit is at index 255
    /// @dev The function satisfies the property:
    /// x >= 2**mostSignificantBit(x) and x < 2**(mostSignificantBit(x)+1)
    /// @param x the value for which to compute the most significant bit, must be greater than 0
    /// @return r the index of the most significant bit
    function mostSignificantBit(uint256 x) internal pure returns (uint8 r) {
    require(x > 0);
    unchecked {
    if (x >= 0x100000000000000000000000000000000) {
    x >>= 128;
    r += 128;
    }
    if (x >= 0x10000000000000000) {
    x >>= 64;
    r += 64;
    }
    if (x >= 0x100000000) {
    x >>= 32;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 29 of 38 : FullMath.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: MIT
    pragma solidity ^0.8.26;
    /// @title Contains 512-bit math functions
    /// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision
    /// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits
    library FullMath {
    /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
    /// @param a The multiplicand
    /// @param b The multiplier
    /// @param denominator The divisor
    /// @return result The 256-bit result
    /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv
    function mulDiv(uint256 a, uint256 b, uint256 denominator) internal pure returns (uint256 result) {
    unchecked {
    // 512-bit multiply [prod1 prod0] = a * b
    // Compute the product mod 2**256 and mod 2**256 - 1
    // then use the Chinese Remainder Theorem to reconstruct
    // the 512 bit result. The result is stored in two 256
    // variables such that product = prod1 * 2**256 + prod0
    uint256 prod0; // Least significant 256 bits of the product
    uint256 prod1; // Most significant 256 bits of the product
    assembly {
    let mm := mulmod(a, b, not(0))
    prod0 := mul(a, b)
    prod1 := sub(sub(mm, prod0), lt(mm, prod0))
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 30 of 38 : Strings.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.1.0) (utils/Strings.sol)
    pragma solidity ^0.8.20;
    import {Math} from "./math/Math.sol";
    import {SignedMath} from "./math/SignedMath.sol";
    /**
    * @dev String operations.
    */
    library Strings {
    bytes16 private constant HEX_DIGITS = "0123456789abcdef";
    uint8 private constant ADDRESS_LENGTH = 20;
    /**
    * @dev The `value` string doesn't fit in the specified `length`.
    */
    error StringsInsufficientHexLength(uint256 value, uint256 length);
    /**
    * @dev Converts a `uint256` to its ASCII `string` decimal representation.
    */
    function toString(uint256 value) internal pure returns (string memory) {
    unchecked {
    uint256 length = Math.log10(value) + 1;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 31 of 38 : Base64.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.1.0) (utils/Base64.sol)
    pragma solidity ^0.8.20;
    /**
    * @dev Provides a set of functions to operate with Base64 strings.
    */
    library Base64 {
    /**
    * @dev Base64 Encoding/Decoding Table
    * See sections 4 and 5 of https://datatracker.ietf.org/doc/html/rfc4648
    */
    string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
    string internal constant _TABLE_URL = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";
    /**
    * @dev Converts a `bytes` to its Bytes64 `string` representation.
    */
    function encode(bytes memory data) internal pure returns (string memory) {
    return _encode(data, _TABLE, true);
    }
    /**
    * @dev Converts a `bytes` to its Bytes64Url `string` representation.
    * Output is not padded with `=` as specified in https://www.rfc-editor.org/rfc/rfc4648[rfc4648].
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 32 of 38 : HexStrings.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    // SPDX-License-Identifier: MIT
    pragma solidity ^0.8.0;
    library HexStrings {
    error HexLengthInsufficient();
    bytes16 internal constant ALPHABET = '0123456789abcdef';
    /// @notice Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
    /// @dev Credit to Open Zeppelin under MIT license https://github.com/OpenZeppelin/openzeppelin-contracts/blob
            /243adff49ce1700e0ecb99fe522fb16cff1d1ddc/contracts/utils/Strings.sol#L55
    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] = ALPHABET[value & 0xf];
    value >>= 4;
    }
    if (value > 0) revert HexLengthInsufficient();
    return string(buffer);
    }
    function toHexStringNoPrefix(uint256 value, uint256 length) internal pure returns (string memory) {
    bytes memory buffer = new bytes(2 * length);
    for (uint256 i = buffer.length; i > 0; i--) {
    buffer[i - 1] = ALPHABET[value & 0xf];
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 33 of 38 : NFTSVG.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: GPL-2.0-or-later
    pragma solidity >=0.7.6;
    pragma abicoder v2;
    import '@openzeppelin/contracts/utils/Strings.sol';
    import '../../core/libraries/BitMath.sol';
    import "@openzeppelin/contracts/utils/Base64.sol";
    /// @title NFTSVG
    /// @notice Provides a function for generating an SVG associated with a Uniswap NFT
    library NFTSVG {
    using Strings for uint256;
    string constant curve1 = 'M1 1C41 41 105 105 145 145';
    string constant curve2 = 'M1 1C33 49 97 113 145 145';
    string constant curve3 = 'M1 1C33 57 89 113 145 145';
    string constant curve4 = 'M1 1C25 65 81 121 145 145';
    string constant curve5 = 'M1 1C17 73 73 129 145 145';
    string constant curve6 = 'M1 1C9 81 65 137 145 145';
    string constant curve7 = 'M1 1C1 89 57.5 145 145 145';
    string constant curve8 = 'M1 1C1 97 49 145 145 145';
    struct SVGBodyParams {
    string quoteToken;
    string baseToken;
    address poolAddress;
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 34 of 38 : IERC165.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol)
    pragma solidity ^0.8.20;
    /**
    * @dev Interface of the ERC-165 standard, as defined in the
    * https://eips.ethereum.org/EIPS/eip-165[ERC].
    *
    * 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[ERC 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);
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 35 of 38 : Math.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.1.0) (utils/math/Math.sol)
    pragma solidity ^0.8.20;
    import {Panic} from "../Panic.sol";
    import {SafeCast} from "./SafeCast.sol";
    /**
    * @dev Standard math utilities missing in the Solidity language.
    */
    library Math {
    enum Rounding {
    Floor, // Toward negative infinity
    Ceil, // Toward positive infinity
    Trunc, // Toward zero
    Expand // Away from zero
    }
    /**
    * @dev Returns the addition of two unsigned integers, with an success flag (no overflow).
    */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool success, uint256 result) {
    unchecked {
    uint256 c = a + b;
    if (c < a) return (false, 0);
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 36 of 38 : SignedMath.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SignedMath.sol)
    pragma solidity ^0.8.20;
    import {SafeCast} from "./SafeCast.sol";
    /**
    * @dev Standard signed math utilities missing in the Solidity language.
    */
    library SignedMath {
    /**
    * @dev Branchless ternary evaluation for `a ? b : c`. Gas costs are constant.
    *
    * IMPORTANT: This function may reduce bytecode size and consume less gas when used standalone.
    * However, the compiler may optimize Solidity ternary operations (i.e. `a ? b : c`) to only compute
    * one branch when needed, making this function more expensive.
    */
    function ternary(bool condition, int256 a, int256 b) internal pure returns (int256) {
    unchecked {
    // branchless ternary works because:
    // b ^ (a ^ b) == a
    // b ^ 0 == b
    return b ^ ((a ^ b) * int256(SafeCast.toUint(condition)));
    }
    }
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 37 of 38 : Panic.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.1.0) (utils/Panic.sol)
    pragma solidity ^0.8.20;
    /**
    * @dev Helper library for emitting standardized panic codes.
    *
    * ```solidity
    * contract Example {
    * using Panic for uint256;
    *
    * // Use any of the declared internal constants
    * function foo() { Panic.GENERIC.panic(); }
    *
    * // Alternatively
    * function foo() { Panic.panic(Panic.GENERIC); }
    * }
    * ```
    *
    * Follows the list from https://github.com/ethereum/solidity/blob/v0.8.24/libsolutil/ErrorCodes.h[libsolutil].
    *
    * _Available since v5.1._
    */
    // slither-disable-next-line unused-state
    library Panic {
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    File 38 of 38 : SafeCast.sol
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    // SPDX-License-Identifier: MIT
    // OpenZeppelin Contracts (last updated v5.1.0) (utils/math/SafeCast.sol)
    // This file was procedurally generated from scripts/generate/templates/SafeCast.js.
    pragma solidity ^0.8.20;
    /**
    * @dev Wrappers over Solidity's uintXX/intXX/bool casting operators with added overflow
    * checks.
    *
    * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
    * easily result in undesired exploitation or bugs, since developers usually
    * assume that overflows raise errors. `SafeCast` restores this intuition by
    * reverting the transaction when such an operation overflows.
    *
    * Using this library instead of the unchecked operations eliminates an entire
    * class of bugs, so it's recommended to use it always.
    */
    library SafeCast {
    /**
    * @dev Value doesn't fit in an uint of `bits` size.
    */
    error SafeCastOverflowedUintDowncast(uint8 bits, uint256 value);
    /**
    * @dev An int value doesn't fit in an uint of `bits` size.
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Settings
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    {
    "remappings": [
    "@openzeppelin-contracts-upgradeable-5.1.0/=dependencies/@openzeppelin-contracts-upgradeable-5.1.0/",
    "@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-5.1.0/",
    "forge-std/=dependencies/forge-std-1.9.4/src/",
    "permit2/=lib/permit2/",
    "@openzeppelin-3.4.2/=node_modules/@openzeppelin-3.4.2/",
    "@openzeppelin-contracts-5.1.0/=dependencies/@openzeppelin-contracts-5.1.0/",
    "@uniswap/=node_modules/@uniswap/",
    "base64-sol/=node_modules/base64-sol/",
    "eth-gas-reporter/=node_modules/eth-gas-reporter/",
    "forge-std-1.9.4/=dependencies/forge-std-1.9.4/src/",
    "hardhat/=node_modules/hardhat/",
    "solmate/=node_modules/solmate/"
    ],
    "optimizer": {
    "enabled": true,
    "runs": 2633
    },
    "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
    },
    "outputSelection": {
    "*": {
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

    Contract Security Audit

    Contract ABI

    [{"inputs":[{"internalType":"address","name":"_WETH9","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidLen","type":"error"},{"inputs":[],"name":"TokenOrder","type":"error"},{"inputs":[],"name":"S","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH9","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"}],"name":"flipRatio","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nativeCurrencyLabel","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"tokenRatioPriority","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract INonfungiblePositionManager","name":"positionManager","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]

    60a034607457601f61107b38819003918201601f19168301916001600160401b03831184841017607857808492602094604052833981010312607457516001600160a01b0381168103607457608052604051610fee908161008d82396080518181816102a8015281816109bb0152610a9f0152f35b5f80fd5b634e487b7160e01b5f52604160045260245ffdfe6080806040526004361015610012575f80fd5b5f3560e01c9081634aa4a4fc1461099e575080634be1c796146109445780637d4a868914610973578063b7af3cdc14610944578063dee91a2c146108fb5763e9dc63751461005e575f80fd5b34610674576040600319360112610674576004356001600160a01b038116809103610674576024356040517f99fbab8800000000000000000000000000000000000000000000000000000000815281600482015261014081602481865afa908115610604575f905f945f905f925f95610854575b506020600491604051928380927fd5f394880000000000000000000000000000000000000000000000000000000082525afa908115610604575f9161081a575b50604051916060830183811067ffffffffffffffff82111761060f576040526001600160a01b0385169081845260208401916001600160a01b038a1690818452604086019260020b835210156107f2576001600160a01b038080955116925116905160020b6040519160208301938452604083015260608201526060815261019b6080826109df565b519020604051907fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060208301937fff00000000000000000000000000000000000000000000000000000000000000855260601b16602183015260358201527fd012d453ebb4a7bb3632aea48cc0e61fba82473e96bb7d980661630271904f2760558201526055815261022e6075826109df565b519020169161023c81610a94565b61024587610a94565b1290811596875f146107eb5780975b156107e35750915b604051947f3850c7bd00000000000000000000000000000000000000000000000000000000865260e086600481885afa918215610604575f92610751575b600496506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016936001600160a01b038a1699858b145f1461074257506102e6610a1e565b955b6001600160a01b0381169586036107345750610302610a1e565b60208b6040519a8b80927f313ce5670000000000000000000000000000000000000000000000000000000082525afa988915610604575f996106f8575b50604051907f313ce5670000000000000000000000000000000000000000000000000000000082526020826004818a5afa918215610604575f926106bc575b50604051977fd0c93a7c0000000000000000000000000000000000000000000000000000000089526020896004818d5afa978815610604575f98610680575b6040517fddca3f43000000000000000000000000000000000000000000000000000000008152995060208a6004818e5afa998a15610604575f9a61063c575b506040519c6101c08e0167ffffffffffffffff81118f82101761060f576040528d5260208d019d8e5260408d0190815260608d0191825260808d0192835260a08d019b60ff168c5260c08d019360ff16845260e08d019485526101008d019560020b86526101208d019660020b87526101408d019760020b88526101608d019860020b89526101808d019962ffffff168a526101a08d019a8b52604051809e819e7fc49917d70000000000000000000000000000000000000000000000000000000083526004830160209052516024830152516001600160a01b03169060440152516001600160a01b031660648d01525160848c016101c090526101e48c0161050491610a59565b9051908b81037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc0160a48d015261053a91610a59565b985160ff1660c48b01525160ff1660e48a01525115156101048901525160020b6101248801525160020b6101448701525160020b6101648601525160020b6101848501525162ffffff166101a4840152516001600160a01b03166101c48301520381736d2f5899f5c6313583c4daccc344d6587fcd2af991815a935f94f48015610604576105de915f916105e2575b50604051918291602083526020830190610a59565b0390f35b6105fe91503d805f833e6105f681836109df565b810190610b4a565b5f6105c9565b6040513d5f823e3d90fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b9099506020813d602011610678575b81610658602093836109df565b81010312610674575162ffffff8116810361067457985f6103fc565b5f80fd5b3d915061064b565b97506020893d6020116106b4575b8161069b602093836109df565b81010312610674576106ae600499610b02565b976103bd565b3d915061068e565b9091506020813d6020116106f0575b816106d8602093836109df565b81010312610674576106e990610b3c565b905f61037e565b3d91506106cb565b9098506020813d60201161072c575b81610714602093836109df565b810103126106745761072590610b3c565b975f61033f565b3d9150610707565b61073d90610bad565b610302565b61074b90610bad565b956102e8565b915060e0863d60e0116107db575b8161076c60e093836109df565b810103126106745785516001600160a01b038116036106745760c061079360208801610b02565b966107a060408201610b2d565b506107ad60608201610b2d565b506107ba60808201610b2d565b506107c760a08201610b3c565b50015180151503610674576004959161029a565b3d915061075f565b90509161025c565b8197610254565b7f38cd3d8e000000000000000000000000000000000000000000000000000000005f5260045ffd5b90506020813d60201161084c575b81610835602093836109df565b810103126106745761084690610aee565b5f610112565b3d9150610828565b96509350505050610140833d82116108f3575b8161087561014093836109df565b810103126106745761088683610aee565b9261089360208201610aee565b906108a060408201610b02565b94600460206108b160608501610b02565b926108e66101206108c460808801610b02565b966108d160a08201610b10565b506108df6101008201610b10565b5001610b10565b50949792939591506100d2565b3d9150610867565b3461067457604060031936011261067457610914610a7e565b6024356001600160a01b03811681036106745761093b610935602093610a94565b91610a94565b12604051908152f35b34610674575f600319360112610674576105de61095f610a1e565b604051918291602083526020830190610a59565b34610674576020600319360112610674576020610996610991610a7e565b610a94565b604051908152f35b34610674575f600319360112610674576020906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b90601f601f19910116810190811067ffffffffffffffff82111761060f57604052565b67ffffffffffffffff811161060f57601f01601f191660200190565b60405190610a2d6040836109df565b600182527f53000000000000000000000000000000000000000000000000000000000000006020830152565b90601f19601f602080948051918291828752018686015e5f8582860101520116010190565b600435906001600160a01b038216820361067457565b6001600160a01b03807f000000000000000000000000000000000000000000000000000000000000000016911614610aca575f90565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9c90565b51906001600160a01b038216820361067457565b51908160020b820361067457565b51906fffffffffffffffffffffffffffffffff8216820361067457565b519061ffff8216820361067457565b519060ff8216820361067457565b6020818303126106745780519067ffffffffffffffff8211610674570181601f8201121561067457805190610b7e82610a02565b92610b8c60405194856109df565b8284526020838301011161067457815f9260208093018386015e8301015290565b610bb681610d20565b90815115610bc2575090565b90506001600160a01b03610bd66006610a02565b91610be460405193846109df565b60068352601f19610bf56006610a02565b01366020850137165f5b60038110610c0c57505090565b8060130360138111610cf3577f1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81168103610cf357829060031b1c9060f0807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff08416161660ff8316039160ff8311610cf357600f610c8d9160041c16610f46565b8160011b927f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168303610cf357610cd1915f1a610ccb8588610f08565b53610f46565b9160018101809111610cf357610cec6001935f1a9186610f08565b5301610bff565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f8060609260405160208101907f95d89b4100000000000000000000000000000000000000000000000000000000825260048152610d5f6024826109df565b51915afa903d15610f0257503d90610d7682610a02565b91610d8460405193846109df565b82523d5f602084013e5b158015610ef9575b610eea57805160208103610eb7575060208180518101031261067457602001519060405191610dc66040846109df565b602080845236848201375f905f5b60208110610e5e575050610de781610a02565b90610df560405192836109df565b808252601f19610e0482610a02565b013660208401375f5b818110610e1b575090925050565b807fff00000000000000000000000000000000000000000000000000000000000000610e4960019388610f08565b51165f1a610e578286610f08565b5301610e0d565b81811a7fff000000000000000000000000000000000000000000000000000000000000008160f81b16610e95575b50600101610dd4565b610ea28487959395610f08565b535f198114610cf35760018091019290610e8c565b9060408211610ed6575050604051610ed06020826109df565b5f815290565b602080610ee7938301019101610b4a565b90565b50604051610ed06020826109df565b50805115610d96565b90610d8e565b908151811015610f19570160200190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b60ff16600a811015610f855760300160ff8111610cf35760f81b7fff000000000000000000000000000000000000000000000000000000000000001690565b60370160ff8111610cf35760f81b7fff00000000000000000000000000000000000000000000000000000000000000169056fea2646970667358221220763e950b536b649273400ddc205c50032757766974bad428b04c2db87e9c70a164736f6c634300081c0033000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38

    Deployed Bytecode

    0x6080806040526004361015610012575f80fd5b5f3560e01c9081634aa4a4fc1461099e575080634be1c796146109445780637d4a868914610973578063b7af3cdc14610944578063dee91a2c146108fb5763e9dc63751461005e575f80fd5b34610674576040600319360112610674576004356001600160a01b038116809103610674576024356040517f99fbab8800000000000000000000000000000000000000000000000000000000815281600482015261014081602481865afa908115610604575f905f945f905f925f95610854575b506020600491604051928380927fd5f394880000000000000000000000000000000000000000000000000000000082525afa908115610604575f9161081a575b50604051916060830183811067ffffffffffffffff82111761060f576040526001600160a01b0385169081845260208401916001600160a01b038a1690818452604086019260020b835210156107f2576001600160a01b038080955116925116905160020b6040519160208301938452604083015260608201526060815261019b6080826109df565b519020604051907fffffffffffffffffffffffffffffffffffffffff00000000000000000000000060208301937fff00000000000000000000000000000000000000000000000000000000000000855260601b16602183015260358201527fd012d453ebb4a7bb3632aea48cc0e61fba82473e96bb7d980661630271904f2760558201526055815261022e6075826109df565b519020169161023c81610a94565b61024587610a94565b1290811596875f146107eb5780975b156107e35750915b604051947f3850c7bd00000000000000000000000000000000000000000000000000000000865260e086600481885afa918215610604575f92610751575b600496506001600160a01b037f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3816936001600160a01b038a1699858b145f1461074257506102e6610a1e565b955b6001600160a01b0381169586036107345750610302610a1e565b60208b6040519a8b80927f313ce5670000000000000000000000000000000000000000000000000000000082525afa988915610604575f996106f8575b50604051907f313ce5670000000000000000000000000000000000000000000000000000000082526020826004818a5afa918215610604575f926106bc575b50604051977fd0c93a7c0000000000000000000000000000000000000000000000000000000089526020896004818d5afa978815610604575f98610680575b6040517fddca3f43000000000000000000000000000000000000000000000000000000008152995060208a6004818e5afa998a15610604575f9a61063c575b506040519c6101c08e0167ffffffffffffffff81118f82101761060f576040528d5260208d019d8e5260408d0190815260608d0191825260808d0192835260a08d019b60ff168c5260c08d019360ff16845260e08d019485526101008d019560020b86526101208d019660020b87526101408d019760020b88526101608d019860020b89526101808d019962ffffff168a526101a08d019a8b52604051809e819e7fc49917d70000000000000000000000000000000000000000000000000000000083526004830160209052516024830152516001600160a01b03169060440152516001600160a01b031660648d01525160848c016101c090526101e48c0161050491610a59565b9051908b81037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc0160a48d015261053a91610a59565b985160ff1660c48b01525160ff1660e48a01525115156101048901525160020b6101248801525160020b6101448701525160020b6101648601525160020b6101848501525162ffffff166101a4840152516001600160a01b03166101c48301520381736d2f5899f5c6313583c4daccc344d6587fcd2af991815a935f94f48015610604576105de915f916105e2575b50604051918291602083526020830190610a59565b0390f35b6105fe91503d805f833e6105f681836109df565b810190610b4a565b5f6105c9565b6040513d5f823e3d90fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b9099506020813d602011610678575b81610658602093836109df565b81010312610674575162ffffff8116810361067457985f6103fc565b5f80fd5b3d915061064b565b97506020893d6020116106b4575b8161069b602093836109df565b81010312610674576106ae600499610b02565b976103bd565b3d915061068e565b9091506020813d6020116106f0575b816106d8602093836109df565b81010312610674576106e990610b3c565b905f61037e565b3d91506106cb565b9098506020813d60201161072c575b81610714602093836109df565b810103126106745761072590610b3c565b975f61033f565b3d9150610707565b61073d90610bad565b610302565b61074b90610bad565b956102e8565b915060e0863d60e0116107db575b8161076c60e093836109df565b810103126106745785516001600160a01b038116036106745760c061079360208801610b02565b966107a060408201610b2d565b506107ad60608201610b2d565b506107ba60808201610b2d565b506107c760a08201610b3c565b50015180151503610674576004959161029a565b3d915061075f565b90509161025c565b8197610254565b7f38cd3d8e000000000000000000000000000000000000000000000000000000005f5260045ffd5b90506020813d60201161084c575b81610835602093836109df565b810103126106745761084690610aee565b5f610112565b3d9150610828565b96509350505050610140833d82116108f3575b8161087561014093836109df565b810103126106745761088683610aee565b9261089360208201610aee565b906108a060408201610b02565b94600460206108b160608501610b02565b926108e66101206108c460808801610b02565b966108d160a08201610b10565b506108df6101008201610b10565b5001610b10565b50949792939591506100d2565b3d9150610867565b3461067457604060031936011261067457610914610a7e565b6024356001600160a01b03811681036106745761093b610935602093610a94565b91610a94565b12604051908152f35b34610674575f600319360112610674576105de61095f610a1e565b604051918291602083526020830190610a59565b34610674576020600319360112610674576020610996610991610a7e565b610a94565b604051908152f35b34610674575f600319360112610674576020906001600160a01b037f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38168152f35b90601f601f19910116810190811067ffffffffffffffff82111761060f57604052565b67ffffffffffffffff811161060f57601f01601f191660200190565b60405190610a2d6040836109df565b600182527f53000000000000000000000000000000000000000000000000000000000000006020830152565b90601f19601f602080948051918291828752018686015e5f8582860101520116010190565b600435906001600160a01b038216820361067457565b6001600160a01b03807f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3816911614610aca575f90565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff9c90565b51906001600160a01b038216820361067457565b51908160020b820361067457565b51906fffffffffffffffffffffffffffffffff8216820361067457565b519061ffff8216820361067457565b519060ff8216820361067457565b6020818303126106745780519067ffffffffffffffff8211610674570181601f8201121561067457805190610b7e82610a02565b92610b8c60405194856109df565b8284526020838301011161067457815f9260208093018386015e8301015290565b610bb681610d20565b90815115610bc2575090565b90506001600160a01b03610bd66006610a02565b91610be460405193846109df565b60068352601f19610bf56006610a02565b01366020850137165f5b60038110610c0c57505090565b8060130360138111610cf3577f1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81168103610cf357829060031b1c9060f0807ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff08416161660ff8316039160ff8311610cf357600f610c8d9160041c16610f46565b8160011b927f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff83168303610cf357610cd1915f1a610ccb8588610f08565b53610f46565b9160018101809111610cf357610cec6001935f1a9186610f08565b5301610bff565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f8060609260405160208101907f95d89b4100000000000000000000000000000000000000000000000000000000825260048152610d5f6024826109df565b51915afa903d15610f0257503d90610d7682610a02565b91610d8460405193846109df565b82523d5f602084013e5b158015610ef9575b610eea57805160208103610eb7575060208180518101031261067457602001519060405191610dc66040846109df565b602080845236848201375f905f5b60208110610e5e575050610de781610a02565b90610df560405192836109df565b808252601f19610e0482610a02565b013660208401375f5b818110610e1b575090925050565b807fff00000000000000000000000000000000000000000000000000000000000000610e4960019388610f08565b51165f1a610e578286610f08565b5301610e0d565b81811a7fff000000000000000000000000000000000000000000000000000000000000008160f81b16610e95575b50600101610dd4565b610ea28487959395610f08565b535f198114610cf35760018091019290610e8c565b9060408211610ed6575050604051610ed06020826109df565b5f815290565b602080610ee7938301019101610b4a565b90565b50604051610ed06020826109df565b50805115610d96565b90610d8e565b908151811015610f19570160200190565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b60ff16600a811015610f855760300160ff8111610cf35760f81b7fff000000000000000000000000000000000000000000000000000000000000001690565b60370160ff8111610cf35760f81b7fff00000000000000000000000000000000000000000000000000000000000000169056fea2646970667358221220763e950b536b649273400ddc205c50032757766974bad428b04c2db87e9c70a164736f6c634300081c0033

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

    000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38

    -----Decoded View---------------
    Arg [0] : _WETH9 (address): 0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38

    -----Encoded View---------------
    1 Constructor Arguments found :
    Arg [0] : 000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38


    Block Age Transaction Gas Used Reward
    view all blocks produced

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

    Validator Index Block Age Amount
    View All Withdrawals

    Transaction Hash Block Age Value Eth2 PubKey Valid
    View All Deposits

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