{
    "Function": "slitherConstructorConstantVariables",
    "File": "contracts/managers/AaveV2Strategy.sol",
    "Parent Contracts": [
        "contracts/managers/Manager.sol",
        "node_modules/@openzeppelin/contracts/security/Pausable.sol",
        "node_modules/@openzeppelin/contracts/access/Ownable.sol",
        "node_modules/@openzeppelin/contracts/utils/Context.sol",
        "contracts/interfaces/managers/IStrategyManager.sol",
        "contracts/interfaces/managers/IManager.sol"
    ],
    "High-Level Calls": [],
    "Internal Calls": [],
    "Library Calls": [],
    "Low-Level Calls": [],
    "Code": "contract AaveV2Strategy is IStrategyManager, Manager {\n  using SafeERC20 for IERC20;\n\n  // Need to call a provider because Aave has the ability to change the lending pool address\n  ILendingPoolAddressesProvider public constant LP_ADDRESS_PROVIDER =\n    ILendingPoolAddressesProvider(0xB53C1a33016B2DC2fF3653530bfF1848a515c8c5);\n\n  // Aave contract that controls stkAAVE rewards\n  IAaveIncentivesController public immutable aaveIncentivesController;\n\n  // This is the token being deposited (USDC)\n  IERC20 public immutable override want;\n  // This is the receipt token Aave gives in exchange for a token deposit (aUSDC)\n  IAToken public immutable aWant;\n\n  // Address to receive stkAAVE rewards\n  address public immutable aaveLmReceiver;\n\n  // Constructor takes the aUSDC address and the rewards receiver address (a Sherlock address) as args\n  constructor(IAToken _aWant, address _aaveLmReceiver) {\n    if (address(_aWant) == address(0)) revert ZeroArgument();\n    if (_aaveLmReceiver == address(0)) revert ZeroArgument();\n\n    aWant = _aWant;\n    // This gets the underlying token associated with aUSDC (USDC)\n    want = IERC20(_aWant.UNDERLYING_ASSET_ADDRESS());\n    // Gets the specific rewards controller for this token type\n    aaveIncentivesController = _aWant.getIncentivesController();\n\n    aaveLmReceiver = _aaveLmReceiver;\n  }\n\n  // Returns the current Aave lending pool address that should be used\n  function getLp() internal view returns (ILendingPool) {\n    return ILendingPool(LP_ADDRESS_PROVIDER.getLendingPool());\n  }\n\n  /// @notice Checks the aUSDC balance in this contract\n  function balanceOf() public view override returns (uint256) {\n    return aWant.balanceOf(address(this));\n  }\n\n  /// @notice Deposits all USDC held in this contract into Aave's lending pool\n  function deposit() external override whenNotPaused {\n    ILendingPool lp = getLp();\n    // Checking the USDC balance of this contract\n    uint256 amount = want.balanceOf(address(this));\n    if (amount == 0) revert InvalidConditions();\n\n    // If allowance for this contract is too low, approve the max allowance\n    if (want.allowance(address(this), address(lp)) < amount) {\n      want.safeApprove(address(lp), type(uint256).max);\n    }\n\n    // Deposits the full balance of USDC held in this contract into Aave's lending pool\n    lp.deposit(address(want), amount, address(this), 0);\n  }\n\n  /// @notice Withdraws all USDC from Aave's lending pool back into the Sherlock core contract\n  /// @dev Only callable by the Sherlock core contract\n  /// @return The final amount withdrawn\n  function withdrawAll() external override onlySherlockCore returns (uint256) {\n    ILendingPool lp = getLp();\n    if (balanceOf() == 0) {\n      return 0;\n    }\n    // Withdraws all USDC from Aave's lending pool and sends it to the Sherlock core contract (msg.sender)\n    return lp.withdraw(address(want), type(uint256).max, msg.sender);\n  }\n\n  /// @notice Withdraws a specific amount of USDC from Aave's lending pool back into the Sherlock core contract\n  /// @param _amount Amount of USDC to withdraw\n  function withdraw(uint256 _amount) external override onlySherlockCore {\n    // Why do we only check if _amount is equal to the max value?\n    if (_amount == type(uint256).max) revert InvalidArgument();\n\n    ILendingPool lp = getLp();\n    // Withdraws _amount of USDC and sends it to the Sherlock core contract\n    // If the amount withdrawn is not equal to _amount, it reverts\n    if (lp.withdraw(address(want), _amount, msg.sender) != _amount) revert InvalidConditions();\n  }\n\n  // Claims the stkAAVE rewards and sends them to the receiver address\n  function claimRewards() external whenNotPaused {\n    // Creates an array with one slot\n    address[] memory assets = new address[](1);\n    // Sets the slot equal to the address of aUSDC\n    assets[0] = address(aWant);\n\n    // Claims all the rewards on aUSDC and sends them to the aaveLmReceiver (an address controlled by governance)\n    // Tokens are NOT meant to be (directly) distributed to stakers.\n    aaveIncentivesController.claimRewards(assets, type(uint256).max, aaveLmReceiver);\n  }\n\n  /// @notice Function used to check if this is the current active yield strategy\n  /// @return Boolean indicating it's active\n  /// @dev If inactive the owner can pull all ERC20s and ETH\n  /// @dev Will be checked by calling the sherlock contract\n  function isActive() public view returns (bool) {\n    return address(sherlockCore.yieldStrategy()) == address(this);\n  }\n\n  // Only contract owner can call this\n  // Sends all specified tokens in this contract to the receiver's address (as well as ETH)\n  function sweep(address _receiver, IERC20[] memory _extraTokens) external onlyOwner {\n    if (_receiver == address(0)) revert ZeroArgument();\n    // This contract must NOT be the current assigned yield strategy contract\n    if (isActive()) revert InvalidConditions();\n    // Executes the sweep for ERC-20s specified in _extraTokens as well as for ETH\n    _sweep(_receiver, _extraTokens);\n  }\n}"
}