creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "lib/blueberry-core/contracts/oracle/BalancerV2SpotOracle.sol": {
        "content": "// SPDX-License-Identifier: MIT\n/*\n██████╗ ██╗     ██╗   ██╗███████╗██████╗ ███████╗██████╗ ██████╗ ██╗   ██╗\n██╔══██╗██║     ██║   ██║██╔════╝██╔══██╗██╔════╝██╔══██╗██╔══██╗╚██╗ ██╔╝\n██████╔╝██║     ██║   ██║█████╗  ██████╔╝█████╗  ██████╔╝██████╔╝ ╚████╔╝\n██╔══██╗██║     ██║   ██║██╔══╝  ██╔══██╗██╔══╝  ██╔══██╗██╔══██╗  ╚██╔╝\n██████╔╝███████╗╚██████╔╝███████╗██████╔╝███████╗██║  ██║██║  ██║   ██║\n╚═════╝ ╚══════╝ ╚═════╝ ╚══════╝╚═════╝ ╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝\n*/\n\npragma solidity 0.8.22;\n\nimport { VaultReentrancyLib } from \"../libraries/balancer-v2/VaultReentrancyLib.sol\";\n\nimport \"../utils/BlueberryConst.sol\" as Constants;\nimport \"../utils/BlueberryErrors.sol\" as Errors;\n\nimport { BaseAdapter } from \"./BaseAdapter.sol\";\nimport { UsingBaseOracle } from \"./UsingBaseOracle.sol\";\n\nimport { IBaseOracle } from \"../interfaces/IBaseOracle.sol\";\nimport { IBalancerV2Pool } from \"../interfaces/balancer-v2/IBalancerV2Pool.sol\";\nimport { IBalancerVault } from \"../interfaces/balancer-v2/IBalancerVault.sol\";\nimport { IBalancerPriceOracle } from \"../interfaces/balancer-v2/IBalancerPriceOracle.sol\";\n\n/**\n * @title BalancerV2 Spot Oracle\n * @author BlueberryProtocol\n * @notice Oracle contract which provides price feeds of tokens from Balancer V2 WeightedPool2Tokens\n *         and Meta Stable Pools\n * @dev The Oracle contract is used soley for calculating the spot price of tokens that do not have\n *      a direct price feed from an external oracle.It should be noted that the main purpose of\n *      this contract is to provide a spot price for tokens like AURA which are extra rewards in some\n *      Blueberry strategies.\n */\ncontract BalancerV2SpotOracle is IBaseOracle, UsingBaseOracle, BaseAdapter {\n    /*//////////////////////////////////////////////////////////////////////////\n                                      Structs\n    //////////////////////////////////////////////////////////////////////////*/\n\n    /**\n     * @dev Struct to store token info related to Balancer Pools\n     * @param Pool The address of the Balancer pool to derive the tokens spot price from\n     * @param quoteToken The token paired against the asset whos price is being calculated\n     * @param twapDuration The duration of the TWAP window (Recommend between 5-30 min)\n     * @param isTokenZero Boolean to determine if the token is the first or second token in the pool\n     */\n    struct TokenInfo {\n        address pool;\n        address quoteToken;\n        uint16 twapDuration;\n        bool isTokenZero;\n    }\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                      Events\n    //////////////////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Emitted when a token is registered with the oracle\n     * @param token The address of the token to register\n     * @param pool The address of the Balancer pool to derive the tokens spot price from\n     * @param duration The duration of the TWAP window\n     */\n    event TokenRegistered(address indexed token, address indexed pool, uint256 duration);\n\n    /**\n     * @notice Emitted when the TWAP duration for a token is updated\n     * @param token The address of the token to update\n     * @param duration The duration of the TWAP window\n     */\n    event TokenTwapDurationUpdated(address indexed token, uint256 duration);\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                      Storage\n    //////////////////////////////////////////////////////////////////////////*/\n\n    /// @notice Balancer V2 Vault\n    IBalancerVault private _vault;\n\n    /// @notice Maps token addresses to their corresponding token info\n    mapping(address => TokenInfo) private _tokenInfo;\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                      MODIFIERS\n    //////////////////////////////////////////////////////////////////////////*/\n\n    // Protects the oracle from being manipulated via read-only reentrancy\n    modifier balancerNonReentrant() {\n        VaultReentrancyLib.ensureNotInVaultContext(_vault);\n        _;\n    }\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                     CONSTRUCTOR\n    //////////////////////////////////////////////////////////////////////////*/\n\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() {\n        _disableInitializers();\n    }\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                      FUNCTIONS\n    //////////////////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Initializes the contract\n     * @param vault Instance of the Balancer V2 Vault\n     * @param base The base oracle instance.\n     * @param owner Address of the owner of the contract.\n     */\n    function initialize(IBalancerVault vault, IBaseOracle base, address owner) external initializer {\n        __UsingBaseOracle_init(base, owner);\n        _vault = vault;\n    }\n\n    /**\n     * @notice Calculates the Spot price for an\n     * @param token The address of the token to get the price of\n     * @return The price of the token in USD scaled by 1e18\n     */\n    function getPrice(address token) public view override balancerNonReentrant returns (uint256) {\n        TokenInfo memory tokenInfo = _tokenInfo[token];\n\n        if (tokenInfo.pool == address(0)) {\n            revert Errors.NO_ORACLE_ROUTE(token);\n        }\n\n        IBalancerPriceOracle.OracleAverageQuery[] memory queries = new IBalancerPriceOracle.OracleAverageQuery[](1);\n        queries[0] = IBalancerPriceOracle.OracleAverageQuery(\n            IBalancerPriceOracle.Variable.PAIR_PRICE,\n            tokenInfo.twapDuration,\n            0\n        );\n\n        uint256[] memory results = IBalancerPriceOracle(tokenInfo.pool).getTimeWeightedAverage(queries);\n        uint256 spotPrice = tokenInfo.isTokenZero ? 1e36 / results[0] : results[0];\n\n        return (spotPrice * _base.getPrice(tokenInfo.quoteToken)) / Constants.PRICE_PRECISION;\n    }\n\n    /**\n     * @notice Registers a token with the oracle\n     * @param token Address of the token to register\n     * @param pool Address of the Balancer Pool to derive the token price from\n     * @param duration The duration of the TWAP window (Recommend between 5-30 min)\n     */\n    function registerToken(address token, address pool, uint256 duration) external onlyOwner {\n        if (token == address(0) || pool == address(0)) {\n            revert Errors.ZERO_ADDRESS();\n        }\n\n        if (_tokenInfo[token].pool == pool) {\n            revert Errors.TOKEN_BPT_ALREADY_REGISTERED(token, pool);\n        }\n\n        if (duration < 5 minutes || duration > 30 minutes) {\n            revert Errors.VALUE_OUT_OF_RANGE();\n        }\n\n        (address[] memory tokens, , ) = _vault.getPoolTokens(IBalancerV2Pool(pool).getPoolId());\n\n        if (tokens.length != 2) {\n            revert Errors.ORACLE_NOT_SUPPORT_LP(pool);\n        }\n\n        (address quoteToken, bool isTokenOne) = tokens[0] == token ? (tokens[1], true) : (tokens[0], false);\n\n        _tokenInfo[token] = TokenInfo(pool, quoteToken, uint16(duration), isTokenOne);\n\n        uint256 price = getPrice(token);\n        if (price == 0) revert Errors.PRICE_FAILED(token);\n\n        emit TokenRegistered(token, pool, duration);\n    }\n\n    /**\n     * @notice Update twap duration for a token\n     * @param token Address of the token to update\n     * @param duration The duration of the TWAP window (Recommend between 5-30 min)\n     */\n    function updateTwapDuration(address token, uint256 duration) external onlyOwner {\n        if (duration < 5 minutes || duration > 30 minutes) {\n            revert Errors.VALUE_OUT_OF_RANGE();\n        }\n\n        _tokenInfo[token].twapDuration = uint16(duration);\n\n        emit TokenTwapDurationUpdated(token, duration);\n    }\n}\n"
      },
      "lib/blueberry-core/contracts/libraries/balancer-v2/VaultReentrancyLib.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this program.  If not, see <http://www.gnu.org/licenses/>.\n// From https://github.com/balancer/balancer-v2-monorepo/blob/fc3e5735a07438ab506931f56adf64dede1441b1/pkg/pool-utils/contracts/lib/VaultReentrancyLib.sol\n\npragma solidity >=0.7.1 <0.9.0;\n\nimport \"./BalancerErrors.sol\";\nimport \"../../interfaces/balancer-v2/IBalancerVault.sol\";\n\nlibrary VaultReentrancyLib {\n    /**\n     * @dev Ensure we are not in a Vault context when this function is called, by attempting a no-op internal\n     * balance operation. If we are already in a Vault transaction (e.g., a swap, join, or exit), the Vault's\n     * reentrancy protection will cause this function to revert.\n     *\n     * The exact function call doesn't really matter: we're just trying to trigger the Vault reentrancy check\n     * (and not hurt anything in case it works). An empty operation array with no specific operation at all works\n     * for that purpose, and is also the least expensive in terms of gas and bytecode size.\n     *\n     * Call this at the top of any function that can cause a state change in a pool and is either public itself,\n     * or called by a public function *outside* a Vault operation (e.g., join, exit, or swap).\n     *\n     * If this is *not* called in functions that are vulnerable to the read-only reentrancy issue described\n     * here (https://forum.balancer.fi/t/reentrancy-vulnerability-scope-expanded/4345), those functions are unsafe,\n     * and subject to manipulation that may result in loss of funds.\n     */\n    function ensureNotInVaultContext(IBalancerVault vault) internal view {\n        // Perform the following operation to trigger the Vault's reentrancy guard:\n        //\n        // IVault.UserBalanceOp[] memory noop = new IVault.UserBalanceOp[](0);\n        // _vault.manageUserBalance(noop);\n        //\n        // However, use a static call so that it can be a view function (even though the function is non-view).\n        // This allows the library to be used more widely, as some functions that need to be protected might be\n        // view.\n        //\n        // This staticcall always reverts, but we need to make sure it doesn't fail due to a re-entrancy attack.\n        // Staticcalls consume all gas forwarded to them on a revert caused by storage modification.\n        // By default, almost the entire available gas is forwarded to the staticcall,\n        // causing the entire call to revert with an 'out of gas' error.\n        //\n        // We set the gas limit to 10k for the staticcall to\n        // avoid wasting gas when it reverts due to storage modification.\n        // `manageUserBalance` is a non-reentrant function in the Vault, so calling it invokes `_enterNonReentrant`\n        // in the `ReentrancyGuard` contract, reproduced here:\n        //\n        //    function _enterNonReentrant() private {\n        //        // If the Vault is actually being reentered, it will revert in the first line, at the `_require` that\n        //        // checks the reentrancy flag, with \"BAL#400\" (corresponding to BalancerErrors.REENTRANCY) in the revertData.\n        //        // The full revertData will be: `abi.encodeWithSignature(\"Error(string)\", \"BAL#400\")`.\n        //        _require(_status != _ENTERED, BalancerErrors.REENTRANCY);\n        //\n        //        // If the Vault is not being reentered, the check above will pass: but it will *still* revert,\n        //        // because the next line attempts to modify storage during a staticcall. However, this type of\n        //        // failure results in empty revertData.\n        //        _status = _ENTERED;\n        //    }\n        //\n        // So based on this analysis, there are only two possible revertData values: empty, or abi.encoded BAL#400.\n        //\n        // It is of course much more bytecode and gas efficient to check for zero-length revertData than to compare it\n        // to the encoded REENTRANCY revertData.\n        //\n        // While it should be impossible for the call to fail in any other way (especially since it reverts before\n        // `manageUserBalance` even gets called), any other error would generate non-zero revertData, so checking for\n        // empty data guards against this case too.\n\n        (, bytes memory revertData) = address(vault).staticcall{ gas: 10_000 }(\n            abi.encodeWithSelector(vault.manageUserBalance.selector, 0)\n        );\n\n        _require(revertData.length == 0, BalancerErrors.REENTRANCY);\n    }\n}"
      },
      "lib/blueberry-core/contracts/utils/BlueberryConst.sol": {
        "content": "// SPDX-License-Identifier: MIT\n/*\n██████╗ ██╗     ██╗   ██╗███████╗██████╗ ███████╗██████╗ ██████╗ ██╗   ██╗\n██╔══██╗██║     ██║   ██║██╔════╝██╔══██╗██╔════╝██╔══██╗██╔══██╗╚██╗ ██╔╝\n██████╔╝██║     ██║   ██║█████╗  ██████╔╝█████╗  ██████╔╝██████╔╝ ╚████╔╝\n██╔══██╗██║     ██║   ██║██╔══╝  ██╔══██╗██╔══╝  ██╔══██╗██╔══██╗  ╚██╔╝\n██████╔╝███████╗╚██████╔╝███████╗██████╔╝███████╗██║  ██║██║  ██║   ██║\n╚═════╝ ╚══════╝ ╚═════╝ ╚══════╝╚═════╝ ╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝\n*/\n\n/**\n * @title BlueberryErrors\n * @author BlueberryProtocol\n * @notice This contract contains the error messages for Blueberry Protocol.\n */\npragma solidity 0.8.22;\n\n/// @dev Common denominator for percentage-based calculations.\nuint256 constant DENOMINATOR = 10000;\n\n/// @dev Minimum threshold for liquidity operations, represented as a fraction of the DENOMINATOR.\nuint256 constant MIN_LIQ_THRESHOLD = 8000; // represent 80%\n\n/// @dev Precision factor to maintain price accuracy.\nuint256 constant PRICE_PRECISION = 1e18;\n\n/// @dev Maximum allowed price deviation, represented as a fraction of the DENOMINATOR.\nuint256 constant MAX_PRICE_DEVIATION = 1000; // represent 10%\n\n/// @dev Minimum time interval for specific time-dependent operations.\nuint32 constant MIN_TIME_GAP = 3 minutes;\n\n/// @dev Maximum time interval for specific time-dependent operations.\nuint32 constant MAX_TIME_GAP = 2 days;\n\n/// @dev Maximum allowed fee rate, represented as a fraction of the DENOMINATOR.\nuint256 constant MAX_FEE_RATE = 2000; // represent 20%\n\n/// @dev Maximum allowed time for vault withdrawal fee calculations.\nuint256 constant MAX_WITHDRAW_VAULT_FEE_WINDOW = 60 days;\n\n/// @dev Maximum delay permitted for swap operations.\nuint32 constant MAX_DELAY_ON_SWAP = 2 hours;\n\n/// @dev Allowed grace period time for sequencer operations.\nuint32 constant SEQUENCER_GRACE_PERIOD_TIME = 3600;\n\n/// @dev Precision factor for Chainlink price feed values.\nuint256 constant CHAINLINK_PRICE_FEED_PRECISION = 1e8;\n\n/// @dev Warm-up period before a liquidation repayment can be initiated.\nuint256 constant LIQUIDATION_REPAY_WARM_UP_PERIOD = 4 hours;\n"
      },
      "lib/blueberry-core/contracts/utils/BlueberryErrors.sol": {
        "content": "// SPDX-License-Identifier: MIT\n/*\n██████╗ ██╗     ██╗   ██╗███████╗██████╗ ███████╗██████╗ ██████╗ ██╗   ██╗\n██╔══██╗██║     ██║   ██║██╔════╝██╔══██╗██╔════╝██╔══██╗██╔══██╗╚██╗ ██╔╝\n██████╔╝██║     ██║   ██║█████╗  ██████╔╝█████╗  ██████╔╝██████╔╝ ╚████╔╝\n██╔══██╗██║     ██║   ██║██╔══╝  ██╔══██╗██╔══╝  ██╔══██╗██╔══██╗  ╚██╔╝\n██████╔╝███████╗╚██████╔╝███████╗██████╔╝███████╗██║  ██║██║  ██║   ██║\n╚═════╝ ╚══════╝ ╚═════╝ ╚══════╝╚═════╝ ╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝\n*/\n/**\n * @title BlueberryErrors\n * @author BlueberryProtocol\n * @notice containing all errors used in Blueberry protocol\n */\n/// title BlueberryErrors\n/// @notice containing all errors used in Blueberry protocol\npragma solidity 0.8.22;\n\n/*//////////////////////////////////////////////////////////////////////////\n                                COMMON ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when an action involves zero amount of tokens.\nerror ZERO_AMOUNT();\n\n/// @notice Thrown when the address provided is the zero address.\nerror ZERO_ADDRESS();\n\n/// @notice Thrown when the lengths of input arrays do not match.\nerror INPUT_ARRAY_MISMATCH();\n\n/// @notice Thrown when the caller is not authorized to call the function.\nerror UNAUTHORIZED();\n\n/*//////////////////////////////////////////////////////////////////////////\n                                ORACLE ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when the delay time exceeds allowed limits.\nerror TOO_LONG_DELAY(uint256 delayTime);\n\n/// @notice Thrown when there's no maximum delay set for a token.\nerror NO_MAX_DELAY(address token);\n\n/// @notice Thrown when the price information for a token is outdated.\nerror PRICE_OUTDATED(address token);\n\n/// @notice Thrown when the price obtained is negative.\nerror PRICE_NEGATIVE(address token);\n\n/// @notice Thrown when the sequencer is offline\nerror SEQUENCER_DOWN(address sequencer);\n\n/// @notice Thrown when the grace period for a sequencer is not over yet.\nerror SEQUENCER_GRACE_PERIOD_NOT_OVER(address sequencer);\n\n/// @notice Thrown when the price deviation exceeds allowed limits.\nerror OUT_OF_DEVIATION_CAP(uint256 deviation);\n\n/// @notice Thrown when the number of sources exceeds the allowed length.\nerror EXCEED_SOURCE_LEN(uint256 length);\n\n/// @notice Thrown when no primary source is available for the token.\nerror NO_PRIMARY_SOURCE(address token);\n\n/// @notice Thrown when no valid price source is available for the token.\nerror NO_VALID_SOURCE(address token);\n\n/// @notice Thrown when the deviation value exceeds the threshold.\nerror EXCEED_DEVIATION();\n\n/// @notice Thrown when the mean price is below the acceptable threshold.\nerror TOO_LOW_MEAN(uint256 mean);\n\n/// @notice Thrown when no mean price is set for the token.\nerror NO_MEAN(address token);\n\n/// @notice Thrown when no stable pool exists for the token.\nerror NO_STABLEPOOL(address token);\n\n/// @notice Thrown when the price fetch process fails for a token.\nerror PRICE_FAILED(address token);\n\n/// @notice Thrown when the liquidation threshold is set too high.\nerror LIQ_THRESHOLD_TOO_HIGH(uint256 threshold);\n\n/// @notice Thrown when the liquidation threshold is set too low.\nerror LIQ_THRESHOLD_TOO_LOW(uint256 threshold);\n\n/// @notice Thrown when the oracle doesn't support a specific token.\nerror ORACLE_NOT_SUPPORT(address token);\n\n/// @notice Thrown when the oracle doesn't support a specific LP pair token.\nerror ORACLE_NOT_SUPPORT_LP(address lp);\n\n/// @notice Thrown when the oracle doesn't support a specific wToken.\nerror ORACLE_NOT_SUPPORT_WTOKEN(address wToken);\n\n/// @notice Thrown when there is no route to fetch data for the oracle\nerror NO_ORACLE_ROUTE(address token);\n\n/// @notice Thrown when a value is out of an acceptable range.\nerror VALUE_OUT_OF_RANGE();\n\n/// @notice Thrown when specified limits are incorrect.\nerror INCORRECT_LIMITS();\n\n/// @notice Thrown when Curve LP is already registered.\nerror CRV_LP_ALREADY_REGISTERED(address lp);\n\n/// @notice Thrown when a token and Balancer LP is already registered.\nerror TOKEN_BPT_ALREADY_REGISTERED(address token, address bpt);\n\n/// @notice Thrown when a pool is subject to read-only reentrancy manipulation.\nerror REENTRANCY_RISK(address pool);\n\n/*//////////////////////////////////////////////////////////////////////////\n                            GENERAL SPELL ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when the caller isn't recognized as a bank.\nerror NOT_BANK(address caller);\n\n/// @notice Thrown when the collateral doesn't exist for a strategy.\nerror COLLATERAL_NOT_EXIST(uint256 strategyId, address colToken);\n\n/// @notice Thrown when the strategy ID doesn't correspond to an existing strategy.\nerror STRATEGY_NOT_EXIST(address spell, uint256 strategyId);\n\n/// @notice Thrown when the position size exceeds maximum limits.\nerror EXCEED_MAX_POS_SIZE(uint256 strategyId);\n\n/// @notice Thrown when the user has not deposited enough isolated collateral for a strategy.\nerror BELOW_MIN_ISOLATED_COLLATERAL(uint256 strategyId);\n\n/// @notice Thrown when the loan-to-value ratio exceeds allowed maximum.\nerror EXCEED_MAX_LTV();\n\n/// @notice Thrown when the strategy ID provided is incorrect.\nerror INCORRECT_STRATEGY_ID(uint256 strategyId);\n\n/// @notice Thrown when the position size is invalid.\nerror INVALID_POS_SIZE();\n\n/// @notice Thrown when an incorrect liquidity pool token is provided.\nerror INCORRECT_LP(address lpToken);\n\n/// @notice Thrown when an incorrect pool ID is provided.\nerror INCORRECT_PID(uint256 pid);\n\n/// @notice Thrown when an incorrect collateral token is provided.\nerror INCORRECT_COLTOKEN(address colToken);\n\n/// @notice Thrown when an incorrect underlying token is provided.\nerror INCORRECT_UNDERLYING(address uToken);\n\n/// @notice Thrown when an incorrect debt token is provided.\nerror INCORRECT_DEBT(address debtToken);\n\n/// @notice Thrown when a swap fails.\nerror SWAP_FAILED(address swapToken);\n\n/*//////////////////////////////////////////////////////////////////////////\n                                VAULT ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when borrowing from the vault fails.\nerror BORROW_FAILED(uint256 amount);\n\n/// @notice Thrown when repaying to the vault fails.\nerror REPAY_FAILED(uint256 amount);\n\n/// @notice Thrown when lending to the vault fails.\nerror LEND_FAILED(uint256 amount);\n\n/// @notice Thrown when redeeming from the vault fails.\nerror REDEEM_FAILED(uint256 amount);\n\n/*//////////////////////////////////////////////////////////////////////////\n                                WRAPPER ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when a duplicate tokenId is added.\nerror DUPLICATE_TOKEN_ID(uint256 tokenId);\n\n/// @notice Thrown when an invalid token ID is provided.\nerror INVALID_TOKEN_ID(uint256 tokenId);\n\n/// @notice Thrown when an incorrect pool ID is provided.\nerror BAD_PID(uint256 pid);\n\n/// @notice Thrown when a mismatch in reward per share is detected.\nerror BAD_REWARD_PER_SHARE(uint256 rewardPerShare);\n\n/*//////////////////////////////////////////////////////////////////////////\n                                BANK ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when a function is called without a required execution flag.\nerror NOT_UNDER_EXECUTION();\n\n/// @notice Thrown when a transaction isn't initiated by the expected spell.\nerror NOT_FROM_SPELL(address from);\n\n/// @notice Thrown when the sender is not the owner of a given position ID.\nerror NOT_FROM_OWNER(uint256 positionId, address sender);\n\n/// @notice Thrown when a spell address isn't whitelisted.\nerror SPELL_NOT_WHITELISTED(address spell);\n\n/// @notice Thrown when a token isn't whitelisted.\nerror TOKEN_NOT_WHITELISTED(address token);\n\n/// @notice Thrown when a bank isn't listed for a given token.\nerror BANK_NOT_LISTED(address token);\n\n/// @notice Thrown when a bank doesn't exist for an index.\nerror BANK_NOT_EXIST(uint8 index);\n\n/// @notice Thrown when a bank is already listed for a given token.\nerror BANK_ALREADY_LISTED();\n\n/// @notice Thrown when the bank limit is reached.\nerror BANK_LIMIT();\n\n/// @notice Thrown when the BTOKEN is already added.\nerror BTOKEN_ALREADY_ADDED();\n\n/// @notice Thrown when the lending action isn't allowed.\nerror LEND_NOT_ALLOWED();\n\n/// @notice Thrown when the borrowing action isn't allowed.\nerror BORROW_NOT_ALLOWED();\n\n/// @notice Thrown when the repaying action isn't allowed.\nerror REPAY_NOT_ALLOWED();\n\n/// @notice Thrown when the redeeming action isn't allowed.\nerror WITHDRAW_LEND_NOT_ALLOWED();\n\n/// @notice Thrown when certain actions are locked.\nerror LOCKED();\n\n/// @notice Thrown when an action isn't executed.\nerror NOT_IN_EXEC();\n\n/// @notice Thrown when the repayment allowance hasn't been warmed up.\nerror REPAY_ALLOW_NOT_WARMED_UP();\n\n/// @notice Thrown when a different collateral type exists.\nerror DIFF_COL_EXIST(address collToken);\n\n/// @notice Thrown when a position is not eligible for liquidation.\nerror NOT_LIQUIDATABLE(uint256 positionId);\n\n/// @notice Thrown when a position is flagged as bad or invalid.\nerror BAD_POSITION(uint256 posId);\n\n/// @notice Thrown when collateral for a specific position is flagged as bad or invalid.\nerror BAD_COLLATERAL(uint256 positionId);\n\n/// @notice Thrown when there's insufficient collateral for an operation.\nerror INSUFFICIENT_COLLATERAL();\n\n/// @notice Thrown when an attempted repayment exceeds the actual debt.\nerror REPAY_EXCEEDS_DEBT(uint256 repay, uint256 debt);\n\n/// @notice Thrown when an invalid utility token is provided.\nerror INVALID_UTOKEN(address uToken);\n\n/// @notice Thrown when a borrow operation results in zero shares.\nerror BORROW_ZERO_SHARE(uint256 borrowAmount);\n\n/*//////////////////////////////////////////////////////////////////////////\n                            CONFIGURATION ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when a certain ratio is too high for an operation.\nerror RATIO_TOO_HIGH(uint256 ratio);\n\n/// @notice Thrown when an invalid fee distribution is detected.\nerror INVALID_FEE_DISTRIBUTION();\n\n/// @notice Thrown when no treasury is set for fee distribution.\nerror NO_TREASURY_SET();\n\n/// @notice Thrown when a fee window has already started.\nerror FEE_WINDOW_ALREADY_STARTED();\n\n/// @notice Thrown when a fee window duration is too long.\nerror FEE_WINDOW_TOO_LONG(uint256 windowTime);\n\n/*//////////////////////////////////////////////////////////////////////////\n                                UTILITY ERRORS\n//////////////////////////////////////////////////////////////////////////*/\n\n/// @notice Thrown when an operation has surpassed its deadline.\nerror EXPIRED(uint256 deadline);\n"
      },
      "lib/blueberry-core/contracts/oracle/BaseAdapter.sol": {
        "content": "// SPDX-License-Identifier: MIT\n/*\n██████╗ ██╗     ██╗   ██╗███████╗██████╗ ███████╗██████╗ ██████╗ ██╗   ██╗\n██╔══██╗██║     ██║   ██║██╔════╝██╔══██╗██╔════╝██╔══██╗██╔══██╗╚██╗ ██╔╝\n██████╔╝██║     ██║   ██║█████╗  ██████╔╝█████╗  ██████╔╝██████╔╝ ╚████╔╝\n██╔══██╗██║     ██║   ██║██╔══╝  ██╔══██╗██╔══╝  ██╔══██╗██╔══██╗  ╚██╔╝\n██████╔╝███████╗╚██████╔╝███████╗██████╔╝███████╗██║  ██║██║  ██║   ██║\n╚═════╝ ╚══════╝ ╚═════╝ ╚══════╝╚═════╝ ╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝\n*/\n\npragma solidity 0.8.22;\n\nimport { Ownable2StepUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\n\nimport \"../utils/BlueberryErrors.sol\" as Errors;\nimport \"../utils/BlueberryConst.sol\" as Constants;\n\n/**\n * @title BaseAdapter\n * @author BlueberryProtocol\n * @notice This contract provides a base for adapters that interface with external oracle services.\n * @dev It allows the owner to set time gaps for price feed data of different tokens.\n */\nabstract contract BaseAdapter is Ownable2StepUpgradeable {\n    /*//////////////////////////////////////////////////////////////////////////\n                                      PUBLIC STORAGE \n    //////////////////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice A mapping that associates each token address with its respective time gap.\n     * @dev Time gap represents the acceptable age of the data before it is considered outdated.\n     */\n    mapping(address => uint256) internal _timeGaps;\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                      EVENTS\n    //////////////////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Emitted when a time gap for a specific token is set or updated.\n     * @param token The token address for which the time gap was set.\n     * @param gap The new time gap value (in seconds).\n     */\n    event SetTimeGap(address token, uint256 gap);\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                      FUNCTIONS\n    //////////////////////////////////////////////////////////////////////////*/\n\n    /**\n     * @notice Allows the owner to set time gaps for a list of tokens.\n     * @dev The time gap is used to determine the acceptable age of the oracle data.\n     * @param tokens List of token addresses for which time gaps will be set.\n     * @param gaps Corresponding list of time gaps to set for each token.\n     */\n    function setTimeGap(address[] calldata tokens, uint256[] calldata gaps) external onlyOwner {\n        uint256 tokensLength = tokens.length;\n        if (tokensLength != gaps.length) revert Errors.INPUT_ARRAY_MISMATCH();\n\n        for (uint256 i = 0; i < tokensLength; ++i) {\n            if (gaps[i] > Constants.MAX_TIME_GAP) revert Errors.TOO_LONG_DELAY(gaps[i]);\n            if (gaps[i] < Constants.MIN_TIME_GAP) revert Errors.TOO_LOW_MEAN(gaps[i]);\n            if (tokens[i] == address(0)) revert Errors.ZERO_ADDRESS();\n\n            _timeGaps[tokens[i]] = gaps[i];\n            emit SetTimeGap(tokens[i], gaps[i]);\n        }\n    }\n\n    /**\n     * @notice Fetch the time gap for a specific token.\n     * @param token The token address for which the time gap will be fetched.\n     * @return The time gap value (in seconds).\n     */\n    function getTimeGap(address token) external view returns (uint256) {\n        return _timeGaps[token];\n    }\n}\n"
      },
      "lib/blueberry-core/contracts/oracle/UsingBaseOracle.sol": {
        "content": "// SPDX-License-Identifier: MIT\n/*\n██████╗ ██╗     ██╗   ██╗███████╗██████╗ ███████╗██████╗ ██████╗ ██╗   ██╗\n██╔══██╗██║     ██║   ██║██╔════╝██╔══██╗██╔════╝██╔══██╗██╔══██╗╚██╗ ██╔╝\n██████╔╝██║     ██║   ██║█████╗  ██████╔╝█████╗  ██████╔╝██████╔╝ ╚████╔╝\n██╔══██╗██║     ██║   ██║██╔══╝  ██╔══██╗██╔══╝  ██╔══██╗██╔══██╗  ╚██╔╝\n██████╔╝███████╗╚██████╔╝███████╗██████╔╝███████╗██║  ██║██║  ██║   ██║\n╚═════╝ ╚══════╝ ╚═════╝ ╚══════╝╚═════╝ ╚══════╝╚═╝  ╚═╝╚═╝  ╚═╝   ╚═╝\n*/\n\npragma solidity 0.8.22;\n\nimport { Ownable2StepUpgradeable } from \"@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol\";\n\nimport { IBaseOracle } from \"../interfaces/IBaseOracle.sol\";\n\n/**\n * @title UsingBaseOracle\n * @author BlueberryProtocol\n * @dev This contract serves as a base for other contracts that need access\n *      to an external oracle service. It provides an immutable reference to a\n *      specified oracle source.\n */\nabstract contract UsingBaseOracle is Ownable2StepUpgradeable {\n    /// @dev Base oracle source\n    IBaseOracle internal _base;\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                     CONSTRUCTOR\n    //////////////////////////////////////////////////////////////////////////*/\n    /// @custom:oz-upgrades-unsafe-allow constructor\n    constructor() {\n        _disableInitializers();\n    }\n\n    /*//////////////////////////////////////////////////////////////////////////\n                                       FUNCTIONS\n    //////////////////////////////////////////////////////////////////////////*/\n\n    /* solhint-disable func-name-mixedcase */\n    /**\n     * @dev Initializes the Base oracle source.\n     * @param base Address of the Base oracle source.\n     * @param owner Address of the owner.\n     */\n    function __UsingBaseOracle_init(IBaseOracle base, address owner) internal onlyInitializing {\n        _base = base;\n        __Ownable2Step_init();\n        _transferOwnership(owner);\n    }\n\n    /* solhint-enable func-name-mixedcase */\n\n    /// @notice Returns the address of the Base oracle source.\n    function getBaseOracle() public view returns (IBaseOracle) {\n        return _base;\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     *      variables without shifting down storage in the inheritance chain.\n     *      See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[10] private __gap;\n}\n"
      },
      "lib/blueberry-core/contracts/interfaces/IBaseOracle.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.22;\n\n/**\n * @title IBaseOracle\n * @author BlueberryProtocol\n * @notice Interface for a basic oracle that provides price data for assets.\n */\ninterface IBaseOracle {\n    /**\n     * @notice Event emitted when a new LP token is registered within its respective implementation.\n     * @param token Address of the LP token being registered\n     */\n    event RegisterLpToken(address token);\n\n    /**\n     * @notice Fetches the price of the given token in USD with 18 decimals precision.\n     * @param token Address of the ERC-20 token for which the price is requested.\n     * @return The USD price of the given token, multiplied by 10**18.\n     */\n    function getPrice(address token) external view returns (uint256);\n}\n"
      },
      "lib/blueberry-core/contracts/interfaces/balancer-v2/IBalancerV2Pool.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.22;\n\ninterface IBalancerV2Pool {\n    function getVault() external view returns (address);\n\n    function getPoolId() external view returns (bytes32);\n\n    function totalSupply() external view returns (uint256);\n\n    function getActualSupply() external view returns (uint256);\n}\n"
      },
      "lib/blueberry-core/contracts/interfaces/balancer-v2/IBalancerVault.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.22;\n\nimport { IAsset } from \"./IAsset.sol\";\n\ninterface IBalancerVault {\n    enum SwapKind {\n        GIVEN_IN,\n        GIVEN_OUT\n    }\n\n    enum UserBalanceOpKind {\n        DEPOSIT_INTERNAL,\n        WITHDRAW_INTERNAL,\n        TRANSFER_INTERNAL,\n        TRANSFER_EXTERNAL\n    }\n\n    struct FundManagement {\n        address sender;\n        bool fromInternalBalance;\n        address payable recipient;\n        bool toInternalBalance;\n    }\n\n    /**\n     * @dev Data for `manageUserBalance` operations, which include the possibility for ETH to be sent and received\n     without manual WETH wrapping or unwrapping.\n     */\n    struct UserBalanceOp {\n        UserBalanceOpKind kind;\n        IAsset asset;\n        uint256 amount;\n        address sender;\n        address payable recipient;\n    }\n\n    struct JoinPoolRequest {\n        address[] assets;\n        uint256[] maxAmountsIn;\n        bytes userData;\n        bool fromInternalBalance;\n    }\n\n    struct ExitPoolRequest {\n        address[] assets;\n        uint256[] minAmountsOut;\n        bytes userData;\n        bool toInternalBalance;\n    }\n\n    struct SingleSwap {\n        bytes32 poolId;\n        SwapKind kind;\n        IAsset assetIn;\n        IAsset assetOut;\n        uint256 amount;\n        bytes userData;\n    }\n\n    function joinPool(\n        bytes32 poolId,\n        address sender,\n        address recipient,\n        JoinPoolRequest memory request\n    ) external payable;\n\n    function exitPool(bytes32 poolId, address sender, address recipient, ExitPoolRequest memory request) external;\n\n    /**\n     * @dev Performs a swap with a single Pool.\n     *\n     * If the swap is 'given in' (the number of tokens to send to the Pool is known), it returns the amount of tokens\n     * taken from the Pool, which must be greater than or equal to `limit`.\n     *\n     * If the swap is 'given out' (the number of tokens to take from the Pool is known), it returns the amount of tokens\n     * sent to the Pool, which must be less than or equal to `limit`.\n     *\n     * Internal Balance usage and the recipient are determined by the `funds` struct.\n     *\n     * Emits a `Swap` event.\n     */\n    function swap(\n        SingleSwap memory singleSwap,\n        FundManagement memory funds,\n        uint256 limit,\n        uint256 deadline\n    ) external payable returns (uint256);\n\n    function getPoolTokens(\n        bytes32 poolId\n    ) external view returns (address[] memory tokens, uint256[] memory balances, uint256 lastChangedBlock);\n\n    function getPool(bytes32 pid) external view returns (address pool, uint256 poolType);\n\n    function manageUserBalance(UserBalanceOp[] memory ops) external;\n}\n"
      },
      "lib/blueberry-core/contracts/interfaces/balancer-v2/IBalancerPriceOracle.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface for querying historical data from a Pool that can be used as a Price Oracle.\n *\n * This lets third parties retrieve average prices of tokens held by a Pool over a given period of time, as well as the\n * price of the Pool share token (BPT) and invariant. Since the invariant is a sensible measure of Pool liquidity, it\n * can be used to compare two different price sources, and choose the most liquid one.\n *\n * Once the oracle is fully initialized, all queries are guaranteed to succeed as long as they require no data that\n * is not older than the largest safe query window.\n */\ninterface IBalancerPriceOracle {\n    // The three values that can be queried:\n    //\n    // - PAIR_PRICE: the price of the tokens in the Pool, expressed as the price of the second token in units of the\n    //   first token. For example, if token A is worth $2, and token B is worth $4, the pair price will be 2.0.\n    //   Note that the price is computed *including* the tokens decimals. This means that the pair price of a Pool with\n    //   DAI and USDC will be close to 1.0, despite DAI having 18 decimals and USDC 6.\n    //\n    // - BPT_PRICE: the price of the Pool share token (BPT), in units of the first token.\n    //   Note that the price is computed *including* the tokens decimals. This means that the BPT price of a Pool with\n    //   USDC in which BPT is worth $5 will be 5.0, despite the BPT having 18 decimals and USDC 6.\n    //\n    // - INVARIANT: the value of the Pool's invariant, which serves as a measure of its liquidity.\n    enum Variable {\n        PAIR_PRICE,\n        BPT_PRICE,\n        INVARIANT\n    }\n\n    /**\n     * @dev Returns the time average weighted price corresponding to each of `queries`. Prices are represented as 18\n     * decimal fixed point values.\n     */\n    function getTimeWeightedAverage(\n        OracleAverageQuery[] memory queries\n    ) external view returns (uint256[] memory results);\n\n    /**\n     * @dev Returns latest sample of `variable`. Prices are represented as 18 decimal fixed point values.\n     */\n    function getLatest(Variable variable) external view returns (uint256);\n\n    /**\n     * @dev Information for a Time Weighted Average query.\n     *\n     * Each query computes the average over a window of duration `secs` seconds that ended `ago` seconds ago. For\n     * example, the average over the past 30 minutes is computed by settings secs to 1800 and ago to 0. If secs is 1800\n     * and ago is 1800 as well, the average between 60 and 30 minutes ago is computed instead.\n     */\n    struct OracleAverageQuery {\n        Variable variable;\n        uint256 secs;\n        uint256 ago;\n    }\n\n    /**\n     * @dev Returns largest time window that can be safely queried, where 'safely' means the Oracle is guaranteed to be\n     * able to produce a result and not revert.\n     *\n     * If a query has a non-zero `ago` value, then `secs + ago` (the oldest point in time) must be smaller than this\n     * value for 'safe' queries.\n     */\n    function getLargestSafeQueryWindow() external view returns (uint256);\n\n    /**\n     * @dev Returns the accumulators corresponding to each of `queries`.\n     */\n    function getPastAccumulators(\n        OracleAccumulatorQuery[] memory queries\n    ) external view returns (int256[] memory results);\n\n    /**\n     * @dev Information for an Accumulator query.\n     *\n     * Each query estimates the accumulator at a time `ago` seconds ago.\n     */\n    struct OracleAccumulatorQuery {\n        Variable variable;\n        uint256 ago;\n    }\n}\n"
      },
      "lib/blueberry-core/contracts/libraries/balancer-v2/BalancerErrors.sol": {
        "content": "// SPDX-License-Identifier: GPL-3.0-or-later\n// This program is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n\n// This program is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n// GNU General Public License for more details.\n\n// You should have received a copy of the GNU General Public License\n// along with this program.  If not, see <http://www.gnu.org/licenses/>.\n\npragma solidity ^0.8.0;\n\n/// Forked from https://github.com/balancer-labs/balancer-v2-monorepo/blob/3703c43c89dc693b918d20ebb0d9e4b205d31c2c/contracts/lib/helpers/BalancerErrors.sol\n/// Updated solidity version to 0.8.X\n\n// solhint-disable\n\n/**\n * @dev Reverts if `condition` is false, with a revert reason containing `errorCode`. Only codes up to 999 are\n * supported.\n * Uses the default 'BAL' prefix for the error code\n */\nfunction _require(bool condition, uint256 errorCode) pure {\n    if (!condition) _revert(errorCode);\n}\n\n/**\n * @dev Reverts if `condition` is false, with a revert reason containing `errorCode`. Only codes up to 999 are\n * supported.\n */\nfunction _require(bool condition, uint256 errorCode, bytes3 prefix) pure {\n    if (!condition) _revert(errorCode, prefix);\n}\n\n/**\n * @dev Reverts with a revert reason containing `errorCode`. Only codes up to 999 are supported.\n * Uses the default 'BAL' prefix for the error code\n */\nfunction _revert(uint256 errorCode) pure {\n    _revert(errorCode, 0x42414c); // This is the raw byte representation of \"BAL\"\n}\n\n/**\n * @dev Reverts with a revert reason containing `errorCode`. Only codes up to 999 are supported.\n */\nfunction _revert(uint256 errorCode, bytes3 prefix) pure {\n    uint256 prefixUint = uint256(uint24(prefix));\n    // We're going to dynamically create a revert string based on the error code, with the following format:\n    // 'BAL#{errorCode}'\n    // where the code is left-padded with zeroes to three digits (so they range from 000 to 999).\n    //\n    // We don't have revert strings embedded in the contract to save bytecode size: it takes much less space to store a\n    // number (8 to 16 bits) than the individual string characters.\n    //\n    // The dynamic string creation algorithm that follows could be implemented in Solidity, but assembly allows for a\n    // much denser implementation, again saving bytecode size. Given this function unconditionally reverts, this is a\n    // safe place to rely on it without worrying about how its usage might affect e.g. memory contents.\n    assembly {\n        // First, we need to compute the ASCII representation of the error code. We assume that it is in the 0-999\n        // range, so we only need to convert three digits. To convert the digits to ASCII, we add 0x30, the value for\n        // the '0' character.\n\n        let units := add(mod(errorCode, 10), 0x30)\n\n        errorCode := div(errorCode, 10)\n        let tenths := add(mod(errorCode, 10), 0x30)\n\n        errorCode := div(errorCode, 10)\n        let hundreds := add(mod(errorCode, 10), 0x30)\n\n        // With the individual characters, we can now construct the full string.\n        // We first append the '#' character (0x23) to the prefix. In the case of 'BAL', it results in 0x42414c23 ('BAL#')\n        // Then, we shift this by 24 (to provide space for the 3 bytes of the error code), and add the\n        // characters to it, each shifted by a multiple of 8.\n        // The revert reason is then shifted left by 200 bits (256 minus the length of the string, 7 characters * 8 bits\n        // per character = 56) to locate it in the most significant part of the 256 slot (the beginning of a byte\n        // array).\n        let formattedPrefix := shl(24, add(0x23, shl(8, prefixUint)))\n\n        let revertReason := shl(200, add(formattedPrefix, add(add(units, shl(8, tenths)), shl(16, hundreds))))\n\n        // We can now encode the reason in memory, which can be safely overwritten as we're about to revert. The encoded\n        // message will have the following layout:\n        // [ revert reason identifier ] [ string location offset ] [ string length ] [ string contents ]\n\n        // The Solidity revert reason identifier is 0x08c739a0, the function selector of the Error(string) function. We\n        // also write zeroes to the next 28 bytes of memory, but those are about to be overwritten.\n        mstore(0x0, 0x08c379a000000000000000000000000000000000000000000000000000000000)\n        // Next is the offset to the location of the string, which will be placed immediately after (20 bytes away).\n        mstore(0x04, 0x0000000000000000000000000000000000000000000000000000000000000020)\n        // The string length is fixed: 7 characters.\n        mstore(0x24, 7)\n        // Finally, the string itself is stored.\n        mstore(0x44, revertReason)\n\n        // Even if the string is only 7 bytes long, we need to return a full 32 byte slot containing it. The length of\n        // the encoded message is therefore 4 + 32 + 32 + 32 = 100.\n        revert(0, 100)\n    }\n}\n\nlibrary BalancerErrors {\n    // Math\n    uint256 internal constant ADD_OVERFLOW = 0;\n    uint256 internal constant SUB_OVERFLOW = 1;\n    uint256 internal constant SUB_UNDERFLOW = 2;\n    uint256 internal constant MUL_OVERFLOW = 3;\n    uint256 internal constant ZERO_DIVISION = 4;\n    uint256 internal constant DIV_INTERNAL = 5;\n    uint256 internal constant X_OUT_OF_BOUNDS = 6;\n    uint256 internal constant Y_OUT_OF_BOUNDS = 7;\n    uint256 internal constant PRODUCT_OUT_OF_BOUNDS = 8;\n    uint256 internal constant INVALID_EXPONENT = 9;\n\n    // Input\n    uint256 internal constant OUT_OF_BOUNDS = 100;\n    uint256 internal constant UNSORTED_ARRAY = 101;\n    uint256 internal constant UNSORTED_TOKENS = 102;\n    uint256 internal constant INPUT_LENGTH_MISMATCH = 103;\n    uint256 internal constant ZERO_TOKEN = 104;\n\n    // Shared pools\n    uint256 internal constant MIN_TOKENS = 200;\n    uint256 internal constant MAX_TOKENS = 201;\n    uint256 internal constant MAX_SWAP_FEE_PERCENTAGE = 202;\n    uint256 internal constant MIN_SWAP_FEE_PERCENTAGE = 203;\n    uint256 internal constant MINIMUM_BPT = 204;\n    uint256 internal constant CALLER_NOT_VAULT = 205;\n    uint256 internal constant UNINITIALIZED = 206;\n    uint256 internal constant BPT_IN_MAX_AMOUNT = 207;\n    uint256 internal constant BPT_OUT_MIN_AMOUNT = 208;\n    uint256 internal constant EXPIRED_PERMIT = 209;\n    uint256 internal constant NOT_TWO_TOKENS = 210;\n    uint256 internal constant DISABLED = 211;\n\n    // Pools\n    uint256 internal constant MIN_AMP = 300;\n    uint256 internal constant MAX_AMP = 301;\n    uint256 internal constant MIN_WEIGHT = 302;\n    uint256 internal constant MAX_STABLE_TOKENS = 303;\n    uint256 internal constant MAX_IN_RATIO = 304;\n    uint256 internal constant MAX_OUT_RATIO = 305;\n    uint256 internal constant MIN_BPT_IN_FOR_TOKEN_OUT = 306;\n    uint256 internal constant MAX_OUT_BPT_FOR_TOKEN_IN = 307;\n    uint256 internal constant NORMALIZED_WEIGHT_INVARIANT = 308;\n    uint256 internal constant INVALID_TOKEN = 309;\n    uint256 internal constant UNHANDLED_JOIN_KIND = 310;\n    uint256 internal constant ZERO_INVARIANT = 311;\n    uint256 internal constant ORACLE_INVALID_SECONDS_QUERY = 312;\n    uint256 internal constant ORACLE_NOT_INITIALIZED = 313;\n    uint256 internal constant ORACLE_QUERY_TOO_OLD = 314;\n    uint256 internal constant ORACLE_INVALID_INDEX = 315;\n    uint256 internal constant ORACLE_BAD_SECS = 316;\n    uint256 internal constant AMP_END_TIME_TOO_CLOSE = 317;\n    uint256 internal constant AMP_ONGOING_UPDATE = 318;\n    uint256 internal constant AMP_RATE_TOO_HIGH = 319;\n    uint256 internal constant AMP_NO_ONGOING_UPDATE = 320;\n    uint256 internal constant STABLE_INVARIANT_DIDNT_CONVERGE = 321;\n    uint256 internal constant STABLE_GET_BALANCE_DIDNT_CONVERGE = 322;\n    uint256 internal constant RELAYER_NOT_CONTRACT = 323;\n    uint256 internal constant BASE_POOL_RELAYER_NOT_CALLED = 324;\n    uint256 internal constant REBALANCING_RELAYER_REENTERED = 325;\n    uint256 internal constant GRADUAL_UPDATE_TIME_TRAVEL = 326;\n    uint256 internal constant SWAPS_DISABLED = 327;\n    uint256 internal constant CALLER_IS_NOT_LBP_OWNER = 328;\n    uint256 internal constant PRICE_RATE_OVERFLOW = 329;\n    uint256 internal constant INVALID_JOIN_EXIT_KIND_WHILE_SWAPS_DISABLED = 330;\n    uint256 internal constant WEIGHT_CHANGE_TOO_FAST = 331;\n    uint256 internal constant LOWER_GREATER_THAN_UPPER_TARGET = 332;\n    uint256 internal constant UPPER_TARGET_TOO_HIGH = 333;\n    uint256 internal constant UNHANDLED_BY_LINEAR_POOL = 334;\n    uint256 internal constant OUT_OF_TARGET_RANGE = 335;\n    uint256 internal constant UNHANDLED_EXIT_KIND = 336;\n    uint256 internal constant UNAUTHORIZED_EXIT = 337;\n    uint256 internal constant MAX_MANAGEMENT_SWAP_FEE_PERCENTAGE = 338;\n    uint256 internal constant UNHANDLED_BY_MANAGED_POOL = 339;\n    uint256 internal constant UNHANDLED_BY_PHANTOM_POOL = 340;\n    uint256 internal constant TOKEN_DOES_NOT_HAVE_RATE_PROVIDER = 341;\n    uint256 internal constant INVALID_INITIALIZATION = 342;\n    uint256 internal constant OUT_OF_NEW_TARGET_RANGE = 343;\n    uint256 internal constant FEATURE_DISABLED = 344;\n    uint256 internal constant UNINITIALIZED_POOL_CONTROLLER = 345;\n    uint256 internal constant SET_SWAP_FEE_DURING_FEE_CHANGE = 346;\n    uint256 internal constant SET_SWAP_FEE_PENDING_FEE_CHANGE = 347;\n    uint256 internal constant CHANGE_TOKENS_DURING_WEIGHT_CHANGE = 348;\n    uint256 internal constant CHANGE_TOKENS_PENDING_WEIGHT_CHANGE = 349;\n    uint256 internal constant MAX_WEIGHT = 350;\n    uint256 internal constant UNAUTHORIZED_JOIN = 351;\n    uint256 internal constant MAX_MANAGEMENT_AUM_FEE_PERCENTAGE = 352;\n    uint256 internal constant FRACTIONAL_TARGET = 353;\n\n    // Lib\n    uint256 internal constant REENTRANCY = 400;\n    uint256 internal constant SENDER_NOT_ALLOWED = 401;\n    uint256 internal constant PAUSED = 402;\n    uint256 internal constant PAUSE_WINDOW_EXPIRED = 403;\n    uint256 internal constant MAX_PAUSE_WINDOW_DURATION = 404;\n    uint256 internal constant MAX_BUFFER_PERIOD_DURATION = 405;\n    uint256 internal constant INSUFFICIENT_BALANCE = 406;\n    uint256 internal constant INSUFFICIENT_ALLOWANCE = 407;\n    uint256 internal constant ERC20_TRANSFER_FROM_ZERO_ADDRESS = 408;\n    uint256 internal constant ERC20_TRANSFER_TO_ZERO_ADDRESS = 409;\n    uint256 internal constant ERC20_MINT_TO_ZERO_ADDRESS = 410;\n    uint256 internal constant ERC20_BURN_FROM_ZERO_ADDRESS = 411;\n    uint256 internal constant ERC20_APPROVE_FROM_ZERO_ADDRESS = 412;\n    uint256 internal constant ERC20_APPROVE_TO_ZERO_ADDRESS = 413;\n    uint256 internal constant ERC20_TRANSFER_EXCEEDS_ALLOWANCE = 414;\n    uint256 internal constant ERC20_DECREASED_ALLOWANCE_BELOW_ZERO = 415;\n    uint256 internal constant ERC20_TRANSFER_EXCEEDS_BALANCE = 416;\n    uint256 internal constant ERC20_BURN_EXCEEDS_ALLOWANCE = 417;\n    uint256 internal constant SAFE_ERC20_CALL_FAILED = 418;\n    uint256 internal constant ADDRESS_INSUFFICIENT_BALANCE = 419;\n    uint256 internal constant ADDRESS_CANNOT_SEND_VALUE = 420;\n    uint256 internal constant SAFE_CAST_VALUE_CANT_FIT_INT256 = 421;\n    uint256 internal constant GRANT_SENDER_NOT_ADMIN = 422;\n    uint256 internal constant REVOKE_SENDER_NOT_ADMIN = 423;\n    uint256 internal constant RENOUNCE_SENDER_NOT_ALLOWED = 424;\n    uint256 internal constant BUFFER_PERIOD_EXPIRED = 425;\n    uint256 internal constant CALLER_IS_NOT_OWNER = 426;\n    uint256 internal constant NEW_OWNER_IS_ZERO = 427;\n    uint256 internal constant CODE_DEPLOYMENT_FAILED = 428;\n    uint256 internal constant CALL_TO_NON_CONTRACT = 429;\n    uint256 internal constant LOW_LEVEL_CALL_FAILED = 430;\n    uint256 internal constant NOT_PAUSED = 431;\n    uint256 internal constant ADDRESS_ALREADY_ALLOWLISTED = 432;\n    uint256 internal constant ADDRESS_NOT_ALLOWLISTED = 433;\n    uint256 internal constant ERC20_BURN_EXCEEDS_BALANCE = 434;\n    uint256 internal constant INVALID_OPERATION = 435;\n    uint256 internal constant CODEC_OVERFLOW = 436;\n    uint256 internal constant IN_RECOVERY_MODE = 437;\n    uint256 internal constant NOT_IN_RECOVERY_MODE = 438;\n    uint256 internal constant INDUCED_FAILURE = 439;\n    uint256 internal constant EXPIRED_SIGNATURE = 440;\n    uint256 internal constant MALFORMED_SIGNATURE = 441;\n    uint256 internal constant SAFE_CAST_VALUE_CANT_FIT_UINT64 = 442;\n    uint256 internal constant UNHANDLED_FEE_TYPE = 443;\n\n    // Vault\n    uint256 internal constant INVALID_POOL_ID = 500;\n    uint256 internal constant CALLER_NOT_POOL = 501;\n    uint256 internal constant SENDER_NOT_ASSET_MANAGER = 502;\n    uint256 internal constant USER_DOESNT_ALLOW_RELAYER = 503;\n    uint256 internal constant INVALID_SIGNATURE = 504;\n    uint256 internal constant EXIT_BELOW_MIN = 505;\n    uint256 internal constant JOIN_ABOVE_MAX = 506;\n    uint256 internal constant SWAP_LIMIT = 507;\n    uint256 internal constant SWAP_DEADLINE = 508;\n    uint256 internal constant CANNOT_SWAP_SAME_TOKEN = 509;\n    uint256 internal constant UNKNOWN_AMOUNT_IN_FIRST_SWAP = 510;\n    uint256 internal constant MALCONSTRUCTED_MULTIHOP_SWAP = 511;\n    uint256 internal constant INTERNAL_BALANCE_OVERFLOW = 512;\n    uint256 internal constant INSUFFICIENT_INTERNAL_BALANCE = 513;\n    uint256 internal constant INVALID_ETH_INTERNAL_BALANCE = 514;\n    uint256 internal constant INVALID_POST_LOAN_BALANCE = 515;\n    uint256 internal constant INSUFFICIENT_ETH = 516;\n    uint256 internal constant UNALLOCATED_ETH = 517;\n    uint256 internal constant ETH_TRANSFER = 518;\n    uint256 internal constant CANNOT_USE_ETH_SENTINEL = 519;\n    uint256 internal constant TOKENS_MISMATCH = 520;\n    uint256 internal constant TOKEN_NOT_REGISTERED = 521;\n    uint256 internal constant TOKEN_ALREADY_REGISTERED = 522;\n    uint256 internal constant TOKENS_ALREADY_SET = 523;\n    uint256 internal constant TOKENS_LENGTH_MUST_BE_2 = 524;\n    uint256 internal constant NONZERO_TOKEN_BALANCE = 525;\n    uint256 internal constant BALANCE_TOTAL_OVERFLOW = 526;\n    uint256 internal constant POOL_NO_TOKENS = 527;\n    uint256 internal constant INSUFFICIENT_FLASH_LOAN_BALANCE = 528;\n\n    // Fees\n    uint256 internal constant SWAP_FEE_PERCENTAGE_TOO_HIGH = 600;\n    uint256 internal constant FLASH_LOAN_FEE_PERCENTAGE_TOO_HIGH = 601;\n    uint256 internal constant INSUFFICIENT_FLASH_LOAN_FEE_AMOUNT = 602;\n    uint256 internal constant AUM_FEE_PERCENTAGE_TOO_HIGH = 603;\n\n    // Misc\n    uint256 internal constant UNIMPLEMENTED = 998;\n    uint256 internal constant SHOULD_NOT_HAPPEN = 999;\n}"
      },
      "lib/blueberry-core/node_modules/@openzeppelin/contracts-upgradeable/access/Ownable2StepUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable2Step.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./OwnableUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership} and {acceptOwnership}.\n *\n * This module is used through inheritance. It will make available all functions\n * from parent (Ownable).\n */\nabstract contract Ownable2StepUpgradeable is Initializable, OwnableUpgradeable {\n    address private _pendingOwner;\n\n    event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner);\n\n    function __Ownable2Step_init() internal onlyInitializing {\n        __Ownable_init_unchained();\n    }\n\n    function __Ownable2Step_init_unchained() internal onlyInitializing {\n    }\n    /**\n     * @dev Returns the address of the pending owner.\n     */\n    function pendingOwner() public view virtual returns (address) {\n        return _pendingOwner;\n    }\n\n    /**\n     * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one.\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual override onlyOwner {\n        _pendingOwner = newOwner;\n        emit OwnershipTransferStarted(owner(), newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`) and deletes any pending owner.\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual override {\n        delete _pendingOwner;\n        super._transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev The new owner accepts the ownership transfer.\n     */\n    function acceptOwnership() public virtual {\n        address sender = _msgSender();\n        require(pendingOwner() == sender, \"Ownable2Step: caller is not the new owner\");\n        _transferOwnership(sender);\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"
      },
      "lib/blueberry-core/contracts/interfaces/balancer-v2/IAsset.sol": {
        "content": "// SPDX-License-Identifier: MIT\n\npragma solidity 0.8.22;\n\ninterface IAsset {\n    // solhint-disable-previous-line no-empty-blocks\n}\n"
      },
      "lib/blueberry-core/node_modules/@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/ContextUpgradeable.sol\";\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module which provides a basic access control mechanism, where\n * there is an account (an owner) that can be granted exclusive access to\n * specific functions.\n *\n * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\n *\n * This module is used through inheritance. It will make available the modifier\n * `onlyOwner`, which can be applied to your functions to restrict their use to\n * the owner.\n */\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\n    address private _owner;\n\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n    /**\n     * @dev Initializes the contract setting the deployer as the initial owner.\n     */\n    function __Ownable_init() internal onlyInitializing {\n        __Ownable_init_unchained();\n    }\n\n    function __Ownable_init_unchained() internal onlyInitializing {\n        _transferOwnership(_msgSender());\n    }\n\n    /**\n     * @dev Throws if called by any account other than the owner.\n     */\n    modifier onlyOwner() {\n        _checkOwner();\n        _;\n    }\n\n    /**\n     * @dev Returns the address of the current owner.\n     */\n    function owner() public view virtual returns (address) {\n        return _owner;\n    }\n\n    /**\n     * @dev Throws if the sender is not the owner.\n     */\n    function _checkOwner() internal view virtual {\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\n    }\n\n    /**\n     * @dev Leaves the contract without owner. It will not be possible to call\n     * `onlyOwner` functions. Can only be called by the current owner.\n     *\n     * NOTE: Renouncing ownership will leave the contract without an owner,\n     * thereby disabling any functionality that is only available to the owner.\n     */\n    function renounceOwnership() public virtual onlyOwner {\n        _transferOwnership(address(0));\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Can only be called by the current owner.\n     */\n    function transferOwnership(address newOwner) public virtual onlyOwner {\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n        _transferOwnership(newOwner);\n    }\n\n    /**\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\n     * Internal function without access restriction.\n     */\n    function _transferOwnership(address newOwner) internal virtual {\n        address oldOwner = _owner;\n        _owner = newOwner;\n        emit OwnershipTransferred(oldOwner, newOwner);\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"
      },
      "lib/blueberry-core/node_modules/@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```solidity\n * contract MyToken is ERC20Upgradeable {\n *     function initialize() initializer public {\n *         __ERC20_init(\"MyToken\", \"MTK\");\n *     }\n * }\n *\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n *     function initializeV2() reinitializer(2) public {\n *         __ERC20Permit_init(\"MyToken\");\n *     }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n *     _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n    /**\n     * @dev Indicates that the contract has been initialized.\n     * @custom:oz-retyped-from bool\n     */\n    uint8 private _initialized;\n\n    /**\n     * @dev Indicates that the contract is in the process of being initialized.\n     */\n    bool private _initializing;\n\n    /**\n     * @dev Triggered when the contract has been initialized or reinitialized.\n     */\n    event Initialized(uint8 version);\n\n    /**\n     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n     * `onlyInitializing` functions can be used to initialize parent contracts.\n     *\n     * Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a\n     * constructor.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier initializer() {\n        bool isTopLevelCall = !_initializing;\n        require(\n            (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n            \"Initializable: contract is already initialized\"\n        );\n        _initialized = 1;\n        if (isTopLevelCall) {\n            _initializing = true;\n        }\n        _;\n        if (isTopLevelCall) {\n            _initializing = false;\n            emit Initialized(1);\n        }\n    }\n\n    /**\n     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n     * used to initialize parent contracts.\n     *\n     * A reinitializer may be used after the original initialization step. This is essential to configure modules that\n     * are added through upgrades and that require initialization.\n     *\n     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`\n     * cannot be nested. If one is invoked in the context of another, execution will revert.\n     *\n     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n     * a contract, executing them in the right order is up to the developer or operator.\n     *\n     * WARNING: setting the version to 255 will prevent any future reinitialization.\n     *\n     * Emits an {Initialized} event.\n     */\n    modifier reinitializer(uint8 version) {\n        require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n        _initialized = version;\n        _initializing = true;\n        _;\n        _initializing = false;\n        emit Initialized(version);\n    }\n\n    /**\n     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n     * {initializer} and {reinitializer} modifiers, directly or indirectly.\n     */\n    modifier onlyInitializing() {\n        require(_initializing, \"Initializable: contract is not initializing\");\n        _;\n    }\n\n    /**\n     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n     * through proxies.\n     *\n     * Emits an {Initialized} event the first time it is successfully executed.\n     */\n    function _disableInitializers() internal virtual {\n        require(!_initializing, \"Initializable: contract is initializing\");\n        if (_initialized != type(uint8).max) {\n            _initialized = type(uint8).max;\n            emit Initialized(type(uint8).max);\n        }\n    }\n\n    /**\n     * @dev Returns the highest version that has been initialized. See {reinitializer}.\n     */\n    function _getInitializedVersion() internal view returns (uint8) {\n        return _initialized;\n    }\n\n    /**\n     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.\n     */\n    function _isInitializing() internal view returns (bool) {\n        return _initializing;\n    }\n}\n"
      },
      "lib/blueberry-core/node_modules/@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport {Initializable} from \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n    function __Context_init() internal onlyInitializing {\n    }\n\n    function __Context_init_unchained() internal onlyInitializing {\n    }\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    function _contextSuffixLength() internal view virtual returns (uint256) {\n        return 0;\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"
      },
      "lib/blueberry-core/node_modules/@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": {
        "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     *\n     * Furthermore, `isContract` will also return true if the target contract within\n     * the same transaction is already scheduled for destruction by `SELFDESTRUCT`,\n     * which only has an effect at the end of a transaction.\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a delegate call.\n     *\n     * _Available since v3.4._\n     */\n    function functionDelegateCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResultFromTarget(target, success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling\n     * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.\n     *\n     * _Available since v4.8._\n     */\n    function verifyCallResultFromTarget(\n        address target,\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        if (success) {\n            if (returndata.length == 0) {\n                // only check isContract if the call was successful and the return data is empty\n                // otherwise we already know that it was a contract\n                require(isContract(target), \"Address: call to non-contract\");\n            }\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    /**\n     * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason or using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            _revert(returndata, errorMessage);\n        }\n    }\n\n    function _revert(bytes memory returndata, string memory errorMessage) private pure {\n        // Look for revert reason and bubble it up if present\n        if (returndata.length > 0) {\n            // The easiest way to bubble the revert reason is using memory via assembly\n            /// @solidity memory-safe-assembly\n            assembly {\n                let returndata_size := mload(returndata)\n                revert(add(32, returndata), returndata_size)\n            }\n        } else {\n            revert(errorMessage);\n        }\n    }\n}\n"
      }
    },
    "settings": {
      "remappings": [
        "@blueberry/=lib/blueberry-core/contracts/",
        "@blueberry-stakevest/=lib/blueberry-stakevest/src/",
        "@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
        "@openzeppelin/contracts-upgradeable/=lib/blueberry-core/node_modules/@openzeppelin/contracts-upgradeable/",
        "src/=src/BlueberryContracts/",
        "openzeppelin-contracts-upgradeable/contracts/=lib/blueberry-stakevest/lib/openzeppelin-contracts-upgradeable/contracts/",
        "solady/=lib/blueberry-stakevest/lib/solady/",
        "@chainlink/=lib/blueberry-core/node_modules/@chainlink/",
        "@aave/=lib/blueberry-core/node_modules/@aave/",
        "@contracts/=lib/blueberry-core/contracts/",
        "@eth-optimism/=lib/blueberry-core/node_modules/@eth-optimism/contracts/",
        "@test/=lib/blueberry-core/test/foundry/",
        "@uniswap/=lib/blueberry-core/node_modules/@uniswap/",
        "base64-sol/=lib/blueberry-core/node_modules/base64-sol/",
        "blueberry-core/=lib/blueberry-core/",
        "blueberry-stakevest/=lib/blueberry-stakevest/",
        "ds-test/=lib/forge-std/lib/ds-test/src/",
        "erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
        "eth-gas-reporter/=lib/blueberry-core/node_modules/eth-gas-reporter/",
        "forge-std/=lib/forge-std/src/",
        "hardhat-deploy/=lib/blueberry-core/node_modules/hardhat-deploy/",
        "hardhat/=lib/blueberry-core/node_modules/hardhat/",
        "openzeppelin-contracts/=lib/openzeppelin-contracts/",
        "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
        "openzeppelin/=lib/blueberry-stakevest/lib/openzeppelin-contracts-upgradeable/contracts/",
        "solidity-stringutils/=lib/openzeppelin-foundry-upgrades/lib/solidity-stringutils/",
        "v3-core/=lib/blueberry-stakevest/lib/v3-core/contracts/"
      ],
      "optimizer": {
        "enabled": true,
        "runs": 200
      },
      "metadata": {
        "useLiteralContent": false,
        "bytecodeHash": "ipfs",
        "appendCBOR": true
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "paris",
      "viaIR": false,
      "libraries": {}
    }
  }}