creation_sourcecode: {{
    "language": "Solidity",
    "sources": {
      "lib/blueberry-core/contracts/money-market/BErc20Delegator.sol": {
        "content": "pragma solidity 0.5.16;\n\nimport \"./BTokenInterfaces.sol\";\n\n/**\n * @title Blueberry's BErc20Delegator Contract\n * @notice BTokens which wrap an EIP-20 underlying and delegate to an implementation\n * @author Blueberry\n */\ncontract BErc20Delegator is\n    BTokenInterface,\n    BErc20Interface,\n    BDelegatorInterface\n{\n    /**\n     * @notice Construct a new money market\n     * @param underlying_ The address of the underlying asset\n     * @param comptroller_ The address of the Comptroller\n     * @param interestRateModel_ The address of the interest rate model\n     * @param initialExchangeRateMantissa_ The initial exchange rate, scaled by 1e18\n     * @param name_ ERC-20 name of this token\n     * @param symbol_ ERC-20 symbol of this token\n     * @param decimals_ ERC-20 decimal precision of this token\n     * @param admin_ Address of the administrator of this token\n     * @param implementation_ The address of the implementation the contract delegates to\n     * @param becomeImplementationData The encoded args for becomeImplementation\n     */\n    constructor(\n        address underlying_,\n        ComptrollerInterface comptroller_,\n        InterestRateModel interestRateModel_,\n        uint256 initialExchangeRateMantissa_,\n        string memory name_,\n        string memory symbol_,\n        uint8 decimals_,\n        address payable admin_,\n        address implementation_,\n        bytes memory becomeImplementationData\n    ) public {\n        // Creator of the contract is admin during initialization\n        admin = msg.sender;\n\n        // First delegate gets to initialize the delegator (i.e. storage contract)\n        delegateTo(\n            implementation_,\n            abi.encodeWithSignature(\n                \"initialize(address,address,address,uint256,string,string,uint8)\",\n                underlying_,\n                comptroller_,\n                interestRateModel_,\n                initialExchangeRateMantissa_,\n                name_,\n                symbol_,\n                decimals_\n            )\n        );\n\n        // New implementations always get set via the setter (post-initialize)\n        _setImplementation(implementation_, false, becomeImplementationData);\n\n        // Set the proper admin now that initialization is done\n        admin = admin_;\n    }\n\n    /**\n     * @notice Called by the admin to update the implementation of the delegator\n     * @param implementation_ The address of the new implementation for delegation\n     * @param allowResign Flag to indicate whether to call _resignImplementation on the old implementation\n     * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\n     */\n    function _setImplementation(\n        address implementation_,\n        bool allowResign,\n        bytes memory becomeImplementationData\n    ) public {\n        require(\n            msg.sender == admin,\n            \"BErc20Delegator::_setImplementation: Caller must be admin\"\n        );\n\n        if (allowResign) {\n            delegateToImplementation(\n                abi.encodeWithSignature(\"_resignImplementation()\")\n            );\n        }\n\n        address oldImplementation = implementation;\n        implementation = implementation_;\n\n        delegateToImplementation(\n            abi.encodeWithSignature(\n                \"_becomeImplementation(bytes)\",\n                becomeImplementationData\n            )\n        );\n\n        emit NewImplementation(oldImplementation, implementation);\n    }\n\n    /**\n     * @notice Sender supplies assets into the market and receives bTokens in exchange\n     * @dev Accrues interest whether or not the operation succeeds, unless reverted\n     * @param mintAmount The amount of the underlying asset to supply\n     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n     */\n    function mint(uint256 mintAmount) external returns (uint256) {\n        mintAmount; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Sender redeems bTokens in exchange for the underlying asset\n     * @dev Accrues interest whether or not the operation succeeds, unless reverted\n     * @param redeemTokens The number of bTokens to redeem into underlying\n     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n     */\n    function redeem(uint256 redeemTokens) external returns (uint256) {\n        redeemTokens; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Sender redeems bTokens in exchange for a specified amount of underlying asset\n     * @dev Accrues interest whether or not the operation succeeds, unless reverted\n     * @param redeemAmount The amount of underlying to redeem\n     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n     */\n    function redeemUnderlying(uint256 redeemAmount) external returns (uint256) {\n        redeemAmount; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Sender borrows assets from the protocol to their own address\n     * @param borrowAmount The amount of the underlying asset to borrow\n     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n     */\n    function borrow(uint256 borrowAmount) external returns (uint256) {\n        borrowAmount; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Sender repays their own borrow\n     * @param repayAmount The amount to repay\n     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n     */\n    function repayBorrow(uint256 repayAmount) external returns (uint256) {\n        repayAmount; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Sender repays a borrow belonging to borrower\n     * @param borrower the account with the debt being payed off\n     * @param repayAmount The amount to repay\n     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n     */\n    function repayBorrowBehalf(address borrower, uint256 repayAmount)\n        external\n        returns (uint256)\n    {\n        borrower;\n        repayAmount; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice The sender liquidates the borrowers collateral.\n     *  The collateral seized is transferred to the liquidator.\n     * @param borrower The borrower of this bToken to be liquidated\n     * @param bTokenCollateral The market in which to seize collateral from the borrower\n     * @param repayAmount The amount of the underlying borrowed asset to repay\n     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n     */\n    function liquidateBorrow(\n        address borrower,\n        uint256 repayAmount,\n        BTokenInterface bTokenCollateral\n    ) external returns (uint256) {\n        borrower;\n        repayAmount;\n        bTokenCollateral; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Transfer `amount` tokens from `msg.sender` to `dst`\n     * @param dst The address of the destination account\n     * @param amount The number of tokens to transfer\n     * @return Whether or not the transfer succeeded\n     */\n    function transfer(address dst, uint256 amount) external returns (bool) {\n        dst;\n        amount; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Transfer `amount` tokens from `src` to `dst`\n     * @param src The address of the source account\n     * @param dst The address of the destination account\n     * @param amount The number of tokens to transfer\n     * @return Whether or not the transfer succeeded\n     */\n    function transferFrom(\n        address src,\n        address dst,\n        uint256 amount\n    ) external returns (bool) {\n        src;\n        dst;\n        amount; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Approve `spender` to transfer up to `amount` from `src`\n     * @dev This will overwrite the approval amount for `spender`\n     *  and is subject to issues noted [here](https://eips.ethereum.org/EIPS/eip-20#approve)\n     * @param spender The address of the account which may transfer tokens\n     * @param amount The number of tokens that are approved (-1 means infinite)\n     * @return Whether or not the approval succeeded\n     */\n    function approve(address spender, uint256 amount) external returns (bool) {\n        spender;\n        amount; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Get the current allowance from `owner` for `spender`\n     * @param owner The address of the account which owns the tokens to be spent\n     * @param spender The address of the account which may transfer tokens\n     * @return The number of tokens allowed to be spent (-1 means infinite)\n     */\n    function allowance(address owner, address spender)\n        external\n        view\n        returns (uint256)\n    {\n        owner;\n        spender; // Shh\n        delegateToViewAndReturn();\n    }\n\n    /**\n     * @notice Get the token balance of the `owner`\n     * @param owner The address of the account to query\n     * @return The number of tokens owned by `owner`\n     */\n    function balanceOf(address owner) external view returns (uint256) {\n        owner; // Shh\n        delegateToViewAndReturn();\n    }\n\n    /**\n     * @notice Get the underlying balance of the `owner`\n     * @dev This also accrues interest in a transaction\n     * @param owner The address of the account to query\n     * @return The amount of underlying owned by `owner`\n     */\n    function balanceOfUnderlying(address owner) external returns (uint256) {\n        owner; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Get a snapshot of the account's balances, and the cached exchange rate\n     * @dev This is used by comptroller to more efficiently perform liquidity checks.\n     * @param account Address of the account to snapshot\n     * @return (possible error, token balance, borrow balance, exchange rate mantissa)\n     */\n    function getAccountSnapshot(address account)\n        external\n        view\n        returns (\n            uint256,\n            uint256,\n            uint256,\n            uint256\n        )\n    {\n        account; // Shh\n        delegateToViewAndReturn();\n    }\n\n    /**\n     * @notice Returns the current per-second borrow interest rate for this bToken\n     * @return The borrow interest rate per second, scaled by 1e18\n     */\n    function borrowRatePerSecond() external view returns (uint256) {\n        delegateToViewAndReturn();\n    }\n\n    /**\n     * @notice Returns the current per-second supply interest rate for this bToken\n     * @return The supply interest rate per second, scaled by 1e18\n     */\n    function supplyRatePerSecond() external view returns (uint256) {\n        delegateToViewAndReturn();\n    }\n\n    /**\n     * @notice Returns the current total borrows plus accrued interest\n     * @return The total borrows with interest\n     */\n    function totalBorrowsCurrent() external returns (uint256) {\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Accrue interest to updated borrowIndex and then calculate account's borrow balance using the updated borrowIndex\n     * @param account The address whose balance should be calculated after updating borrowIndex\n     * @return The calculated balance\n     */\n    function borrowBalanceCurrent(address account) external returns (uint256) {\n        account; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Return the borrow balance of account based on stored data\n     * @param account The address whose balance should be calculated\n     * @return The calculated balance\n     */\n    function borrowBalanceStored(address account)\n        public\n        view\n        returns (uint256)\n    {\n        account; // Shh\n        delegateToViewAndReturn();\n    }\n\n    /**\n     * @notice Accrue interest then return the up-to-date exchange rate\n     * @return Calculated exchange rate scaled by 1e18\n     */\n    function exchangeRateCurrent() public returns (uint256) {\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Calculates the exchange rate from the underlying to the BToken\n     * @dev This function does not accrue interest before calculating the exchange rate\n     * @return Calculated exchange rate scaled by 1e18\n     */\n    function exchangeRateStored() public view returns (uint256) {\n        delegateToViewAndReturn();\n    }\n\n    /**\n     * @notice Get cash balance of this bToken in the underlying asset\n     * @return The quantity of underlying asset owned by this contract\n     */\n    function getCash() external view returns (uint256) {\n        delegateToViewAndReturn();\n    }\n\n    /**\n     * @notice Applies accrued interest to total borrows and reserves.\n     * @dev This calculates interest accrued from the last checkpointed second\n     *      up to the current second and writes new checkpoint to storage.\n     */\n    function accrueInterest() public returns (uint256) {\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Transfers collateral tokens (this market) to the liquidator.\n     * @dev Will fail unless called by another bToken during the process of liquidation.\n     *  Its absolutely critical to use msg.sender as the borrowed bToken and not a parameter.\n     * @param liquidator The account receiving seized collateral\n     * @param borrower The account having collateral seized\n     * @param seizeTokens The number of bTokens to seize\n     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n     */\n    function seize(\n        address liquidator,\n        address borrower,\n        uint256 seizeTokens\n    ) external returns (uint256) {\n        liquidator;\n        borrower;\n        seizeTokens; // Shh\n        delegateAndReturn();\n    }\n\n    /*** Admin Functions ***/\n\n    /**\n     * @notice Begins transfer of admin rights. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\n     * @dev Admin function to begin change of admin. The newPendingAdmin must call `_acceptAdmin` to finalize the transfer.\n     * @param newPendingAdmin New pending admin.\n     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n     */\n    function _setPendingAdmin(address payable newPendingAdmin)\n        external\n        returns (uint256)\n    {\n        newPendingAdmin; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Sets a new comptroller for the market\n     * @dev Admin function to set a new comptroller\n     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n     */\n    function _setComptroller(ComptrollerInterface newComptroller)\n        public\n        returns (uint256)\n    {\n        newComptroller; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice accrues interest and sets a new reserve factor for the protocol using _setReserveFactorFresh\n     * @dev Admin function to accrue interest and set a new reserve factor\n     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n     */\n    function _setReserveFactor(uint256 newReserveFactorMantissa)\n        external\n        returns (uint256)\n    {\n        newReserveFactorMantissa; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Accepts transfer of admin rights. msg.sender must be pendingAdmin\n     * @dev Admin function for pending admin to accept role and update admin\n     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n     */\n    function _acceptAdmin() external returns (uint256) {\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Accrues interest and adds reserves by transferring from admin\n     * @param addAmount Amount of reserves to add\n     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n     */\n    function _addReserves(uint256 addAmount) external returns (uint256) {\n        addAmount; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Accrues interest and reduces reserves by transferring to admin\n     * @param reduceAmount Amount of reduction to reserves\n     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n     */\n    function _reduceReserves(uint256 reduceAmount) external returns (uint256) {\n        reduceAmount; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Accrues interest and updates the interest rate model using _setInterestRateModelFresh\n     * @dev Admin function to accrue interest and update the interest rate model\n     * @param newInterestRateModel the new interest rate model to use\n     * @return uint 0=success, otherwise a failure (see ErrorReporter.sol for details)\n     */\n    function _setInterestRateModel(InterestRateModel newInterestRateModel)\n        public\n        returns (uint256)\n    {\n        newInterestRateModel; // Shh\n        delegateAndReturn();\n    }\n\n    /**\n     * @notice Internal method to delegate execution to another contract\n     * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n     * @param callee The contract to delegatecall\n     * @param data The raw data to delegatecall\n     * @return The returned bytes from the delegatecall\n     */\n    function delegateTo(address callee, bytes memory data)\n        internal\n        returns (bytes memory)\n    {\n        (bool success, bytes memory returnData) = callee.delegatecall(data);\n        assembly {\n            if eq(success, 0) {\n                revert(add(returnData, 0x20), returndatasize)\n            }\n        }\n        return returnData;\n    }\n\n    /**\n     * @notice Delegates execution to the implementation contract\n     * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n     * @param data The raw data to delegatecall\n     * @return The returned bytes from the delegatecall\n     */\n    function delegateToImplementation(bytes memory data)\n        public\n        returns (bytes memory)\n    {\n        return delegateTo(implementation, data);\n    }\n\n    /**\n     * @notice Delegates execution to an implementation contract\n     * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n     *  There are an additional 2 prefix uints from the wrapper returndata, which we ignore since we make an extra hop.\n     * @param data The raw data to delegatecall\n     * @return The returned bytes from the delegatecall\n     */\n    function delegateToViewImplementation(bytes memory data)\n        public\n        view\n        returns (bytes memory)\n    {\n        (bool success, bytes memory returnData) = address(this).staticcall(\n            abi.encodeWithSignature(\"delegateToImplementation(bytes)\", data)\n        );\n        assembly {\n            if eq(success, 0) {\n                revert(add(returnData, 0x20), returndatasize)\n            }\n        }\n        return abi.decode(returnData, (bytes));\n    }\n\n    function delegateToViewAndReturn() private view returns (bytes memory) {\n        (bool success, ) = address(this).staticcall(\n            abi.encodeWithSignature(\"delegateToImplementation(bytes)\", msg.data)\n        );\n\n        assembly {\n            let free_mem_ptr := mload(0x40)\n            returndatacopy(free_mem_ptr, 0, returndatasize)\n\n            switch success\n            case 0 {\n                revert(free_mem_ptr, returndatasize)\n            }\n            default {\n                return(add(free_mem_ptr, 0x40), returndatasize)\n            }\n        }\n    }\n\n    function delegateAndReturn() private returns (bytes memory) {\n        (bool success, ) = implementation.delegatecall(msg.data);\n\n        assembly {\n            let free_mem_ptr := mload(0x40)\n            returndatacopy(free_mem_ptr, 0, returndatasize)\n\n            switch success\n            case 0 {\n                revert(free_mem_ptr, returndatasize)\n            }\n            default {\n                return(free_mem_ptr, returndatasize)\n            }\n        }\n    }\n\n    /**\n     * @notice Delegates execution to an implementation contract\n     * @dev It returns to the external caller whatever the implementation returns or forwards reverts\n     */\n    function() external payable {\n        require(\n            msg.value == 0,\n            \"BErc20Delegator:fallback: cannot send value to fallback\"\n        );\n\n        // delegate all other functions to current implementation\n        delegateAndReturn();\n    }\n}\n"
      },
      "lib/blueberry-core/contracts/money-market/BTokenInterfaces.sol": {
        "content": "pragma solidity 0.5.16;\n\nimport \"./ComptrollerInterface.sol\";\nimport \"./InterestRateModel.sol\";\nimport \"./ERC3156FlashBorrowerInterface.sol\";\n\ncontract BTokenStorage {\n    /**\n     * @dev Guard variable for re-entrancy checks\n     */\n    bool internal _notEntered;\n\n    /**\n     * @notice EIP-20 token name for this token\n     */\n    string public name;\n\n    /**\n     * @notice EIP-20 token symbol for this token\n     */\n    string public symbol;\n\n    /**\n     * @notice EIP-20 token decimals for this token\n     */\n    uint8 public decimals;\n\n    /**\n     * @notice Maximum borrow rate that can ever be applied (.0005% / block)\n     */\n\n    uint256 internal constant borrowRateMaxMantissa = 0.0005e16;\n\n    /**\n     * @notice Maximum fraction of interest that can be set aside for reserves\n     */\n    uint256 internal constant reserveFactorMaxMantissa = 1e18;\n\n    /**\n     * @notice Administrator for this contract\n     */\n    address payable public admin;\n\n    /**\n     * @notice Pending administrator for this contract\n     */\n    address payable public pendingAdmin;\n\n    /**\n     * @notice Contract which oversees inter-bToken operations\n     */\n    ComptrollerInterface public comptroller;\n\n    /**\n     * @notice Model which tells what the current interest rate should be\n     */\n    InterestRateModel public interestRateModel;\n\n    /**\n     * @notice Initial exchange rate used when minting the first BTokens (used when totalSupply = 0)\n     */\n    uint256 internal initialExchangeRateMantissa;\n\n    /**\n     * @notice Fraction of interest currently set aside for reserves\n     */\n    uint256 public reserveFactorMantissa;\n\n    /**\n     * @notice Block timestamp that interest was last accrued at\n     */\n    uint256 public accrualBlockTimestamp;\n\n    /**\n     * @notice Accumulator of the total earned interest rate since the opening of the market\n     */\n    uint256 public borrowIndex;\n\n    /**\n     * @notice Total amount of outstanding borrows of the underlying in this market\n     */\n    uint256 public totalBorrows;\n\n    /**\n     * @notice Total amount of reserves of the underlying held in this market\n     */\n    uint256 public totalReserves;\n\n    /**\n     * @notice Total number of tokens in circulation\n     */\n    uint256 public totalSupply;\n\n    /**\n     * @notice Official record of token balances for each account\n     */\n    mapping(address => uint256) internal accountTokens;\n\n    /**\n     * @notice Approved token transfer amounts on behalf of others\n     */\n    mapping(address => mapping(address => uint256)) internal transferAllowances;\n\n    /**\n     * @notice Container for borrow balance information\n     * @member principal Total balance (with accrued interest), after applying the most recent balance-changing action\n     * @member interestIndex Global borrowIndex as of the most recent balance-changing action\n     */\n    struct BorrowSnapshot {\n        uint256 principal;\n        uint256 interestIndex;\n    }\n\n    /**\n     * @notice Mapping of account addresses to outstanding borrow balances\n     */\n    mapping(address => BorrowSnapshot) internal accountBorrows;\n}\n\ncontract BErc20Storage {\n    /**\n     * @notice Underlying asset for this BToken\n     */\n    address public underlying;\n\n    /**\n     * @notice Implementation address for this contract\n     */\n    address public implementation;\n}\n\ncontract BSupplyCapStorage {\n    /**\n     * @notice Internal cash counter for this BToken. Should equal underlying.balanceOf(address(this)) for BERC20.\n     */\n    uint256 public internalCash;\n}\n\ncontract BCollateralCapStorage {\n    /**\n     * @notice Total number of tokens used as collateral in circulation.\n     */\n    uint256 public totalCollateralTokens;\n\n    /**\n     * @notice Record of token balances which could be treated as collateral for each account.\n     *         If collateral cap is not set, the value should be equal to accountTokens.\n     */\n    mapping(address => uint256) public accountCollateralTokens;\n\n    /**\n     * @notice Check if accountCollateralTokens have been initialized.\n     */\n    mapping(address => bool) public isCollateralTokenInit;\n\n    /**\n     * @notice Collateral cap for this BToken, zero for no cap.\n     */\n    uint256 public collateralCap;\n}\n\n/*** Interface ***/\n\ncontract BTokenInterface is BTokenStorage {\n    /**\n     * @notice Indicator that this is a BToken contract (for inspection)\n     */\n    bool public constant isBToken = true;\n\n    /*** Market Events ***/\n\n    /**\n     * @notice Event emitted when interest is accrued\n     */\n    event AccrueInterest(\n        uint256 cashPrior,\n        uint256 interestAccumulated,\n        uint256 borrowIndex,\n        uint256 totalBorrows\n    );\n\n    /**\n     * @notice Event emitted when tokens are minted\n     */\n    event Mint(address minter, uint256 mintAmount, uint256 mintTokens);\n\n    /**\n     * @notice Event emitted when tokens are redeemed\n     */\n    event Redeem(address redeemer, uint256 redeemAmount, uint256 redeemTokens);\n\n    /**\n     * @notice Event emitted when underlying is borrowed\n     */\n    event Borrow(\n        address borrower,\n        uint256 borrowAmount,\n        uint256 accountBorrows,\n        uint256 totalBorrows\n    );\n\n    /**\n     * @notice Event emitted when a borrow is repaid\n     */\n    event RepayBorrow(\n        address payer,\n        address borrower,\n        uint256 repayAmount,\n        uint256 accountBorrows,\n        uint256 totalBorrows\n    );\n\n    /**\n     * @notice Event emitted when a borrow is liquidated\n     */\n    event LiquidateBorrow(\n        address liquidator,\n        address borrower,\n        uint256 repayAmount,\n        address bTokenCollateral,\n        uint256 seizeTokens\n    );\n\n    /*** Admin Events ***/\n\n    /**\n     * @notice Event emitted when pendingAdmin is changed\n     */\n    event NewPendingAdmin(address oldPendingAdmin, address newPendingAdmin);\n\n    /**\n     * @notice Event emitted when pendingAdmin is accepted, which means admin is updated\n     */\n    event NewAdmin(address oldAdmin, address newAdmin);\n\n    /**\n     * @notice Event emitted when comptroller is changed\n     */\n    event NewComptroller(\n        ComptrollerInterface oldComptroller,\n        ComptrollerInterface newComptroller\n    );\n\n    /**\n     * @notice Event emitted when interestRateModel is changed\n     */\n    event NewMarketInterestRateModel(\n        InterestRateModel oldInterestRateModel,\n        InterestRateModel newInterestRateModel\n    );\n\n    /**\n     * @notice Event emitted when the reserve factor is changed\n     */\n    event NewReserveFactor(\n        uint256 oldReserveFactorMantissa,\n        uint256 newReserveFactorMantissa\n    );\n\n    /**\n     * @notice Event emitted when the reserves are added\n     */\n    event ReservesAdded(\n        address benefactor,\n        uint256 addAmount,\n        uint256 newTotalReserves\n    );\n\n    /**\n     * @notice Event emitted when the reserves are reduced\n     */\n    event ReservesReduced(\n        address admin,\n        uint256 reduceAmount,\n        uint256 newTotalReserves\n    );\n\n    /**\n     * @notice EIP20 Transfer event\n     */\n    event Transfer(address indexed from, address indexed to, uint256 amount);\n\n    /**\n     * @notice EIP20 Approval event\n     */\n    event Approval(\n        address indexed owner,\n        address indexed spender,\n        uint256 amount\n    );\n\n    /**\n     * @notice Failure event\n     */\n    event Failure(uint256 error, uint256 info, uint256 detail);\n\n    /*** User Interface ***/\n\n    function transfer(address dst, uint256 amount) external returns (bool);\n\n    function transferFrom(\n        address src,\n        address dst,\n        uint256 amount\n    ) external returns (bool);\n\n    function approve(address spender, uint256 amount) external returns (bool);\n\n    function allowance(address owner, address spender)\n        external\n        view\n        returns (uint256);\n\n    function balanceOf(address owner) external view returns (uint256);\n\n    function balanceOfUnderlying(address owner) external returns (uint256);\n\n    function getAccountSnapshot(address account)\n        external\n        view\n        returns (\n            uint256,\n            uint256,\n            uint256,\n            uint256\n        );\n\n    function borrowRatePerSecond() external view returns (uint256);\n\n    function supplyRatePerSecond() external view returns (uint256);\n\n    function totalBorrowsCurrent() external returns (uint256);\n\n    function borrowBalanceCurrent(address account) external returns (uint256);\n\n    function borrowBalanceStored(address account) public view returns (uint256);\n\n    function exchangeRateCurrent() public returns (uint256);\n\n    function exchangeRateStored() public view returns (uint256);\n\n    function getCash() external view returns (uint256);\n\n    function accrueInterest() public returns (uint256);\n\n    function seize(\n        address liquidator,\n        address borrower,\n        uint256 seizeTokens\n    ) external returns (uint256);\n\n    /*** Admin Functions ***/\n\n    function _setPendingAdmin(address payable newPendingAdmin)\n        external\n        returns (uint256);\n\n    function _acceptAdmin() external returns (uint256);\n\n    function _setComptroller(ComptrollerInterface newComptroller)\n        public\n        returns (uint256);\n\n    function _setReserveFactor(uint256 newReserveFactorMantissa)\n        external\n        returns (uint256);\n\n    function _reduceReserves(uint256 reduceAmount) external returns (uint256);\n\n    function _setInterestRateModel(InterestRateModel newInterestRateModel)\n        public\n        returns (uint256);\n}\n\ncontract BErc20Interface is BErc20Storage {\n    /*** User Interface ***/\n\n    function mint(uint256 mintAmount) external returns (uint256);\n\n    function redeem(uint256 redeemTokens) external returns (uint256);\n\n    function redeemUnderlying(uint256 redeemAmount) external returns (uint256);\n\n    function borrow(uint256 borrowAmount) external returns (uint256);\n\n    function repayBorrow(uint256 repayAmount) external returns (uint256);\n\n    function repayBorrowBehalf(address borrower, uint256 repayAmount)\n        external\n        returns (uint256);\n\n    function liquidateBorrow(\n        address borrower,\n        uint256 repayAmount,\n        BTokenInterface bTokenCollateral\n    ) external returns (uint256);\n\n    function _addReserves(uint256 addAmount) external returns (uint256);\n}\n\ncontract BWrappedNativeInterface is BErc20Interface {\n    /**\n     * @notice Flash loan fee ratio\n     */\n    uint256 public constant flashFeeBips = 1;\n\n    /*** Market Events ***/\n\n    /**\n     * @notice Event emitted when a flashloan occurred\n     */\n    event Flashloan(\n        address indexed receiver,\n        uint256 amount,\n        uint256 totalFee,\n        uint256 reservesFee\n    );\n\n    /*** User Interface ***/\n\n    function mintNative() external payable returns (uint256);\n\n    function redeemNative(uint256 redeemTokens) external returns (uint256);\n\n    function redeemUnderlyingNative(uint256 redeemAmount)\n        external\n        returns (uint256);\n\n    function borrowNative(uint256 borrowAmount) external returns (uint256);\n\n    function repayBorrowNative() external payable returns (uint256);\n\n    function repayBorrowBehalfNative(address borrower)\n        external\n        payable\n        returns (uint256);\n\n    function liquidateBorrowNative(\n        address borrower,\n        BTokenInterface bTokenCollateral\n    ) external payable returns (uint256);\n\n    function flashLoan(\n        ERC3156FlashBorrowerInterface receiver,\n        address initiator,\n        uint256 amount,\n        bytes calldata data\n    ) external returns (bool);\n\n    function _addReservesNative() external payable returns (uint256);\n\n    function collateralCap() external view returns (uint256);\n\n    function totalCollateralTokens() external view returns (uint256);\n}\n\ncontract BCapableErc20Interface is BErc20Interface, BSupplyCapStorage {\n    /**\n     * @notice Flash loan fee ratio\n     */\n    uint256 public constant flashFeeBips = 1;\n\n    /*** Market Events ***/\n\n    /**\n     * @notice Event emitted when a flashloan occurred\n     */\n    event Flashloan(\n        address indexed receiver,\n        uint256 amount,\n        uint256 totalFee,\n        uint256 reservesFee\n    );\n\n    /*** User Interface ***/\n\n    function gulp() external;\n}\n\ncontract BCollateralCapErc20Interface is\n    BCapableErc20Interface,\n    BCollateralCapStorage\n{\n    /*** Admin Events ***/\n\n    /**\n     * @notice Event emitted when collateral cap is set\n     */\n    event NewCollateralCap(address token, uint256 newCap);\n\n    /**\n     * @notice Event emitted when user collateral is changed\n     */\n    event UserCollateralChanged(address account, uint256 newCollateralTokens);\n\n    /*** User Interface ***/\n\n    function registerCollateral(address account) external returns (uint256);\n\n    function unregisterCollateral(address account) external;\n\n    function flashLoan(\n        ERC3156FlashBorrowerInterface receiver,\n        address initiator,\n        uint256 amount,\n        bytes calldata data\n    ) external returns (bool);\n\n    /*** Admin Functions ***/\n\n    function _setCollateralCap(uint256 newCollateralCap) external;\n}\n\ncontract BDelegatorInterface {\n    /**\n     * @notice Emitted when implementation is changed\n     */\n    event NewImplementation(\n        address oldImplementation,\n        address newImplementation\n    );\n\n    /**\n     * @notice Called by the admin to update the implementation of the delegator\n     * @param implementation_ The address of the new implementation for delegation\n     * @param allowResign Flag to indicate whether to call _resignImplementation on the old implementation\n     * @param becomeImplementationData The encoded bytes data to be passed to _becomeImplementation\n     */\n    function _setImplementation(\n        address implementation_,\n        bool allowResign,\n        bytes memory becomeImplementationData\n    ) public;\n}\n\ncontract BDelegateInterface {\n    /**\n     * @notice Called by the delegator on a delegate to initialize it for duty\n     * @dev Should revert if any issues arise which make it unfit for delegation\n     * @param data The encoded bytes data for any initialization\n     */\n    function _becomeImplementation(bytes memory data) public;\n\n    /**\n     * @notice Called by the delegator on a delegate to forfeit its responsibility\n     */\n    function _resignImplementation() public;\n}\n\n/*** External interface ***/\n\n/**\n * @title Flash loan receiver interface\n */\ninterface IFlashloanReceiver {\n    function executeOperation(\n        address sender,\n        address underlying,\n        uint256 amount,\n        uint256 fee,\n        bytes calldata params\n    ) external;\n}\n"
      },
      "lib/blueberry-core/contracts/money-market/ComptrollerInterface.sol": {
        "content": "pragma solidity 0.5.16;\n\ncontract ComptrollerInterface {\n    /// @notice Indicator that this is a Comptroller contract (for inspection)\n    bool public constant isComptroller = true;\n\n    /*** Assets You Are In ***/\n\n    function enterMarkets(address[] calldata bTokens)\n        external\n        returns (uint256[] memory);\n\n    function exitMarket(address bToken) external returns (uint256);\n\n    /*** Policy Hooks ***/\n\n    function mintAllowed(\n        address bToken,\n        address minter,\n        uint256 mintAmount\n    ) external returns (uint256);\n\n    function mintVerify(\n        address bToken,\n        address minter,\n        uint256 mintAmount,\n        uint256 mintTokens\n    ) external;\n\n    function redeemAllowed(\n        address bToken,\n        address redeemer,\n        uint256 redeemTokens\n    ) external returns (uint256);\n\n    function redeemVerify(\n        address bToken,\n        address redeemer,\n        uint256 redeemAmount,\n        uint256 redeemTokens\n    ) external;\n\n    function borrowAllowed(\n        address bToken,\n        address borrower,\n        uint256 borrowAmount\n    ) external returns (uint256);\n\n    function borrowVerify(\n        address bToken,\n        address borrower,\n        uint256 borrowAmount\n    ) external;\n\n    function repayBorrowAllowed(\n        address bToken,\n        address payer,\n        address borrower,\n        uint256 repayAmount\n    ) external returns (uint256);\n\n    function repayBorrowVerify(\n        address bToken,\n        address payer,\n        address borrower,\n        uint256 repayAmount,\n        uint256 borrowerIndex\n    ) external;\n\n    function liquidateBorrowAllowed(\n        address bTokenBorrowed,\n        address bTokenCollateral,\n        address liquidator,\n        address borrower,\n        uint256 repayAmount\n    ) external returns (uint256);\n\n    function liquidateBorrowVerify(\n        address bTokenBorrowed,\n        address bTokenCollateral,\n        address liquidator,\n        address borrower,\n        uint256 repayAmount,\n        uint256 seizeTokens\n    ) external;\n\n    function seizeAllowed(\n        address bTokenCollateral,\n        address bTokenBorrowed,\n        address liquidator,\n        address borrower,\n        uint256 seizeTokens\n    ) external returns (uint256);\n\n    function seizeVerify(\n        address bTokenCollateral,\n        address bTokenBorrowed,\n        address liquidator,\n        address borrower,\n        uint256 seizeTokens\n    ) external;\n\n    function transferAllowed(\n        address bToken,\n        address src,\n        address dst,\n        uint256 transferTokens\n    ) external returns (uint256);\n\n    function transferVerify(\n        address bToken,\n        address src,\n        address dst,\n        uint256 transferTokens\n    ) external;\n\n    /*** Liquidity/Liquidation Calculations ***/\n\n    function liquidateCalculateSeizeTokens(\n        address bTokenBorrowed,\n        address bTokenCollateral,\n        uint256 repayAmount\n    ) external view returns (uint256, uint256);\n}\n"
      },
      "lib/blueberry-core/contracts/money-market/InterestRateModel.sol": {
        "content": "pragma solidity 0.5.16;\n\n/**\n * @title Blueberry's InterestRateModel Interface\n * @author Compound (Modified by Blueberry)\n */\ncontract InterestRateModel {\n    /// @notice Indicator that this is an InterestRateModel contract (for inspection)\n    bool public constant isInterestRateModel = true;\n\n    /**\n     * @notice Calculates the current borrow interest rate per second\n     * @param cash The total amount of cash the market has\n     * @param borrows The total amount of borrows the market has outstanding\n     * @param reserves The total amount of reserves the market has\n     * @return The borrow rate per second (as a percentage, and scaled by 1e18)\n     */\n    function getBorrowRate(\n        uint256 cash,\n        uint256 borrows,\n        uint256 reserves\n    ) external view returns (uint256);\n\n    /**\n     * @notice Calculates the current supply interest rate per second\n     * @param cash The total amount of cash the market has\n     * @param borrows The total amount of borrows the market has outstanding\n     * @param reserves The total amount of reserves the market has\n     * @param reserveFactorMantissa The current reserve factor the market has\n     * @return The supply rate per second (as a percentage, and scaled by 1e18)\n     */\n    function getSupplyRate(\n        uint256 cash,\n        uint256 borrows,\n        uint256 reserves,\n        uint256 reserveFactorMantissa\n    ) external view returns (uint256);\n}\n"
      },
      "lib/blueberry-core/contracts/money-market/ERC3156FlashBorrowerInterface.sol": {
        "content": "pragma solidity 0.5.16;\n\ninterface ERC3156FlashBorrowerInterface {\n    /**\n     * @dev Receive a flash loan.\n     * @param initiator The initiator of the loan.\n     * @param token The loan currency.\n     * @param amount The amount of tokens lent.\n     * @param fee The additional amount of tokens to repay.\n     * @param data Arbitrary data structure, intended to contain user-defined parameters.\n     * @return The keccak256 hash of \"ERC3156FlashBorrower.onFlashLoan\"\n     */\n    function onFlashLoan(\n        address initiator,\n        address token,\n        uint256 amount,\n        uint256 fee,\n        bytes calldata data\n    ) external returns (bytes32);\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/",
        "@eth-optimism/=lib/blueberry-core/node_modules/@eth-optimism/contracts/",
        "@uniswap/=lib/blueberry-core/node_modules/@uniswap/",
        "base64-sol/=lib/blueberry-core/node_modules/base64-sol/",
        "blueberry-core/=lib/blueberry-core/contracts/",
        "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
      },
      "outputSelection": {
        "*": {
          "*": [
            "evm.bytecode",
            "evm.deployedBytecode",
            "devdoc",
            "userdoc",
            "metadata",
            "abi"
          ]
        }
      },
      "evmVersion": "istanbul",
      "libraries": {}
    }
  }}