File size: 27,498 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
{
  "language": "Solidity",
  "sources": {
    "lib/openzeppelin-contracts/contracts/access/Ownable.sol": {
      "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../utils/Context.sol\";\r\n\r\n/**\r\n * @dev Contract module which provides a basic access control mechanism, where\r\n * there is an account (an owner) that can be granted exclusive access to\r\n * specific functions.\r\n *\r\n * By default, the owner account will be the one that deploys the contract. This\r\n * can later be changed with {transferOwnership}.\r\n *\r\n * This module is used through inheritance. It will make available the modifier\r\n * `onlyOwner`, which can be applied to your functions to restrict their use to\r\n * the owner.\r\n */\r\nabstract contract Ownable is Context {\r\n    address private _owner;\r\n\r\n    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\r\n\r\n    /**\r\n     * @dev Initializes the contract setting the deployer as the initial owner.\r\n     */\r\n    constructor() {\r\n        _transferOwnership(_msgSender());\r\n    }\r\n\r\n    /**\r\n     * @dev Throws if called by any account other than the owner.\r\n     */\r\n    modifier onlyOwner() {\r\n        _checkOwner();\r\n        _;\r\n    }\r\n\r\n    /**\r\n     * @dev Returns the address of the current owner.\r\n     */\r\n    function owner() public view virtual returns (address) {\r\n        return _owner;\r\n    }\r\n\r\n    /**\r\n     * @dev Throws if the sender is not the owner.\r\n     */\r\n    function _checkOwner() internal view virtual {\r\n        require(owner() == _msgSender(), \"Ownable: caller is not the owner\");\r\n    }\r\n\r\n    /**\r\n     * @dev Leaves the contract without owner. It will not be possible to call\r\n     * `onlyOwner` functions. Can only be called by the current owner.\r\n     *\r\n     * NOTE: Renouncing ownership will leave the contract without an owner,\r\n     * thereby disabling any functionality that is only available to the owner.\r\n     */\r\n    function renounceOwnership() public virtual onlyOwner {\r\n        _transferOwnership(address(0));\r\n    }\r\n\r\n    /**\r\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n     * Can only be called by the current owner.\r\n     */\r\n    function transferOwnership(address newOwner) public virtual onlyOwner {\r\n        require(newOwner != address(0), \"Ownable: new owner is the zero address\");\r\n        _transferOwnership(newOwner);\r\n    }\r\n\r\n    /**\r\n     * @dev Transfers ownership of the contract to a new account (`newOwner`).\r\n     * Internal function without access restriction.\r\n     */\r\n    function _transferOwnership(address newOwner) internal virtual {\r\n        address oldOwner = _owner;\r\n        _owner = newOwner;\r\n        emit OwnershipTransferred(oldOwner, newOwner);\r\n    }\r\n}\r\n"
    },
    "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Interface of the ERC20 standard as defined in the EIP.\r\n */\r\ninterface IERC20 {\r\n    /**\r\n     * @dev Emitted when `value` tokens are moved from one account (`from`) to\r\n     * another (`to`).\r\n     *\r\n     * Note that `value` may be zero.\r\n     */\r\n    event Transfer(address indexed from, address indexed to, uint256 value);\r\n\r\n    /**\r\n     * @dev Emitted when the allowance of a `spender` for an `owner` is set by\r\n     * a call to {approve}. `value` is the new allowance.\r\n     */\r\n    event Approval(address indexed owner, address indexed spender, uint256 value);\r\n\r\n    /**\r\n     * @dev Returns the amount of tokens in existence.\r\n     */\r\n    function totalSupply() external view returns (uint256);\r\n\r\n    /**\r\n     * @dev Returns the amount of tokens owned by `account`.\r\n     */\r\n    function balanceOf(address account) external view returns (uint256);\r\n\r\n    /**\r\n     * @dev Moves `amount` tokens from the caller's account to `to`.\r\n     *\r\n     * Returns a boolean value indicating whether the operation succeeded.\r\n     *\r\n     * Emits a {Transfer} event.\r\n     */\r\n    function transfer(address to, uint256 amount) external returns (bool);\r\n\r\n    /**\r\n     * @dev Returns the remaining number of tokens that `spender` will be\r\n     * allowed to spend on behalf of `owner` through {transferFrom}. This is\r\n     * zero by default.\r\n     *\r\n     * This value changes when {approve} or {transferFrom} are called.\r\n     */\r\n    function allowance(address owner, address spender) external view returns (uint256);\r\n\r\n    /**\r\n     * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\r\n     *\r\n     * Returns a boolean value indicating whether the operation succeeded.\r\n     *\r\n     * IMPORTANT: Beware that changing an allowance with this method brings the risk\r\n     * that someone may use both the old and the new allowance by unfortunate\r\n     * transaction ordering. One possible solution to mitigate this race\r\n     * condition is to first reduce the spender's allowance to 0 and set the\r\n     * desired value afterwards:\r\n     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\r\n     *\r\n     * Emits an {Approval} event.\r\n     */\r\n    function approve(address spender, uint256 amount) external returns (bool);\r\n\r\n    /**\r\n     * @dev Moves `amount` tokens from `from` to `to` using the\r\n     * allowance mechanism. `amount` is then deducted from the caller's\r\n     * allowance.\r\n     *\r\n     * Returns a boolean value indicating whether the operation succeeded.\r\n     *\r\n     * Emits a {Transfer} event.\r\n     */\r\n    function transferFrom(address from, address to, uint256 amount) external returns (bool);\r\n}\r\n"
    },
    "lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
      "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\nimport \"../IERC20.sol\";\r\n\r\n/**\r\n * @dev Interface for the optional metadata functions from the ERC20 standard.\r\n *\r\n * _Available since v4.1._\r\n */\r\ninterface IERC20Metadata is IERC20 {\r\n    /**\r\n     * @dev Returns the name of the token.\r\n     */\r\n    function name() external view returns (string memory);\r\n\r\n    /**\r\n     * @dev Returns the symbol of the token.\r\n     */\r\n    function symbol() external view returns (string memory);\r\n\r\n    /**\r\n     * @dev Returns the decimals places of the token.\r\n     */\r\n    function decimals() external view returns (uint8);\r\n}\r\n"
    },
    "lib/openzeppelin-contracts/contracts/utils/Context.sol": {
      "content": "// SPDX-License-Identifier: MIT\r\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\r\n\r\npragma solidity ^0.8.0;\r\n\r\n/**\r\n * @dev Provides information about the current execution context, including the\r\n * sender of the transaction and its data. While these are generally available\r\n * via msg.sender and msg.data, they should not be accessed in such a direct\r\n * manner, since when dealing with meta-transactions the account sending and\r\n * paying for execution may not be the actual sender (as far as an application\r\n * is concerned).\r\n *\r\n * This contract is only required for intermediate, library-like contracts.\r\n */\r\nabstract contract Context {\r\n    function _msgSender() internal view virtual returns (address) {\r\n        return msg.sender;\r\n    }\r\n\r\n    function _msgData() internal view virtual returns (bytes calldata) {\r\n        return msg.data;\r\n    }\r\n}\r\n"
    },
    "src/BasketsPriceFeed.sol": {
      "content": "pragma solidity ^0.8.0;\r\n\r\nimport {Ownable} from \"@openzeppelin/access/Ownable.sol\";\r\nimport {IBasketFacet} from \"./Interfaces/IBasketFacet.sol\";\r\nimport {ILendingRegistry} from \"./Interfaces/ILendingRegistry.sol\";\r\nimport {IChainLinkOracle} from \"./Interfaces/IChainLinkOracle.sol\";\r\nimport {IRETH} from \"./Interfaces/IRETH.sol\";\r\nimport {IWSTETH} from \"./Interfaces/IWSTETH.sol\";\r\nimport {IERC20} from \"@openzeppelin/token/ERC20/IERC20.sol\";\r\nimport {ILendingLogic} from \"./Interfaces/ILendingLogic.sol\";\r\nimport {IERC20Metadata} from \"@openzeppelin/token/ERC20/extensions/IERC20Metadata.sol\";\r\n\r\ncontract BasketsPriceFeed is Ownable {\r\n    IBasketFacet immutable basket;\r\n    ILendingRegistry immutable lendingRegistry;\r\n    IRETH public constant RETH = IRETH(0xae78736Cd615f374D3085123A210448E74Fc6393);\r\n    IWSTETH public constant WSTETH = IWSTETH(0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0);\r\n    uint8 public constant decimals = 18;\r\n    mapping(address => IChainLinkOracle) public linkFeeds;\r\n\r\n    constructor (address _basket, address _lendingRegistry) {\r\n        basket = IBasketFacet(_basket);\r\n        lendingRegistry = ILendingRegistry(_lendingRegistry);\r\n    }\r\n\r\n    /**\r\n     * Function to retrieve the price of 1 basket token in USD, scaled by 1e18\r\n     *\r\n     * @return usdPrice Price of 1 basket token in USD\r\n     */\r\n    function latestAnswer() external view returns (uint256 usdPrice) {\r\n        address[] memory components = basket.getTokens();\r\n\r\n        uint256 marketCapUSD = 0;\r\n\r\n        // Gather link prices, component balances, and basket market cap\r\n        for (uint8 i = 0; i < components.length; i++) {\r\n            address component = components[i];\r\n            address underlying = lendingRegistry.wrappedToUnderlying(component);\r\n            IERC20 componentToken = IERC20(component);\r\n            IChainLinkOracle linkFeed;\r\n            if (underlying != address(0)) { // Wrapped tokens\r\n                ILendingLogic lendingLogic = ILendingLogic(lendingRegistry.protocolToLogic(lendingRegistry.wrappedToProtocol(component)));\r\n                linkFeed = linkFeeds[underlying];\r\n                marketCapUSD += (\r\n                    fmul(fmul(componentToken.balanceOf(address(basket)), lendingLogic.exchangeRateView(component), 1 ether),\r\n                    10 ** (36 - IERC20Metadata(address(componentToken)).decimals() - linkFeed.decimals()) * uint256(linkFeed.latestAnswer()),1 ether)\r\n                );\r\n            } if (component == address(RETH)) { // rETH\r\n                linkFeed = linkFeeds[component];\r\n                marketCapUSD += (\r\n                    fmul(fmul(componentToken.balanceOf(address(basket)), RETH.getExchangeRate(), 1 ether),\r\n                    10 ** (36 - IERC20Metadata(address(componentToken)).decimals() - linkFeed.decimals()) * uint256(linkFeed.latestAnswer()),1 ether)\r\n                );\r\n            } if (component == address(WSTETH)) { // wstETH\r\n                linkFeed = linkFeeds[component];\r\n                marketCapUSD += (\r\n                    fmul(fmul(componentToken.balanceOf(address(basket)), WSTETH.stEthPerToken(), 1 ether),\r\n                    10 ** (36 - IERC20Metadata(address(componentToken)).decimals() - linkFeed.decimals()) * uint256(linkFeed.latestAnswer()),1 ether)\r\n                );\r\n            } else { // Non-wrapped tokens\r\n                linkFeed = linkFeeds[component];\r\n                marketCapUSD += (\r\n                    fmul(componentToken.balanceOf(address(basket)),10 ** (36 - IERC20Metadata(address(componentToken)).decimals() - linkFeed.decimals())  * uint256(linkFeed.latestAnswer()),1 ether)\r\n                );\r\n            }\r\n        }\r\n        usdPrice = fdiv(marketCapUSD, IERC20(address(basket)).totalSupply(), 1 ether);\t\r\n\treturn usdPrice;\r\n    }\r\n\r\n    function setTokenFeed(address _token, address _oracle) external onlyOwner {\r\n        linkFeeds[_token] = IChainLinkOracle(_oracle);\r\n    }\r\n\r\n    function removeTokenFeed(address _token) external onlyOwner {\r\n        delete linkFeeds[_token];\r\n    }\r\n\r\n    function fmul(\r\n        uint256 x,\r\n        uint256 y,\r\n        uint256 baseUnit\r\n    ) internal pure returns (uint256 z) {\r\n        assembly {\r\n            if iszero(eq(div(mul(x,y),x),y)) {revert(0,0)}\r\n            z := div(mul(x,y),baseUnit)\r\n        }\r\n    }\r\n\r\n    function fdiv(\r\n        uint256 x,\r\n        uint256 y,\r\n        uint256 baseUnit\r\n    ) internal pure returns (uint256 z) {\r\n        assembly {\r\n            if iszero(eq(div(mul(x,baseUnit),x),baseUnit)) {revert(0,0)}\r\n            z := div(mul(x,baseUnit),y)\r\n        }\r\n    }\r\n}\r\n\r\n"
    },
    "src/Interfaces/IBasketFacet.sol": {
      "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\ninterface IBasketFacet {\r\n\r\n    event TokenAdded(address indexed _token);\r\n    event TokenRemoved(address indexed _token);\r\n    event EntryFeeSet(uint256 fee);\r\n    event ExitFeeSet(uint256 fee);\r\n    event AnnualizedFeeSet(uint256 fee);\r\n    event FeeBeneficiarySet(address indexed beneficiary);\r\n    event EntryFeeBeneficiaryShareSet(uint256 share);\r\n    event ExitFeeBeneficiaryShareSet(uint256 share);\r\n\r\n    event PoolJoined(address indexed who, uint256 amount);\r\n    event PoolExited(address indexed who, uint256 amount);\r\n    event FeeCharged(uint256 amount);\r\n    event LockSet(uint256 lockBlock);\r\n    event CapSet(uint256 cap);\r\n\r\n    /**\r\n        @notice Sets entry fee paid when minting\r\n        @param _fee Amount of fee. 1e18 == 100%, capped at 10%\r\n    */\r\n    function setEntryFee(uint256 _fee) external;\r\n\r\n    /**\r\n        @notice Get the entry fee\r\n        @return Current entry fee\r\n    */\r\n    function getEntryFee() external view returns(uint256);\r\n\r\n    /**\r\n        @notice Set the exit fee paid when exiting\r\n        @param _fee Amount of fee. 1e18 == 100%, capped at 10%\r\n    */\r\n    function setExitFee(uint256 _fee) external;\r\n\r\n    /**\r\n        @notice Get the exit fee\r\n        @return Current exit fee\r\n    */\r\n    function getExitFee() external view returns(uint256);\r\n\r\n    /**\r\n        @notice Set the annualized fee. Often referred to as streaming fee\r\n        @param _fee Amount of fee. 1e18 == 100%, capped at 10%\r\n    */\r\n    function setAnnualizedFee(uint256 _fee) external;\r\n\r\n    /**\r\n        @notice Get the annualized fee.\r\n        @return Current annualized fee.\r\n    */\r\n    function getAnnualizedFee() external view returns(uint256);\r\n\r\n    /**\r\n        @notice Set the address receiving the fees.\r\n    */\r\n    function setFeeBeneficiary(address _beneficiary) external;\r\n\r\n    /**\r\n        @notice Get the fee benificiary\r\n        @return The current fee beneficiary\r\n    */\r\n    function getFeeBeneficiary() external view returns(address);\r\n\r\n    /**\r\n        @notice Set the fee beneficiaries share of the entry fee\r\n        @notice _share Share of the fee. 1e18 == 100%. Capped at 100%\r\n    */\r\n    function setEntryFeeBeneficiaryShare(uint256 _share) external;\r\n\r\n    /**\r\n        @notice Get the entry fee beneficiary share\r\n        @return Feeshare amount\r\n    */\r\n    function getEntryFeeBeneficiaryShare() external view returns(uint256);\r\n\r\n    /**\r\n        @notice Set the fee beneficiaries share of the exit fee\r\n        @notice _share Share of the fee. 1e18 == 100%. Capped at 100%\r\n    */\r\n    function setExitFeeBeneficiaryShare(uint256 _share) external;\r\n\r\n    /**\r\n        @notice Get the exit fee beneficiary share\r\n        @return Feeshare amount\r\n    */\r\n    function getExitFeeBeneficiaryShare() external view returns(uint256);\r\n\r\n    /**\r\n        @notice Calculate the oustanding annualized fee\r\n        @return Amount of pool tokens to be minted to charge the annualized fee\r\n    */\r\n    function calcOutStandingAnnualizedFee() external view returns(uint256);\r\n\r\n    /**\r\n        @notice Charges the annualized fee\r\n    */\r\n    function chargeOutstandingAnnualizedFee() external;\r\n\r\n    /**\r\n        @notice Pulls underlying from caller and mints the pool token\r\n        @param _amount Amount of pool tokens to mint\r\n    */\r\n    function joinPool(uint256 _amount) external;\r\n\r\n    /**\r\n        @notice Burns pool tokens from the caller and returns underlying assets\r\n    */\r\n    function exitPool(uint256 _amount) external;\r\n\r\n    /**\r\n        @notice Get if the pool is locked or not. (not accepting exit and entry)\r\n        @return Boolean indicating if the pool is locked\r\n    */\r\n    function getLock() external view returns (bool);\r\n\r\n    /**\r\n        @notice Get the block until which the pool is locked\r\n        @return The lock block\r\n    */\r\n    function getLockBlock() external view returns (uint256);\r\n\r\n    /**\r\n        @notice Set the lock block\r\n        @param _lock Block height of the lock\r\n    */\r\n    function setLock(uint256 _lock) external;\r\n\r\n    /**\r\n        @notice Get the maximum of pool tokens that can be minted\r\n        @return Cap\r\n    */\r\n    function getCap() external view returns (uint256);\r\n\r\n    /**\r\n        @notice Set the maximum of pool tokens that can be minted\r\n        @param _maxCap Max cap\r\n    */\r\n    function setCap(uint256 _maxCap) external;\r\n\r\n    /**\r\n        @notice Get the amount of tokens owned by the pool\r\n        @param _token Addres of the token\r\n        @return Amount owned by the contract\r\n    */\r\n    function balance(address _token) external view returns (uint256);\r\n\r\n    /**\r\n        @notice Get the tokens in the pool\r\n        @return Array of tokens in the pool\r\n    */\r\n    function getTokens() external view returns (address[] memory);\r\n\r\n    /**\r\n        @notice Add a token to the pool. Should have at least a balance of 10**6\r\n        @param _token Address of the token to add\r\n    */\r\n    function addToken(address _token) external;\r\n\r\n    /**\r\n        @notice Removes a token from the pool\r\n        @param _token Address of the token to remove\r\n    */\r\n    function removeToken(address _token) external;\r\n\r\n    /**\r\n        @notice Checks if a token was added to the pool\r\n        @param _token address of the token\r\n        @return If token is in the pool or not\r\n    */\r\n    function getTokenInPool(address _token) external view returns (bool);\r\n\r\n    /**\r\n        @notice Calculate the amounts of underlying needed to mint that pool amount.\r\n        @param _amount Amount of pool tokens to mint\r\n        @return tokens Tokens needed\r\n        @return amounts Amounts of underlying needed\r\n    */\r\n    function calcTokensForAmount(uint256 _amount)\r\n        external\r\n        view\r\n        returns (address[] memory tokens, uint256[] memory amounts);\r\n\r\n    /**\r\n        @notice Calculate the amounts of underlying to receive when burning that pool amount\r\n        @param _amount Amount of pool tokens to burn\r\n        @return tokens Tokens returned\r\n        @return amounts Amounts of underlying returned\r\n    */\r\n    function calcTokensForAmountExit(uint256 _amount)\r\n        external\r\n        view\r\n        returns (address[] memory tokens, uint256[] memory amounts);\r\n}\r\n"
    },
    "src/Interfaces/IChainLinkOracle.sol": {
      "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\ninterface IChainLinkOracle {\r\n  function decimals() external view returns (uint8);\r\n\r\n  function description() external view returns (string memory);\r\n\r\n  function latestAnswer() external view returns (int256);\r\n\r\n  function latestTimestamp() external view returns (uint256);\r\n\r\n  function latestRound() external view returns (uint256);\r\n\r\n  function getAnswer(uint256 roundId) external view returns (int256);\r\n\r\n  function getTimestamp(uint256 roundId) external view returns (uint256);\r\n\r\n  event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt);\r\n\r\n  event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);\r\n\r\n  function version() external view returns (uint256);\r\n\r\n  // getRoundData and latestRoundData should both raise \"No data present\"\r\n  // if they do not have data to report, instead of returning unset values\r\n  // which could be misinterpreted as actual reported values.\r\n  function getRoundData(uint80 _roundId)\r\n    external\r\n    view\r\n    returns (\r\n      uint80 roundId,\r\n      int256 answer,\r\n      uint256 startedAt,\r\n      uint256 updatedAt,\r\n      uint80 answeredInRound\r\n    );\r\n\r\n  function latestRoundData()\r\n    external\r\n    view\r\n    returns (\r\n      uint80 roundId,\r\n      int256 answer,\r\n      uint256 startedAt,\r\n      uint256 updatedAt,\r\n      uint80 answeredInRound\r\n    );\r\n}\r\n"
    },
    "src/Interfaces/ILendingLogic.sol": {
      "content": "// SPDX-License-Identifier: MIT\r\npragma solidity ^0.8.0;\r\n\r\ninterface ILendingLogic {\r\n    /**\r\n        @notice Get the APR based on underlying token.\r\n        @param _token Address of the underlying token\r\n        @return Interest with 18 decimals\r\n    */\r\n    function getAPRFromUnderlying(address _token) external view returns(uint256);\r\n\r\n    /**\r\n        @notice Get the APR based on wrapped token.\r\n        @param _token Address of the wrapped token\r\n        @return Interest with 18 decimals\r\n    */\r\n    function getAPRFromWrapped(address _token) external view returns(uint256);\r\n\r\n    /**\r\n        @notice Get the calls needed to lend.\r\n        @param _underlying Address of the underlying token\r\n        @param _amount Amount of the underlying token\r\n        @return targets Addresses of the src to call\r\n        @return data Calldata of the calls\r\n    */\r\n    function lend(address _underlying, uint256 _amount, address _tokenHolder) external view returns(address[] memory targets, bytes[] memory data);\r\n\r\n    /**\r\n        @notice Get the calls needed to unlend\r\n        @param _wrapped Address of the wrapped token\r\n        @param _amount Amount of the underlying tokens\r\n        @return targets Addresses of the src to call\r\n        @return data Calldata of the calls\r\n    */\r\n    function unlend(address _wrapped, uint256 _amount, address _tokenHolder) external view returns(address[] memory targets, bytes[] memory data);\r\n\r\n    /**\r\n        @notice Get the underlying wrapped exchange rate\r\n        @param _wrapped Address of the wrapped token\r\n        @return The exchange rate\r\n    */\r\n    function exchangeRate(address _wrapped) external returns(uint256);\r\n\r\n    /**\r\n        @notice Get the underlying wrapped exchange rate in a view (non state changing) way\r\n        @param _wrapped Address of the wrapped token\r\n        @return The exchange rate\r\n    */\r\n    function exchangeRateView(address _wrapped) external view returns(uint256);\r\n}\r\n"
    },
    "src/Interfaces/ILendingRegistry.sol": {
      "content": "//SPDX-License-Identifier: Unlicense\r\npragma solidity ^0.8.0;\r\n\r\ninterface ILendingRegistry {\r\n    // Maps wrapped token to protocol\r\n    function wrappedToProtocol(address _wrapped) external view returns(bytes32);\r\n    // Maps wrapped token to underlying\r\n    function wrappedToUnderlying(address _wrapped) external view returns(address);\r\n    function underlyingToProtocolWrapped(address _underlying, bytes32 protocol) external view returns (address);\r\n    function protocolToLogic(bytes32 _protocol) external view returns (address);\r\n\r\n    /**\r\n        @notice Set which protocl a wrapped token belongs to\r\n        @param _wrapped Address of the wrapped token\r\n        @param _protocol Bytes32 key of the protocol\r\n    */\r\n    function setWrappedToProtocol(address _wrapped, bytes32 _protocol) external;\r\n\r\n    /**\r\n        @notice Set what is the underlying for a wrapped token\r\n        @param _wrapped Address of the wrapped token\r\n        @param _underlying Address of the underlying token\r\n    */\r\n    function setWrappedToUnderlying(address _wrapped, address _underlying) external;\r\n\r\n    /**\r\n        @notice Set the logic contract for the protocol\r\n        @param _protocol Bytes32 key of the procol\r\n        @param _logic Address of the lending logic contract for that protocol\r\n    */\r\n    function setProtocolToLogic(bytes32 _protocol, address _logic) external;\r\n    /**\r\n        @notice Set the wrapped token for the underlying deposited in this protocol\r\n        @param _underlying Address of the unerlying token\r\n        @param _protocol Bytes32 key of the protocol\r\n        @param _wrapped Address of the wrapped token\r\n    */\r\n    function setUnderlyingToProtocolWrapped(address _underlying, bytes32 _protocol, address _wrapped) external;\r\n\r\n    /**\r\n        @notice Get tx data to lend the underlying amount in a specific protocol\r\n        @param _underlying Address of the underlying token\r\n        @param _amount Amount to lend\r\n        @param _protocol Bytes32 key of the protocol\r\n        @return targets Addresses of the src to call\r\n        @return data Calldata for the calls\r\n    */\r\n    function getLendTXData(address _underlying, uint256 _amount, bytes32 _protocol) external view returns(address[] memory targets, bytes[] memory data);\r\n\r\n    /**\r\n        @notice Get the tx data to unlend the wrapped amount\r\n        @param _wrapped Address of the wrapped token\r\n        @param _amount Amount of wrapped token to unlend\r\n        @return targets Addresses of the src to call\r\n        @return data Calldata for the calls\r\n    */\r\n    function getUnlendTXData(address _wrapped, uint256 _amount) external view returns(address[] memory targets, bytes[] memory data);\r\n}\r\n"
    },
    "src/Interfaces/IRETH.sol": {
      "content": "pragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/token/ERC20/IERC20.sol\";\r\n\r\ninterface IRETH is IERC20 {\r\n  function getExchangeRate() external view returns (uint256);\r\n}"
    },
    "src/Interfaces/IWSTETH.sol": {
      "content": "pragma solidity ^0.8.0;\r\n\r\nimport \"@openzeppelin/token/ERC20/IERC20.sol\";\r\n\r\ninterface IWSTETH is IERC20 {\r\n  function stEthPerToken() external view returns (uint256);\r\n}"
    }
  },
  "settings": {
    "remappings": [
      "@openzeppelin/=lib/openzeppelin-contracts/contracts/",
      "ds-test/=lib/forge-std/lib/ds-test/src/",
      "forge-std/=lib/forge-std/src/",
      "openzeppelin-contracts/=lib/openzeppelin-contracts/",
      "solmate/=lib/solmate/src/",
      "weird-erc20/=lib/weird-erc20/src/"
    ],
    "optimizer": {
      "enabled": true,
      "runs": 200
    },
    "metadata": {
      "bytecodeHash": "ipfs"
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "evmVersion": "london",
    "libraries": {}
  }
}