Actions – Absinthe Docs
Skip to content

Actions

Action Types

  • 🔢 Priceable: Must include amount.asset and amount.amount
  • 📊 Non-priceable: Omitted from pricing but still exported for "it happened" analytics

Special Handling

Swaps: Emit two actions (one per leg) under the same id. The enrichment step dedupes by id and keeps the first leg that successfully prices.

Usage in Adapters

Actions represent instantaneous events in your protocol. Here's how to emit them:

// Priceable action (will be priced)
emit('action', {
  id: 'swap-123',
  user: userAddress,
  amount: {
    asset: '0xA0b86a33E6441e88C5F2712C3E9b74F5b8E4E0c4', // USDC
    amount: '1000000' // 1 USDC
  },
  type: 'swap'
});
 
// Non-priceable action (analytics only)
emit('action', {
  id: 'claim-456',
  user: userAddress,
  type: 'claim'
});

Action Lifecycle

  1. Emission - Adapter emits action with required fields
  2. Validation - Engine validates action structure
  3. Pricing - Priceable actions get USD valuations
  4. Deduplication - Same id actions are deduped
  5. Export - Actions written to configured sinks