DeFi Saver
Search…
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:
1
contract StrategyExecutor {
2
3
/// @notice Checks all the triggers and executes actions
4
/// @dev Only authorized callers can execute it
5
/// @param _subId Id of the subscription
6
/// @param _strategyIndex Which strategy in a bundle, need to specify because when sub is part of a bundle
7
/// @param _triggerCallData All input data needed to execute triggers
8
/// @param _actionsCallData All input data needed to execute actions
9
/// @param _sub StrategySub struct needed because on-chain we store only the hash
10
function executeStrategy(
11
uint256 _subId,
12
uint256 _strategyIndex,
13
bytes[] calldata _triggerCallData,
14
bytes[] calldata _actionsCallData,
15
StrategySub memory _sub
16
) public
17
18
}
Copied!
Last modified 1d ago
Copy link