Skip to content

query module balance invariants

akrokr requested to merge akh/query_invariants into develop

Adds a few invariants using the cosmos invariant types and exposes two query endpoints: /invariants and /invariant/<name>.

Examples:

$ curl http://localhost:1317/thorchain/invariants
{
  "invariants": [
    "asgard",
    "bond",
    "thorchain"
  ]
}

$ curl -s "http://thornode:1317/thorchain/invariant/asgard?height=9850000"
{
  "broken": true,
  "invariant": "asgard",
  "msg": "oversolvent: 1000001avax/avax\noversolvent: 4581avax/usdc-0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e\noversolvent: 20529bch/bch\noversolvent: 99999bnb/bnb\noversolvent: 573766btc/btc\noversolvent: 1525889735doge/doge\noversolvent: 4455527eth/eth\noversolvent: 215666666666eth/fox-0xc770eefad204b5180df6a14ee197d99d808ee52d\noversolvent: 21884753549eth/usdc-0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48\noversolvent: 281542eth/usdt-0xdac17f958d2ee523a2206206994597c13d831ec7\noversolvent: 1039626gaia/atom\ninsolvent: 5071161706599rune\noversolvent: 2527terra/luna\noversolvent: 29955102645terra/ust\n"
}

$ curl -s "http://thornode:1317/thorchain/invariant/bond?height=9850000"
{
  "broken": true,
  "invariant": "bond",
  "msg": "oversolvent: 6936522592883rune"
}

$ curl -s "http://thornode:1317/thorchain/invariant/thorchain?height=9850000"
{
  "broken": true,
  "invariant": "thorchain",
  "msg": "oversolvent: 100000000rune\n"
}

Closes #1484 (closed)

Edited by akrokr

Merge request reports