Skip to main content
Monitoring treasury deposits and token transfers in real time is critical for DAOs, DeFi projects, and teams that manage on-chain funds. Traditionally, that requires backend servers and cron jobs: infrastructure you must maintain and secure. Kwala Workflows removes that operational burden. With a simple YAML-driven workflow, you can listen for on-chain events and send notifications to off-chain endpoints like Discord, no backend required. In this guide, we’ll build a real-time deposit alert system that sends a Discord notification whenever a stablecoin (USDC) is deposited into a Treasury Vault contract. The entire flow is driven by Kwala workflows and a single YAML configuration.

Objective

Create a Kwala workflow that:
  • TRIGGER: Detects USDCAccepted events emitted by the Treasury Vault contract when a USDC deposit happens.
  • ACTION: Instantly posts a notification to a Discord channel via webhook.
This eliminates the need for manual monitoring or custom backend scripts for token-transfer tracking.

Prepare your Discord webhook

  1. Open Discord and go to Server Settings > Apps > Create New App
  2. Select Create a Bot and configure the name, avatar, and permissions
  3. Go to Server Settings > Integrations > Webhooks
  4. Select New Webhook, choose your target channel, then select Copy Webhook URL
  5. (Optional) Test the webhook with a POST request: {"content": "Test message from Discord Webhook!"}
Keep the webhook URL handy — you’ll add it to the workflow action.

Step 1: Smart contract setup

This use case uses two Solidity contracts: a simple ERC20 (USDC-like) and a treasury vault that accepts deposits and emits an event. MintERC20USDC.sol Contract Address (Base Sepolia): 0x025B55313ac120435963f571F02EcC3d35FA6e6e
TreasuryAcceptUSDC.sol Contract Address: 0x60Fc086C786e8B66aeD0163A266bd3aF9125e8D0
Flow summary
  1. Mint USDC tokens from MintERC20USDC.
  2. Approve the TreasuryAcceptUSDC contract to spend tokens.
  3. Deposit tokens into the treasury (calls deposit).
  4. TreasuryAcceptUSDC emits USDCAccepted, which Kwala detects and uses to send a Discord alert.

Step 2: Build the Kwala workflow

Step 2.1: Create a new workflow

  • Open the Kwala Dashboard: Kwala Dashboard
  • Select Create New Workflow
  • Name it, for example: USDC_Received_Notifier1

Step 2.2: Configure the trigger

  • Execute After: immediately
  • Repeat Every: event
  • Recurring Source Contract: 0x60Fc086C786e8B66aeD0163A266bd3aF9125e8D0 (Treasury contract on Base Sepolia)
  • Recurring Chain ID: 84532 (Base Sepolia testnet)
  • Recurring Event Name: USDCAccepted(address,uint256,uint256)
  • Expires: An expiration date such as 08-10-2025 15:00 IST
  • Action Status Notification POST URL:
This ensures every USDC deposit triggers the workflow.

Step 2.3: Configure the action (Discord notification)

  • Action Name: discord_call
  • Type: POST (API CALL)
  • API Endpoint: your Discord webhook URL (example provided in the YAML)
  • API Payload: content: "USDC Received on USDC Treasury Vault Smart Contract"
  • Retries Until Success: 5
  • Execution Mode: sequential

YAML: Use as-is in the Kwala dashboard

Paste this YAML into the Kwala dashboard, save & compile, then deploy.

Step 3: Deploy and test

  1. Save and compile the YAML workflow in Kwala.
  2. Deploy it and wait for status: claimed.
  3. In Remix:
    • Mint USDC via MintERC20USDC (if needed).
    • Approve the treasury contract to spend your USDC.
    • Call deposit(amount) on TreasuryAcceptUSDC.
  4. After the deposit transaction completes, the contract emits USDCAccepted, Kwala detects it and your Discord webhook receives the message:
Discord output:
USDC Received on USDC Treasury Vault Smart Contract

Conclusion

You’ve built a real-time stablecoin deposit alert using Kwala Workflows, a single YAML workflow that connects on-chain USDCAccepted events to a Discord notification. No servers, no cron jobs, and no custom backend. Kwala helps you connect on-chain events to off-chain systems quickly, automate DeFi treasury monitoring without operational overhead, and build event-driven Web3 infrastructure using YAML.

Next steps

Monitor Your Workflows

Learn how to track and analyze your workflow executions in real-time

Best Practices

Discover tips and patterns for building robust Web3 automations