DeFi Saver
Strategy Executor
This is the main and only entry point to trigger the execution of strategies. The public function executeStrategy() is only callable by certain addresses, which is enforced by the BotAuth contract. Besides those checks, there are a few others; first because the bot calling is sending the full StrategySub struct the hash is checked if it's valid. Second, each sub can be enabled/disabled by the user that created it, and there is also a check if the sub is allowed. Once the conditions are passed ProxyAuth is called (which holds users DSProxy authorizations) and from ProxyAuth users DSProxy calls RecipeExecutor.
Triggers are not checked in the StrategyExecutor but rather in RecipeExecutor to enable changeable triggers and some minor gas cost savings.
Below is the interface of the contract:
contract StrategyExecutor {
/// @notice Checks all the triggers and executes actions
/// @dev Only authorized callers can execute it
/// @param _subId Id of the subscription
/// @param _strategyIndex Which strategy in a bundle, need to specify because when sub is part of a bundle
/// @param _triggerCallData All input data needed to execute triggers
/// @param _actionsCallData All input data needed to execute actions
/// @param _sub StrategySub struct needed because on-chain we store only the hash
function executeStrategy(
uint256 _subId,
uint256 _strategyIndex,
bytes[] calldata _triggerCallData,
bytes[] calldata _actionsCallData,
StrategySub memory _sub
) public
Copy link