For the complete documentation index, see llms.txt. This page is also available as Markdown.

Dollar-Cost Averaging (DCA)

The goal of this function is to periodically buy a fixed amount of a token using slippage-protected swaps.

For example, suppose the inputs are:

  • Token In: USDC

  • Token Out: WETH

And the cron trigger schedule is 30 19 * * 0, meaning:

  • 30 -> minute

  • 19 -> hour UTC

  • * -> every day of the month

  • * -> every month

  • 0 -> 0 = Sunday, 1 = Monday, etc

Then the function will buy 100 USDC worth of WETH every Sunday at 7:30 PM UTC.

Function

https://github.com/mimic-protocol/examples/blob/main/examples/12-dollar-cost-averaging/src/function.ts

Github link

Manifest

https://github.com/mimic-protocol/examples/blob/main/examples/12-dollar-cost-averaging/manifest.yaml

Github link

Last updated