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

New RPC call, getaddressrank and getaddressleaderboard #363

Merged
merged 9 commits into from
Jul 3, 2018

Conversation

mempko
Copy link
Member

@mempko mempko commented Jun 6, 2018

In an effort to promote more transparency into the ambassador reward lottery, this PR introduces an RPC call called "getaddressrank", which provides information about an addresses rank in the community and enough information to compute a probability of winning an ambassador reward.

@mempko mempko changed the title New RPC call, getaddressrank New RPC call, getaddressrank and getaddressleaderboard Jun 6, 2018
src/rpc/misc.cpp Outdated
UniValue o(UniValue::VOBJ);

//percentile to two digits
double percentile =
Copy link

Choose a reason for hiding this comment

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

Another approach might be to sprintf("%.2f", (static_cast<double>(r.second) / static_cast<double>(total)) * 100)

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the code review suggestions!

src/rpc/misc.cpp Outdated
}

CAmount lottery_anv = pog::GetCachedTotalANV();
if(lottery_anv == 0) {
Copy link

Choose a reason for hiding this comment

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

  • space /pedantic

src/rpc/misc.cpp Outdated
);

CAmount lottery_anv = pog::GetCachedTotalANV();
if(lottery_anv == 0) {
Copy link

Choose a reason for hiding this comment

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

  • space /pedantic

src/rpc/misc.cpp Outdated
return rankarr;
}

UniValue getaddressrank(const JSONRPCRequest& request)
Copy link

Choose a reason for hiding this comment

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

Some DRY + duplication between this and getaddressleaderboard. I don't have a concrete suggestion for how to address it but something to consider.

referral::AddressANVs entrants;

// unlikely that the candidates grew over 50% since last time.
auto reserve_size = max_embassador_lottery * 1.5;
Copy link

Choose a reason for hiding this comment

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

Nitpick: it's s/embassador/ambassador (unless this is on purpose and I'm not familiar with the jargon).

Copy link
Contributor

@adilwali adilwali left a comment

Choose a reason for hiding this comment

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

LGTM

@adilwali adilwali merged commit 27f6177 into master Jul 3, 2018
@adilwali adilwali deleted the feature/address-rank branch July 3, 2018 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants