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

Integrate JS RUN fees with the x/distribution module #3135

Merged
merged 3 commits into from
May 21, 2021

Conversation

michaelfig
Copy link
Member

  • JS polls the AMM/Treasury every 1 hour
  • JS sends RUN to the vpurse module
  • fees sent from JS accumulate in the reward holding pool
  • have a vpurse.epochDuration genesis parameter,
  • for each block since the last disbursal, calculate percentage of epochDuration, and give out that portion of the reward holding pool to the feeCollector
  • the RUN is distributed to validators/stakers

@michaelfig michaelfig requested a review from Chris-Hibbert May 20, 2021 00:48
@michaelfig michaelfig self-assigned this May 20, 2021
@michaelfig michaelfig requested a review from JimLarson May 20, 2021 00:48
@michaelfig michaelfig force-pushed the 3114-give-to-fee-collector branch from 889436a to 1bbf7dc Compare May 20, 2021 03:04
Copy link
Contributor

@JimLarson JimLarson left a comment

Choose a reason for hiding this comment

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

Go stuff looks good.

},
async pushAmount(amount) {
const value = AmountMath.getValue(feeKit.brand, amount);
await bankCall({
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume that this implicitly throws any error returned by the call?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, an async method always returns a promise. await x either returns the resolved value of x, or if x is rejected, throws the rejected reason (if uncaught, resulting in a rejected promise with the same reason).

Copy link
Contributor

@Chris-Hibbert Chris-Hibbert left a comment

Choose a reason for hiding this comment

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

Looks good. One comment needs to be updated.

@@ -30,56 +26,28 @@ export function makeTreasuryFeeCollector(zoe, treasuryCreatorFacet) {
// remainder till the next epoch.

/** @type {BuildFeeDistributor} */
export function buildDistributor(treasury, bank, epochTimer, params) {
export async function buildDistributor(
Copy link
Contributor

Choose a reason for hiding this comment

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

Please update the comment above.

// A distributor of fees from treasury to the Bank module. Each time the
// epochTimer signals the end of an Epoch, it will ask
// the treasury for the fees that have been collected to date and send that
// payment to the depositFacet.

@JimLarson
Copy link
Contributor

Note: #3114

@michaelfig michaelfig force-pushed the 3114-give-to-fee-collector branch from 1bbf7dc to 9c6e9f9 Compare May 20, 2021 23:33
@michaelfig michaelfig enabled auto-merge May 20, 2021 23:38
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.

3 participants