Contract

0xDC9282C2C0BF94832DB65f9120F3D51C7bEC752d

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

-

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

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

Contract Source Code Verified (Exact Match)

Contract Name:
SolidlyAdapter

Compiler Version
v0.8.23+commit.f704f362

Optimization Enabled:
No with 200 runs

Other Settings:
shanghai EvmVersion
File 1 of 20 : SolidlyAdapter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import {Math} from "@openzeppelin/contracts/utils/math/Math.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Strings} from "@openzeppelin/contracts/utils/Strings.sol";
import {IERC165} from "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import {IControllable} from "../interfaces/IControllable.sol";
import {IAmmAdapter} from "../interfaces/IAmmAdapter.sol";
import {Controllable} from "../core/base/Controllable.sol";
import {AmmAdapterIdLib} from "./libs/AmmAdapterIdLib.sol";
import {ISolidlyPool} from "../integrations/solidly/ISolidlyPool.sol";
import {ConstantsLib} from "../core/libs/ConstantsLib.sol";

/// @title AMM adapter for Solidly forks
/// @author Alien Deployer (https://github.com/a17)
contract SolidlyAdapter is Controllable, IAmmAdapter {
    using SafeERC20 for IERC20;

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                         CONSTANTS                          */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @inheritdoc IControllable
    string public constant VERSION = "1.0.0";

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                      INITIALIZATION                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @inheritdoc IAmmAdapter
    function init(address platform_) external initializer {
        __Controllable_init(platform_);
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       USER ACTIONS                         */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @inheritdoc IAmmAdapter
    //slither-disable-next-line reentrancy-events
    function swap(
        address pool,
        address tokenIn,
        address tokenOut,
        address recipient,
        uint priceImpactTolerance
    ) external {
        uint amountIn = IERC20(tokenIn).balanceOf(address(this));
        uint amountOut = ISolidlyPool(pool).getAmountOut(amountIn, tokenIn);
        uint balanceBefore = IERC20(tokenOut).balanceOf(recipient);

        uint amount1 = 10 ** IERC20Metadata(tokenIn).decimals();
        uint priceBefore = getPrice(pool, tokenIn, tokenOut, amount1);

        uint amount0Out;
        uint amount1Out;
        {
            (address token0,) = _sortTokens(tokenIn, tokenOut);
            (amount0Out, amount1Out) = tokenIn == token0 ? (uint(0), amountOut) : (amountOut, uint(0));

            IERC20(tokenIn).safeTransfer(pool, amountIn);
        }
        ISolidlyPool(pool).swap(amount0Out, amount1Out, recipient, new bytes(0));

        uint priceAfter = getPrice(pool, tokenIn, tokenOut, amount1);
        uint priceImpact = (priceBefore - priceAfter) * ConstantsLib.DENOMINATOR / priceBefore;
        if (priceImpact >= priceImpactTolerance) {
            revert(string(abi.encodePacked("!PRICE ", Strings.toString(priceImpact))));
        }

        uint balanceAfter = IERC20(tokenOut).balanceOf(recipient);
        emit SwapInPool(
            pool,
            tokenIn,
            tokenOut,
            recipient,
            priceImpactTolerance,
            amountIn,
            balanceAfter > balanceBefore ? balanceAfter - balanceBefore : 0
        );
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                      VIEW FUNCTIONS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @inheritdoc IAmmAdapter
    function ammAdapterId() external pure returns (string memory) {
        return AmmAdapterIdLib.SOLIDLY;
    }

    /// @inheritdoc IAmmAdapter
    function poolTokens(address pool) public view returns (address[] memory tokens) {
        tokens = new address[](2);
        tokens[0] = ISolidlyPool(pool).token0();
        tokens[1] = ISolidlyPool(pool).token1();
    }

    /// @inheritdoc IAmmAdapter
    function getLiquidityForAmounts(
        address pool,
        uint[] memory amounts
    ) external view returns (uint liquidity, uint[] memory amountsConsumed) {
        amountsConsumed = new uint[](2);
        (uint reserveA, uint reserveB) = _getReserves(pool);
        uint amountBOptimal = _quoteAddLiquidity(amounts[0], reserveA, reserveB);
        if (amountBOptimal <= amounts[1]) {
            (amountsConsumed[0], amountsConsumed[1]) = (amounts[0], amountBOptimal);
        } else {
            uint amountAOptimal = _quoteAddLiquidity(amounts[1], reserveB, reserveA);
            (amountsConsumed[0], amountsConsumed[1]) = (amountAOptimal, amounts[1]);
        }

        uint _totalSupply = ISolidlyPool(pool).totalSupply();
        liquidity = Math.min(amountsConsumed[0] * _totalSupply / reserveA, amountsConsumed[1] * _totalSupply / reserveB);
    }

    /// @inheritdoc IAmmAdapter
    function getProportions(address pool) external view returns (uint[] memory props) {
        props = new uint[](2);
        if (ISolidlyPool(pool).stable()) {
            address token1 = ISolidlyPool(pool).token1();
            uint token1Decimals = IERC20Metadata(token1).decimals();
            uint token1Price = getPrice(pool, token1, address(0), 10 ** token1Decimals);
            (uint reserve0, uint reserve1) = _getReserves(pool);
            uint reserve1Priced = reserve1 * token1Price / 10 ** token1Decimals;
            uint totalPriced = reserve0 + reserve1Priced;
            props[0] = reserve0 * 1e18 / totalPriced;
            props[1] = reserve1Priced * 1e18 / totalPriced;
        } else {
            props[0] = 5e17;
            props[1] = 5e17;
        }
    }

    /// @inheritdoc IAmmAdapter
    function getPrice(address pool, address tokenIn, address, /*tokenOut*/ uint amount) public view returns (uint) {
        return ISolidlyPool(pool).getAmountOut(amount, tokenIn);
    }

    /// @inheritdoc IERC165
    function supportsInterface(bytes4 interfaceId) public view override(Controllable, IERC165) returns (bool) {
        return interfaceId == type(IAmmAdapter).interfaceId || super.supportsInterface(interfaceId);
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       INTERNAL LOGIC                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @dev Returns sorted token addresses, used to handle return values from pairs sorted in this order
    function _sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
    }

    function _getReserves(address pool) internal view returns (uint reserveA, uint reserveB) {
        address[] memory tokens = poolTokens(pool);
        (address token0,) = _sortTokens(tokens[0], tokens[1]);
        (uint reserve0, uint reserve1,) = ISolidlyPool(pool).getReserves();
        (reserveA, reserveB) = tokens[0] == token0 ? (reserve0, reserve1) : (reserve1, reserve0);
    }

    function _quoteAddLiquidity(uint amountA, uint reserveA, uint reserveB) internal pure returns (uint) {
        return amountA * reserveB / reserveA;
    }
}

File 2 of 20 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

File 3 of 20 : IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

File 4 of 20 : Math.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/Math.sol)

pragma solidity ^0.8.20;

/**
 * @dev Standard math utilities missing in the Solidity language.
 */
library Math {
    /**
     * @dev Muldiv operation overflow.
     */
    error MathOverflowedMulDiv();

    enum Rounding {
        Floor, // Toward negative infinity
        Ceil, // Toward positive infinity
        Trunc, // Toward zero
        Expand // Away from zero
    }

    /**
     * @dev Returns the addition of two unsigned integers, with an overflow flag.
     */
    function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            uint256 c = a + b;
            if (c < a) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the subtraction of two unsigned integers, with an overflow flag.
     */
    function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b > a) return (false, 0);
            return (true, a - b);
        }
    }

    /**
     * @dev Returns the multiplication of two unsigned integers, with an overflow flag.
     */
    function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            // Gas optimization: this is cheaper than requiring 'a' not being zero, but the
            // benefit is lost if 'b' is also tested.
            // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
            if (a == 0) return (true, 0);
            uint256 c = a * b;
            if (c / a != b) return (false, 0);
            return (true, c);
        }
    }

    /**
     * @dev Returns the division of two unsigned integers, with a division by zero flag.
     */
    function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a / b);
        }
    }

    /**
     * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
     */
    function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
        unchecked {
            if (b == 0) return (false, 0);
            return (true, a % b);
        }
    }

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

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

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

    /**
     * @dev Returns the ceiling of the division of two numbers.
     *
     * This differs from standard division with `/` in that it rounds towards infinity instead
     * of rounding towards zero.
     */
    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
        if (b == 0) {
            // Guarantee the same behavior as in a regular Solidity division.
            return a / b;
        }

        // (a + b - 1) / b can overflow on addition, so we distribute.
        return a == 0 ? 0 : (a - 1) / b + 1;
    }

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

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

            // Make sure the result is less than 2^256. Also prevents denominator == 0.
            if (denominator <= prod1) {
                revert MathOverflowedMulDiv();
            }

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

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

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

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

            uint256 twos = denominator & (0 - denominator);
            assembly {
                // Divide denominator by twos.
                denominator := div(denominator, twos)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    /**
     * @dev Returns whether a provided rounding mode is considered rounding up for unsigned integers.
     */
    function unsignedRoundsUp(Rounding rounding) internal pure returns (bool) {
        return uint8(rounding) % 2 == 1;
    }
}

File 5 of 20 : SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

File 6 of 20 : Strings.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Strings.sol)

pragma solidity ^0.8.20;

import {Math} from "./math/Math.sol";
import {SignedMath} from "./math/SignedMath.sol";

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

    /**
     * @dev The `value` string doesn't fit in the specified `length`.
     */
    error StringsInsufficientHexLength(uint256 value, uint256 length);

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

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

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

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

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

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

File 7 of 20 : IERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/IERC165.sol)

pragma solidity ^0.8.20;

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

File 8 of 20 : IControllable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

/// @dev Base core interface implemented by most platform contracts.
///      Inherited contracts store an immutable Platform proxy address in the storage,
///      which provides authorization capabilities and infrastructure contract addresses.
/// @author Alien Deployer (https://github.com/a17)
/// @author JodsMigel (https://github.com/JodsMigel)
interface IControllable {
    //region ----- Custom Errors -----
    error IncorrectZeroArgument();
    error IncorrectMsgSender();
    error NotGovernance();
    error NotMultisig();
    error NotGovernanceAndNotMultisig();
    error NotOperator();
    error NotFactory();
    error NotPlatform();
    error NotVault();
    error IncorrectArrayLength();
    error AlreadyExist();
    error NotExist();
    error NotTheOwner();
    error ETHTransferFailed();
    error IncorrectInitParams();
    //endregion -- Custom Errors -----

