-
Notifications
You must be signed in to change notification settings - Fork 49
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
Conversation
src/contracts/QVAULT.h
Outdated
struct getNumberOfAsset_input | ||
{ | ||
uint64 assetName; | ||
id issuer; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
src/contracts/QVAULT.h
Outdated
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed!
removed the whitespace
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.
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;`