0

How to monitor USDT deposits in multiple smart contract wallets on binance smart chain (BSC)?

2 Answers 2

2

You could monitor the real-time USDT deposit transactions using the Moralis streams API. All you need is to setup a streams with a webhook to receive the real-time data.

This is an example of how the code to set up monitoring event streams will look like. You can modify it to your requirement.

import Moralis from "moralis";
import { EvmChain } from "@moralisweb3/common-evm-utils";

Moralis.start({
  apiKey: "YOUR_API_KEY",
});

const ERC20_transfer_ABI = [{
  "anonymous": false,
  "inputs": [
    { "indexed": true, "name": "from", "type": "address" },
    { "indexed": true, "name": "to", "type": "address" },
    { "indexed": false, "name": "value", "type": "uint256" },
  ],
  "name": "transfer",
  "type": "event",
}]; // valid abi of the event

const options = {
  chains: [EvmChain.BSC], // list of blockchains to monitor
  description: "monitor all ERC20 transfers", // your description
  tag: "ERC20_transfers", // give it a tag
  abi: ERC20_transfer_ABI,
  allAddresses: true,
  topic0: ["transfer(address,address,uint256)"], // topic of the event
  advancedOptions: [
    {
      topic0: "transfer(address,address,uint256)",
    },
  webhookUrl: "https://YOUR_WEBHOOK_URL", // webhook url to receive events,
};

const stream = await Moralis.Streams.add(options);
const { id } = stream.toJSON(); // { id: 'YOUR_STREAM_ID', ...newStream }

// Now add the contract address which you want to monitor address with the stream
const address = "0x.."; 

await Moralis.Streams.addAddress({ address, id });

You can check Moralis docs or reach out to the moralis forum if you have any questions.

disclaimer: I work at Moralis

1

You can

  • Write monitoring script in Python, JavaScript. Programming knowledge is needed.
  • Monitor all USDT ERC-20 Transfer events. Some tutorials for event monitoring here.
  • From all events, filter events that have the target address matching your list
2
  • Thanks, could you please share a JavaScript code snippet?
    – softweng
    Commented Jul 14, 2023 at 8:34
  • No, I am here to answer your questions, not doing your work for you. If you want work then hire a contractor. Commented Jul 14, 2023 at 9:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.