Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Query locked DOT, VDOT balances #732

Merged
merged 2 commits into from
Apr 15, 2024
Merged

Conversation

bvotteler
Copy link
Contributor

@bvotteler bvotteler commented Mar 8, 2024

A script to gather locked balances for vaults and lending protocol via reserved amounts in tokens.account.

Usage:
From project root

npx tsx ./scripts/locked-dot-vdot.ts [options]

Options:

$ npx tsx ./scripts/locked-dot-vdot.ts --help
Options:
      --help          Show help                                        [boolean]
      --version       Show version number                              [boolean]
  -b, --block-hash    Block hash at which to query, defaults to latest block.
                      Must be prefixed with '0x' and have a length of 66.
                                                                        [string]
  -o, --output-file   Which file to write json results to, defaults to
                      'output-{blockhash}.json'                         [string]
  -p, --print-only    Do not write results to file, only log to console,
                      defaults to false.              [boolean] [default: false]

To run specifically for the last block on March 31, 2024 (UTC)

The blockhash is 0xb541ad774ba9e8d35d9551a3b6580e813990cd17abe1d8dcc1bde3a0d6f43348

From the project's root, run it with the hash:

npx tsx ./scripts/locked-dot-vdot.ts --b 0xb541ad774ba9e8d35d9551a3b6580e813990cd17abe1d8dcc1bde3a0d6f43348

The output file (output-<hash>.json) will have entries as follows:

  "wd7svyXhyKPao4yxmQNYaUq24W6LfWNLYtGuWqNXmEiGzCRCo": {
    "DOT": "251157228793"
  },
  "wdCwNZeeibBLnGbAXtNMbYX1C77mJMn67bLhYJtcbeBobGnLw": {
    "VDOT": "11185015028811"
  },
  "wd9Dd4BVQP57Mth44TG6BWcU9HiakoppsSnZRCCc8ttmJe2Un": {
    "DOT": "20000000000000",
    "VDOT": "20000000000000"
  },

@bvotteler
Copy link
Contributor Author

bvotteler commented Mar 8, 2024

Sample output (updated):

{
// ...
  "wd7svyXhyKPao4yxmQNYaUq24W6LfWNLYtGuWqNXmEiGzCRCo": {
    "DOT": "251157228793"
  },
  "wdCwNZeeibBLnGbAXtNMbYX1C77mJMn67bLhYJtcbeBobGnLw": {
    "VDOT": "11185015028811"
  },
  "wd9Dd4BVQP57Mth44TG6BWcU9HiakoppsSnZRCCc8ttmJe2Un": {
    "DOT": "20000000000000",
    "VDOT": "20000000000000"
  },
// ...
}

@bvotteler bvotteler marked this pull request as ready for review April 1, 2024 21:52
@bvotteler bvotteler requested review from gregdhill and nud3l April 1, 2024 21:52
@bvotteler
Copy link
Contributor Author

bvotteler commented Apr 1, 2024

Attaching full output from running for blockhash 0xb541ad774ba9e8d35d9551a3b6580e813990cd17abe1d8dcc1bde3a0d6f43348:
output-0xb541ad774ba9e8d35d9551a3b6580e813990cd17abe1d8dcc1bde3a0d6f43348.json

More detailed data, with separated reserved (eg. vault collateral) amounts from amounts locked in lending can be found here:
raw-output-0xb541ad774ba9e8d35d9551a3b6580e813990cd17abe1d8dcc1bde3a0d6f43348.json

@bvotteler bvotteler merged commit 7a37014 into master Apr 15, 2024
3 checks passed
@bvotteler bvotteler deleted the feat-query-dot-vdot-reserved branch April 15, 2024 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants