Creating Incentives

Step-by-step guide to creating any type of incentive

Every incentive follows the same pattern: set up your data sourcegenerate a querypreview resultscreate the incentive. The setup step varies by action type.

Choose Your Action Type

ActionWhat It TracksSetup Required
SwapToken trades on DEXs (Jupiter, Raydium, etc.)None — already indexed
Bonding CurveTrades on launchpads (Raydium Launchlab, Metaplex Genesis)None — already indexed
HoldToken balance at evaluation timeNone — already indexed
Custom EventOff-chain activity (signups, social actions, purchases)Event schema + data ingestion
IDL InstructionOn-chain Solana program interactionsIDL upload

Token Incentives (Zero Setup)

Token incentives reward on-chain token activity using already-indexed data. No setup required.

1

Generate the query

Use generate_incentive_query with the appropriate source:

Swap — track DEX trades:

source: "swap"
tokenMint: "your-token-mint"
direction: "buy"
measure: "volume"

Bonding Curve — track launchpad trades:

source: "bonding_curve"
tokenMint: "your-token-mint"
launchpad: "raydium_launchlab"
measure: "volume"

Hold — track token holders:

source: "hold"
tokenMint: "your-token-mint"
measure: "balance"
minBalance: 1000
2

Preview results

Use preview_incentive_query to validate against real data:

sqlQuery: "<the generated SQL>"
3

Create the incentive

Use create_recurring_incentive with the query and reward configuration:

name: "Weekly Swap Leaderboard"
type: "leaderboard"
emissionType: "TOKENS"
tokenAddress: "your-token-mint"
tokenDecimals: 9
totalFundAmount: 1000
interval: "WEEKLY"
startDate: "2025-01-01T00:00:00Z"
sqlQuery: "<the generated SQL>"

Token Incentive Examples

RecipeSourceMeasureDirectionType
Top Buyers by Volumeswapvolumebuyleaderboard
Hold Rewardsholdbalanceleaderboard or rebate
Bonding Curve Early Buyersbonding_curvevolumebuyleaderboard
Swap Raffleswapcountbuyraffle

Custom Event Incentives

Custom event incentives track off-chain activity — social actions, content creation, purchases, game events.

1

Create the event schema

Use create_custom_event to define your event:

eventName: "content_share"
name: "Content Share"
fields: [
  { fieldName: "platform", type: "string" },
  { fieldName: "reach", type: "number" },
  { fieldName: "verified", type: "boolean" }
]
2

Attach to your project

Use attach_custom_event to make it available for incentives:

customEventId: "<the event ID from step 1>"
3

Send event data

Use the ingestion API with your API key:

curl -X POST https://ingest.torque.so/events \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key" \
  -d '{
    "userPubkey": "wallet-address",
    "timestamp": 1234567890000,
    "eventName": "content_share",
    "data": {
      "platform": "twitter",
      "reach": 1500,
      "verified": true
    }
  }'
4

Generate, preview, and create

Generate the query:

source: "custom_event"
customEventId: "<the event ID>"
valueExpression: "SUM(reach)"
filters: ["verified = true"]

Preview with preview_incentive_query, then create with create_recurring_incentive (include customEventId in the creation call).

Events must be ingested at least once before they become query-ready. Use list_project_events to check which events are ready.

IDL Instruction Incentives

IDL instruction incentives reward users for interacting with specific instructions in your Solana program.

1

Parse the IDL

Use parse_idl to inspect your Anchor IDL:

filePath: "/path/to/your/idl.json"
2

Upload the IDL

Use create_idl to upload and select instructions to track:

filePath: "/path/to/your/idl.json"
displayName: "My Program"
selectedInstructions: [
  {
    instructionName: "buy_exact_in",
    fields: [
      { fieldName: "amount_in", type: "number" },
      { fieldName: "min_amount_out", type: "number" }
    ],
    accounts: ["payer", "pool"]
  }
]
3

Generate, preview, and create

Generate the query:

source: "idl_instruction"
instructionId: "<the instruction ID from step 2>"
valueExpression: "SUM(amount_in)"

Preview with preview_incentive_query, then create with create_recurring_incentive (include instructionId in the creation call).

Use list_idls to see uploaded IDLs and their tracked instructions. Use create_instruction to add instructions to an existing IDL.

Reward Types

Once you have a query, choose how rewards are distributed:

TypeHow It WorksKey Params
LeaderboardRank users by metric, distribute via formulacustomFormula
RebateReturn a % of each user's metric valuerebatePercentage
RaffleWeighted random draw from qualifying usersraffleBuckets, raffleWeighting
DirectFixed amounts to specific walletsallocations

See Incentive Types for full details on each type, formulas, and examples.