# Strategy

## Strategy

This is an abstract contract that implements key functionality for all strategies. For example, the AaveLeverageStrategy contract inherits from Strategy and AaveCore.

### collateralToken

```solidity
contract IERC20 collateralToken
```

### receiptToken

```solidity
address receiptToken
```

### pool

```solidity
address pool
```

### feeCollector

```solidity
address feeCollector
```

### swapManager

```solidity
contract ISwapManager swapManager
```

### oraclePeriod

```solidity
uint256 oraclePeriod
```

### oracleRouterIdx

```solidity
uint256 oracleRouterIdx
```

### swapSlippage

```solidity
uint256 swapSlippage
```

### \_keepers

```solidity
struct EnumerableSet.AddressSet _keepers
```

### UpdatedFeeCollector

```solidity
event UpdatedFeeCollector(address previousFeeCollector, address newFeeCollector)
```

### UpdatedSwapManager

```solidity
event UpdatedSwapManager(address previousSwapManager, address newSwapManager)
```

### UpdatedSwapSlippage

```solidity
event UpdatedSwapSlippage(uint256 oldSwapSlippage, uint256 newSwapSlippage)
```

### UpdatedOracleConfig

```solidity
event UpdatedOracleConfig(uint256 oldPeriod, uint256 newPeriod, uint256 oldRouterIdx, uint256 newRouterIdx)
```

### addKeeper

```solidity
function addKeeper(address _keeperAddress) external
```

Add given address in keepers list.

| Name            | Type    | Description            |
| --------------- | ------- | ---------------------- |
| \_keeperAddress | address | keeper address to add. |

### keepers

```solidity
function keepers() external view returns (address[])
```

Return list of keepers

### migrate

```solidity
function migrate(address _newStrategy) external virtual
```

Migrate all asset and vault ownership,if any, to new strategy

\_*beforeMigration hook can be implemented in child strategy to do extra steps.*

| Name          | Type    | Description             |
| ------------- | ------- | ----------------------- |
| \_newStrategy | address | Address of new strategy |

### removeKeeper

```solidity
function removeKeeper(address _keeperAddress) external
```

Remove given address from keepers list.

| Name            | Type    | Description               |
| --------------- | ------- | ------------------------- |
| \_keeperAddress | address | keeper address to remove. |

### updateFeeCollector

```solidity
function updateFeeCollector(address _feeCollector) external
```

Update fee collector

| Name           | Type    | Description           |
| -------------- | ------- | --------------------- |
| \_feeCollector | address | fee collector address |

### updateSwapManager

```solidity
function updateSwapManager(address _swapManager) external
```

Update swap manager address

| Name          | Type    | Description          |
| ------------- | ------- | -------------------- |
| \_swapManager | address | swap manager address |

### updateSwapSlippage

```solidity
function updateSwapSlippage(uint256 _newSwapSlippage) external
```

### updateOracleConfig

```solidity
function updateOracleConfig(uint256 _newPeriod, uint256 _newRouterIdx) external
```

### approveToken

```solidity
function approveToken() external
```

*Approve all required tokens*

### setupOracles

```solidity
function setupOracles() external
```

### withdraw

```solidity
function withdraw(uint256 _amount) external
```

*Withdraw collateral token from lending pool.*

| Name     | Type    | Description                |
| -------- | ------- | -------------------------- |
| \_amount | uint256 | Amount of collateral token |

### rebalance

```solidity
function rebalance() external virtual
```

*Rebalance profit, loss and investment of this strategy*

### sweepERC20

```solidity
function sweepERC20(address _fromToken) external
```

*sweep given token to feeCollector of strategy*

| Name        | Type    | Description            |
| ----------- | ------- | ---------------------- |
| \_fromToken | address | token address to sweep |

### token

```solidity
function token() external view returns (address)
```

Returns address of token correspond to collateral token

### totalValue

```solidity
function totalValue() public view virtual returns (uint256 _value)
```

Calculate total value of asset under management

*Report total value in collateral token*

### totalValueCurrent

```solidity
function totalValueCurrent() external virtual returns (uint256)
```

Calculate total value of asset under management (in real-time)

*Report total value in collateral token*

### isReservedToken

```solidity
function isReservedToken(address _token) public view virtual returns (bool)
```

Check whether given token is reserved or not. Reserved tokens are not allowed to sweep.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.vesper.finance/vesper-developers/vesper-contracts-api-reference/strategy-contracts/strategy.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
