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: added new functions to get the Stats of QVAULT SC #249

Merged
merged 3 commits into from
Jan 6, 2025

Conversation

TakaYuPP
Copy link
Contributor

  1. Adding the new functions to get the Stats
  • getNumberOfAsset - we can get the number of assets that QVAULT holds using this function.
  • getStatsPerEpoch - we can get the Stats of QVUALT SC in special epoch using this function.

These functions are already tested on testnet with qubic-cli and also I have added the gtest.

  1. Changing the sizeof(IPO) to sizeof(QVAULT) in contract.def
  • The IPO of QVAULT is finished and we need to update the size of QVAULT SC to use the below sturct to save the Stats data.
    `struct StatsInfo
    {
    uint64 totalRevenue;
    uint64 revenueOfQcapHolders;
    uint64 revenueOfOneQcap;
    uint64 revenueOfQvaultHolders;
    uint64 revenueOfOneQvault;
    uint64 revenueOfReinvesting;
    uint64 revenueOfDevTeam;
    };

    array<StatsInfo, QVAULT_MAX_EPOCHS> _allEpochStats;`

struct getNumberOfAsset_input
{
uint64 assetName;
id issuer;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like the whitespace is off here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed!


if(input.epoch < QVAULT_INITIAL_EPOCH || input.epoch >= QVAULT_MAX_EPOCHS)
{
return ;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure that the output contains default values

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default values for output are all 0.

locals.statsOfEpoch.revenueOfQcapHolders = locals.paymentForQCAPHolders;
locals.statsOfEpoch.revenueOfOneQcap = div(locals.paymentForQCAPHolders, locals.circulatedSupply);
locals.statsOfEpoch.revenueOfQvaultHolders = locals.paymentForShareholders;
locals.statsOfEpoch.revenueOfOneQvault = div(locals.paymentForShareholders, 676ULL);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use your global variable instead of the hard-coded number

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed!

@Franziska-Mueller Franziska-Mueller merged commit 1d57e74 into qubic:develop Jan 6, 2025
1 check passed
Franziska-Mueller added a commit that referenced this pull request Jan 6, 2025
Franziska-Mueller added a commit that referenced this pull request Jan 6, 2025
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