    event ContractInitialized(address platform, uint ts, uint block);

    /// @notice Stability Platform main contract address
    function platform() external view returns (address);

    /// @notice Version of contract implementation
    /// @dev SemVer scheme MAJOR.MINOR.PATCH
    //slither-disable-next-line naming-convention
    function VERSION() external view returns (string memory);

    /// @notice Block number when contract was initialized
    function createdBlock() external view returns (uint);
}

File 9 of 20 : IAmmAdapter.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import "@openzeppelin/contracts/utils/introspection/IERC165.sol";

/// @dev Get price, swap, liquidity calculations. Used by strategies and swapper
/// @author Alien Deployer (https://github.com/a17)
/// @author JodsMigel (https://github.com/JodsMigel)
interface IAmmAdapter is IERC165 {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    error PriceIncreased();
    error WrongCallbackAmount();
    error NotSupportedByCAMM();

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                           EVENTS                           */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    event SwapInPool(
        address pool,
        address tokenIn,
        address tokenOut,
        address recipient,
        uint priceImpactTolerance,
        uint amountIn,
        uint amountOut
    );

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                         DATA TYPES                         */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    struct SwapCallbackData {
        address tokenIn;
        uint amount;
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       VIEW FUNCTIONS                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @notice String ID of the adapter
    function ammAdapterId() external view returns (string memory);

    /// @notice Tokens of a pool supported by the adapter
    function poolTokens(address pool) external view returns (address[] memory);

    /// @notice Computes the maximum amount of liquidity received for given amounts of pool assets and the current
    /// pool price.
    /// This function signature can be used only for non-concentrated AMMs.
    /// @param pool Address of a pool supported by the adapter
    /// @param amounts Amounts of pool assets
    /// @return liquidity Liquidity out value
    /// @return amountsConsumed Amounts of consumed assets when providing liquidity
    function getLiquidityForAmounts(
        address pool,
        uint[] memory amounts
    ) external view returns (uint liquidity, uint[] memory amountsConsumed);

    /// @notice Priced proportions of pool assets
    /// @param pool Address of a pool supported by the adapter
    /// @return Proportions with 18 decimals precision. Max is 1e18, min is 0.
    function getProportions(address pool) external view returns (uint[] memory);

    /// @notice Current price in pool without amount impact
    /// @param pool Address of a pool supported by the adapter
    /// @param tokenIn Token for sell
    /// @param tokenOut Token for buy
    /// @param amount Amount of tokenIn. For zero value provided amount 1.0 (10 ** decimals of tokenIn) will be used.
    /// @return Amount of tokenOut with tokenOut decimals precision
    function getPrice(address pool, address tokenIn, address tokenOut, uint amount) external view returns (uint);

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                      WRITE FUNCTIONS                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @notice Swap given tokenIn for tokenOut. Assume that tokenIn already sent to this contract.
    /// @param pool Address of a pool supported by the adapter
    /// @param tokenIn Token for sell
    /// @param tokenOut Token for buy
    /// @param recipient Recipient for tokenOut
    /// @param priceImpactTolerance Price impact tolerance. Must include fees at least. Denominator is 100_000.
    function swap(
        address pool,
        address tokenIn,
        address tokenOut,
        address recipient,
        uint priceImpactTolerance
    ) external;

    /// @dev Initializer for proxied adapter
    function init(address platform) external;
}

File 10 of 20 : Controllable.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "../libs/SlotsLib.sol";
import "../../interfaces/IControllable.sol";
import "../../interfaces/IPlatform.sol";

/// @dev Base core contract.
///      It store an immutable platform proxy address in the storage and provides access control to inherited contracts.
/// @author Alien Deployer (https://github.com/a17)
/// @author 0xhokugava (https://github.com/0xhokugava)
abstract contract Controllable is Initializable, IControllable, ERC165 {
    using SlotsLib for bytes32;

    string public constant CONTROLLABLE_VERSION = "1.0.0";
    bytes32 internal constant _PLATFORM_SLOT = bytes32(uint(keccak256("eip1967.controllable.platform")) - 1);
    bytes32 internal constant _CREATED_BLOCK_SLOT = bytes32(uint(keccak256("eip1967.controllable.created_block")) - 1);

    /// @dev Prevent implementation init
    constructor() {
        _disableInitializers();
    }

    /// @notice Initialize contract after setup it as proxy implementation
    ///         Save block.timestamp in the "created" variable
    /// @dev Use it only once after first logic setup
    /// @param platform_ Platform address
    //slither-disable-next-line naming-convention
    function __Controllable_init(address platform_) internal onlyInitializing {
        if (platform_ == address(0) || IPlatform(platform_).multisig() == address(0)) {
            revert IncorrectZeroArgument();
        }
        SlotsLib.set(_PLATFORM_SLOT, platform_); // syntax for forge coverage
        _CREATED_BLOCK_SLOT.set(block.number);
        emit ContractInitialized(platform_, block.timestamp, block.number);
    }

    modifier onlyGovernance() {
        _requireGovernance();
        _;
    }

    modifier onlyMultisig() {
        _requireMultisig();
        _;
    }

    modifier onlyGovernanceOrMultisig() {
        _requireGovernanceOrMultisig();
        _;
    }

    modifier onlyOperator() {
        _requireOperator();
        _;
    }

    modifier onlyFactory() {
        _requireFactory();
        _;
    }

    // ************* SETTERS/GETTERS *******************

    /// @inheritdoc IControllable
    function platform() public view override returns (address) {
        return _PLATFORM_SLOT.getAddress();
    }

    /// @inheritdoc IControllable
    function createdBlock() external view override returns (uint) {
        return _CREATED_BLOCK_SLOT.getUint();
    }

    /// @inheritdoc IERC165
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IControllable).interfaceId || super.supportsInterface(interfaceId);
    }

    function _requireGovernance() internal view {
        if (IPlatform(platform()).governance() != msg.sender) {
            revert NotGovernance();
        }
    }

    function _requireMultisig() internal view {
        if (!IPlatform(platform()).isOperator(msg.sender)) {
            revert NotMultisig();
        }
    }

    function _requireGovernanceOrMultisig() internal view {
        IPlatform _platform = IPlatform(platform());
        // nosemgrep
        if (_platform.governance() != msg.sender && _platform.multisig() != msg.sender) {
            revert NotGovernanceAndNotMultisig();
        }
    }

    function _requireOperator() internal view {
        if (!IPlatform(platform()).isOperator(msg.sender)) {
            revert NotOperator();
        }
    }

    function _requireFactory() internal view {
        if (IPlatform(platform()).factory() != msg.sender) {
            revert NotFactory();
        }
    }
}

File 11 of 20 : AmmAdapterIdLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.21;

library AmmAdapterIdLib {
    string public constant UNISWAPV3 = "UniswapV3";
    string public constant ALGEBRA = "Algebra";
    string public constant KYBER = "KyberSwap";
    string public constant CURVE = "Curve";
    string public constant SOLIDLY = "Solidly";
    string public constant BALANCER_COMPOSABLE_STABLE = "BalancerComposableStable";
    string public constant BALANCER_WEIGHTED = "BalancerWeighted";
}

File 12 of 20 : ISolidlyPool.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

interface ISolidlyPool {
    /// @notice True if pool is stable, false if volatile
    function stable() external view returns (bool);

    /// @notice Returns the decimal (dec), reserves (r), stable (st), and tokens (t) of token0 and token1
    function metadata()
    external
    view
    returns (uint dec0, uint dec1, uint r0, uint r1, bool st, address t0, address t1);

    /// @notice Claim accumulated but unclaimed fees (claimable0 and claimable1)
    function claimFees() external returns (uint, uint);

    /// @notice Returns [token0, token1]
    function tokens() external view returns (address, address);

    /// @notice Address of token in the pool with the lower address value
    function token0() external view returns (address);

    /// @notice Address of token in the poool with the higher address value
    function token1() external view returns (address);

    /// @notice Amount of token0 in pool
    function reserve0() external view returns (uint);

    /// @notice Amount of token1 in pool
    function reserve1() external view returns (uint);

    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);

    /// @notice Returns the amount of tokens in existence.
    function totalSupply() external view returns (uint);

    /// @notice Amount of unclaimed, but claimable tokens from fees of token0 for an LP
    function claimable0(address) external view returns (uint);

    /// @notice Amount of unclaimed, but claimable tokens from fees of token1 for an LP
    function claimable1(address) external view returns (uint);

    /// @notice Get the amount of tokenOut given the amount of tokenIn
    /// @param amountIn Amount of token in
    /// @param tokenIn  Address of token
    /// @return Amount out
    function getAmountOut(uint amountIn, address tokenIn) external view returns (uint);

    /// @notice Update reserves and, on the first call per block, price accumulators
    /// @return _reserve0 .
    /// @return _reserve1 .
    /// @return _blockTimestampLast .
    function getReserves() external view returns (uint _reserve0, uint _reserve1, uint _blockTimestampLast);

    /// @notice This low-level function should be called from a contract which performs important safety checks
    /// @param amount0Out   Amount of token0 to send to `to`
    /// @param amount1Out   Amount of token1 to send to `to`
    /// @param to           Address to recieve the swapped output
    /// @param data         Additional calldata for flashloans
    function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;

    /// @notice This low-level function should be called from a contract which performs important safety checks
    ///         standard uniswap v2 implementation
    /// @param to Address to receive token0 and token1 from burning the pool token
    /// @return amount0 Amount of token0 returned
    /// @return amount1 Amount of token1 returned
    function burn(address to) external returns (uint amount0, uint amount1);

    /// @notice This low-level function should be called by addLiquidity functions in Router.sol, which performs important safety checks
    ///         standard uniswap v2 implementation
    /// @param to           Address to receive the minted LP token
    /// @return liquidity   Amount of LP token minted
    function mint(address to) external returns (uint liquidity);

    /// @notice Force balances to match reserves
    /// @param to Address to receive any skimmed rewards
    function skim(address to) external;

    /**
     * @dev Moves `amount` tokens from `from` to `to` using the
     * allowance mechanism. `amount` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint amount) external returns (bool);

    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     */
    function permit(
        address owner,
        address spender,
        uint value,
        uint deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

}

