generated from sushiswap/hardhat-foundation
/
IStrategy.sol
27 lines (22 loc) · 1.52 KB
/
IStrategy.sol
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
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity 0.8.7;
interface IStrategy {
/// @notice Send the assets to the Strategy and call skim to invest them.
/// @param amount The amount of tokens to invest.
function skim(uint256 amount) external;
/// @notice Harvest any profits made converted to the asset and pass them to the caller.
/// @param balance The amount of tokens the caller thinks it has invested.
/// @param sender The address of the initiator of this transaction. Can be used for reimbursements, etc.
/// @return amountAdded The delta (+profit or -loss) that occured in contrast to `balance`.
function harvest(uint256 balance, address sender) external returns (int256 amountAdded);
/// @notice Withdraw assets. The returned amount can differ from the requested amount due to rounding.
/// @dev The `actualAmount` should be very close to the amount.
/// The difference should NOT be used to report a loss. That's what harvest is for.
/// @param amount The requested amount the caller wants to withdraw.
/// @return actualAmount The real amount that is withdrawn.
function withdraw(uint256 amount) external returns (uint256 actualAmount);
/// @notice Withdraw all assets in the safest way possible. This shouldn't fail.
/// @param balance The amount of tokens the caller thinks it has invested.
/// @return amountAdded The delta (+profit or -loss) that occured in contrast to `balance`.
function exit(uint256 balance) external returns (int256 amountAdded);
}