Strategy
Contract Overview
The Strategy
contract is designed to manage the parameters and operational settings for a lending strategy. It interacts with an oracle to fetch token prices and uses these prices to determine the validity of the strategy's intent. Or the Strategy Manager can encapsute its own Strike Price logic. The contract supports functionalities such as setting strategy parameters, pausing/unpausing the contract, and retrieving intent data.
Read Methods
1. getIntentData
Returns
Name | Type | Description |
---|---|---|
invalid | bool | Indicates if the strategy is invalid or the contract is paused. |
data | DataTypes.Intent memory | The current intent data including adjusted price, interest rate, and loan duration. |
This function retrieves the current price from the oracle and calculates the adjusted price using the adjustment factor. It also checks if the strategy is invalid due to being paused or if the price is outside the acceptable range.
Write Methods
1. setStrategy
Parameters
Name | Type | Description |
---|---|---|
_loanDuration | uint256 | The duration of the loan in seconds. |
_interestRate | uint256 | The interest rate for the loan. |
_adjustmentFactor | uint256 | The factor used to adjust the price. |
Sets the strategy parameters including loan duration, interest rate, and adjustment factor. Reverts if the parameters are outside the acceptable ranges.
Notice:
- Modifier: Only the contract owner can call this function.
2. setOperationalParams
Parameters
Name | Type | Description |
---|---|---|
_minSpotPrice | uint256 | The minimum acceptable spot price. |
_maxSpotPrice | uint256 | The maximum acceptable spot price. |
Sets the operational parameters including the minimum and maximum spot prices. Reverts if the minimum price is greater than or equal to the maximum price.
Notice:
- Modifier: Only the contract owner can call this function.
3. pause
Pauses the contract, preventing certain actions from being performed. Can only be called by the owner.
Notice:
- Modifier: Only the contract owner can call this function.
- Reason: To allow the owner to pause the contract in case of emergencies or maintenance.
4. unpause
Unpauses the contract, allowing actions to be performed again. Can only be called by the owner.
Notice:
- Modifier: Only the contract owner can call this function.
- Reason: To allow the owner to resume contract operations after an emergency or maintenance.
Constructor
Parameters
Name | Type | Description |
---|---|---|
_oracle | address | The address of the oracle contract. |
_collToken | address | The address of the collateral token. |
_borrowToken | address | The address of the borrow token. |
Initializes the contract with the provided oracle, collateral token, and borrow token addresses. Reverts if any of the addresses are zero.