Discord alerts: How to set up a 24/7 DeFi activity monitor

by Esprezzo Team on October 30, 2024

How-to-set-up-Discord-for-DeFi-activityDiscord has become the hub for communities of all kinds. For Web3 communities, it's the go-to spot for everything from sharing alpha and discussing new projects to getting support for products, marketplaces, and devtools. If you’re into Web3 and use Discord, you've likely noticed the proliferation of Discord bots designed to manage communities, track crypto prices, and alert communities about NFT and DeFi activity. However, many of these bots come with a hefty price tag or require coding skills to integrate.

Enter Dispatch: a game-changer for monitoring on-chain activity without any coding. Dispatch seamlessly connects with Discord, allowing you to get automated, real-time on-chain activity updates directly in your server or DMs. Whether you're interested in tracking token movements, keeping an eye on liquidity changes, or want to create a self-updating channel with the latest updates on your project's activity, Dispatch makes it easy.

 In this guide, we'll walk you through setting up DeFi alerts in your Discord channel using Dispatch. We'll be using Velodrome Finance's Router smart contract on the Optimism network. By the end of this guide, you'll have created a real-time data feed for this DeFi protocol—a skill you can apply to any blockchain project you're interested in. It's like having a personal Web3 assistant delivering on-chain updates directly to your Discord, keeping you informed about critical activities as they happen.

What you'll need to set up DeFi alerts in Discord

Before we get started, make sure you have the following:

Step-by-step guide overview

In this guide, we'll walk you through these steps:

  • Creating a new Discord channel for your alerts
  • Setting up a Dispatch account and connecting it to your Discord server
  • Creating a Patch (data stream) in Dispatch
  • Customizing your data stream to focus on specific on-chain activity
  • Testing your setup to ensure everything is working correctly

By the end of this guide, you'll have created a Discord bot that provides real-time updates on key activities in Velodrome Finance's ecosystem. For this demo, we’ll be setting up a data stream for one of Velodrome’s smart contracts on the Optimism network, but as mentioned previously, you can use Dispatch to create data streams for any smart contract on a variety of EVM networks, including Arbitrum, Base, Ethereum, and Polygon. 

Watch our step-by-step video guide below to get started, or continue reading for detailed instructions:

Creating a new Discord channel

If you already have a channel where you'd like to receive DeFi alerts, you can skip ahead to the next section. If not, here's how to create a new channel: 

1. Open your Discord server 
2. In the left sidebar, locate the "+" icon next to "TEXT CHANNELS" 
3. Click the "+" icon to create a new channel 
4. Name your channel something descriptive like "defi-alerts" or "velodrome-tracking" 
5. Click "Create Channel" to finishCreating-a-new-Discord-channel

Creating a Discord channel

Note: If you encounter any issues with channel creation or permissions, check out Discord troubleshooting guide for detailed help.

Setting up your Patch in Dispatch

Now that you have a dedicated channel for your DeFi alerts, let's create a data stream (Patch) in Dispatch to monitor Velodrome Finance and send alerts to your Discord server. Before we begin, make sure you’re logged into your Dispatch account.


1. Create a new Patch

  • Select "Smart Contract Activity" as the Trigger
  • Choose "Discord" as the Action

Create-a-Patch-or-automationStart setting up smart contract activity alerts with Dispatch

 

2. Add the Velodrome Finance smart contract

Like other DEXs, Velodrome uses many smart contracts to handle different pieces of logic and data. For this example, we’ll be setting up a data stream for the Router smart contract so that we can get insights into swaps and liquidity changes.

Let’s tell Dispatch which contract to monitor on the Optimism network:

  • Network: Optimism
  • Velodrome Finance's Router contract address: 0xa062aE8A9c5e11aaA026fc2670B0D65cCc8B2858
  • Give your contract a memorable nickname (e.g., "Velodrome Finance Router Contract")

Contract nicknames are useful when you’re creating data streams for multiple contracts from the same project, and if you’ll be using that contract for other data streams later. You can change the contract’s nickname after you create the Patch, so don’t worry about it too much.

Select-the-network-in-DispatchIt’s easy to add smart contracts to Dispatch for activity monitoring

3. Select the smart contract activity to monitor

Choose the specific events or functions you want to track. For Velodrome Finance, consider monitoring functions such as:

  • addLiquidity
  • addLiquidityETH
  • removeLiquidity
  • removeLiquidityETH
  • swapExactETHForTokens

Select-smart-contract-activitySelecting smart contract activity to monitor

 

4. Configure the Discord integration

On the Action details step:

  • Select "Post in a Discord server" as the Action
  • Choose your Discord server as the Destination
  • Select the channel you created earlier for DeFi alerts
  • Click "Continue" to proceed

Connecting-Discord-to-DispatchConnecting Discord server to Dispatch

 

5. Test and turn on the Patch

Finalize your Patch setup:

  • Test your Patch (highly recommended to ensure Dispatch can send alerts to the destination you’ve provided)
  • Give your Patch a descriptive name
  • Click the "Turn Patch on" button

Test-the-Action-in-DispatchTesting Action in Dispatch Patch Builder

What if your Discord test fails?
If you get an error when testing whether Dispatch can send to your Discord destination, make sure you have the correct permissions in the server, and that the channel you’ve selected allows bots to post. Get more troubleshooting help here.

You're all set!

Now that your Patch is active, you'll start receiving real-time alerts in your Discord channel whenever specific events occur on the Velodrome Finance Router contract. Anytime liquidity is added or removed, or when swaps are executed, you'll see a new message in your designated Discord channel with the details you've selected.

Here's an example of what your alerts might look like: 

Velodrome-Finance-example-Discord-alert

Example Dispatch alerts in Discord

This setup is just the beginning of what you can do with Dispatch. Beyond monitoring DeFi activity, you can use Dispatch to track a wide range of on-chain events across various protocols and chains. Whether you're interested in monitoring governance proposals, transfers, or specific user interactions, Dispatch can help you stay informed in real-time.

Want to give Dispatch a try? 

If you liked this tutorial and want to try other automations, sign up for a free Dispatch account. 

Esprezzo Team
Esprezzo Team

We're on a mission to make it easier and faster for anyone to use blockchain data to drive decisions and workflow automations. Whether you're a DeFi enthusiast, crypto trader or developer building revolutionary blockchain-based applications, we're here to help you bring your vision to reality.

Esprezzo and blockchain-related news for developers and business leaders

Best practices and industry news for growing your business with decentralized and blockchain-integrated applications

Subscribe here!

Recent Posts