File 13 of 20 : ConstantsLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

library ConstantsLib {
    uint internal constant DENOMINATOR = 100_000;
    address internal constant DEAD_ADDRESS = 0xdEad000000000000000000000000000000000000;
}

File 14 of 20 : IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

File 15 of 20 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}

File 16 of 20 : SignedMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/math/SignedMath.sol)

pragma solidity ^0.8.20;

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

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

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

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

File 17 of 20 : Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Storage of the initializable contract.
     *
     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
     * when using with upgradeable contracts.
     *
     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
     */
    struct InitializableStorage {
        /**
         * @dev Indicates that the contract has been initialized.
         */
        uint64 _initialized;
        /**
         * @dev Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reininitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._initialized = 1;
        if (isTopLevelCall) {
            $._initializing = true;
        }
        _;
        if (isTopLevelCall) {
            $._initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._initialized = version;
        $._initializing = true;
        _;
        $._initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint64) {
        return _getInitializableStorage()._initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _getInitializableStorage()._initializing;
    }

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        assembly {
            $.slot := INITIALIZABLE_STORAGE
        }
    }
}

File 18 of 20 : ERC165.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/introspection/ERC165.sol)

pragma solidity ^0.8.20;

import {IERC165} from "./IERC165.sol";

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

File 19 of 20 : SlotsLib.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

/// @title Minimal library for setting / getting slot variables (used in upgradable proxy contracts)
library SlotsLib {
    /// @dev Gets a slot as an address
    function getAddress(bytes32 slot) internal view returns (address result) {
        assembly {
            result := sload(slot)
        }
    }

    /// @dev Gets a slot as uint256
    function getUint(bytes32 slot) internal view returns (uint result) {
        assembly {
            result := sload(slot)
        }
    }

    /// @dev Sets a slot with address
    /// @notice Check address for 0 at the setter
    function set(bytes32 slot, address value) internal {
        assembly {
            sstore(slot, value)
        }
    }

    /// @dev Sets a slot with uint
    function set(bytes32 slot, uint value) internal {
        assembly {
            sstore(slot, value)
        }
    }
}

File 20 of 20 : IPlatform.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.23;

/// @notice Interface of the main contract and entry point to the platform.
/// @author Alien Deployer (https://github.com/a17)
/// @author Jude (https://github.com/iammrjude)
/// @author JodsMigel (https://github.com/JodsMigel)
interface IPlatform {
    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                       CUSTOM ERRORS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    error AlreadyAnnounced();
    error SameVersion();
    error NoNewVersion();
    error UpgradeTimerIsNotOver(uint TimerTimestamp);
    error IncorrectFee(uint minFee, uint maxFee);
    error NotEnoughAllowedBBToken();
    error TokenAlreadyExistsInSet(address token);
    error AggregatorNotExists(address dexAggRouter);

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                           EVENTS                           */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    event PlatformVersion(string version);
    event UpgradeAnnounce(
        string oldVersion, string newVersion, address[] proxies, address[] newImplementations, uint timelock
    );
    event CancelUpgrade(string oldVersion, string newVersion);
    event ProxyUpgraded(
        address indexed proxy, address implementation, string oldContractVersion, string newContractVersion
    );
    event Addresses(
        address multisig_,
        address factory_,
        address priceReader_,
        address swapper_,
        address buildingPermitToken_,
        address vaultManager_,
        address strategyLogic_,
        address aprOracle_,
        address hardWorker,
        address rebalancer,
        address zap,
        address bridge
    );
    event OperatorAdded(address operator);
    event OperatorRemoved(address operator);
    event FeesChanged(uint fee, uint feeShareVaultManager, uint feeShareStrategyLogic, uint feeShareEcosystem);
    event MinInitialBoostChanged(uint minInitialBoostPerDay, uint minInitialBoostDuration);
    event NewAmmAdapter(string id, address proxy);
    event EcosystemRevenueReceiver(address receiver);
    event SetAllowedBBTokenVaults(address bbToken, uint vaultsToBuild, bool firstSet);
    event RemoveAllowedBBToken(address bbToken);
    event AddAllowedBoostRewardToken(address token);
    event RemoveAllowedBoostRewardToken(address token);
    event AddDefaultBoostRewardToken(address token);
    event RemoveDefaultBoostRewardToken(address token);
    event AddBoostTokens(address[] allowedBoostRewardToken, address[] defaultBoostRewardToken);
    event AllowedBBTokenVaultUsed(address bbToken, uint vaultToUse);
    event AddDexAggregator(address router);
    event RemoveDexAggregator(address router);
    event MinTvlForFreeHardWorkChanged(uint oldValue, uint newValue);
    event CustomVaultFee(address vault, uint platformFee);
    event Rebalancer(address rebalancer_);
    event Bridge(address bridge_);

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                         DATA TYPES                         */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    struct PlatformUpgrade {
        string newVersion;
        address[] proxies;
        address[] newImplementations;
    }

    struct PlatformSettings {
        string networkName;
        bytes32 networkExtra;
        uint fee;
        uint feeShareVaultManager;
        uint feeShareStrategyLogic;
        uint feeShareEcosystem;
        uint minInitialBoostPerDay;
        uint minInitialBoostDuration;
    }

    struct AmmAdapter {
        string id;
        address proxy;
    }

    struct SetupAddresses {
        address factory;
        address priceReader;
        address swapper;
        address buildingPermitToken;
        address buildingPayPerVaultToken;
        address vaultManager;
        address strategyLogic;
        address aprOracle;
        address targetExchangeAsset;
        address hardWorker;
        address zap;
        address bridge;
        address rebalancer;
    }

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                      VIEW FUNCTIONS                        */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @notice Platform version in CalVer scheme: YY.MM.MINOR-tag. Updates on core contract upgrades.
    function platformVersion() external view returns (string memory);

    /// @notice Time delay for proxy upgrades of core contracts and changing important platform settings by multisig
    //slither-disable-next-line naming-convention
    function TIME_LOCK() external view returns (uint);

    /// @notice DAO governance
    function governance() external view returns (address);

    /// @notice Core team multi signature wallet. Development and operations fund
    function multisig() external view returns (address);

    /// @notice This NFT allow user to build limited number of vaults per week
    function buildingPermitToken() external view returns (address);

    /// @notice This ERC20 token is used as payment token for vault building
    function buildingPayPerVaultToken() external view returns (address);

    /// @notice Receiver of ecosystem revenue
    function ecosystemRevenueReceiver() external view returns (address);

    /// @dev The best asset in a network for swaps between strategy assets and farms rewards assets
    ///      The target exchange asset is used for finding the best strategy's exchange asset.
    ///      Rhe fewer routes needed to swap to the target exchange asset, the better.
    function targetExchangeAsset() external view returns (address);

    /// @notice Platform factory assembling vaults. Stores settings, strategy logic, farms.
    /// Provides the opportunity to upgrade vaults and strategies.
    /// @return Address of Factory proxy
    function factory() external view returns (address);

    /// @notice The holders of these NFT receive a share of the vault revenue
    /// @return Address of VaultManager proxy
    function vaultManager() external view returns (address);

    /// @notice The holders of these tokens receive a share of the revenue received in all vaults using this strategy logic.
    function strategyLogic() external view returns (address);

    /// @notice Combining oracle and DeX spot prices
    /// @return Address of PriceReader proxy
    function priceReader() external view returns (address);

    /// @notice Providing underlying assets APRs on-chain
    /// @return Address of AprOracle proxy
    function aprOracle() external view returns (address);

    /// @notice On-chain price quoter and swapper
    /// @return Address of Swapper proxy
    function swapper() external view returns (address);

    /// @notice HardWork resolver and caller
    /// @return Address of HardWorker proxy
    function hardWorker() external view returns (address);

    /// @notice Rebalance resolver
    /// @return Address of Rebalancer proxy
    function rebalancer() external view returns (address);

    /// @notice ZAP feature
    /// @return Address of Zap proxy
    function zap() external view returns (address);

    /// @notice Stability Bridge
    /// @return Address of Bridge proxy
    function bridge() external view returns (address);

    /// @notice Name of current EVM network
    function networkName() external view returns (string memory);

    /// @notice Minimal initial boost rewards per day USD amount which needs to create rewarding vault
    function minInitialBoostPerDay() external view returns (uint);

    /// @notice Minimal boost rewards vesting duration for initial boost
    function minInitialBoostDuration() external view returns (uint);

    /// @notice This function provides the timestamp of the platform upgrade timelock.
    /// @dev This function is an external view function, meaning it doesn't modify the state.
    /// @return uint representing the timestamp of the platform upgrade timelock.
    function platformUpgradeTimelock() external view returns (uint);

    /// @dev Extra network data
    /// @return 0-2 bytes - color
    ///         3-5 bytes - background color
    ///         6-31 bytes - free
    function networkExtra() external view returns (bytes32);

    /// @notice Pending platform upgrade data
    function pendingPlatformUpgrade() external view returns (PlatformUpgrade memory);

    /// @notice Get platform revenue fee settings
    /// @return fee Revenue fee % (between MIN_FEE - MAX_FEE) with DENOMINATOR precision.
    /// @return feeShareVaultManager Revenue fee share % of VaultManager tokenId owner
    /// @return feeShareStrategyLogic Revenue fee share % of StrategyLogic tokenId owner
    /// @return feeShareEcosystem Revenue fee share % of ecosystemFeeReceiver
    function getFees()
        external
        view
        returns (uint fee, uint feeShareVaultManager, uint feeShareStrategyLogic, uint feeShareEcosystem);

    /// @notice Get custom vault platform fee
    /// @return fee revenue fee % with DENOMINATOR precision
    function getCustomVaultFee(address vault) external view returns (uint fee);

    /// @notice Platform settings
    function getPlatformSettings() external view returns (PlatformSettings memory);

    /// @notice AMM adapters of the platform
    function getAmmAdapters() external view returns (string[] memory id, address[] memory proxy);

    /// @notice Get AMM adapter data by hash
    /// @param ammAdapterIdHash Keccak256 hash of adapter ID string
    /// @return ID string and proxy address of AMM adapter
    function ammAdapter(bytes32 ammAdapterIdHash) external view returns (AmmAdapter memory);

    /// @notice Allowed buy-back tokens for rewarding vaults
    function allowedBBTokens() external view returns (address[] memory);

    /// @notice Vaults building limit for buy-back token.
    /// This limit decrements when a vault for BB-token is built.
    /// @param token Allowed buy-back token
    /// @return vaultsLimit Number of vaults that can be built for BB-token
    function allowedBBTokenVaults(address token) external view returns (uint vaultsLimit);

    /// @notice Vaults building limits for allowed buy-back tokens.
    /// @return bbToken Allowed buy-back tokens
    /// @return vaultsLimit Number of vaults that can be built for BB-tokens
    function allowedBBTokenVaults() external view returns (address[] memory bbToken, uint[] memory vaultsLimit);

    /// @notice Non-zero vaults building limits for allowed buy-back tokens.
    /// @return bbToken Allowed buy-back tokens
    /// @return vaultsLimit Number of vaults that can be built for BB-tokens
    function allowedBBTokenVaultsFiltered()
        external
        view
        returns (address[] memory bbToken, uint[] memory vaultsLimit);

    /// @notice Check address for existance in operators list
    /// @param operator Address
    /// @return True if this address is Stability Operator
    function isOperator(address operator) external view returns (bool);

    /// @notice Tokens that can be used for boost rewards of rewarding vaults
    /// @return Addresses of tokens
    function allowedBoostRewardTokens() external view returns (address[] memory);

    /// @notice Allowed boost reward tokens that used for unmanaged rewarding vaults creation
    /// @return Addresses of tokens
    function defaultBoostRewardTokens() external view returns (address[] memory);

    /// @notice Allowed boost reward tokens that used for unmanaged rewarding vaults creation
    /// @param addressToRemove This address will be removed from default boost reward tokens
    /// @return Addresses of tokens
    function defaultBoostRewardTokensFiltered(address addressToRemove) external view returns (address[] memory);

    /// @notice Allowed DeX aggregators
    /// @return Addresses of DeX aggregator rounters
    function dexAggregators() external view returns (address[] memory);

    /// @notice DeX aggregator router address is allowed to be used in the platform
    /// @param dexAggRouter Address of DeX aggreagator router
    /// @return Can be used
    function isAllowedDexAggregatorRouter(address dexAggRouter) external view returns (bool);

    /// @notice Show minimum TVL for compensate if vault has not enough ETH
    /// @return Minimum TVL for compensate.
    function minTvlForFreeHardWork() external view returns (uint);

    /// @notice Front-end platform viewer
    /// @return platformAddresses Platform core addresses
    ///        platformAddresses[0] factory
    ///        platformAddresses[1] vaultManager
    ///        platformAddresses[2] strategyLogic
    ///        platformAddresses[3] buildingPermitToken
    ///        platformAddresses[4] buildingPayPerVaultToken
    ///        platformAddresses[5] governance
    ///        platformAddresses[6] multisig
    ///        platformAddresses[7] zap
    ///        platformAddresses[8] bridge
    /// @return bcAssets Blue chip token addresses
    /// @return dexAggregators_ DeX aggregators allowed to be used entire the platform
    /// @return vaultType Vault type ID strings
    /// @return vaultExtra Vault color, background color and other extra data. Index of vault same as in previous array.
    /// @return vaultBulldingPrice Price of creating new vault in buildingPayPerVaultToken. Index of vault same as in previous array.
    /// @return strategyId Strategy logic ID strings
    /// @return isFarmingStrategy True if strategy is farming strategy. Index of strategy same as in previous array.
    /// @return strategyTokenURI StrategyLogic NFT tokenId metadata and on-chain image. Index of strategy same as in previous array.
    /// @return strategyExtra Strategy color, background color and other extra data. Index of strategy same as in previous array.
    function getData()
        external
        view
        returns (
            address[] memory platformAddresses,
            address[] memory bcAssets,
            address[] memory dexAggregators_,
            string[] memory vaultType,
            bytes32[] memory vaultExtra,
            uint[] memory vaultBulldingPrice,
            string[] memory strategyId,
            bool[] memory isFarmingStrategy,
            string[] memory strategyTokenURI,
            bytes32[] memory strategyExtra
        );

    // todo add vaultSymbol, vaultName
    /// @notice Front-end balances, prices and vault list viewer
    /// @param yourAccount Address of account to query balances
    /// @return token Tokens supported by the platform
    /// @return tokenPrice USD price of token. Index of token same as in previous array.
    /// @return tokenUserBalance User balance of token. Index of token same as in previous array.
    /// @return vault Deployed vaults
    /// @return vaultSharePrice Price 1.0 vault share. Index of vault same as in previous array.
    /// @return vaultUserBalance User balance of vault. Index of vault same as in previous array.
    /// @return nft Ecosystem NFTs
    ///         nft[0] BuildingPermitToken
    ///         nft[1] VaultManager
    ///         nft[2] StrategyLogic
    /// @return nftUserBalance User balance of NFT. Index of NFT same as in previous array.
    /// @return buildingPayPerVaultTokenBalance User balance of vault creation paying token
    function getBalance(address yourAccount)
        external
        view
        returns (
            address[] memory token,
            uint[] memory tokenPrice,
            uint[] memory tokenUserBalance,
            address[] memory vault,
            uint[] memory vaultSharePrice,
            uint[] memory vaultUserBalance,
            address[] memory nft,
            uint[] memory nftUserBalance,
            uint buildingPayPerVaultTokenBalance
        );

    /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/
    /*                      WRITE FUNCTIONS                       */
    /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/

    /// @notice Add platform operator.
    /// Only governance and multisig can add operator.
    /// @param operator Address of new operator
    function addOperator(address operator) external;

    /// @notice Remove platform operator.
    /// Only governance and multisig can remove operator.
    /// @param operator Address of operator to remove
    function removeOperator(address operator) external;

    /// @notice Announce upgrade of platform proxies implementations
    /// Only governance and multisig can announce platform upgrades.
    /// @param newVersion New platform version. Version must be changed when upgrading.
    /// @param proxies Addresses of core contract proxies
    /// @param newImplementations New implementation for proxy. Index of proxy same as in previous array.
    function announcePlatformUpgrade(
        string memory newVersion,
        address[] memory proxies,
        address[] memory newImplementations
    ) external;

    /// @notice Upgrade platform
    /// Only operator (multisig is operator too) can ececute pending platform upgrade
    function upgrade() external;

    /// @notice Cancel pending platform upgrade
    /// Only operator (multisig is operator too) can ececute pending platform upgrade
    function cancelUpgrade() external;

    /// @notice Register AMM adapter in platform
    /// @param id AMM adapter ID string from AmmAdapterIdLib
    /// @param proxy Address of AMM adapter proxy
    function addAmmAdapter(string memory id, address proxy) external;

    // todo Only governance and multisig can set allowed bb-token vaults building limit
    /// @notice Set new vaults building limit for buy-back token
    /// @param bbToken Address of allowed buy-back token
    /// @param vaultsToBuild Number of vaults that can be built for BB-token
    function setAllowedBBTokenVaults(address bbToken, uint vaultsToBuild) external;

    // todo Only governance and multisig can add allowed boost reward token
    /// @notice Add new allowed boost reward token
    /// @param token Address of token
    function addAllowedBoostRewardToken(address token) external;

    // todo Only governance and multisig can remove allowed boost reward token
    /// @notice Remove allowed boost reward token
    /// @param token Address of allowed boost reward token
    function removeAllowedBoostRewardToken(address token) external;

    // todo Only governance and multisig can add default boost reward token
    /// @notice Add default boost reward token
    /// @param token Address of default boost reward token
    function addDefaultBoostRewardToken(address token) external;

    // todo Only governance and multisig can remove default boost reward token
    /// @notice Remove default boost reward token
    /// @param token Address of allowed boost reward token
    function removeDefaultBoostRewardToken(address token) external;

    // todo Only governance and multisig can add allowed boost reward token
    // todo Only governance and multisig can add default boost reward token
    /// @notice Add new allowed boost reward token
    /// @notice Add default boost reward token
    /// @param allowedBoostRewardToken Address of allowed boost reward token
    /// @param defaultBoostRewardToken Address of default boost reward token
    function addBoostTokens(
        address[] memory allowedBoostRewardToken,
        address[] memory defaultBoostRewardToken
    ) external;

    /// @notice Decrease allowed BB-token vault building limit when vault is built
    /// Only Factory can do it.
    /// @param bbToken Address of allowed buy-back token
    function useAllowedBBTokenVault(address bbToken) external;

    /// @notice Allow DeX aggregator routers to be used in the platform
    /// @param dexAggRouter Addresses of DeX aggreagator routers
    function addDexAggregators(address[] memory dexAggRouter) external;

    /// @notice Remove allowed DeX aggregator router from the platform
    /// @param dexAggRouter Address of DeX aggreagator router
    function removeDexAggregator(address dexAggRouter) external;

    /// @notice Change initial boost rewards settings
    /// @param minInitialBoostPerDay_ Minimal initial boost rewards per day USD amount which needs to create rewarding vault
    /// @param minInitialBoostDuration_ Minimal boost rewards vesting duration for initial boost
    function setInitialBoost(uint minInitialBoostPerDay_, uint minInitialBoostDuration_) external;

    /// @notice Update new minimum TVL for compensate.
    /// @param value New minimum TVL for compensate.
    function setMinTvlForFreeHardWork(uint value) external;

    /// @notice Set custom platform fee for vault
    /// @param vault Vault address
    /// @param platformFee Custom platform fee
    function setCustomVaultFee(address vault, uint platformFee) external;

    /// @notice Setup Rebalancer.
    /// Only Goverannce or Multisig can do this when Rebalancer is not set.
    /// @param rebalancer_ Proxy address of Bridge
    function setupRebalancer(address rebalancer_) external;

    /// @notice Setup Bridge.
    /// Only Goverannce or Multisig can do this when Bridge is not set.
    /// @param bridge_ Proxy address of Bridge
    function setupBridge(address bridge_) external;
}

