Skip to content

Comments

Fat tokenomic#983

Merged
kvinwang merged 22 commits intomasterfrom
fat-tokenomic
Oct 12, 2022
Merged

Fat tokenomic#983
kvinwang merged 22 commits intomasterfrom
fat-tokenomic

Conversation

@kvinwang
Copy link
Collaborator

@kvinwang kvinwang commented Sep 29, 2022

This PR implements the fat contract tokenomic according to the design.
Additionally, adds pRPCs to get contract info from pruntime.

@kvinwang kvinwang marked this pull request as ready for review October 8, 2022 06:17
@kvinwang kvinwang requested a review from h4x3rotab October 8, 2022 06:17
@kvinwang kvinwang force-pushed the fat-tokenomic branch 2 times, most recently from 4c2771b to 151408c Compare October 8, 2022 08:48
Copy link
Contributor

@h4x3rotab h4x3rotab left a comment

Choose a reason for hiding this comment

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

If a contract has a weight of 0 (by default for public good cluster), will pruntime refuse to serve any query? What if it's the system contract?


let mut total = ContractTotalStakes::<T>::get(&contract);
let orig = ContractUserStakes::<T>::get(&user, &contract);
if amount > orig {
Copy link
Contributor

Choose a reason for hiding this comment

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

If not changed, maybe we are going to return directly without emitting any events?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It did return directly. I removed the return because users may stake before the contract is deployed and the stake wouldn't take effect when the contract launches later. Users can re-stake with the same amount to resend the message to contract.

Copy link
Contributor

Choose a reason for hiding this comment

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

Got it. That's a good point. Let's mention in the docstring

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Let's mention in the docstring

Docstring added

@kvinwang
Copy link
Collaborator Author

kvinwang commented Oct 12, 2022

If a contract has a weight of 0 (by default for public good cluster), will pruntime refuse to serve any query? What if it's the system contract?

weight=0 is treat as weight=1. The system contract isn't treated as special yet. Is it needed?

@h4x3rotab
Copy link
Contributor

Maybe need to give it a higher priority. Not sure how much to set. So far there's no much case that needs to query System, but maybe in the future it will be different.

@kvinwang
Copy link
Collaborator Author

Either the system contract itself or a driver can set a large weight to the system contract if it is needed in the future.

@kvinwang kvinwang merged commit 1592904 into master Oct 12, 2022
@kvinwang kvinwang deleted the fat-tokenomic branch October 12, 2022 14:12
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