File size: 58,351 Bytes
f998fcd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
{
  "language": "Solidity",
  "sources": {
    "@mean-finance/transformers/solidity/contracts/transformers/wstETHTransformer.sol": {
      "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.7 <0.9.0;\n\nimport '@openzeppelin/contracts/interfaces/IERC20.sol';\nimport '@openzeppelin/contracts/utils/math/Math.sol';\nimport './BaseTransformer.sol';\n\n/// @title An implementaton of `ITransformer` for wstETH <=> stETH\ncontract wstETHTransformer is BaseTransformer {\n  using SafeERC20 for IwstETH;\n  using SafeERC20 for IstETH;\n\n  /// @notice The address of the stETH contract\n  IstETH public immutable stETH;\n\n  constructor(IstETH _stETH, address _governor) Governable(_governor) {\n    stETH = _stETH;\n  }\n\n  /// @inheritdoc ITransformer\n  function getUnderlying(address) external view returns (address[] memory) {\n    return _toSingletonArray(stETH);\n  }\n\n  /// @inheritdoc ITransformer\n  function calculateTransformToUnderlying(address, uint256 _amountDependent) external view returns (UnderlyingAmount[] memory) {\n    uint256 _amountUnderlying = stETH.getPooledEthByShares(_amountDependent);\n    return _toSingletonArray(stETH, _amountUnderlying);\n  }\n\n  /// @inheritdoc ITransformer\n  function calculateTransformToDependent(address, UnderlyingAmount[] calldata _underlying) external view returns (uint256 _amountDependent) {\n    if (_underlying.length != 1) revert InvalidUnderlyingInput();\n    _amountDependent = stETH.getSharesByPooledEth(_underlying[0].amount);\n  }\n\n  /// @inheritdoc ITransformer\n  function calculateNeededToTransformToUnderlying(address, UnderlyingAmount[] calldata _expectedUnderlying)\n    external\n    view\n    returns (uint256 _neededDependent)\n  {\n    if (_expectedUnderlying.length != 1) revert InvalidUnderlyingInput();\n    _neededDependent = _calculateNeededToTransformToUnderlying(_expectedUnderlying[0].amount);\n  }\n\n  /// @inheritdoc ITransformer\n  function calculateNeededToTransformToDependent(address, uint256 _expectedDependent)\n    external\n    view\n    returns (UnderlyingAmount[] memory _neededUnderlying)\n  {\n    uint256 _neededUnderlyingAmount = _calculateNeededToTransformToDependent(_expectedDependent);\n    return _toSingletonArray(stETH, _neededUnderlyingAmount);\n  }\n\n  /// @inheritdoc ITransformer\n  function transformToUnderlying(\n    address _dependent,\n    uint256 _amountDependent,\n    address _recipient,\n    UnderlyingAmount[] calldata _minAmountOut,\n    uint256 _deadline\n  ) external payable checkDeadline(_deadline) returns (UnderlyingAmount[] memory) {\n    if (_minAmountOut.length != 1) revert InvalidUnderlyingInput();\n    uint256 _amountUnderlying = _takewstETHFromSenderAndUnwrap(_dependent, _amountDependent, _recipient);\n    if (_minAmountOut[0].amount > _amountUnderlying) revert ReceivedLessThanExpected(_amountUnderlying);\n    return _toSingletonArray(stETH, _amountUnderlying);\n  }\n\n  /// @inheritdoc ITransformer\n  function transformToDependent(\n    address _dependent,\n    UnderlyingAmount[] calldata _underlying,\n    address _recipient,\n    uint256 _minAmountOut,\n    uint256 _deadline\n  ) external payable checkDeadline(_deadline) returns (uint256 _amountDependent) {\n    if (_underlying.length != 1) revert InvalidUnderlyingInput();\n    _amountDependent = _takestETHFromSenderAndWrap(_dependent, _underlying[0].amount, _recipient);\n    if (_minAmountOut > _amountDependent) revert ReceivedLessThanExpected(_amountDependent);\n  }\n\n  /// @inheritdoc ITransformer\n  function transformToExpectedUnderlying(\n    address _dependent,\n    UnderlyingAmount[] calldata _expectedUnderlying,\n    address _recipient,\n    uint256 _maxAmountIn,\n    uint256 _deadline\n  ) external payable checkDeadline(_deadline) returns (uint256 _spentDependent) {\n    if (_expectedUnderlying.length != 1) revert InvalidUnderlyingInput();\n    uint256 _expectedUnderlyingAmount = _expectedUnderlying[0].amount;\n    _spentDependent = _calculateNeededToTransformToUnderlying(_expectedUnderlyingAmount);\n    if (_spentDependent > _maxAmountIn) revert NeededMoreThanExpected(_spentDependent);\n    uint256 _receivedUnderlying = _takewstETHFromSenderAndUnwrap(_dependent, _spentDependent, _recipient);\n    if (_expectedUnderlyingAmount > _receivedUnderlying) revert ReceivedLessThanExpected(_receivedUnderlying);\n  }\n\n  /// @inheritdoc ITransformer\n  function transformToExpectedDependent(\n    address _dependent,\n    uint256 _expectedDependent,\n    address _recipient,\n    UnderlyingAmount[] calldata _maxAmountIn,\n    uint256 _deadline\n  ) external payable checkDeadline(_deadline) returns (UnderlyingAmount[] memory _spentUnderlying) {\n    if (_maxAmountIn.length != 1) revert InvalidUnderlyingInput();\n    uint256 _neededUnderlyingAmount = _calculateNeededToTransformToDependent(_expectedDependent);\n    if (_neededUnderlyingAmount > _maxAmountIn[0].amount) revert NeededMoreThanExpected(_neededUnderlyingAmount);\n    uint256 _receivedDependent = _takestETHFromSenderAndWrap(_dependent, _neededUnderlyingAmount, _recipient);\n    if (_expectedDependent > _receivedDependent) revert ReceivedLessThanExpected(_receivedDependent);\n    return _toSingletonArray(stETH, _neededUnderlyingAmount);\n  }\n\n  function _calculateNeededToTransformToUnderlying(uint256 _expectedUnderlying) internal view returns (uint256 _neededDependent) {\n    // Since stETH contracts rounds down, we do the math here and round up\n    uint256 _totalSuppy = stETH.totalSupply();\n    uint256 _totalShares = stETH.getTotalShares();\n    _neededDependent = Math.mulDiv(_expectedUnderlying, _totalShares, _totalSuppy, Math.Rounding.Up);\n  }\n\n  function _calculateNeededToTransformToDependent(uint256 _expectedDependent) internal view returns (uint256 _neededUnderlying) {\n    // Since stETH contracts rounds down, we do the math here and round up\n    uint256 _totalShares = stETH.getTotalShares();\n    uint256 _totalSuppy = stETH.totalSupply();\n    _neededUnderlying = Math.mulDiv(_expectedDependent, _totalSuppy, _totalShares, Math.Rounding.Up);\n  }\n\n  function _takewstETHFromSenderAndUnwrap(\n    address _dependent,\n    uint256 _amount,\n    address _recipient\n  ) internal returns (uint256 _underlyingAmount) {\n    IwstETH(_dependent).safeTransferFrom(msg.sender, address(this), _amount);\n    _underlyingAmount = IwstETH(_dependent).unwrap(_amount);\n    stETH.safeTransfer(_recipient, _underlyingAmount);\n  }\n\n  function _takestETHFromSenderAndWrap(\n    address _dependent,\n    uint256 _amount,\n    address _recipient\n  ) internal returns (uint256 _dependentAmount) {\n    stETH.safeTransferFrom(msg.sender, address(this), _amount);\n    stETH.approve(_dependent, _amount);\n    _dependentAmount = IwstETH(_dependent).wrap(_amount);\n    IwstETH(_dependent).safeTransfer(_recipient, _dependentAmount);\n  }\n\n  function _toSingletonArray(IstETH _underlying) internal pure returns (address[] memory _underlyingArray) {\n    _underlyingArray = new address[](1);\n    _underlyingArray[0] = address(_underlying);\n  }\n\n  function _toSingletonArray(IstETH _underlying, uint256 _amount) internal pure returns (UnderlyingAmount[] memory _amounts) {\n    _amounts = new UnderlyingAmount[](1);\n    _amounts[0] = UnderlyingAmount({underlying: address(_underlying), amount: _amount});\n  }\n}\n\ninterface IstETH is IERC20 {\n  /**\n   * @return The total amount of stETH\n   */\n  function totalSupply() external view returns (uint256);\n\n  /**\n   * @return The total amount of internal shares on stETH\n   * @dev This has nothing to do with wstETH supply\n   */\n  function getTotalShares() external view returns (uint256);\n\n  /**\n   * @return The amount of Ether that corresponds to `sharesAmount` token shares.\n   */\n  function getPooledEthByShares(uint256 sharesAmount) external view returns (uint256);\n\n  /**\n   * @return The amount of shares that corresponds to `stEthAmount` protocol-controlled Ether.\n   */\n  function getSharesByPooledEth(uint256 ethAmount) external view returns (uint256);\n}\n\ninterface IwstETH is IERC20 {\n  /**\n   * @notice Exchanges stETH to wstETH\n   * @param _stETHAmount amount of stETH to wrap in exchange for wstETH\n   * @dev Requirements:\n   *  - `_stETHAmount` must be non-zero\n   *  - msg.sender must approve at least `_stETHAmount` stETH to this\n   *    contract.\n   *  - msg.sender must have at least `_stETHAmount` of stETH.\n   * User should first approve _stETHAmount to the WstETH contract\n   * @return Amount of wstETH user receives after wrap\n   */\n  function wrap(uint256 _stETHAmount) external returns (uint256);\n\n  /**\n   * @notice Exchanges wstETH to stETH\n   * @param _wstETHAmount amount of wstETH to uwrap in exchange for stETH\n   * @dev Requirements:\n   *  - `_wstETHAmount` must be non-zero\n   *  - msg.sender must have at least `_wstETHAmount` wstETH.\n   * @return Amount of stETH user receives after unwrap\n   */\n  function unwrap(uint256 _wstETHAmount) external returns (uint256);\n}\n"
    },
    "@openzeppelin/contracts/interfaces/IERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\n"
    },
    "@openzeppelin/contracts/utils/math/Math.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n    enum Rounding {\n        Down, // Toward negative infinity\n        Up, // Toward infinity\n        Zero // Toward zero\n    }\n\n    /**\n     * @dev Returns the largest of two numbers.\n     */\n    function max(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a >= b ? a : b;\n    }\n\n    /**\n     * @dev Returns the smallest of two numbers.\n     */\n    function min(uint256 a, uint256 b) internal pure returns (uint256) {\n        return a < b ? a : b;\n    }\n\n    /**\n     * @dev Returns the average of two numbers. The result is rounded towards\n     * zero.\n     */\n    function average(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b) / 2 can overflow.\n        return (a & b) + (a ^ b) / 2;\n    }\n\n    /**\n     * @dev Returns the ceiling of the division of two numbers.\n     *\n     * This differs from standard division with `/` in that it rounds up instead\n     * of rounding down.\n     */\n    function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n        // (a + b - 1) / b can overflow on addition, so we distribute.\n        return a == 0 ? 0 : (a - 1) / b + 1;\n    }\n\n    /**\n     * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n     * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n     * with further edits by Uniswap Labs also under MIT license.\n     */\n    function mulDiv(\n        uint256 x,\n        uint256 y,\n        uint256 denominator\n    ) internal pure returns (uint256 result) {\n        unchecked {\n            // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n            // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n            // variables such that product = prod1 * 2^256 + prod0.\n            uint256 prod0; // Least significant 256 bits of the product\n            uint256 prod1; // Most significant 256 bits of the product\n            assembly {\n                let mm := mulmod(x, y, not(0))\n                prod0 := mul(x, y)\n                prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n            }\n\n            // Handle non-overflow cases, 256 by 256 division.\n            if (prod1 == 0) {\n                return prod0 / denominator;\n            }\n\n            // Make sure the result is less than 2^256. Also prevents denominator == 0.\n            require(denominator > prod1);\n\n            ///////////////////////////////////////////////\n            // 512 by 256 division.\n            ///////////////////////////////////////////////\n\n            // Make division exact by subtracting the remainder from [prod1 prod0].\n            uint256 remainder;\n            assembly {\n                // Compute remainder using mulmod.\n                remainder := mulmod(x, y, denominator)\n\n                // Subtract 256 bit number from 512 bit number.\n                prod1 := sub(prod1, gt(remainder, prod0))\n                prod0 := sub(prod0, remainder)\n            }\n\n            // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n            // See https://cs.stackexchange.com/q/138556/92363.\n\n            // Does not overflow because the denominator cannot be zero at this stage in the function.\n            uint256 twos = denominator & (~denominator + 1);\n            assembly {\n                // Divide denominator by twos.\n                denominator := div(denominator, twos)\n\n                // Divide [prod1 prod0] by twos.\n                prod0 := div(prod0, twos)\n\n                // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n                twos := add(div(sub(0, twos), twos), 1)\n            }\n\n            // Shift in bits from prod1 into prod0.\n            prod0 |= prod1 * twos;\n\n            // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n            // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n            // four bits. That is, denominator * inv = 1 mod 2^4.\n            uint256 inverse = (3 * denominator) ^ 2;\n\n            // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n            // in modular arithmetic, doubling the correct bits in each step.\n            inverse *= 2 - denominator * inverse; // inverse mod 2^8\n            inverse *= 2 - denominator * inverse; // inverse mod 2^16\n            inverse *= 2 - denominator * inverse; // inverse mod 2^32\n            inverse *= 2 - denominator * inverse; // inverse mod 2^64\n            inverse *= 2 - denominator * inverse; // inverse mod 2^128\n            inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n            // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n            // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n            // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n            // is no longer required.\n            result = prod0 * inverse;\n            return result;\n        }\n    }\n\n    /**\n     * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n     */\n    function mulDiv(\n        uint256 x,\n        uint256 y,\n        uint256 denominator,\n        Rounding rounding\n    ) internal pure returns (uint256) {\n        uint256 result = mulDiv(x, y, denominator);\n        if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n            result += 1;\n        }\n        return result;\n    }\n\n    /**\n     * @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down.\n     *\n     * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n     */\n    function sqrt(uint256 a) internal pure returns (uint256) {\n        if (a == 0) {\n            return 0;\n        }\n\n        // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n        // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n        // `msb(a) <= a < 2*msb(a)`.\n        // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.\n        // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.\n        // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a\n        // good first aproximation of `sqrt(a)` with at least 1 correct bit.\n        uint256 result = 1;\n        uint256 x = a;\n        if (x >> 128 > 0) {\n            x >>= 128;\n            result <<= 64;\n        }\n        if (x >> 64 > 0) {\n            x >>= 64;\n            result <<= 32;\n        }\n        if (x >> 32 > 0) {\n            x >>= 32;\n            result <<= 16;\n        }\n        if (x >> 16 > 0) {\n            x >>= 16;\n            result <<= 8;\n        }\n        if (x >> 8 > 0) {\n            x >>= 8;\n            result <<= 4;\n        }\n        if (x >> 4 > 0) {\n            x >>= 4;\n            result <<= 2;\n        }\n        if (x >> 2 > 0) {\n            result <<= 1;\n        }\n\n        // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n        // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n        // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n        // into the expected uint128 result.\n        unchecked {\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            result = (result + a / result) >> 1;\n            return min(result, a / result);\n        }\n    }\n\n    /**\n     * @notice Calculates sqrt(a), following the selected rounding direction.\n     */\n    function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n        uint256 result = sqrt(a);\n        if (rounding == Rounding.Up && result * result < a) {\n            result += 1;\n        }\n        return result;\n    }\n}\n"
    },
    "@mean-finance/transformers/solidity/contracts/transformers/BaseTransformer.sol": {
      "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/introspection/ERC165.sol';\nimport '../../interfaces/ITransformer.sol';\nimport '../utils/CollectableDust.sol';\nimport '../utils/Multicall.sol';\n\n/// @title A base implementation of `ITransformer` that implements `CollectableDust` and `Multicall`\nabstract contract BaseTransformer is CollectableDust, Multicall, ERC165, ITransformer {\n  /// @inheritdoc IERC165\n  function supportsInterface(bytes4 _interfaceId) public view virtual override returns (bool) {\n    return\n      _interfaceId == type(ITransformer).interfaceId ||\n      _interfaceId == type(IGovernable).interfaceId ||\n      _interfaceId == type(ICollectableDust).interfaceId ||\n      _interfaceId == type(IMulticall).interfaceId ||\n      super.supportsInterface(_interfaceId);\n  }\n\n  modifier checkDeadline(uint256 _deadline) {\n    if (block.timestamp > _deadline) revert TransactionExpired();\n    _;\n  }\n}\n"
    },
    "@openzeppelin/contracts/token/ERC20/IERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\n    /**\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\n     * another (`to`).\n     *\n     * Note that `value` may be zero.\n     */\n    event Transfer(address indexed from, address indexed to, uint256 value);\n\n    /**\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\n     * a call to {approve}. `value` is the new allowance.\n     */\n    event Approval(address indexed owner, address indexed spender, uint256 value);\n\n    /**\n     * @dev Returns the amount of tokens in existence.\n     */\n    function totalSupply() external view returns (uint256);\n\n    /**\n     * @dev Returns the amount of tokens owned by `account`.\n     */\n    function balanceOf(address account) external view returns (uint256);\n\n    /**\n     * @dev Moves `amount` tokens from the caller's account to `to`.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transfer(address to, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Returns the remaining number of tokens that `spender` will be\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\n     * zero by default.\n     *\n     * This value changes when {approve} or {transferFrom} are called.\n     */\n    function allowance(address owner, address spender) external view returns (uint256);\n\n    /**\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\n     * that someone may use both the old and the new allowance by unfortunate\n     * transaction ordering. One possible solution to mitigate this race\n     * condition is to first reduce the spender's allowance to 0 and set the\n     * desired value afterwards:\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\n     *\n     * Emits an {Approval} event.\n     */\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    /**\n     * @dev Moves `amount` tokens from `from` to `to` using the\n     * allowance mechanism. `amount` is then deducted from the caller's\n     * allowance.\n     *\n     * Returns a boolean value indicating whether the operation succeeded.\n     *\n     * Emits a {Transfer} event.\n     */\n    function transferFrom(\n        address from,\n        address to,\n        uint256 amount\n    ) external returns (bool);\n}\n"
    },
    "@openzeppelin/contracts/utils/introspection/ERC165.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165 is IERC165 {\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IERC165).interfaceId;\n    }\n}\n"
    },
    "@mean-finance/transformers/solidity/contracts/utils/Multicall.sol": {
      "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport '@openzeppelin/contracts/utils/Address.sol';\nimport '../../interfaces/utils/IMulticall.sol';\n\n/**\n * @dev Adding this contract will enable batching calls. This is basically the same as Open Zeppelin's\n *      Multicall contract, but we have made it payable. Any contract that uses this Multicall version\n *      should be very careful when using msg.value.\n *      For more context, read: https://github.com/Uniswap/v3-periphery/issues/52\n */\nabstract contract Multicall is IMulticall {\n  /// @inheritdoc IMulticall\n  function multicall(bytes[] calldata data) external payable returns (bytes[] memory results) {\n    results = new bytes[](data.length);\n    for (uint256 i; i < data.length; i++) {\n      results[i] = Address.functionDelegateCall(address(this), data[i]);\n    }\n    return results;\n  }\n}\n"
    },
    "@mean-finance/transformers/solidity/interfaces/ITransformer.sol": {
      "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.5.0;\n\n/**\n * @title A contract that can map between one token and their underlying counterparts, and vice-versa\n * @notice This contract defines the concept of dependent tokens. These are tokens that depend on one or more underlying tokens,\n *         they can't exist on their own. This concept can apply to some known types of tokens, such as:\n *           - Wrappers (WETH/WMATIC/WBNB)\n *           - ERC-4626 tokens\n *           - LP tokens\n *         Now, transformers are smart contract that knows how to map dependent tokens into their underlying counterparts,\n *         and vice-versa. We are doing this so that we can abstract the way tokens can be transformed between each other\n * @dev All non-view functions were made payable, so that they could be multicalled when msg.value > 0\n */\ninterface ITransformer {\n  /// @notice An amount of an underlying token\n  struct UnderlyingAmount {\n    address underlying;\n    uint256 amount;\n  }\n\n  /// @notice Thrown when the underlying input is not valid for the used transformer\n  error InvalidUnderlyingInput();\n\n  /// @notice Thrown when the transformation provides less output than expected\n  error ReceivedLessThanExpected(uint256 received);\n\n  /// @notice Thrown when the transformation needs more input than expected\n  error NeededMoreThanExpected(uint256 needed);\n\n  /// @notice Thrown when a transaction is executed after the deadline has passed\n  error TransactionExpired();\n\n  /**\n   * @notice Returns the addresses of all the underlying tokens, for the given dependent\n   * @dev This function must be unaware of context. The returned values must be the same,\n   *      regardless of who the caller is\n   * @param dependent The address of the dependent token\n   * @return The addresses of all the underlying tokens\n   */\n  function getUnderlying(address dependent) external view returns (address[] memory);\n\n  /**\n   * @notice Calculates how much would the transformation to the underlying tokens return\n   * @dev This function must be unaware of context. The returned values must be the same,\n   *      regardless of who the caller is\n   * @param dependent The address of the dependent token\n   * @param amountDependent The amount to transform\n   * @return The transformed amount in each of the underlying tokens\n   */\n  function calculateTransformToUnderlying(address dependent, uint256 amountDependent) external view returns (UnderlyingAmount[] memory);\n\n  /**\n   * @notice Calculates how much would the transformation to the dependent token return\n   * @dev This function must be unaware of context. The returned values must be the same,\n   *      regardless of who the caller is\n   * @param dependent The address of the dependent token\n   * @param underlying The amounts of underlying tokens to transform\n   * @return amountDependent The transformed amount in the dependent token\n   */\n  function calculateTransformToDependent(address dependent, UnderlyingAmount[] calldata underlying)\n    external\n    view\n    returns (uint256 amountDependent);\n\n  /**\n   * @notice Calculates how many dependent tokens are needed to transform to the expected\n   *         amount of underlying\n   * @dev This function must be unaware of context. The returned values must be the same,\n   *      regardless of who the caller is\n   * @param dependent The address of the dependent token\n   * @param expectedUnderlying The expected amounts of underlying tokens\n   * @return neededDependent The amount of dependent needed\n   */\n  function calculateNeededToTransformToUnderlying(address dependent, UnderlyingAmount[] calldata expectedUnderlying)\n    external\n    view\n    returns (uint256 neededDependent);\n\n  /**\n   * @notice Calculates how many underlying tokens are needed to transform to the expected\n   *         amount of dependent\n   * @dev This function must be unaware of context. The returned values must be the same,\n   *      regardless of who the caller is\n   * @param dependent The address of the dependent token\n   * @param expectedDependent The expected amount of dependent tokens\n   * @return neededUnderlying The amount of underlying tokens needed\n   */\n  function calculateNeededToTransformToDependent(address dependent, uint256 expectedDependent)\n    external\n    view\n    returns (UnderlyingAmount[] memory neededUnderlying);\n\n  /**\n   * @notice Executes the transformation to the underlying tokens\n   * @param dependent The address of the dependent token\n   * @param amountDependent The amount to transform\n   * @param recipient The address that would receive the underlying tokens\n   * @param minAmountOut The minimum amount of underlying that the caller expects to get. Will fail\n   *                     if less is received. As a general rule, the underlying tokens should\n   *                     be provided in the same order as `getUnderlying` returns them\n   * @param deadline A deadline when the transaction becomes invalid\n   * @return The transformed amount in each of the underlying tokens\n   */\n  function transformToUnderlying(\n    address dependent,\n    uint256 amountDependent,\n    address recipient,\n    UnderlyingAmount[] calldata minAmountOut,\n    uint256 deadline\n  ) external payable returns (UnderlyingAmount[] memory);\n\n  /**\n   * @notice Executes the transformation to the dependent token\n   * @param dependent The address of the dependent token\n   * @param underlying The amounts of underlying tokens to transform\n   * @param recipient The address that would receive the dependent tokens\n   * @param minAmountOut The minimum amount of dependent that the caller expects to get. Will fail\n   *                     if less is received\n   * @param deadline A deadline when the transaction becomes invalid\n   * @return amountDependent The transformed amount in the dependent token\n   */\n  function transformToDependent(\n    address dependent,\n    UnderlyingAmount[] calldata underlying,\n    address recipient,\n    uint256 minAmountOut,\n    uint256 deadline\n  ) external payable returns (uint256 amountDependent);\n\n  /**\n   * @notice Transforms dependent tokens to an expected amount of underlying tokens\n   * @param dependent The address of the dependent token\n   * @param expectedUnderlying The expected amounts of underlying tokens\n   * @param recipient The address that would receive the underlying tokens\n   * @param maxAmountIn The maximum amount of dependent that the caller is willing to spend.\n   *                    Will fail more is needed\n   * @param deadline A deadline when the transaction becomes invalid\n   * @return spentDependent The amount of spent dependent tokens\n   */\n  function transformToExpectedUnderlying(\n    address dependent,\n    UnderlyingAmount[] calldata expectedUnderlying,\n    address recipient,\n    uint256 maxAmountIn,\n    uint256 deadline\n  ) external payable returns (uint256 spentDependent);\n\n  /**\n   * @notice Transforms underlying tokens to an expected amount of dependent tokens\n   * @param dependent The address of the dependent token\n   * @param expectedDependent The expected amounts of dependent tokens\n   * @param recipient The address that would receive the underlying tokens\n   * @param maxAmountIn The maximum amount of underlying that the caller is willing to spend.\n   *                    Will fail more is needed. As a general rule, the underlying tokens should\n   *                    be provided in the same order as `getUnderlying` returns them\n   * @param deadline A deadline when the transaction becomes invalid\n   * @return spentUnderlying The amount of spent underlying tokens\n   */\n  function transformToExpectedDependent(\n    address dependent,\n    uint256 expectedDependent,\n    address recipient,\n    UnderlyingAmount[] calldata maxAmountIn,\n    uint256 deadline\n  ) external payable returns (UnderlyingAmount[] memory spentUnderlying);\n}\n"
    },
    "@mean-finance/transformers/solidity/contracts/utils/CollectableDust.sol": {
      "content": "// SPDX-License-Identifier: GPL-2.0-or-later\n\npragma solidity >=0.8.7 <0.9.0;\n\nimport '@openzeppelin/contracts/interfaces/IERC20.sol';\nimport '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';\nimport '@openzeppelin/contracts/utils/Address.sol';\nimport '../../interfaces/utils/ICollectableDust.sol';\nimport './Governable.sol';\n\nabstract contract CollectableDust is Governable, ICollectableDust {\n  using SafeERC20 for IERC20;\n  using Address for address payable;\n\n  /// @inheritdoc ICollectableDust\n  address public constant PROTOCOL_TOKEN = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;\n\n  /// @inheritdoc ICollectableDust\n  function getBalances(address[] calldata _tokens) external view returns (TokenBalance[] memory _balances) {\n    _balances = new TokenBalance[](_tokens.length);\n    for (uint256 i; i < _tokens.length; i++) {\n      uint256 _balance = _tokens[i] == PROTOCOL_TOKEN ? address(this).balance : IERC20(_tokens[i]).balanceOf(address(this));\n      _balances[i] = TokenBalance({token: _tokens[i], balance: _balance});\n    }\n  }\n\n  /// @inheritdoc ICollectableDust\n  function sendDust(\n    address _token,\n    uint256 _amount,\n    address _recipient\n  ) external onlyGovernor {\n    if (_recipient == address(0)) revert DustRecipientIsZeroAddress();\n    if (_token == PROTOCOL_TOKEN) {\n      payable(_recipient).sendValue(_amount);\n    } else {\n      IERC20(_token).safeTransfer(_recipient, _amount);\n    }\n    emit DustSent(_token, _amount, _recipient);\n  }\n}\n"
    },
    "@openzeppelin/contracts/utils/introspection/IERC165.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165 {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"
    },
    "@openzeppelin/contracts/utils/Address.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary Address {\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     *\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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, \"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(\n        address target,\n        bytes memory data,\n        uint256 value\n    ) 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        require(isContract(target), \"Address: call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResult(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        require(isContract(target), \"Address: static call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResult(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        require(isContract(target), \"Address: delegate call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.delegatecall(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason 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            // 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}\n"
    },
    "@mean-finance/transformers/solidity/interfaces/utils/IMulticall.sol": {
      "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.7 <0.9.0;\n\n/**\n * @title A contract that supports batching calls\n * @notice Contracts with this interface provide a function to batch together multiple calls\n *         in a single external call.\n */\ninterface IMulticall {\n  /**\n   * @notice Receives and executes a batch of function calls on this contract.\n   * @param data A list of different function calls to execute\n   * @return results The result of executing each of those calls\n   */\n  function multicall(bytes[] calldata data) external payable returns (bytes[] memory results);\n}\n"
    },
    "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\n * @dev Wrappers around ERC20 operations that throw on failure (when the token\n * contract returns false). Tokens that return no value (and instead revert or\n * throw on failure) are also supported, non-reverting calls are assumed to be\n * successful.\n * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n    using Address for address;\n\n    function safeTransfer(\n        IERC20 token,\n        address to,\n        uint256 value\n    ) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n    }\n\n    function safeTransferFrom(\n        IERC20 token,\n        address from,\n        address to,\n        uint256 value\n    ) internal {\n        _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n    }\n\n    /**\n     * @dev Deprecated. This function has issues similar to the ones found in\n     * {IERC20-approve}, and its usage is discouraged.\n     *\n     * Whenever possible, use {safeIncreaseAllowance} and\n     * {safeDecreaseAllowance} instead.\n     */\n    function safeApprove(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        // safeApprove should only be called when setting an initial allowance,\n        // or when resetting it to zero. To increase and decrease it, use\n        // 'safeIncreaseAllowance' and 'safeDecreaseAllowance'\n        require(\n            (value == 0) || (token.allowance(address(this), spender) == 0),\n            \"SafeERC20: approve from non-zero to non-zero allowance\"\n        );\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n    }\n\n    function safeIncreaseAllowance(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        uint256 newAllowance = token.allowance(address(this), spender) + value;\n        _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n    }\n\n    function safeDecreaseAllowance(\n        IERC20 token,\n        address spender,\n        uint256 value\n    ) internal {\n        unchecked {\n            uint256 oldAllowance = token.allowance(address(this), spender);\n            require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n            uint256 newAllowance = oldAllowance - value;\n            _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n        }\n    }\n\n    function safePermit(\n        IERC20Permit token,\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) internal {\n        uint256 nonceBefore = token.nonces(owner);\n        token.permit(owner, spender, value, deadline, v, r, s);\n        uint256 nonceAfter = token.nonces(owner);\n        require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\n    }\n\n    /**\n     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement\n     * on the return value: the return value is optional (but if data is returned, it must not be false).\n     * @param token The token targeted by the call.\n     * @param data The call data (encoded using abi.encode or one of its variants).\n     */\n    function _callOptionalReturn(IERC20 token, bytes memory data) private {\n        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since\n        // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that\n        // the target address contains contract code and also asserts for success in the low-level call.\n\n        bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n        if (returndata.length > 0) {\n            // Return data is optional\n            require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n        }\n    }\n}\n"
    },
    "@mean-finance/transformers/solidity/interfaces/utils/ICollectableDust.sol": {
      "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.7 <0.9.0;\n\nimport './IGovernable.sol';\n\n/**\n * @title A contract that allows the current governor to withdraw funds\n * @notice This is meant to be used to recover any tokens that were sent to the contract\n *         by mistake\n */\ninterface ICollectableDust {\n  /// @notice The balance of a given token\n  struct TokenBalance {\n    address token;\n    uint256 balance;\n  }\n\n  /// @notice Thrown when trying to send dust to the zero address\n  error DustRecipientIsZeroAddress();\n\n  /**\n   * @notice Emitted when dust is sent\n   * @param token The token that was sent\n   * @param amount The amount that was sent\n   * @param recipient The address that received the tokens\n   */\n  event DustSent(address token, uint256 amount, address recipient);\n\n  /**\n   * @notice Returns the address of the protocol token\n   * @dev Cannot be modified\n   * @return The address of the protocol token;\n   */\n  function PROTOCOL_TOKEN() external view returns (address);\n\n  /**\n   * @notice Returns the balance of each of the given tokens\n   * @dev Meant to be used for off-chain queries\n   * @param tokens The tokens to check the balance for, can be ERC20s or the protocol token\n   * @return The balances for the given tokens\n   */\n  function getBalances(address[] calldata tokens) external view returns (TokenBalance[] memory);\n\n  /**\n   * @notice Sends the given token to the recipient\n   * @dev Can only be called by the governor\n   * @param token The token to send to the recipient (can be an ERC20 or the protocol token)\n   * @param amount The amount to transfer to the recipient\n   * @param recipient The address of the recipient\n   */\n  function sendDust(\n    address token,\n    uint256 amount,\n    address recipient\n  ) external;\n}\n"
    },
    "@mean-finance/transformers/solidity/contracts/utils/Governable.sol": {
      "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.7 <0.9.0;\n\nimport '../../interfaces/utils/IGovernable.sol';\n\n/**\n * @notice This contract is meant to be used in other contracts. By using this contract,\n *         a specific address will be given a \"governor\" role, which basically will be able to\n *         control certains aspects of the contract. There are other contracts that do the same,\n *         but this contract forces a new governor to accept the role before it's transferred.\n *         This is a basically a safety measure to prevent losing access to the contract.\n */\nabstract contract Governable is IGovernable {\n  /// @inheritdoc IGovernable\n  address public governor;\n\n  /// @inheritdoc IGovernable\n  address public pendingGovernor;\n\n  constructor(address _governor) {\n    if (_governor == address(0)) revert GovernorIsZeroAddress();\n    governor = _governor;\n  }\n\n  /// @inheritdoc IGovernable\n  function isGovernor(address _account) public view returns (bool) {\n    return _account == governor;\n  }\n\n  /// @inheritdoc IGovernable\n  function isPendingGovernor(address _account) public view returns (bool) {\n    return _account == pendingGovernor;\n  }\n\n  /// @inheritdoc IGovernable\n  function setPendingGovernor(address _pendingGovernor) external onlyGovernor {\n    pendingGovernor = _pendingGovernor;\n    emit PendingGovernorSet(_pendingGovernor);\n  }\n\n  /// @inheritdoc IGovernable\n  function acceptPendingGovernor() external onlyPendingGovernor {\n    governor = pendingGovernor;\n    pendingGovernor = address(0);\n    emit PendingGovernorAccepted();\n  }\n\n  modifier onlyGovernor() {\n    if (!isGovernor(msg.sender)) revert OnlyGovernor();\n    _;\n  }\n\n  modifier onlyPendingGovernor() {\n    if (!isPendingGovernor(msg.sender)) revert OnlyPendingGovernor();\n    _;\n  }\n}\n"
    },
    "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": {
      "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n    /**\n     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n     * given ``owner``'s signed approval.\n     *\n     * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n     * ordering also apply here.\n     *\n     * Emits an {Approval} event.\n     *\n     * Requirements:\n     *\n     * - `spender` cannot be the zero address.\n     * - `deadline` must be a timestamp in the future.\n     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n     * over the EIP712-formatted function arguments.\n     * - the signature must use ``owner``'s current nonce (see {nonces}).\n     *\n     * For more information on the signature format, see the\n     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n     * section].\n     */\n    function permit(\n        address owner,\n        address spender,\n        uint256 value,\n        uint256 deadline,\n        uint8 v,\n        bytes32 r,\n        bytes32 s\n    ) external;\n\n    /**\n     * @dev Returns the current nonce for `owner`. This value must be\n     * included whenever a signature is generated for {permit}.\n     *\n     * Every successful call to {permit} increases ``owner``'s nonce by one. This\n     * prevents a signature from being used multiple times.\n     */\n    function nonces(address owner) external view returns (uint256);\n\n    /**\n     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n     */\n    // solhint-disable-next-line func-name-mixedcase\n    function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n"
    },
    "@mean-finance/transformers/solidity/interfaces/utils/IGovernable.sol": {
      "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity >=0.8.7 <0.9.0;\n\n/**\n * @title A contract that manages a \"governor\" role\n */\ninterface IGovernable {\n  /// @notice Thrown when trying to set the zero address as governor\n  error GovernorIsZeroAddress();\n\n  /// @notice Thrown when trying to execute an action that only the governor an execute\n  error OnlyGovernor();\n\n  /// @notice Thrown when trying to execute an action that only the pending governor an execute\n  error OnlyPendingGovernor();\n\n  /**\n   * @notice Emitted when a new pending governor is set\n   * @param newPendingGovernor The new pending governor\n   */\n  event PendingGovernorSet(address newPendingGovernor);\n\n  /**\n   * @notice Emitted when the pending governor accepts the role and becomes the governor\n   */\n  event PendingGovernorAccepted();\n\n  /**\n   * @notice Returns the address of the governor\n   * @return The address of the governor\n   */\n  function governor() external view returns (address);\n\n  /**\n   * @notice Returns the address of the pending governor\n   * @return The address of the pending governor\n   */\n  function pendingGovernor() external view returns (address);\n\n  /**\n   * @notice Returns whether the given account is the current governor\n   * @param account The account to check\n   * @return Whether it is the current governor or not\n   */\n  function isGovernor(address account) external view returns (bool);\n\n  /**\n   * @notice Returns whether the given account is the pending governor\n   * @param account The account to check\n   * @return Whether it is the pending governor or not\n   */\n  function isPendingGovernor(address account) external view returns (bool);\n\n  /**\n   * @notice Sets a new pending governor\n   * @dev Only the current governor can execute this action\n   * @param pendingGovernor The new pending governor\n   */\n  function setPendingGovernor(address pendingGovernor) external;\n\n  /**\n   * @notice Sets the pending governor as the governor\n   * @dev Only the pending governor can execute this action\n   */\n  function acceptPendingGovernor() external;\n}\n"
    }
  },
  "settings": {
    "optimizer": {
      "enabled": true,
      "runs": 9999
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "libraries": {}
  }
}