Settings
{
  "remappings": [
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "@solady/=lib/solady/src/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
    "forge-std/=lib/forge-std/src/",
    "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
    "openzeppelin/=lib/openzeppelin-contracts-upgradeable/contracts/",
    "solady/=lib/solady/",
    "openzeppelin-contracts/=lib/openzeppelin-contracts/"
  ],
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "shanghai",
  "viaIR": false,
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"AlreadyExist","type":"error"},{"inputs":[],"name":"ETHTransferFailed","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"IncorrectArrayLength","type":"error"},{"inputs":[],"name":"IncorrectInitParams","type":"error"},{"inputs":[],"name":"IncorrectMsgSender","type":"error"},{"inputs":[],"name":"IncorrectZeroArgument","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[],"name":"NotExist","type":"error"},{"inputs":[],"name":"NotFactory","type":"error"},{"inputs":[],"name":"NotGovernance","type":"error"},{"inputs":[],"name":"NotGovernanceAndNotMultisig","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"NotMultisig","type":"error"},{"inputs":[],"name":"NotOperator","type":"error"},{"inputs":[],"name":"NotPlatform","type":"error"},{"inputs":[],"name":"NotSupportedByCAMM","type":"error"},{"inputs":[],"name":"NotTheOwner","type":"error"},{"inputs":[],"name":"NotVault","type":"error"},{"inputs":[],"name":"PriceIncreased","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"inputs":[],"name":"WrongCallbackAmount","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"platform","type":"address"},{"indexed":false,"internalType":"uint256","name":"ts","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"block","type":"uint256"}],"name":"ContractInitialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"address","name":"tokenIn","type":"address"},{"indexed":false,"internalType":"address","name":"tokenOut","type":"address"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"priceImpactTolerance","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"SwapInPool","type":"event"},{"inputs":[],"name":"CONTROLLABLE_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"ammAdapterId","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"createdBlock","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"uint256[]","name":"amounts","type":"uint256[]"}],"name":"getLiquidityForAmounts","outputs":[{"internalType":"uint256","name":"liquidity","type":"uint256"},{"internalType":"uint256[]","name":"amountsConsumed","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"getProportions","outputs":[{"internalType":"uint256[]","name":"props","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"platform_","type":"address"}],"name":"init","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"platform","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"}],"name":"poolTokens","outputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint256","name":"priceImpactTolerance","type":"uint256"}],"name":"swap","outputs":[],"stateMutability":"nonpayable","type":"function"}]

