A Twitter Bot to track winners and user deposits on PoolTogether, in 2 minutes đ¤
Here at HAL we are big fans of PoolTogether, a no-loss, audited savings game powered by blockchain technology. The way it works is simple but brilliant:
- You join the pool buying tickets. For every DAI you deposit you get 1 ticket
- Interest builds. All the DAI in the pool earn interest.
- You maybe win: at the end of the week one lucky person wins all of the interest đ°
- You never lose! Whether you win or not, you can withdraw your savings and winnings at any time đ
In this post Iâm going to show you how we created a Twitter Bot to easily track the weekly PoolTogether winner, as well as everyone else who joins the pool. As always, this is just to show you what kind of stuff is possible to hack together with HAL â feel free to tweak and twist this example any way you want!
Tracking winners and user deposits
Head over to HAL.xyz and create a new âWatch an Eventâ trigger:
Insert the PoolTogether contract address, 0xa125841831b4645f22c1c4ccb6e1df0842e60040, in the âContract Addressâ field, and a list of events will be automatically fetched for you to choose from. Every time a lucky winner gets the prize, a âRewardedâ event is emitted. Thatâs what weâre going to track.
If youâd rather track user deposits, you would simply pick the âDepositedâ event instead. If youâd rather track⌠you got the gist of it already. Once youâve selected the event you want to track, youâll be able to add extra filters on the various fields of the event, as well as referencing all these variables later on.
For now, weâll leave all of those variables blank, and move on to the fun part :)
Time to Tweet
For this example I created a new Twitter bot, and I gave HAL permissions to post tweets on behalf of my bot. You simply need to click on the âConnectâ button next to the Twitter logo.
Now itâs finally time to create a nice twitter message. You can reference all the variables in the event that weâve seen above, such as winner
(the address of the lucky one), winnings
(the amount of DAI they won). Weâre also going to create a nice link to the Etherscan transaction, and of course weâre going to finish up the message with a few emojis. This is what my template looks like:
When youâre happy with your message all is left to do is to save your new trigger and if you joined any poolâŚcross your fingers⌠đ¤
This is what our bot looks like. Itâs already alive and kicking, and you can follow it here.
Where to go from here
Thereâs a lot more you might want to explore:
- Stay in touch: you can follow us on Twitter, join our builders community on Telegram, and subscribe to our newsletter
- Check out our developers documentation, where you can learn how to create triggers programmatically using GraphQL and much more
- Start building triggers using HAL!