This is technical documentation about the DeFi Saver SDK. If you are looking for information about using the DeFi Saver app, please visit our help center.
DeFi Saver is an advanced management dashboard for all your DeFi needs.
The following documentation will go over the Solidity architecture that powers DeFi Saver and provide an in-depth explanation on how it works.
With DeFi Saver you can manage and interact between decentralized finance protocols. By creating strategies you can create advanced actions that will be executed automatically when certain conditions are met. The code is open source and runs on the Ethereum blockchain.
Overview of main system components for executing strategy
A contract which will perform a specific action (e.g. Maker Payback). It inherits the standard ActionBase. Actions are proxy/logic contracts that are called through user's wallet (Safe/DSProxy) and can’t hold any state.
A contract which will perform a check if a certain condition is met (e.g. whether Maker Vault's collateralization ratio is lower than specified). It inherits the standard TriggerInterface.
A recipe is a series of actions that are bundled together and executed in one sequence. Actions can share return values and use them as inputs in next actions.
A recipe can be either executed immediately or through a strategy. If a flash loan action is used within a recipe, it must be the first action.
Is the main building block. A Strategy is an array of triggers and a recipe, where the recipe will be executed if all the specified trigger conditions are met. Users build their own strategies which are executed by bots.
A list of strategies that have the same triggers but their recipes are different. A good example is a normal repay and a repay with a flash loan, would be in a repay bundle. The bot can choose which recipe is better at time of execution. Users can subscribe to a bundle, rather than multiple strategies to save on gas cost.
Users subscribe to certain strategies and write their own data for that strategy. For instance if a strategy involves makerdao, user subscription might include the users vaultId. Users can subscribe to multiple strategies with different subscription data.