608060405234801562000010575f80fd5b50620000216200002760201b60201c565b62000191565b5f620000386200012b60201b60201c565b9050805f0160089054906101000a900460ff161562000083576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b67ffffffffffffffff8016815f015f9054906101000a900467ffffffffffffffff1667ffffffffffffffff1614620001285767ffffffffffffffff815f015f6101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055507fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d267ffffffffffffffff6040516200011f919062000176565b60405180910390a15b50565b5f7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00905090565b5f67ffffffffffffffff82169050919050565b620001708162000152565b82525050565b5f6020820190506200018b5f83018462000165565b92915050565b612a7a806200019f5f395ff3fe608060405234801561000f575f80fd5b50600436106100b2575f3560e01c80638a7f53601161006f5780638a7f53601461019f5780638da4e9c0146101bd578063936725ec146101d9578063a9126169146101f7578063e9f6dd2314610227578063ffa1ad7414610257576100b2565b806301ffc9a7146100b657806319ab453c146100e657806338a47247146101025780634593144c146101335780634bde38c8146101515780636ea4a2361461016f575b5f80fd5b6100d060048036038101906100cb9190611c4f565b610275565b6040516100dd9190611c94565b60405180910390f35b61010060048036038101906100fb9190611d07565b6102ee565b005b61011c60048036038101906101179190611eb5565b61046f565b60405161012a929190611fd5565b60405180910390f35b61013b6106e6565b6040516101489190612003565b60405180910390f35b610159610725565b604051610166919061202b565b60405180910390f35b61018960048036038101906101849190612044565b610764565b6040516101969190612003565b60405180910390f35b6101a76107e9565b6040516101b49190612122565b60405180910390f35b6101d760048036038101906101d29190612142565b610826565b005b6101e1610ce7565b6040516101ee9190612122565b60405180910390f35b610211600480360381019061020c9190611d07565b610d20565b60405161021e9190612270565b60405180910390f35b610241600480360381019061023c9190611d07565b610ee8565b60405161024e9190612290565b60405180910390f35b61025f6111ca565b60405161026c9190612122565b60405180910390f35b5f7f089493a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806102e757506102e682611203565b5b9050919050565b5f6102f761127c565b90505f815f0160089054906101000a900460ff161590505f825f015f9054906101000a900467ffffffffffffffff1690505f808267ffffffffffffffff1614801561033f5750825b90505f60018367ffffffffffffffff1614801561037257505f3073ffffffffffffffffffffffffffffffffffffffff163b145b905081158015610380575080155b156103b7576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001855f015f6101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055508315610404576001855f0160086101000a81548160ff0219169083151502179055505b61040d866112a3565b8315610467575f855f0160086101000a81548160ff0219169083151502179055507fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2600160405161045e9190612305565b60405180910390a15b505050505050565b5f6060600267ffffffffffffffff81111561048d5761048c611d46565b5b6040519080825280602002602001820160405280156104bb5781602001602082028036833780820191505090505b5090505f806104c98661146e565b915091505f6104f3865f815181106104e4576104e361231e565b5b6020026020010151848461159b565b9050856001815181106105095761050861231e565b5b6020026020010151811161057757855f8151811061052a5761052961231e565b5b602002602001015181855f815181106105465761054561231e565b5b60200260200101866001815181106105615761056061231e565b5b60200260200101828152508281525050506105fe565b5f61059e8760018151811061058f5761058e61231e565b5b6020026020010151848661159b565b905080876001815181106105b5576105b461231e565b5b6020026020010151865f815181106105d0576105cf61231e565b5b60200260200101876001815181106105eb576105ea61231e565b5b6020026020010182815250828152505050505b5f8773ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610648573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061066c919061235f565b90506106d98482875f815181106106865761068561231e565b5b602002602001015161069891906123b7565b6106a29190612425565b8483886001815181106106b8576106b761231e565b5b60200260200101516106ca91906123b7565b6106d49190612425565b6115bc565b9550505050509250929050565b5f61072060017f812a673dfca07956350df10f8a654925f561d7a0da09bdbe79e653939a14d9f15f1c6107199190612455565b5f1b6115d4565b905090565b5f61075f60017faa116a42804728f23983458454b6eb9c6ddf3011db9f9addaf3cd7508d85b0d65f1c6107589190612455565b5f1b6115de565b905090565b5f8473ffffffffffffffffffffffffffffffffffffffff1663f140a35a83866040518363ffffffff1660e01b81526004016107a0929190612488565b602060405180830381865afa1580156107bb573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107df919061235f565b9050949350505050565b60606040518060400160405280600781526020017f536f6c69646c7900000000000000000000000000000000000000000000000000815250905090565b5f8473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610860919061202b565b602060405180830381865afa15801561087b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061089f919061235f565b90505f8673ffffffffffffffffffffffffffffffffffffffff1663f140a35a83886040518363ffffffff1660e01b81526004016108dd929190612488565b602060405180830381865afa1580156108f8573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061091c919061235f565b90505f8573ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff1660e01b8152600401610958919061202b565b602060405180830381865afa158015610973573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610997919061235f565b90505f8773ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109e3573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a0791906124e5565b600a610a13919061263f565b90505f610a228a8a8a85610764565b90505f805f610a318c8c6115e8565b5090508073ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff1614610a6e57865f610a71565b5f875b8093508194505050610aa48d898e73ffffffffffffffffffffffffffffffffffffffff166116369092919063ffffffff16565b508b73ffffffffffffffffffffffffffffffffffffffff1663022c0d9f83838c5f67ffffffffffffffff811115610ade57610add611d46565b5b6040519080825280601f01601f191660200182016040528015610b105781602001600182028036833780820191505090505b506040518563ffffffff1660e01b8152600401610b3094939291906126db565b5f604051808303815f87803b158015610b47575f80fd5b505af1158015610b59573d5f803e3d5ffd5b505050505f610b6a8d8d8d88610764565b90505f84620186a08387610b7e9190612455565b610b8891906123b7565b610b929190612425565b9050898110610bff57610ba4816116b5565b604051602001610bb491906127a9565b6040516020818303038152906040526040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bf69190612122565b60405180910390fd5b5f8c73ffffffffffffffffffffffffffffffffffffffff166370a082318d6040518263ffffffff1660e01b8152600401610c39919061202b565b602060405180830381865afa158015610c54573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c78919061235f565b90507fbb06f6df5e04fa268205fa5ae17a68f4c76de353ab4b6a5c83a4ac748bb4dee48f8f8f8f8f8f8e8811610cae575f610cbb565b8e88610cba9190612455565b5b604051610cce97969594939291906127ca565b60405180910390a1505050505050505050505050505050565b6040518060400160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b6060600267ffffffffffffffff811115610d3d57610d3c611d46565b5b604051908082528060200260200182016040528015610d6b5781602001602082028036833780820191505090505b5090508173ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610db7573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ddb919061284b565b815f81518110610dee57610ded61231e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508173ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e71573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e95919061284b565b81600181518110610ea957610ea861231e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050919050565b6060600267ffffffffffffffff811115610f0557610f04611d46565b5b604051908082528060200260200182016040528015610f335781602001602082028036833780820191505090505b5090508173ffffffffffffffffffffffffffffffffffffffff166322be3de16040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f7f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fa391906128a0565b15611173575f8273ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ff2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611016919061284b565b90505f8173ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611062573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061108691906124e5565b60ff1690505f6110a485845f85600a61109f91906128cb565b610764565b90505f806110b18761146e565b915091505f84600a6110c391906128cb565b84836110cf91906123b7565b6110d99190612425565b90505f81846110e89190612915565b905080670de0b6b3a7640000856110ff91906123b7565b6111099190612425565b885f8151811061111c5761111b61231e565b5b60200260200101818152505080670de0b6b3a76400008361113d91906123b7565b6111479190612425565b8860018151811061115b5761115a61231e565b5b602002602001018181525050505050505050506111c5565b6706f05b59d3b20000815f8151811061118f5761118e61231e565b5b6020026020010181815250506706f05b59d3b20000816001815181106111b8576111b761231e565b5b6020026020010181815250505b919050565b6040518060400160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b5f7ff1ec81f0000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061127557506112748261177f565b5b9050919050565b5f7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00905090565b6112ab6117e8565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16148061137c57505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16634783c35b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611340573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611364919061284b565b73ffffffffffffffffffffffffffffffffffffffff16145b156113b3576040517f71c42ac300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6113ed60017faa116a42804728f23983458454b6eb9c6ddf3011db9f9addaf3cd7508d85b0d65f1c6113e59190612455565b5f1b82611828565b6114304360017f812a673dfca07956350df10f8a654925f561d7a0da09bdbe79e653939a14d9f15f1c6114209190612455565b5f1b61182f90919063ffffffff16565b7f1a2dd071001ebf6e03174e3df5b305795a4ad5d41d8fdb9ba41dbbe23671342681424360405161146393929190612948565b60405180910390a150565b5f805f61147a84610d20565b90505f6114bc825f815181106114935761149261231e565b5b6020026020010151836001815181106114af576114ae61231e565b5b60200260200101516115e8565b5090505f808673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa15801561150a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061152e919061297d565b50915091508273ffffffffffffffffffffffffffffffffffffffff16845f8151811061155d5761155c61231e565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff161461158757808261158a565b81815b809650819750505050505050915091565b5f8282856115a991906123b7565b6115b39190612425565b90509392505050565b5f8183106115ca57816115cc565b825b905092915050565b5f81549050919050565b5f81549050919050565b5f808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610611624578284611627565b83835b80925081935050509250929050565b6116b0838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040516024016116699291906129cd565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611836565b505050565b60605f60016116c3846118cb565b0190505f8167ffffffffffffffff8111156116e1576116e0611d46565b5b6040519080825280601f01601f1916602001820160405280156117135781602001600182028036833780820191505090505b5090505f82602001820190505b600115611774578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8581611769576117686123f8565b5b0494505f8503611720575b819350505050919050565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6117f0611a1c565b611826576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b8082555050565b8082555050565b5f611860828473ffffffffffffffffffffffffffffffffffffffff16611a3a90919063ffffffff16565b90505f81511415801561188457508080602001905181019061188291906128a0565b155b156118c657826040517f5274afe70000000000000000000000000000000000000000000000000000000081526004016118bd919061202b565b60405180910390fd5b505050565b5f805f90507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310611927577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161191d5761191c6123f8565b5b0492506040810190505b6d04ee2d6d415b85acef81000000008310611964576d04ee2d6d415b85acef8100000000838161195a576119596123f8565b5b0492506020810190505b662386f26fc10000831061199357662386f26fc100008381611989576119886123f8565b5b0492506010810190505b6305f5e10083106119bc576305f5e10083816119b2576119b16123f8565b5b0492506008810190505b61271083106119e15761271083816119d7576119d66123f8565b5b0492506004810190505b60648310611a0457606483816119fa576119f96123f8565b5b0492506002810190505b600a8310611a13576001810190505b80915050919050565b5f611a2561127c565b5f0160089054906101000a900460ff16905090565b6060611a4783835f611a4f565b905092915050565b606081471015611a9657306040517fcd786059000000000000000000000000000000000000000000000000000000008152600401611a8d919061202b565b60405180910390fd5b5f808573ffffffffffffffffffffffffffffffffffffffff168486604051611abe9190612a2e565b5f6040518083038185875af1925050503d805f8114611af8576040519150601f19603f3d011682016040523d82523d5f602084013e611afd565b606091505b5091509150611b0d868383611b18565b925050509392505050565b606082611b2d57611b2882611ba5565b611b9d565b5f8251148015611b5357505f8473ffffffffffffffffffffffffffffffffffffffff163b145b15611b9557836040517f9996b315000000000000000000000000000000000000000000000000000000008152600401611b8c919061202b565b60405180910390fd5b819050611b9e565b5b9392505050565b5f81511115611bb75780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611c2e81611bfa565b8114611c38575f80fd5b50565b5f81359050611c4981611c25565b92915050565b5f60208284031215611c6457611c63611bf2565b5b5f611c7184828501611c3b565b91505092915050565b5f8115159050919050565b611c8e81611c7a565b82525050565b5f602082019050611ca75f830184611c85565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f611cd682611cad565b9050919050565b611ce681611ccc565b8114611cf0575f80fd5b50565b5f81359050611d0181611cdd565b92915050565b5f60208284031215611d1c57611d1b611bf2565b5b5f611d2984828501611cf3565b91505092915050565b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b611d7c82611d36565b810181811067ffffffffffffffff82111715611d9b57611d9a611d46565b5b80604052505050565b5f611dad611be9565b9050611db98282611d73565b919050565b5f67ffffffffffffffff821115611dd857611dd7611d46565b5b602082029050602081019050919050565b5f80fd5b5f819050919050565b611dff81611ded565b8114611e09575f80fd5b50565b5f81359050611e1a81611df6565b92915050565b5f611e32611e2d84611dbe565b611da4565b90508083825260208201905060208402830185811115611e5557611e54611de9565b5b835b81811015611e7e5780611e6a8882611e0c565b845260208401935050602081019050611e57565b5050509392505050565b5f82601f830112611e9c57611e9b611d32565b5b8135611eac848260208601611e20565b91505092915050565b5f8060408385031215611ecb57611eca611bf2565b5b5f611ed885828601611cf3565b925050602083013567ffffffffffffffff811115611ef957611ef8611bf6565b5b611f0585828601611e88565b9150509250929050565b611f1881611ded565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b611f5081611ded565b82525050565b5f611f618383611f47565b60208301905092915050565b5f602082019050919050565b5f611f8382611f1e565b611f8d8185611f28565b9350611f9883611f38565b805f5b83811015611fc8578151611faf8882611f56565b9750611fba83611f6d565b925050600181019050611f9b565b5085935050505092915050565b5f604082019050611fe85f830185611f0f565b8181036020830152611ffa8184611f79565b90509392505050565b5f6020820190506120165f830184611f0f565b92915050565b61202581611ccc565b82525050565b5f60208201905061203e5f83018461201c565b92915050565b5f805f806080858703121561205c5761205b611bf2565b5b5f61206987828801611cf3565b945050602061207a87828801611cf3565b935050604061208b87828801611cf3565b925050606061209c87828801611e0c565b91505092959194509250565b5f81519050919050565b5f82825260208201905092915050565b5f5b838110156120df5780820151818401526020810190506120c4565b5f8484015250505050565b5f6120f4826120a8565b6120fe81856120b2565b935061210e8185602086016120c2565b61211781611d36565b840191505092915050565b5f6020820190508181035f83015261213a81846120ea565b905092915050565b5f805f805f60a0868803121561215b5761215a611bf2565b5b5f61216888828901611cf3565b955050602061217988828901611cf3565b945050604061218a88828901611cf3565b935050606061219b88828901611cf3565b92505060806121ac88828901611e0c565b9150509295509295909350565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6121eb81611ccc565b82525050565b5f6121fc83836121e2565b60208301905092915050565b5f602082019050919050565b5f61221e826121b9565b61222881856121c3565b9350612233836121d3565b805f5b8381101561226357815161224a88826121f1565b975061225583612208565b925050600181019050612236565b5085935050505092915050565b5f6020820190508181035f8301526122888184612214565b905092915050565b5f6020820190508181035f8301526122a88184611f79565b905092915050565b5f819050919050565b5f67ffffffffffffffff82169050919050565b5f819050919050565b5f6122ef6122ea6122e5846122b0565b6122cc565b6122b9565b9050919050565b6122ff816122d5565b82525050565b5f6020820190506123185f8301846122f6565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f8151905061235981611df6565b92915050565b5f6020828403121561237457612373611bf2565b5b5f6123818482850161234b565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6123c182611ded565b91506123cc83611ded565b92508282026123da81611ded565b915082820484148315176123f1576123f061238a565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61242f82611ded565b915061243a83611ded565b92508261244a576124496123f8565b5b828204905092915050565b5f61245f82611ded565b915061246a83611ded565b92508282039050818111156124825761248161238a565b5b92915050565b5f60408201905061249b5f830185611f0f565b6124a8602083018461201c565b9392505050565b5f60ff82169050919050565b6124c4816124af565b81146124ce575f80fd5b50565b5f815190506124df816124bb565b92915050565b5f602082840312156124fa576124f9611bf2565b5b5f612507848285016124d1565b91505092915050565b5f8160011c9050919050565b5f808291508390505b6001851115612565578086048111156125415761254061238a565b5b60018516156125505780820291505b808102905061255e85612510565b9450612525565b94509492505050565b5f8261257d5760019050612638565b8161258a575f9050612638565b81600181146125a057600281146125aa576125d9565b6001915050612638565b60ff8411156125bc576125bb61238a565b5b8360020a9150848211156125d3576125d261238a565b5b50612638565b5060208310610133831016604e8410600b841016171561260e5782820a9050838111156126095761260861238a565b5b612638565b61261b848484600161251c565b925090508184048111156126325761263161238a565b5b81810290505b9392505050565b5f61264982611ded565b9150612654836124af565b92506126817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848461256e565b905092915050565b5f81519050919050565b5f82825260208201905092915050565b5f6126ad82612689565b6126b78185612693565b93506126c78185602086016120c2565b6126d081611d36565b840191505092915050565b5f6080820190506126ee5f830187611f0f565b6126fb6020830186611f0f565b612708604083018561201c565b818103606083015261271a81846126a3565b905095945050505050565b5f81905092915050565b7f21505249434520000000000000000000000000000000000000000000000000005f82015250565b5f612763600783612725565b915061276e8261272f565b600782019050919050565b5f612783826120a8565b61278d8185612725565b935061279d8185602086016120c2565b80840191505092915050565b5f6127b382612757565b91506127bf8284612779565b915081905092915050565b5f60e0820190506127dd5f83018a61201c565b6127ea602083018961201c565b6127f7604083018861201c565b612804606083018761201c565b6128116080830186611f0f565b61281e60a0830185611f0f565b61282b60c0830184611f0f565b98975050505050505050565b5f8151905061284581611cdd565b92915050565b5f602082840312156128605761285f611bf2565b5b5f61286d84828501612837565b91505092915050565b61287f81611c7a565b8114612889575f80fd5b50565b5f8151905061289a81612876565b92915050565b5f602082840312156128b5576128b4611bf2565b5b5f6128c28482850161288c565b91505092915050565b5f6128d582611ded565b91506128e083611ded565b925061290d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848461256e565b905092915050565b5f61291f82611ded565b915061292a83611ded565b92508282019050808211156129425761294161238a565b5b92915050565b5f60608201905061295b5f83018661201c565b6129686020830185611f0f565b6129756040830184611f0f565b949350505050565b5f805f6060848603121561299457612993611bf2565b5b5f6129a18682870161234b565b93505060206129b28682870161234b565b92505060406129c38682870161234b565b9150509250925092565b5f6040820190506129e05f83018561201c565b6129ed6020830184611f0f565b9392505050565b5f81905092915050565b5f612a0882612689565b612a1281856129f4565b9350612a228185602086016120c2565b80840191505092915050565b5f612a3982846129fe565b91508190509291505056fea2646970667358221220b7e88cc019937dbfcd872824ae419651e86848831c59de1c49347337f4ca3abd64736f6c63430008170033

