Skip to main content

DCA CPI Integration

This section contains examples of composing Jupiter's DCA program in your program via Cross Program Invocation (CPI).

Our aim is to simplify the process for our partners to integrate Jupiter's DCA for customized incentive programs.

Use Cases

The use cases for DCA are limitless. Feel free to use the following example as an inspiration to introduce your own functionalities.

Our example code allows you to have your own customized frontend + program that incentivizes users to DCA into your token in order to receive additional airdrops from you.

Open Sourced Code

The open-sourced example allows you to airdrop additional tokens to users who DCA into your token.

Setting up (Program)

  1. Fork and clone
  2. Adjust the parameters
  3. Generate a new program ID and modify the program code
  4. Deploy the program to Solana

Setting up (Airdrop Script)

  1. Replace with your deployed program ID here
  2. Set env var ADMIN_PRIVATE_KEY - this is the account you will use to execute airdrops (it should contain sufficient tokens to airdrop + SOL to perform transactions)
  3. Run the airdrop script cd app && npm i && npm run airdrop code

Setting up (Frontend)

  1. Fork and clone
  2. Replace the program ID here
  3. Craft new plans for the campaigns - Plans are hardcoded on the Frontend, and enforce on the contract level.
export const SECONDS_IN_MINUTE = 60; // 1 minute
export const SECONDS_IN_DAY = 86400; // 1 day
export const LOCKING_PLAN: ILockingPlan[] = [
name: `5 minutes`,
incetivesPct: 0,
cycleSecondsApart: SECONDS_IN_MINUTE, // executed per minute
numberOfTrade: 5,
name: `60 days`,
incetivesPct: 20,
cycleSecondsApart: SECONDS_IN_DAY,
numberOfTrade: 60, // executed daily
name: `90 days`,
incetivesPct: 30,
cycleSecondsApart: SECONDS_IN_DAY,
numberOfTrade: 90, // executed daily


Here's how it works

A user creates a DCA via your frontend and program. This creates an escrow account that integrates with Jupiter's DCA program.

Once the DCA is completed (all orders are executed), the user will then be able to claim the tokens that they bought. Once they claim their tokens, the airdrop script will airdrop additional tokens from your admin account to them.

User flow

  1. User create a DCA order via your deployed UI.
  2. DCA completes within the preset duration.
  3. User will be able to navigate to the site and close their escrow and receive the output token from the executed DCA orders.
  4. Once the order and escrow has been closed, partners and integrators will automatically airdrop rewards or incentives directly into user's wallet (With the provided script running in a infinite loop in the background)