Alert System

Learn how to set up custom alerts for price movements, APY changes, protocol events, and portfolio activity to stay informed of important Solana DeFi opportunities and risks.

Overview

Difract's alert system keeps you informed about important events related to your Solana DeFi activities without requiring constant monitoring. You can set up custom alerts based on various conditions and receive notifications through multiple channels.

Note: Alerts can be customized based on your specific needs and risk tolerance. We recommend setting up alerts for both opportunities and risks in the Solana ecosystem.

The alert system is designed to help you:

  • Respond quickly to market opportunities on Solana
  • Protect your positions from adverse conditions
  • Track protocol changes and governance proposals
  • Monitor your Solana portfolio's performance and health

Notification Channels

Difract offers multiple channels for receiving alerts, allowing you to choose the most convenient option for your workflow:

In-App Notifications

  • Dashboard notification center
  • Real-time popups for critical alerts
  • Notification history log

External Notifications

  • Email notifications
  • SMS alerts (for critical events)
  • Mobile push notifications

Integration Options

  • Webhook support
  • Discord/Telegram bots
  • Calendar integrations

Setting Up Notification Channels

Configure your preferred notification channels in the settings panel or when creating a new alert:

// Example: Configuring notification channels
await difract.alerts.configureChannels({
  email: {
    addresses: ['user@example.com'],
    frequency: 'instant', // 'instant', 'digest', 'daily'
    minSeverity: 'info' // 'critical', 'warning', 'info'
  },
  push: {
    enabled: true,
    minSeverity: 'warning'
  },
  sms: {
    phoneNumbers: ['+1234567890'],
    minSeverity: 'critical',
    timeRestricted: {
      enabled: true,
      allowedHours: [9, 22] // Only send between 9am and 10pm
    }
  },
  discord: {
    webhookUrl: 'https://discord.com/api/webhooks/your-webhook-url',
    channelId: 'your-channel-id'
  }
});

Portfolio Alerts

Portfolio alerts notify you of changes related to your overall Solana portfolio, including value fluctuations, yield performance, and risk metrics.

Available Portfolio Alert Types

  • Total Value Change: Alerts when your portfolio value increases or decreases by a specified percentage
  • Yield Performance: Notifications when your yield drops below a threshold or increases above a target
  • Risk Exposure: Alerts for changes in your portfolio's risk profile or concentration
  • Transaction Fees: Notifications when priority fees or compute costs exceed a specified threshold
// Example: Setting up portfolio alerts
await difract.alerts.create({
  type: 'portfolio',
  conditions: [
    {
      metric: 'totalValue',
      operator: 'decreaseBy',
      threshold: 10, // percentage
      timeframe: '24h'
    },
    {
      metric: 'averageYield',
      operator: 'lessThan',
      threshold: 5, // percentage APY
    },
    {
      metric: 'protocolExposure',
      operator: 'greaterThan',
      threshold: 40, // percentage in one protocol
      protocols: ['marinade', 'orca', 'raydium']
    }
  ],
  name: 'Solana Portfolio Health Monitor',
  severity: 'warning',
  enabled: true
});

Protocol Alerts

Protocol alerts notify you of important events and changes in the Solana DeFi protocols you use or are interested in monitoring.

Available Protocol Alert Types

  • TVL Changes: Alerts for significant increases or decreases in total value locked
  • Governance Proposals: Notifications for new proposals, voting periods, and execution on Realms or other governance platforms
  • Protocol Upgrades: Alerts for program upgrades, new features, or security patches
  • Risk Indicators: Notifications for changes in protocol risk metrics or audit status

Caution: Significant TVL drops or unusual protocol behavior could indicate potential security issues. Consider setting up alerts with lower thresholds for protocols with your largest exposures.

// Example: Setting up protocol alerts
await difract.alerts.create({
  type: 'protocol',
  protocols: ['marinade', 'raydium', 'orca'],
  conditions: [
    {
      metric: 'tvl',
      operator: 'decreaseBy',
      threshold: 15, // percentage
      timeframe: '24h'
    },
    {
      metric: 'governance',
      events: ['proposal.created', 'proposal.activeVoting', 'proposal.executed'],
      includeDetails: true
    },
    {
      metric: 'utilization',
      operator: 'greaterThan',
      threshold: 85, // percentage
      assets: ['USDC', 'USDT', 'SOL']
    }
  ],
  name: 'Solana Protocol Health Monitor',
  severity: 'warning',
  enabled: true
});