Deployed Bytecode

0x608060405234801561000f575f80fd5b50600436106100b2575f3560e01c80638a7f53601161006f5780638a7f53601461019f5780638da4e9c0146101bd578063936725ec146101d9578063a9126169146101f7578063e9f6dd2314610227578063ffa1ad7414610257576100b2565b806301ffc9a7146100b657806319ab453c146100e657806338a47247146101025780634593144c146101335780634bde38c8146101515780636ea4a2361461016f575b5f80fd5b6100d060048036038101906100cb9190611c4f565b610275565b6040516100dd9190611c94565b60405180910390f35b61010060048036038101906100fb9190611d07565b6102ee565b005b61011c60048036038101906101179190611eb5565b61046f565b60405161012a929190611fd5565b60405180910390f35b61013b6106e6565b6040516101489190612003565b60405180910390f35b610159610725565b604051610166919061202b565b60405180910390f35b61018960048036038101906101849190612044565b610764565b6040516101969190612003565b60405180910390f35b6101a76107e9565b6040516101b49190612122565b60405180910390f35b6101d760048036038101906101d29190612142565b610826565b005b6101e1610ce7565b6040516101ee9190612122565b60405180910390f35b610211600480360381019061020c9190611d07565b610d20565b60405161021e9190612270565b60405180910390f35b610241600480360381019061023c9190611d07565b610ee8565b60405161024e9190612290565b60405180910390f35b61025f6111ca565b60405161026c9190612122565b60405180910390f35b5f7f089493a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806102e757506102e682611203565b5b9050919050565b5f6102f761127c565b90505f815f0160089054906101000a900460ff161590505f825f015f9054906101000a900467ffffffffffffffff1690505f808267ffffffffffffffff1614801561033f5750825b90505f60018367ffffffffffffffff1614801561037257505f3073ffffffffffffffffffffffffffffffffffffffff163b145b905081158015610380575080155b156103b7576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6001855f015f6101000a81548167ffffffffffffffff021916908367ffffffffffffffff1602179055508315610404576001855f0160086101000a81548160ff0219169083151502179055505b61040d866112a3565b8315610467575f855f0160086101000a81548160ff0219169083151502179055507fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2600160405161045e9190612305565b60405180910390a15b505050505050565b5f6060600267ffffffffffffffff81111561048d5761048c611d46565b5b6040519080825280602002602001820160405280156104bb5781602001602082028036833780820191505090505b5090505f806104c98661146e565b915091505f6104f3865f815181106104e4576104e361231e565b5b6020026020010151848461159b565b9050856001815181106105095761050861231e565b5b6020026020010151811161057757855f8151811061052a5761052961231e565b5b602002602001015181855f815181106105465761054561231e565b5b60200260200101866001815181106105615761056061231e565b5b60200260200101828152508281525050506105fe565b5f61059e8760018151811061058f5761058e61231e565b5b6020026020010151848661159b565b905080876001815181106105b5576105b461231e565b5b6020026020010151865f815181106105d0576105cf61231e565b5b60200260200101876001815181106105eb576105ea61231e565b5b6020026020010182815250828152505050505b5f8773ffffffffffffffffffffffffffffffffffffffff166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610648573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061066c919061235f565b90506106d98482875f815181106106865761068561231e565b5b602002602001015161069891906123b7565b6106a29190612425565b8483886001815181106106b8576106b761231e565b5b60200260200101516106ca91906123b7565b6106d49190612425565b6115bc565b9550505050509250929050565b5f61072060017f812a673dfca07956350df10f8a654925f561d7a0da09bdbe79e653939a14d9f15f1c6107199190612455565b5f1b6115d4565b905090565b5f61075f60017faa116a42804728f23983458454b6eb9c6ddf3011db9f9addaf3cd7508d85b0d65f1c6107589190612455565b5f1b6115de565b905090565b5f8473ffffffffffffffffffffffffffffffffffffffff1663f140a35a83866040518363ffffffff1660e01b81526004016107a0929190612488565b602060405180830381865afa1580156107bb573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906107df919061235f565b9050949350505050565b60606040518060400160405280600781526020017f536f6c69646c7900000000000000000000000000000000000000000000000000815250905090565b5f8473ffffffffffffffffffffffffffffffffffffffff166370a08231306040518263ffffffff1660e01b8152600401610860919061202b565b602060405180830381865afa15801561087b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061089f919061235f565b90505f8673ffffffffffffffffffffffffffffffffffffffff1663f140a35a83886040518363ffffffff1660e01b81526004016108dd929190612488565b602060405180830381865afa1580156108f8573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061091c919061235f565b90505f8573ffffffffffffffffffffffffffffffffffffffff166370a08231866040518263ffffffff1660e01b8152600401610958919061202b565b602060405180830381865afa158015610973573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610997919061235f565b90505f8773ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156109e3573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a0791906124e5565b600a610a13919061263f565b90505f610a228a8a8a85610764565b90505f805f610a318c8c6115e8565b5090508073ffffffffffffffffffffffffffffffffffffffff168c73ffffffffffffffffffffffffffffffffffffffff1614610a6e57865f610a71565b5f875b8093508194505050610aa48d898e73ffffffffffffffffffffffffffffffffffffffff166116369092919063ffffffff16565b508b73ffffffffffffffffffffffffffffffffffffffff1663022c0d9f83838c5f67ffffffffffffffff811115610ade57610add611d46565b5b6040519080825280601f01601f191660200182016040528015610b105781602001600182028036833780820191505090505b506040518563ffffffff1660e01b8152600401610b3094939291906126db565b5f604051808303815f87803b158015610b47575f80fd5b505af1158015610b59573d5f803e3d5ffd5b505050505f610b6a8d8d8d88610764565b90505f84620186a08387610b7e9190612455565b610b8891906123b7565b610b929190612425565b9050898110610bff57610ba4816116b5565b604051602001610bb491906127a9565b6040516020818303038152906040526040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610bf69190612122565b60405180910390fd5b5f8c73ffffffffffffffffffffffffffffffffffffffff166370a082318d6040518263ffffffff1660e01b8152600401610c39919061202b565b602060405180830381865afa158015610c54573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610c78919061235f565b90507fbb06f6df5e04fa268205fa5ae17a68f4c76de353ab4b6a5c83a4ac748bb4dee48f8f8f8f8f8f8e8811610cae575f610cbb565b8e88610cba9190612455565b5b604051610cce97969594939291906127ca565b60405180910390a1505050505050505050505050505050565b6040518060400160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b6060600267ffffffffffffffff811115610d3d57610d3c611d46565b5b604051908082528060200260200182016040528015610d6b5781602001602082028036833780820191505090505b5090508173ffffffffffffffffffffffffffffffffffffffff16630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610db7573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610ddb919061284b565b815f81518110610dee57610ded61231e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250508173ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e71573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e95919061284b565b81600181518110610ea957610ea861231e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050919050565b6060600267ffffffffffffffff811115610f0557610f04611d46565b5b604051908082528060200260200182016040528015610f335781602001602082028036833780820191505090505b5090508173ffffffffffffffffffffffffffffffffffffffff166322be3de16040518163ffffffff1660e01b8152600401602060405180830381865afa158015610f7f573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fa391906128a0565b15611173575f8273ffffffffffffffffffffffffffffffffffffffff1663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ff2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611016919061284b565b90505f8173ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611062573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061108691906124e5565b60ff1690505f6110a485845f85600a61109f91906128cb565b610764565b90505f806110b18761146e565b915091505f84600a6110c391906128cb565b84836110cf91906123b7565b6110d99190612425565b90505f81846110e89190612915565b905080670de0b6b3a7640000856110ff91906123b7565b6111099190612425565b885f8151811061111c5761111b61231e565b5b60200260200101818152505080670de0b6b3a76400008361113d91906123b7565b6111479190612425565b8860018151811061115b5761115a61231e565b5b602002602001018181525050505050505050506111c5565b6706f05b59d3b20000815f8151811061118f5761118e61231e565b5b6020026020010181815250506706f05b59d3b20000816001815181106111b8576111b761231e565b5b6020026020010181815250505b919050565b6040518060400160405280600581526020017f312e302e3000000000000000000000000000000000000000000000000000000081525081565b5f7ff1ec81f0000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061127557506112748261177f565b5b9050919050565b5f7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00905090565b6112ab6117e8565b5f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16148061137c57505f73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16634783c35b6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611340573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611364919061284b565b73ffffffffffffffffffffffffffffffffffffffff16145b156113b3576040517f71c42ac300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6113ed60017faa116a42804728f23983458454b6eb9c6ddf3011db9f9addaf3cd7508d85b0d65f1c6113e59190612455565b5f1b82611828565b6114304360017f812a673dfca07956350df10f8a654925f561d7a0da09bdbe79e653939a14d9f15f1c6114209190612455565b5f1b61182f90919063ffffffff16565b7f1a2dd071001ebf6e03174e3df5b305795a4ad5d41d8fdb9ba41dbbe23671342681424360405161146393929190612948565b60405180910390a150565b5f805f61147a84610d20565b90505f6114bc825f815181106114935761149261231e565b5b6020026020010151836001815181106114af576114ae61231e565b5b60200260200101516115e8565b5090505f808673ffffffffffffffffffffffffffffffffffffffff16630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa15801561150a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061152e919061297d565b50915091508273ffffffffffffffffffffffffffffffffffffffff16845f8151811061155d5761155c61231e565b5b602002602001015173ffffffffffffffffffffffffffffffffffffffff161461158757808261158a565b81815b809650819750505050505050915091565b5f8282856115a991906123b7565b6115b39190612425565b90509392505050565b5f8183106115ca57816115cc565b825b905092915050565b5f81549050919050565b5f81549050919050565b5f808273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1610611624578284611627565b83835b80925081935050509250929050565b6116b0838473ffffffffffffffffffffffffffffffffffffffff1663a9059cbb85856040516024016116699291906129cd565b604051602081830303815290604052915060e01b6020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff8381831617835250505050611836565b505050565b60605f60016116c3846118cb565b0190505f8167ffffffffffffffff8111156116e1576116e0611d46565b5b6040519080825280601f01601f1916602001820160405280156117135781602001600182028036833780820191505090505b5090505f82602001820190505b600115611774578080600190039150507f3031323334353637383961626364656600000000000000000000000000000000600a86061a8153600a8581611769576117686123f8565b5b0494505f8503611720575b819350505050919050565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b6117f0611a1c565b611826576040517fd7e6bcf800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b565b8082555050565b8082555050565b5f611860828473ffffffffffffffffffffffffffffffffffffffff16611a3a90919063ffffffff16565b90505f81511415801561188457508080602001905181019061188291906128a0565b155b156118c657826040517f5274afe70000000000000000000000000000000000000000000000000000000081526004016118bd919061202b565b60405180910390fd5b505050565b5f805f90507a184f03e93ff9f4daa797ed6e38ed64bf6a1f0100000000000000008310611927577a184f03e93ff9f4daa797ed6e38ed64bf6a1f010000000000000000838161191d5761191c6123f8565b5b0492506040810190505b6d04ee2d6d415b85acef81000000008310611964576d04ee2d6d415b85acef8100000000838161195a576119596123f8565b5b0492506020810190505b662386f26fc10000831061199357662386f26fc100008381611989576119886123f8565b5b0492506010810190505b6305f5e10083106119bc576305f5e10083816119b2576119b16123f8565b5b0492506008810190505b61271083106119e15761271083816119d7576119d66123f8565b5b0492506004810190505b60648310611a0457606483816119fa576119f96123f8565b5b0492506002810190505b600a8310611a13576001810190505b80915050919050565b5f611a2561127c565b5f0160089054906101000a900460ff16905090565b6060611a4783835f611a4f565b905092915050565b606081471015611a9657306040517fcd786059000000000000000000000000000000000000000000000000000000008152600401611a8d919061202b565b60405180910390fd5b5f808573ffffffffffffffffffffffffffffffffffffffff168486604051611abe9190612a2e565b5f6040518083038185875af1925050503d805f8114611af8576040519150601f19603f3d011682016040523d82523d5f602084013e611afd565b606091505b5091509150611b0d868383611b18565b925050509392505050565b606082611b2d57611b2882611ba5565b611b9d565b5f8251148015611b5357505f8473ffffffffffffffffffffffffffffffffffffffff163b145b15611b9557836040517f9996b315000000000000000000000000000000000000000000000000000000008152600401611b8c919061202b565b60405180910390fd5b819050611b9e565b5b9392505050565b5f81511115611bb75780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611c2e81611bfa565b8114611c38575f80fd5b50565b5f81359050611c4981611c25565b92915050565b5f60208284031215611c6457611c63611bf2565b5b5f611c7184828501611c3b565b91505092915050565b5f8115159050919050565b611c8e81611c7a565b82525050565b5f602082019050611ca75f830184611c85565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f611cd682611cad565b9050919050565b611ce681611ccc565b8114611cf0575f80fd5b50565b5f81359050611d0181611cdd565b92915050565b5f60208284031215611d1c57611d1b611bf2565b5b5f611d2984828501611cf3565b91505092915050565b5f80fd5b5f601f19601f8301169050919050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b611d7c82611d36565b810181811067ffffffffffffffff82111715611d9b57611d9a611d46565b5b80604052505050565b5f611dad611be9565b9050611db98282611d73565b919050565b5f67ffffffffffffffff821115611dd857611dd7611d46565b5b602082029050602081019050919050565b5f80fd5b5f819050919050565b611dff81611ded565b8114611e09575f80fd5b50565b5f81359050611e1a81611df6565b92915050565b5f611e32611e2d84611dbe565b611da4565b90508083825260208201905060208402830185811115611e5557611e54611de9565b5b835b81811015611e7e5780611e6a8882611e0c565b845260208401935050602081019050611e57565b5050509392505050565b5f82601f830112611e9c57611e9b611d32565b5b8135611eac848260208601611e20565b91505092915050565b5f8060408385031215611ecb57611eca611bf2565b5b5f611ed885828601611cf3565b925050602083013567ffffffffffffffff811115611ef957611ef8611bf6565b5b611f0585828601611e88565b9150509250929050565b611f1881611ded565b82525050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b611f5081611ded565b82525050565b5f611f618383611f47565b60208301905092915050565b5f602082019050919050565b5f611f8382611f1e565b611f8d8185611f28565b9350611f9883611f38565b805f5b83811015611fc8578151611faf8882611f56565b9750611fba83611f6d565b925050600181019050611f9b565b5085935050505092915050565b5f604082019050611fe85f830185611f0f565b8181036020830152611ffa8184611f79565b90509392505050565b5f6020820190506120165f830184611f0f565b92915050565b61202581611ccc565b82525050565b5f60208201905061203e5f83018461201c565b92915050565b5f805f806080858703121561205c5761205b611bf2565b5b5f61206987828801611cf3565b945050602061207a87828801611cf3565b935050604061208b87828801611cf3565b925050606061209c87828801611e0c565b91505092959194509250565b5f81519050919050565b5f82825260208201905092915050565b5f5b838110156120df5780820151818401526020810190506120c4565b5f8484015250505050565b5f6120f4826120a8565b6120fe81856120b2565b935061210e8185602086016120c2565b61211781611d36565b840191505092915050565b5f6020820190508181035f83015261213a81846120ea565b905092915050565b5f805f805f60a0868803121561215b5761215a611bf2565b5b5f61216888828901611cf3565b955050602061217988828901611cf3565b945050604061218a88828901611cf3565b935050606061219b88828901611cf3565b92505060806121ac88828901611e0c565b9150509295509295909350565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6121eb81611ccc565b82525050565b5f6121fc83836121e2565b60208301905092915050565b5f602082019050919050565b5f61221e826121b9565b61222881856121c3565b9350612233836121d3565b805f5b8381101561226357815161224a88826121f1565b975061225583612208565b925050600181019050612236565b5085935050505092915050565b5f6020820190508181035f8301526122888184612214565b905092915050565b5f6020820190508181035f8301526122a88184611f79565b905092915050565b5f819050919050565b5f67ffffffffffffffff82169050919050565b5f819050919050565b5f6122ef6122ea6122e5846122b0565b6122cc565b6122b9565b9050919050565b6122ff816122d5565b82525050565b5f6020820190506123185f8301846122f6565b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f8151905061235981611df6565b92915050565b5f6020828403121561237457612373611bf2565b5b5f6123818482850161234b565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6123c182611ded565b91506123cc83611ded565b92508282026123da81611ded565b915082820484148315176123f1576123f061238a565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61242f82611ded565b915061243a83611ded565b92508261244a576124496123f8565b5b828204905092915050565b5f61245f82611ded565b915061246a83611ded565b92508282039050818111156124825761248161238a565b5b92915050565b5f60408201905061249b5f830185611f0f565b6124a8602083018461201c565b9392505050565b5f60ff82169050919050565b6124c4816124af565b81146124ce575f80fd5b50565b5f815190506124df816124bb565b92915050565b5f602082840312156124fa576124f9611bf2565b5b5f612507848285016124d1565b91505092915050565b5f8160011c9050919050565b5f808291508390505b6001851115612565578086048111156125415761254061238a565b5b60018516156125505780820291505b808102905061255e85612510565b9450612525565b94509492505050565b5f8261257d5760019050612638565b8161258a575f9050612638565b81600181146125a057600281146125aa576125d9565b6001915050612638565b60ff8411156125bc576125bb61238a565b5b8360020a9150848211156125d3576125d261238a565b5b50612638565b5060208310610133831016604e8410600b841016171561260e5782820a9050838111156126095761260861238a565b5b612638565b61261b848484600161251c565b925090508184048111156126325761263161238a565b5b81810290505b9392505050565b5f61264982611ded565b9150612654836124af565b92506126817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848461256e565b905092915050565b5f81519050919050565b5f82825260208201905092915050565b5f6126ad82612689565b6126b78185612693565b93506126c78185602086016120c2565b6126d081611d36565b840191505092915050565b5f6080820190506126ee5f830187611f0f565b6126fb6020830186611f0f565b612708604083018561201c565b818103606083015261271a81846126a3565b905095945050505050565b5f81905092915050565b7f21505249434520000000000000000000000000000000000000000000000000005f82015250565b5f612763600783612725565b915061276e8261272f565b600782019050919050565b5f612783826120a8565b61278d8185612725565b935061279d8185602086016120c2565b80840191505092915050565b5f6127b382612757565b91506127bf8284612779565b915081905092915050565b5f60e0820190506127dd5f83018a61201c565b6127ea602083018961201c565b6127f7604083018861201c565b612804606083018761201c565b6128116080830186611f0f565b61281e60a0830185611f0f565b61282b60c0830184611f0f565b98975050505050505050565b5f8151905061284581611cdd565b92915050565b5f602082840312156128605761285f611bf2565b5b5f61286d84828501612837565b91505092915050565b61287f81611c7a565b8114612889575f80fd5b50565b5f8151905061289a81612876565b92915050565b5f602082840312156128b5576128b4611bf2565b5b5f6128c28482850161288c565b91505092915050565b5f6128d582611ded565b91506128e083611ded565b925061290d7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff848461256e565b905092915050565b5f61291f82611ded565b915061292a83611ded565b92508282019050808211156129425761294161238a565b5b92915050565b5f60608201905061295b5f83018661201c565b6129686020830185611f0f565b6129756040830184611f0f565b949350505050565b5f805f6060848603121561299457612993611bf2565b5b5f6129a18682870161234b565b93505060206129b28682870161234b565b92505060406129c38682870161234b565b9150509250925092565b5f6040820190506129e05f83018561201c565b6129ed6020830184611f0f565b9392505050565b5f81905092915050565b5f612a0882612689565b612a1281856129f4565b9350612a228185602086016120c2565b80840191505092915050565b5f612a3982846129fe565b91508190509291505056fea2646970667358221220b7e88cc019937dbfcd872824ae419651e86848831c59de1c49347337f4ca3abd64736f6c63430008170033

Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

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.