Get Balance of address and check < 5000 tokens?

:computer: Environment

Rinkeby

:memo:Details

I want ot monitor an address to see if the balance of a token goes below a certain amount. there isnt much documentation as to how to do this? where can i get nmore examples??

:1234: Code to reproduce

N/A

Hi, welcome! :wave:

I think you can watch the event of this token, of course, if this token has a Transfer event, once you get the event, you can check the token balance.

Or you can just write a timed tasks to check token balance, such as every 10 minutes to do this.

Exactly! You can also use Autotask Condition checks for this. What you want to do is more or less the following:

  • Create a new Sentinel on Rinkeby that watches over the token contract address (not the address whose balance you want to check)
  • As @Skyge says, choose the Transfer event as a condition, and narrow it down by from == YOUR_ADDRESS so you only look for transfers of funds out of your address.
  • Set up an Autotask as Condition check that will be invoked by this Sentinel on every transfer out of your address, and check the address balance. If it's below the threshold, return a match.
  • And set up whatever notifications you want (Slack, Email, Discord, etc).
1 Like