Actions
Action Types
- 🔢 Priceable: Must include
amount.asset
andamount.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
- Emission - Adapter emits action with required fields
- Validation - Engine validates action structure
- Pricing - Priceable actions get USD valuations
- Deduplication - Same
id
actions are deduped - Export - Actions written to configured sinks