Market Alerts

Market alerts keep you informed about price movements, liquidity changes, and market conditions that could affect your Solana DeFi positions.

Available Market Alert Types

  • Price Movements: Alerts when asset prices cross specified thresholds or exhibit volatility
  • Liquidity Changes: Notifications for significant changes in pool liquidity
  • Correlation Shifts: Alerts when asset correlations change, affecting diversification
  • Market Sentiment: Notifications based on market sentiment indicators
// Example: Setting up market alerts
await difract.alerts.create({
  type: 'market',
  assets: ['SOL', 'mSOL', 'USDC/USDT'],
  conditions: [
    {
      metric: 'price',
      operator: 'crossesAbove',
      threshold: 150, // USD
      asset: 'SOL'
    },
    {
      metric: 'price',
      operator: 'percentageChange',
      threshold: 10, // percentage
      direction: 'either', // 'up', 'down', 'either'
      timeframe: '24h',
      asset: 'mSOL'
    },
    {
      metric: 'liquidity',
      operator: 'decreaseBy',
      threshold: 30, // percentage
      timeframe: '24h',
      asset: 'USDC/USDT', // For a specific pool
      dexes: ['raydium', 'orca', 'openbook']
    }
  ],
  name: 'Solana Market Movement Monitor',
  severity: 'info',
  enabled: true
});

Transaction Alerts

Transaction alerts notify you about on-chain activities related to your Solana wallet addresses, including deposits, withdrawals, swaps, and other transactions.

Available Transaction Alert Types

  • Transaction Status: Alerts for pending, confirmed, or failed transactions
  • Large Transfers: Notifications for significant value movements in or out of your wallets
  • Program Interactions: Alerts when specific Solana programs interact with your addresses
  • Fee Anomalies: Notifications for unusual priority fee costs or network congestion
// Example: Setting up transaction alerts
await difract.alerts.create({
  type: 'transaction',
  wallets: ['CuieVDEDtLo7FypA9SbLM9saXFdb1dsshEkyErMqkRQq', 'EKpQGSJtjMFqKZ9KQanSqYXRcF8fBopzLHYxdM65zcjm'],
  conditions: [
    {
      metric: 'status',
      events: ['pending', 'confirmed', 'failed'],
      minValue: 1000, // USD equivalent
    },
    {
      metric: 'transfer',
      direction: 'outgoing',
      operator: 'greaterThan',
      threshold: 5000, // USD equivalent
      assets: ['SOL', 'USDC', 'mSOL']
    },
    {
      metric: 'programInteraction',
      programs: [
        'JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4', // Jupiter aggregator
        'MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD', // Marinade Finance program
      ],
      includeFailedTxs: true
    }
  ],
  name: 'Solana Transaction Monitor',
  severity: 'warning',
  enabled: true
});

Alert Management

Difract provides tools to manage your Solana alerts effectively, ensuring you receive relevant notifications without being overwhelmed.

Alert Dashboard

The alert dashboard allows you to view, edit, and manage all your configured alerts in one place. From here, you can:

  • Enable or disable individual alerts
  • Edit alert conditions and thresholds
  • View alert history and triggered events
  • Create new alerts from templates
  • Group alerts by category or severity

Alert Snoozing and Filtering

Control when and how you receive notifications to prevent alert fatigue:

// Example: Managing alerts
// Snooze all non-critical alerts for 24 hours
await difract.alerts.snooze({
  duration: 24 * 60 * 60, // seconds
  excludeSeverity: ['critical']
});

// Configure quiet hours
await difract.alerts.configureQuietHours({
  enabled: true,
  startHour: 22, // 10 PM
  endHour: 8, // 8 AM
  timeZone: 'America/New_York',
  overrideForSeverity: ['critical'] // Critical alerts bypass quiet hours
});

// Get alert history
const alertHistory = await difract.alerts.getHistory({
  timeframe: '7d',
  severities: ['warning', 'critical'],
  limit: 50
});

// Delete unused alerts
await difract.alerts.delete({
  ids: ['alert-1', 'alert-2'],
  // OR
  unusedSince: '30d' // Delete alerts not triggered in 30 days
});

Next Steps