TRX1 Dev Blog #15 (March 2022)

Thor Rune Xchain
5 min readApr 4, 2022

In this episode, you will learn about Slack module beta version, Rune circulating supply and about many other improvements to support the new THORChain features.

I had to skip the first week of March for family reasons. These are turbulent times and I needed some more time to ensure the safety and comfort of loved ones.

THORChain monitoring bot

Let’s start by talking about the updates.

Synthetics

Synthetics is a big step forward for THORChain. Surely the bot was supposed to support their launch. The following modifications have been made for this purpose:

  1. Correct display of the names of synthetic assets
  2. Added synthetic balances in the LP yield module
  3. 24h synths trade volume is summed in the daily stats report
  4. Notices of large swaps may also apply to synthetics

Terra/Luna

The Terra/Luna chain connection is another important milestone. THORChain monitoring bot enables the explorer links for the new chain and adds a set of related constants. The UST pool now also takes part in the weighted average Rune price calculation.

Hard fork

THORChain experienced a planned hard fork in March. I had to verify that all bot functions would work after this event. It has been determined that LP-yield module utilizes data on the historical state of blocks and pools. Thus I ensured that all the necessary pieces of information were cached in the database. Also, the aiothornode library has been updated. You can read about its evolution in the end section of this article.

ILP payouts

Impermanent loss protection payout daily tally was introduced. You can find this number in the daily THORChain stats report.

THORChain stats

Moreover, large IL protection payouts will also be visible in the notification channel.

Rune circulating supply calculation

Since we have three kinds of Rune tokens (native THOR.RUNE, BEP2 BNB.RUNE and ERC20 ETH.RUNE), it is not trivial to calculate the total circulating supply. It turns out that the Coingecko and Coinmarketcap sites do not give accurate figures.

I was asked to sketch a Python script to more precisely calculate these numbers.

Therefore, a piece of code was built that makes queries to either the smart contract on Ethereum, BNB network and native THORChain wallets. For each network, we get the total number of tokens in circulation and subtract the amount of balances on wallets that are considered locked (reserves, coins not yet issued, etc).

The results of my work are already publicly available. The code is available here: https://replit.com/@tirinox/THORRuneSupply

You can try the API endpoint here: https://THORRuneSupply.tirinox.repl.co

⚠️ Warning: This endpoint is not ready for production use. It is advisable to copy the code and run it on your own server.

Circulating supply counting results

After that, this code was also integrated into the monitoring bot. It has undergone some optimizations for acceleration and stability.

Dynamic liquidity cap calculation

With the Mimir caps removed, the protocol cap is equals active bonded Rune. This also affected the bot, the necessary changes have been made. First, I deleted the notifications of the cap increase. Second, I adjusted the calculation properly so that everything looks right in the notification texts and when using the /cap command.

It’s now dynamic!

NodeOp tools engine

Regarding this part, here’s what was done:

  • All types of node notifications have been carefully tested once again
  • The app started filtering out old events to avoid spam after a long period of inactivity
  • Added a warning if any node in your watch list disappears from the network for some unknown reason
  • Fixed a bug with notification of bond changes
  • Fixed a bug with incorrect loading of settings on the web panel

Slack support

The Slack module continues to be developed and tuned. The following objectives were completed in March:

  • /pause and /go commands logic. Permission scopes were also updated to enable slash command for public app distributions
  • The image uploading code that will be useful for posting charts and infographics
  • OAuth token management for broadcasting alerts to multiple workspaces. We store a token for each channel, so that we can then know which one we need to send a particular message.
  • Automatically stop the notification feed for channels that have become unavailable. For example, this happens if the bot is removed from the channel or deauthorized.

Finally, Slack support is uploaded to the live server, but has not yet been revealed. I’ve been testing it in my workspace for a few days now and I think I’ve already found a few bugs. It seems they should be addressed. After that I will give private access to the beta version to parties interested.

Various other little things

  • THORYield links corrected
  • /price command empty output solved
  • “Unknown network” fix for the leaderboard
  • Improved the Mimir notification logic
  • Refund transaction errors fixed
  • THORNode/RPC/Midgard URLs are configurable now
  • A few minor typos were eliminated

Work in progress: high/low BEP2 vs Native price divergence alerts. First they will appear in the general channel, then perhaps they will become personable.

Python library: aiothornode

The library has expanded the set of available predefined environments. The list looks like this:

  1. Main official public access points aka https://midgard.thorchain.info/ and https://thornode.thorchain.info/
  2. Testnet
  3. Stagenet 🆕
  4. NineReals mainnet (e.g. https://midgard.ninerealms.com/) 🆕
  5. THORSwap mainnet 🆕

New features

The version 0.22 and above of aithornode library supports parsing the list of bond providers.

The Genesis endpoint has also been added. From this information, in particular, you can retrieve the new network ID after hard forks.

I also remembered to update the methods for getting the bank balance and transactions from blocks to comply with the new API rules.

Links

PyPi: https://pypi.org/project/aiothornode/

Source code: https://github.com/tirinox/aiothornode

Conclusion

Now I’m forming a roadmap for the second quarter of 2022.

In a nutshell, the plans are

  • Twitter bot development
  • THORName support
  • General alerts for Slack channels
  • NodeOp tools: more flexible setup and new types of alerts
  • Personal alerts for wallet balance updates and price divergence
  • THORChain protocol records: all time high volumes, liquidity, number of users, Rune holders, etc.

I probably won’t make everything in time, but it’s worth giving me a chance.

Be healthy, be wealthy. See you soon!

--

--