quasar icon indicating copy to clipboard operation
quasar copied to clipboard

More qVesting module queries

Open magiodev opened this issue 1 year ago • 1 comments

1. Overview

This PR introduces significant enhancements to the qVesting module, focusing on improving querying capabilities and overall code efficiency.

2. Implementation details

  • Refined Querying: The VestingAccounts function now fetches all accounts, ensuring both genesis and subsequently created accounts are included.
  • Legacy Account Query: The QVestingAccounts function still fetches only vesting accounts created via qVesting module.
  • Aggregate View: A new SpendableSupply function has been added, offering an aggregated perspective of spendable balance for a given denomination across all accounts.
  • Efficiency and Clarity: Redundancies have been eliminated, especially in account type checks. The type assertion mechanism of Go is utilized more effectively, leading to cleaner and more efficient code.
  • Protocol Buffer Adjustments: The Protocol Buffer message definitions have been updated to align with the new changes, ensuring seamless integration.

3. How to test/use

  1. Query Vesting Accounts: Use the updated VestingAccounts function to fetch all vesting accounts.
  2. Spendable Supply: Implement the SpendableSupply function to obtain a consolidated view of spendable balances for a specified denomination.
  3. Check Protocol Buffers: Ensure the updated Protocol Buffer message definitions are correctly integrated and functioning as expected.

4. Checklist

  • [x] Does the Readme need to be updated?

5. Limitations (optional)

The enhancements focus on a specific denomination (token type). If there are multiple denominations on the chain, further adjustments might be required.

6. Future Work (optional)

  1. Consider extending the module to support queries for multiple denominations simultaneously.
  2. Investigate further optimizations, especially in data structure choices, to boost query performance.

magiodev avatar Aug 24 '23 13:08 magiodev

Actual query command lines available at this point:

quasarnoded q qvesting params

quasarnoded q qvesting vesting-accounts (supports pagination)

quasarnoded q qvesting qvesting-accounts (supports pagination)

quasarnoded q qvesting spendable-balances <addr> (supports pagination)

quasarnoded q qvesting spendable-supply <denom>

quasarnoded q qvesting vesting-locked-supply <denom>

magiodev avatar Aug 24 '23 13:08 magiodev