Welcome to the DeFi Saver knowledge base.

How can I reuse output of previous functions?

Written by Nikola Jankovic
Updated 3 months ago

When chaining actions together, it can be useful to use the output of one action as the input of another. The simplest example would be following a Sell action with a Supply action. As the output of a Sell cannot be known ahead of time (it can only be estimated), you can directly link its output to be used as the input of the Supply action later on. This way, no "dust" is left behind (i.e. you don’t have to underestimate the output of the Sell action) and recipe creation is made easier. 

Whenever the UI detects you can reuse previous outputs, it will be shown with a dropdown allowing you to to select a value, along with its source. If the original value is changed, the value passed down will be updated too. 

Did this answer your question?